summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-09-01 15:55:15 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-09-01 17:09:26 -0400
commitd11832573a44ef0fa2ab36e6878d975388f9ab92 (patch)
tree316885860693a1d0fb7a6cffd9e046d37540e68b
parent74d5bfab5a03c46777cd031b635f872b88dc1fef (diff)
downloadperl-d11832573a44ef0fa2ab36e6878d975388f9ab92.tar.gz
Static initialization using 1/0 or 0/0 not C89.
-rw-r--r--embedvar.h4
-rw-r--r--perl.h10
-rw-r--r--perlapi.h4
-rw-r--r--perlvars.h13
4 files changed, 8 insertions, 23 deletions
diff --git a/embedvar.h b/embedvar.h
index 0ae37a127a..766880ca73 100644
--- a/embedvar.h
+++ b/embedvar.h
@@ -375,8 +375,6 @@
#define PL_Ghash_seed_set (my_vars->Ghash_seed_set)
#define PL_hints_mutex (my_vars->Ghints_mutex)
#define PL_Ghints_mutex (my_vars->Ghints_mutex)
-#define PL_infinity (my_vars->Ginfinity)
-#define PL_Ginfinity (my_vars->Ginfinity)
#define PL_keyword_plugin (my_vars->Gkeyword_plugin)
#define PL_Gkeyword_plugin (my_vars->Gkeyword_plugin)
#define PL_malloc_mutex (my_vars->Gmalloc_mutex)
@@ -387,8 +385,6 @@
#define PL_Gmy_ctx_mutex (my_vars->Gmy_ctx_mutex)
#define PL_my_cxt_index (my_vars->Gmy_cxt_index)
#define PL_Gmy_cxt_index (my_vars->Gmy_cxt_index)
-#define PL_nan (my_vars->Gnan)
-#define PL_Gnan (my_vars->Gnan)
#define PL_op_mutex (my_vars->Gop_mutex)
#define PL_Gop_mutex (my_vars->Gop_mutex)
#define PL_op_seq (my_vars->Gop_seq)
diff --git a/perl.h b/perl.h
index 36ecb50798..4bd7c9285a 100644
--- a/perl.h
+++ b/perl.h
@@ -4102,6 +4102,12 @@ END_EXTERN_C
# endif
#endif
+/* If you are thinking of using HUGE_VAL for infinity, or using
+ * <math.h> functions to generate NV_INF (e.g. exp(1e9), log(-1.0)),
+ * stop. Neither will work portably: HUGE_VAL can be just DBL_MAX,
+ * and the math functions might be just generating DBL_MAX, or even
+ * zero. */
+
#if !defined(NV_INF) && defined(USE_LONG_DOUBLE) && defined(LDBL_INFINITY)
# define NV_INF LDBL_INFINITY
#endif
@@ -4115,7 +4121,7 @@ END_EXTERN_C
# define NV_INF (NV)INF
#endif
#if !defined(NV_INF)
-# define NV_INF (NV)PL_infinity
+# define NV_INF ((NV)1.0/0.0) /* Some compilers will warn. */
#endif
#if !defined(NV_NAN) && defined(USE_LONG_DOUBLE)
@@ -4148,7 +4154,7 @@ END_EXTERN_C
# define NV_NAN (NV)SNAN
#endif
#if !defined(NV_NAN) && defined(NV_INF)
-# define NV_NAN PL_nan
+# define NV_NAN ((NV)0.0/0.0) /* Some compilers will warn. */
#endif
#ifndef __cplusplus
diff --git a/perlapi.h b/perlapi.h
index da48b53f49..910f789540 100644
--- a/perlapi.h
+++ b/perlapi.h
@@ -121,8 +121,6 @@ END_EXTERN_C
#define PL_hash_seed_set (*Perl_Ghash_seed_set_ptr(NULL))
#undef PL_hints_mutex
#define PL_hints_mutex (*Perl_Ghints_mutex_ptr(NULL))
-#undef PL_infinity
-#define PL_infinity (*Perl_Ginfinity_ptr(NULL))
#undef PL_keyword_plugin
#define PL_keyword_plugin (*Perl_Gkeyword_plugin_ptr(NULL))
#undef PL_malloc_mutex
@@ -133,8 +131,6 @@ END_EXTERN_C
#define PL_my_ctx_mutex (*Perl_Gmy_ctx_mutex_ptr(NULL))
#undef PL_my_cxt_index
#define PL_my_cxt_index (*Perl_Gmy_cxt_index_ptr(NULL))
-#undef PL_nan
-#define PL_nan (*Perl_Gnan_ptr(NULL))
#undef PL_op_mutex
#define PL_op_mutex (*Perl_Gop_mutex_ptr(NULL))
#undef PL_op_seq
diff --git a/perlvars.h b/perlvars.h
index 40f5072b35..7bafa40882 100644
--- a/perlvars.h
+++ b/perlvars.h
@@ -237,16 +237,3 @@ PERLVAR(G, malloc_mutex, perl_mutex) /* Mutex for malloc */
PERLVARI(G, hash_seed_set, bool, FALSE) /* perl.c */
PERLVARA(G, hash_seed, PERL_HASH_SEED_BYTES, unsigned char) /* perl.c and hv.h */
-
-/* The infinity. Used if no suitable definition is found in <math.h>.
- * Note: many older places (like HP-UX 10.X) define HUGE_VAL
- * as DBL_MAX (or LDBL_MAX for long doubles). Therefore HUGE_VAL
- * is not a suitable replacement for infinity.
- *
- * The division by zero might warn with some compilers. */
-PERLVARIC(G, infinity, NV, (NV)1.0/0.0)
-
-/* The not-a-number. Used if no suitable definition is found in <math.h>
- *
- * The division by zero might warn with some compilers. */
-PERLVARIC(G, nan, NV, (NV)0.0/0.0)