This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't use isfinitel/isinfl/isnanl if the C99 macros exist.
authorJarkko Hietaniemi <jhi@iki.fi>
Wed, 27 Aug 2014 22:46:21 +0000 (18:46 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 28 Aug 2014 11:50:28 +0000 (07:50 -0400)
Moves the C99 logic from sv.c (?) to perl.h.

perl.h
sv.c

diff --git a/perl.h b/perl.h
index e824f20..82dc6b1 100644 (file)
--- a/perl.h
+++ b/perl.h
 #   include "config.h"
 #endif
 
+#ifndef HAS_C99
+# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(__VMS)
+#  define HAS_C99 1
+# endif
+#endif
+
 /* See L<perlguts/"The Perl API"> for detailed notes on
  * PERL_IMPLICIT_CONTEXT and PERL_IMPLICIT_SYS */
 
@@ -1917,16 +1923,16 @@ EXTERN_C long double modfl(long double, long double *);
 #       endif
 #   endif
 #   ifndef Perl_isnan
-#       ifdef HAS_ISNANL
+#       if defined(HAS_ISNANL) && !(defined(isnan) && HAS_C99)
 #           define Perl_isnan(x) isnanl(x)
 #       endif
 #   endif
 #   ifndef Perl_isinf
-#       if defined(HAS_ISINFL)
+#       if defined(HAS_ISINFL) && !(defined(isinf) && HAS_C99)
 #           define Perl_isinf(x) isinfl(x)
 #       endif
 #   endif
-#   ifndef Perl_isfinite
+#   if !defined(Perl_isfinite) && !(defined(isfinite) && HAS_C99)
 #     ifdef HAS_ISFINITEL
 #       define Perl_isfinite(x) isfinitel(x)
 #     elif defined(HAS_FINITEL)
diff --git a/sv.c b/sv.c
index 2940942..2bbb088 100644 (file)
--- a/sv.c
+++ b/sv.c
 # include <rms.h>
 #endif
 
-#ifndef HAS_C99
-# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(__VMS)
-#  define HAS_C99 1
-# endif
-#endif
 #ifdef HAS_C99
 # include <stdint.h>
 #endif