From 94a840083584aaafbfc2ca2eadebd0bbf8a92fe9 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Fri, 16 Sep 2016 06:15:55 +0000 Subject: * internal.h (WARN_UNUSED_RESULT): moved to configure.in, to actually check its availability rather to check GCC's version. * configure.in (WARN_UNUSED_RESULT): moved to here. * configure.in (RUBY_FUNC_ATTRIBUTE): change function declaration to return int rather than void, because it makes no sense for a warn_unused_result attributed function to return void. Funny thing however is that it also makes no sense for noreturn attributed function to return int. So there is a fundamental conflict between them. While I tested this, I confirmed both GCC 6 and Clang 3.8 prefers int over void to correctly detect necessary attributes under this setup. Maybe subject to change in future. * internal.h (UNINITIALIZED_VAR): renamed to MAYBE_UNUSED, then moved to configure.in for the same reason we move WARN_UNUSED_RESULT. * configure.in (MAYBE_UNUSED): moved to here. * internal.h (__has_attribute): deleted, because it has no use now. * string.c (rb_str_enumerate_lines): refactor macro rename. * string.c (rb_str_enumerate_bytes): ditto. * string.c (rb_str_enumerate_chars): ditto. * string.c (rb_str_enumerate_codepoints): ditto. * thread.c (do_select): ditto. * vm_backtrace.c (rb_debug_inspector_open): ditto. * vsnprintf.c (BSD_vfprintf): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- configure.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'configure.in') diff --git a/configure.in b/configure.in index da0fc54997..fe8ee14f79 100644 --- a/configure.in +++ b/configure.in @@ -1809,7 +1809,7 @@ AS_VAR_POPDEF([rbcv])dnl dnl RUBY_FUNC_ATTRIBUTE(attrib, macroname, cachevar, condition) AC_DEFUN([RUBY_FUNC_ATTRIBUTE], [dnl RUBY_DECL_ATTRIBUTE([$1], [$2], [$3], [$4], - [function], [@%:@define x void conftest_attribute_check(void)] + [function], [@%:@define x int conftest_attribute_check(void)] ) ]) @@ -1829,6 +1829,8 @@ RUBY_FUNC_ATTRIBUTE(__deprecated__("by "@%:@n), DEPRECATED_BY(n,x), rb_cv_func_d RUBY_TYPE_ATTRIBUTE(__deprecated__ mesg, DEPRECATED_TYPE(mesg,x), rb_cv_type_deprecated) RUBY_FUNC_ATTRIBUTE(__noinline__, NOINLINE) RUBY_FUNC_ATTRIBUTE(__always_inline__, ALWAYS_INLINE) +RUBY_FUNC_ATTRIBUTE(__warn_unused_result__, WARN_UNUSED_RESULT) +RUBY_FUNC_ATTRIBUTE(__unused__, MAYBE_UNUSED) RUBY_FUNC_ATTRIBUTE(__error__ mesg, ERRORFUNC(mesg,x), rb_cv_func___error__) RUBY_FUNC_ATTRIBUTE(__warning__ mesg, WARNINGFUNC(mesg,x), rb_cv_func___warning__) RUBY_FUNC_ATTRIBUTE(__weak__, WEAK, rb_cv_func_weak) -- cgit v1.2.3