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

12 commits

Author SHA1 Message Date
卜部昌平
3e92785fd6 RUBY3_ASSUME: suppress warnings on icc
icc warns side effects for RUBY3_ASSUME like this:

> ./include/ruby/3/value_type.h(202): warning #2261: __assume expression with side effects discarded
>           RUBY3_ASSUME(RB_FLONUM_P(obj));
>                        ^

Which is a false positive (RB_FLONUM_P has no side effect).  It seems
there is no way for us to tell icc that a functin is safe inside of
__assume.   Just suppress the warning instead.
2020-04-10 16:17:30 +09:00
卜部昌平
133ae0807d RUBY3_HAS_BUILTIN: fix __builtin_unreachable
This macro has to be truthy, otherwise the `+0` trick above evalues
RUBY3_HAS_BUILTIN(__builtin_unreachable) to be always false.
2020-04-10 16:17:30 +09:00
Koichi Sasada
443389effc reduce duplicate include.
Without this patch, 20k files are opened (openat syscall) because
of duplicate includes. This patch reduced it to 3k and build time
was reduced compile time of range.o from 15sec -> 3sec on my machine.
[Bug #16772]
2020-04-10 14:53:25 +09:00
Yusuke Endoh
b965e7e05e Revert "include/ruby/3/core/rtypeddata.h: Use 0 instead of NULL for C++ compiler"
This reverts commit d2bb2e066b.

It didn't work:

https://rubyci.org/logs/rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20200409T050004Z.log.html.gz#end
```
In file included from ../../.././include/ruby/3/core.h(32),
                 from ../../.././include/ruby/ruby.h(28),
                 from ../../.././include/ruby.h(33),
                 from init.c(1):
../../.././include/ruby/3/core/rtypeddata.h(164): warning #967: conversion from "int" to "const struct rb_data_type_struct *"; sizes do not match
          RUBY3_UNREACHABLE_RETURN(0);
```
2020-04-09 14:24:23 +09:00
Yusuke Endoh
d2bb2e066b include/ruby/3/core/rtypeddata.h: Use 0 instead of NULL for C++ compiler
NULL in C++ is esoteric
2020-04-09 12:50:53 +09:00
Yusuke Endoh
8ab4c55e7a include/ruby/3: Skip RUBY3_UNREACHABLE_RETURN for icc
I'm unsure why, but it fails on icc.

https://rubyci.org/logs/rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20200408T220004Z.log.html.gz
```
In file included from ../../.././include/ruby/3/core.h(32),
                 from ../../.././include/ruby/ruby.h(28),
                  from cxxanyargs.cpp(1):
../../.././include/ruby/3/core/rtypeddata.h(163): error: return value type does not match the function type
            RUBY3_UNREACHABLE_RETURN(NULL);
```
2020-04-09 08:19:00 +09:00
Yusuke Endoh
78eec3cdc5 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 */
```
2020-04-09 07:37:53 +09:00
卜部昌平
dd04b8034b RARRAY_EMBED_LEN/RSTRING_EMBED_LEN: add RUBY3_CAST
RUBY3_CAST is a macro to suppress g++/clang++ warnings about C-style
casts.  Though Ruby core don't have to bother C++ situations, extension
libraries can benefit from this.
2020-04-08 22:32:02 +09:00
卜部昌平
ec1b3464da RUBY3_HAS_BUILTIN: icc has broken __has_builtin
It turned out that compilation errors in icc were due to their having
broken __has_builtin.  Let's just skip such situations.
2020-04-08 22:30:14 +09:00
Nobuyoshi Nakada
11d5a8318d
Suppress C4244 "possible loss of data" warnings 2020-04-08 18:03:46 +09:00
卜部昌平
6163a4e1b3 RUBY3_HAS_BUILTIN: fix for nonexistent builtin
Trying to fix icc breakage:
https://rubyci.org/logs/rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20200408T050004Z.fail.html.gz

It seems the macro had problems when a builtin does not exist for the
target compiler.  Force evaluete to 0 then, by adding 0 to the
expression.
2020-04-08 16:18:59 +09:00
卜部昌平
9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00