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

Fix duplicated HAVE_NAN

And remove redundant `HAVE_*` macros,
and use `USE_RB_*` macros instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kazu 2018-01-27 04:14:26 +00:00
parent 3e458f15c8
commit ef83b306e2
3 changed files with 5 additions and 17 deletions

View file

@ -520,20 +520,6 @@ AS_IF([test "$GCC:${warnflags+set}:no" = yes::no], [
])
RUBY_TRY_CFLAGS(-Qunused-arguments, [RUBY_APPEND_OPTIONS(rb_cv_wsuppress_flags, -Qunused-arguments)])
for n in huge_val infinity nan; do
m=AS_TR_CPP($n)
AC_CACHE_CHECK([whether $m is available without C99 option], rb_cv_$n,
[AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY(AC_INCLUDES_DEFAULT([@%:@include <math.h>
@%:@ifndef $m
@%:@error no $m
@%:@endif
]), [1])], [eval rb_cv_$n=yes], [eval rb_cv_$n=no])])
AS_IF([eval test '"$rb_cv_'$n'"' = yes], [
AC_DEFINE_UNQUOTED([HAVE_]$m)
])
done
AC_ARG_WITH(compress-debug-sections,
AS_HELP_STRING([--with-compress-debug-sections=type],
[enable debug section compression]),

View file

@ -136,7 +136,7 @@ RUBY_EXTERN double lgamma_r(double, int *);
RUBY_EXTERN double cbrt(double);
#endif
#if !defined(HAVE_INFINITY) || !defined(HAVE_NAN)
#if !defined(INFINITY) || !defined(NAN)
union bytesequence4_or_float {
unsigned char bytesequence[4];
float float_value;
@ -147,12 +147,14 @@ union bytesequence4_or_float {
/** @internal */
RUBY_EXTERN const union bytesequence4_or_float rb_infinity;
# define INFINITY (rb_infinity.float_value)
# define USE_RB_INFINITY 1
#endif
#ifndef NAN
/** @internal */
RUBY_EXTERN const union bytesequence4_or_float rb_nan;
# define NAN (rb_nan.float_value)
# define USE_RB_NAN 1
#endif
#ifndef HUGE_VAL

View file

@ -61,14 +61,14 @@
#define DBL_EPSILON 2.2204460492503131e-16
#endif
#ifdef HAVE_INFINITY
#ifndef USE_RB_INFINITY
#elif !defined(WORDS_BIGENDIAN) /* BYTE_ORDER == LITTLE_ENDIAN */
const union bytesequence4_or_float rb_infinity = {{0x00, 0x00, 0x80, 0x7f}};
#else
const union bytesequence4_or_float rb_infinity = {{0x7f, 0x80, 0x00, 0x00}};
#endif
#ifdef HAVE_NAN
#ifndef USE_RB_NAN
#elif !defined(WORDS_BIGENDIAN) /* BYTE_ORDER == LITTLE_ENDIAN */
const union bytesequence4_or_float rb_nan = {{0x00, 0x00, 0xc0, 0x7f}};
#else