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.
This commit is contained in:
卜部昌平 2020-04-09 16:07:29 +09:00
Родитель d69c532685
Коммит 3e92785fd6
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -28,6 +28,7 @@
#include "ruby/3/config.h"
#include "ruby/3/cast.h"
#include "ruby/3/has/builtin.h"
#include "ruby/3/warning_push.h"
/** @cond INTERNAL_MACRO */
#if RUBY3_COMPILER_SINCE(MSVC, 13, 10, 0)
@ -58,7 +59,16 @@
#endif
/** Wraps (or simulates) `__asume`. */
#if defined(RUBY3_HAVE___ASSUME)
#if RUBY3_COMPILER_SINCE(Intel, 13, 0, 0)
# /* icc warnings are false positives. Ignore them. */
# /* "warning #2261: __assume expression with side effects discarded" */
# define RUBY3_ASSUME(expr) \
RUBY3_WARNING_PUSH() \
RUBY3_WARNING_IGNORED(2261) \
__assume(expr) \
RUBY3_WARNING_POP()
#elif defined(RUBY3_HAVE___ASSUME)
# define RUBY3_ASSUME __assume
#elif RUBY3_HAS_BUILTIN(__builtin_assume)