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

include/ruby/3: Stop RUBY3_UNREACHABLE_RETURN to suppress a SunC warning

I don't find how to suppress a false positive "unreachable" warning of
the Sun compiler:

```
"./include/ruby/3/core/rtypeddata.h", line 163: warning: statement not
reached
"./include/ruby/3/memory.h", line 256: warning: statement not reached
```

This warnings make mkmf test fail:

https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris10-sunc/ruby-master/log/20200408T170004Z.fail.html.gz
```

  1) Failure:
TestMkmf::TestConvertible#test_typeof_builtin
[/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/test/mkmf/test_convertible.rb:9]:
convertible_int: checking for convertible type of short...
-------------------- short

--------------------

convertible_int: checking for convertible type of int...
-------------------- int

--------------------

convertible_int: checking for convertible type of long...
-------------------- long

--------------------

convertible_int: checking for convertible type of signed short...
-------------------- failed

...

"cc -I.
-I/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/.ext/include/sparc-solaris2.10
-I/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/include
-I./test  -I/opt/csw/include -D_XOPEN_SOURCE=600   -DFFI_NO_RAW_API  -g
-c conftest.c"
"/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/include/ruby/3/core/rtypeddata.h",
line 163: warning: statement not reached
"/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/include/ruby/3/memory.h",
line 256: warning: statement not reached
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: typedef signed short rbcv_typedef_;
4:
5: extern rbcv_typedef_ foo();
6: extern short foo();
/* end */
```
This commit is contained in:
Yusuke Endoh 2020-04-09 07:37:53 +09:00
parent e7128aa772
commit 78eec3cdc5
2 changed files with 4 additions and 0 deletions

View file

@ -160,7 +160,9 @@ RTYPEDDATA_TYPE(VALUE obj)
#if ! RUBY_NDEBUG
if (RB_UNLIKELY(! RTYPEDDATA_P(obj))) {
rb_unexpected_type(obj, RUBY_T_DATA);
# if ! defined(__sun)
RUBY3_UNREACHABLE_RETURN(NULL);
# endif
}
#endif

View file

@ -253,7 +253,9 @@ ruby3_size_mul_or_raise(size_t x, size_t y)
}
else {
ruby_malloc_size_overflow(x, y);
# if ! defined(__sun)
RUBY3_UNREACHABLE_RETURN(0);
# endif
}
}