1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-08-30 13:29:45 +00:00
parent 765e4e2ea6
commit b6c425aadd
2 changed files with 15 additions and 2 deletions

View file

@ -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

View file

@ -103,8 +103,13 @@ Init_sym(void)
Init_id();
}
static ID attrsetname_to_attr(VALUE name);
static VALUE lookup_id_str(ID id);
WARN_UNUSED_RESULT(static VALUE dsymbol_alloc(const VALUE klass, const VALUE str, rb_encoding *const enc));
WARN_UNUSED_RESULT(static VALUE dsymbol_check(const VALUE sym));
WARN_UNUSED_RESULT(static ID dsymbol_pindown(VALUE sym));
WARN_UNUSED_RESULT(static ID lookup_str_id(VALUE str));
WARN_UNUSED_RESULT(static VALUE lookup_str_sym(const VALUE str));
WARN_UNUSED_RESULT(static VALUE lookup_id_str(ID id));
WARN_UNUSED_RESULT(static ID attrsetname_to_attr(VALUE name));
ID
rb_id_attrset(ID id)