From ef83b306e2456d005df5ac4a81c9b22126c8b6e6 Mon Sep 17 00:00:00 2001 From: kazu Date: Sat, 27 Jan 2018 04:14:26 +0000 Subject: 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 --- configure.ac | 14 -------------- include/ruby/missing.h | 4 +++- numeric.c | 4 ++-- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index bc593016c2..352a8140ca 100644 --- a/configure.ac +++ b/configure.ac @@ -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 -@%:@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]), diff --git a/include/ruby/missing.h b/include/ruby/missing.h index 68a90aeb96..dc3fd502b5 100644 --- a/include/ruby/missing.h +++ b/include/ruby/missing.h @@ -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 diff --git a/numeric.c b/numeric.c index a7769ca255..9cc3f4d9d3 100644 --- a/numeric.c +++ b/numeric.c @@ -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 -- cgit v1.2.3