This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl.h: Only #define item once
[perl5.git] / perl.h
diff --git a/perl.h b/perl.h
index b6dbf61..7313de0 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -2685,6 +2685,7 @@ typedef struct padname PADNAME;
 #endif
 
 #include "handy.h"
+#include "charclass_invlists.h"
 
 #if defined(USE_LARGE_FILES) && !defined(NO_64_BIT_RAWIO)
 #   if LSEEKSIZE == 8 && !defined(USE_64_BIT_RAWIO)
@@ -2917,6 +2918,26 @@ typedef struct padname PADNAME;
          signal(SIGFPE, SIG_IGN); \
      } STMT_END
 #endif
+/* In IRIX the default for Flush to Zero bit is true,
+ * which means that results going below the minimum of normal
+ * floating points go to zero, instead of going denormal/subnormal.
+ * This is unlike almost any other system running Perl, so let's clear it.
+ * [perl #123767] IRIX64 blead (ddce084a) opbasic/arith.t failure, originally
+ * [perl #120426] small numbers shouldn't round to zero if they have extra floating digits
+ *
+ * XXX The flush-to-zero behaviour should be a Configure scan.
+ * To change the behaviour usually requires some system-specific
+ * incantation, though, like the below. */
+#ifdef __sgi
+#  include <sys/fpu.h>
+#  define PERL_SYS_FPU_INIT \
+     STMT_START { \
+         union fpc_csr csr; \
+         csr.fc_word = get_fpc_csr(); \
+         csr.fc_struct.flush = 0; \
+         set_fpc_csr(csr.fc_word); \
+     } STMT_END
+#endif
 
 #ifndef PERL_SYS_FPU_INIT
 #  define PERL_SYS_FPU_INIT NOOP
@@ -3510,6 +3531,18 @@ typedef pthread_key_t    perl_key;
 /* placeholder */
 #endif
 
+/* STATIC_ASSERT_GLOBAL/STATIC_ASSERT_STMT are like assert(), but for compile
+   time invariants. That is, their argument must be a constant expression that
+   can be verified by the compiler. This expression can contain anything that's
+   known to the compiler, e.g. #define constants, enums, or sizeof (...). If
+   the expression evaluates to 0, compilation fails.
+   Because they generate no runtime code (i.e.  their use is "free"), they're
+   always active, even under non-DEBUGGING builds.
+   STATIC_ASSERT_GLOBAL expands to a declaration and is suitable for use at
+   file scope (outside of any function).
+   STATIC_ASSERT_STMT expands to a statement and is suitable for use inside a
+   function.
+*/
 #if (defined(static_assert) || (defined(__cplusplus) && __cplusplus >= 201103L)) && (!defined(__IBMC__) || __IBMC__ >= 1210)
 /* static_assert is a macro defined in <assert.h> in C11 or a compiler
    builtin in C++11.
@@ -4316,11 +4349,6 @@ static const union { unsigned int __i; float __f; } __PL_inf_u =
 #   endif
 #   if !defined(NV_NAN) && defined(LDBL_QNAN)
 #       define NV_NAN LDBL_QNAN
-#       define NV_QNAN LDBL_QNAN
-#   endif
-#   if !defined(NV_NAN) && defined(LDBL_SNAN)
-#       define NV_NAN LDBL_SNAN
-#       define NV_SNAN LDBL_SNAN
 #   endif
 #endif
 #if !defined(NV_NAN) && defined(DBL_NAN)
@@ -4328,27 +4356,15 @@ static const union { unsigned int __i; float __f; } __PL_inf_u =
 #endif
 #if !defined(NV_NAN) && defined(DBL_QNAN)
 #  define NV_NAN (NV)DBL_QNAN
-#  define NV_QNAN DBL_QNAN
-#endif
-#if !defined(NV_NAN) && defined(DBL_SNAN)
-#  define NV_NAN (NV)DBL_SNAN
-#  define NV_SNAN DBL_SNAN
 #endif
 #if !defined(NV_NAN) && defined(NAN)
 #  define NV_NAN (NV)NAN
 #endif
 #if !defined(NV_NAN) && defined(QNAN)
 #  define NV_NAN (NV)QNAN
-#  define NV_QNAN QNAN
-#endif
-#if !defined(NV_NAN) && defined(SNAN)
-#  define NV_NAN (NV)SNAN
-#  define NV_SNAN SNAN
 #endif
 #if !defined(NV_NAN) && defined(I_SUNMATH)
 #  define NV_NAN (NV)quiet_nan()
-#  define NV_QNAN (NV)quiet_nan()
-#  define NV_SNAN (NV)signaling_nan()
 #endif
 #if !defined(NV_NAN)
 #  if INTSIZE == 4
@@ -5793,12 +5809,16 @@ typedef struct am_table_short AMTS;
          * this will so rarely  be true, there is no point to optimize for
          * time; instead it makes sense to minimize space used and do all the
          * work in the rarely called function */
-#       define _CHECK_AND_WARN_PROBLEMATIC_LOCALE                           \
-       STMT_START {                                                        \
-            if (UNLIKELY(PL_warn_locale)) {                                 \
-                _warn_problematic_locale();                                 \
-            }                                                               \
-        }  STMT_END
+#       ifdef USE_LOCALE_CTYPE
+#           define _CHECK_AND_WARN_PROBLEMATIC_LOCALE                         \
+                STMT_START {                                                  \
+                    if (UNLIKELY(PL_warn_locale)) {                           \
+                        _warn_problematic_locale();                           \
+                    }                                                         \
+                }  STMT_END
+#       else
+#           define _CHECK_AND_WARN_PROBLEMATIC_LOCALE
+#       endif
 
 
     /* These two internal macros are called when a warning should be raised,
@@ -5934,8 +5954,6 @@ typedef struct am_table_short AMTS;
 #define RESTORE_NUMERIC_STANDARD() \
        if (_was_standard) SET_NUMERIC_STANDARD();
 
-#define Atof                           my_atof
-
 #else /* !USE_LOCALE_NUMERIC */
 
 #define SET_NUMERIC_STANDARD()         /**/
@@ -5953,10 +5971,10 @@ typedef struct am_table_short AMTS;
 #define LOCK_NUMERIC_STANDARD()
 #define UNLOCK_NUMERIC_STANDARD()
 
-#define Atof                           my_atof
-
 #endif /* !USE_LOCALE_NUMERIC */
 
+#define Atof                           my_atof
+
 #ifdef USE_QUADMATH
 #  define Perl_strtod(s, e) strtoflt128(s, e)
 #elif defined(HAS_LONG_DOUBLE) && defined(USE_LONG_DOUBLE)
@@ -6486,15 +6504,6 @@ extern void moncontrol(int);
 #  endif
 #endif
 
-/* The implicit bit platforms include the implicit bit
- * in the NV_MANT_DIG.  The bit isn't really there, however,
- * so the real count of mantissa bits is one less. */
-#ifdef NV_IMPLICIT_BIT
-#  define NV_MANT_REAL_DIG (NV_MANT_DIG - 1)
-#else
-#  define NV_MANT_REAL_DIG (NV_MANT_DIG)
-#endif
-
 /*
 
    (KEEP THIS LAST IN perl.h!)