diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-30 13:29:45 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-30 13:29:45 +0000 |
commit | b6c425aaddd38fec6a6b6f0d816bff18bc205cfd (patch) | |
tree | 5cd93f4fa0ebc5b0e084f63775f21abfc6d84feb /internal.h | |
parent | 765e4e2ea68f4b219df33719009ea83677b5d85d (diff) | |
download | ruby-b6c425aaddd38fec6a6b6f0d816bff18bc205cfd.tar.gz |
internal.h: WARN_UNUSED_RESULT
* internal.h (WARN_UNUSED_RESULT): warn unused result by gcc 3.4
or later.
* symbol.c: declare some functions with WARN_UNUSED_RESULT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal.h b/internal.h index 8b9701c597..2e88324f0c 100644 --- a/internal.h +++ b/internal.h @@ -40,6 +40,14 @@ extern "C" { #define UNINITIALIZED_VAR(x) x #endif +#if __has_attribute(warn_unused_result) +#define WARN_UNUSED_RESULT(x) x __attribute__((warn_unused_result)) +#elif defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 3004 +#define WARN_UNUSED_RESULT(x) x __attribute__((warn_unused_result)) +#else +#define WARN_UNUSED_RESULT(x) x +#endif + #ifdef HAVE_VALGRIND_MEMCHECK_H # include <valgrind/memcheck.h> # ifndef VALGRIND_MAKE_MEM_DEFINED |