summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-16 06:15:55 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-16 06:15:55 +0000
commit2fc5210f31ad23463d7b0a0e36bcfbeee7b41b3e (patch)
treef95643295c10e0d9a6d8bec6e8c147cdbd83be4a /string.c
parent921c47764677d19d42cb647fd0c32e9c7440b5dc (diff)
* 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
Diffstat (limited to 'string.c')
-rw-r--r--string.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/string.c b/string.c
index 9725e32805..6988e08ec1 100644
--- a/string.c
+++ b/string.c
@@ -7348,7 +7348,7 @@ rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, int wantarray)
long pos, len, rslen;
int paragraph_mode = 0;
- VALUE UNINITIALIZED_VAR(ary);
+ VALUE MAYBE_UNUSED(ary);
if (argc == 0)
rs = rb_rs;
@@ -7522,7 +7522,7 @@ static VALUE
rb_str_enumerate_bytes(VALUE str, int wantarray)
{
long i;
- VALUE UNINITIALIZED_VAR(ary);
+ VALUE MAYBE_UNUSED(ary);
if (rb_block_given_p()) {
if (wantarray) {
@@ -7606,7 +7606,7 @@ rb_str_enumerate_chars(VALUE str, int wantarray)
long i, len, n;
const char *ptr;
rb_encoding *enc;
- VALUE UNINITIALIZED_VAR(ary);
+ VALUE MAYBE_UNUSED(ary);
str = rb_str_new_frozen(str);
ptr = RSTRING_PTR(str);
@@ -7705,7 +7705,7 @@ rb_str_enumerate_codepoints(VALUE str, int wantarray)
unsigned int c;
const char *ptr, *end;
rb_encoding *enc;
- VALUE UNINITIALIZED_VAR(ary);
+ VALUE MAYBE_UNUSED(ary);
if (single_byte_optimizable(str))
return rb_str_enumerate_bytes(str, wantarray);