[前][次][番号順一覧][スレッド一覧]

ruby-changes:49949

From: kazu <ko1@a...>
Date: Sat, 27 Jan 2018 13:14:33 +0900 (JST)
Subject: [ruby-changes:49949] kazu:r62067 (trunk): Fix duplicated HAVE_NAN

kazu	2018-01-27 13:14:26 +0900 (Sat, 27 Jan 2018)

  New Revision: 62067

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62067

  Log:
    Fix duplicated HAVE_NAN
    
    And remove redundant `HAVE_*` macros,
    and use `USE_RB_*` macros instead.

  Modified files:
    trunk/configure.ac
    trunk/include/ruby/missing.h
    trunk/numeric.c
Index: configure.ac
===================================================================
--- configure.ac	(revision 62066)
+++ configure.ac	(revision 62067)
@@ -520,20 +520,6 @@ AS_IF([test "$GCC:${warnflags+set}:no" = https://github.com/ruby/ruby/blob/trunk/configure.ac#L520
 ])
 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]),
Index: numeric.c
===================================================================
--- numeric.c	(revision 62066)
+++ numeric.c	(revision 62067)
@@ -61,14 +61,14 @@ https://github.com/ruby/ruby/blob/trunk/numeric.c#L61
 #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
Index: include/ruby/missing.h
===================================================================
--- include/ruby/missing.h	(revision 62066)
+++ include/ruby/missing.h	(revision 62067)
@@ -136,7 +136,7 @@ RUBY_EXTERN double lgamma_r(double, int https://github.com/ruby/ruby/blob/trunk/include/ruby/missing.h#L136
 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 { https://github.com/ruby/ruby/blob/trunk/include/ruby/missing.h#L147
 /** @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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]