This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tru64: _SOCKADDR_LEN is good.
[perl5.git] / perl.h
diff --git a/perl.h b/perl.h
index d711b20..091d2d1 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1063,6 +1063,14 @@ EXTERN_C int usleep(unsigned int);
 #   endif
 #endif /* !HAS_BCMP */
 
+/* In Tru64 define _SOCKADDR_LEN to use 4.4BSD and IPv6 interfaces.
+ * Define it before any network headers like netinet/in.h or sys/socket.h.
+ * For OSF/1 3.2, however, defining _SOCKADDR_LEN would be
+ * a bad idea since it breaks send() and recv(). */
+#if defined(__osf__) && defined(__alpha) && !defined(_SOCKADDR_LEN) && !defined(DEC_OSF1_3_X)
+#   define _SOCKADDR_LEN
+#endif
+
 #ifdef I_NETINET_IN
 #   include <netinet/in.h>
 #endif
@@ -1128,14 +1136,6 @@ EXTERN_C int usleep(unsigned int);
 #  define WIN32SCK_IS_STDSCK           /* don't pull in custom wsock layer */
 #endif
 
-/* In Tru64 use the 4.4BSD struct msghdr, not the 4.3 one.
- * This is important for using IPv6.
- * For OSF/1 3.2, however, defining _SOCKADDR_LEN would be
- * a bad idea since it breaks send() and recv(). */
-#if defined(__osf__) && defined(__alpha) && !defined(_SOCKADDR_LEN) && !defined(DEC_OSF1_3_X)
-#   define _SOCKADDR_LEN
-#endif
-
 #if defined(HAS_SOCKET) && !defined(WIN32) /* WIN32 handles sockets via win32.h */
 # include <sys/socket.h>
 # if defined(USE_SOCKS) && defined(I_SOCKS)
@@ -1857,6 +1857,16 @@ typedef NVTYPE NV;
 #   include <ieeefp.h>
 #endif
 
+#ifdef USING_MSVC6
+/* VC6 has broken NaN semantics: NaN == NaN returns true instead of false,
+ * and for example NaN < IV_MIN. */
+#  define NAN_COMPARE_BROKEN
+#endif
+#if defined(__DECC) && defined(__osf__)
+/* Also Tru64 cc has broken NaN comparisons. */
+#  define NAN_COMPARE_BROKEN
+#endif
+
 #ifdef USE_LONG_DOUBLE
 #   ifdef I_SUNMATH
 #       include <sunmath.h>
@@ -1999,7 +2009,7 @@ extern long double Perl_my_frexpl(long double x, int *e);
 #   ifndef Perl_isinf
 #       if defined(HAS_ISINFL) && !(defined(isinf) && defined(HAS_C99))
 #           define Perl_isinf(x) isinfl(x)
-#       elif defined(LDBL_MAX)
+#       elif defined(LDBL_MAX) && !defined(NAN_COMPARE_BROKEN)
 #           define Perl_isinf(x) ((x) > LDBL_MAX || (x) < -LDBL_MAX)
 #       endif
 #   endif
@@ -2074,7 +2084,7 @@ extern long double Perl_my_frexpl(long double x, int *e);
 #   ifndef Perl_isinf
 #       if defined(HAS_ISINF)
 #           define Perl_isinf(x) isinf(x)
-#       elif defined(DBL_MAX)
+#       elif defined(DBL_MAX) && !defined(NAN_COMPARE_BROKEN)
 #           define Perl_isinf(x) ((x) > DBL_MAX || (x) < -DBL_MAX)
 #       endif
 #   endif
@@ -2592,6 +2602,7 @@ typedef struct svop SVOP;
 typedef struct padop PADOP;
 typedef struct pvop PVOP;
 typedef struct loop LOOP;
+typedef struct methop METHOP;
 
 #ifdef PERL_CORE
 typedef struct opslab OPSLAB;
@@ -2663,6 +2674,10 @@ typedef SV PADNAME;
 # define PERL_SAWAMPERSAND
 #endif
 
+#if defined(PERL_DEBUG_READONLY_OPS) && !defined(USE_ITHREADS)
+# error PERL_DEBUG_READONLY_OPS only works with ithreads
+#endif
+
 #include "handy.h"
 
 #if defined(USE_LARGE_FILES) && !defined(NO_64_BIT_RAWIO)
@@ -2884,6 +2899,23 @@ typedef SV PADNAME;
 #  define PERL_FPU_POST_EXEC  }
 #endif
 
+/* In Tru64 the cc -ieee enables the IEEE math but disables traps.
+ * We need to reenable the "invalid" trap because otherwise generation
+ * of NaN values leaves the IEEE fp flags in bad state, leaving any further
+ * fp ops behaving strangely (Inf + 1 resulting in zero, for example). */
+#ifdef __osf__
+#  include <machine/fpu.h>
+#  define PERL_SYS_FPU_INIT \
+     STMT_START { \
+         ieee_set_fp_control(IEEE_TRAP_ENABLE_INV); \
+         signal(SIGFPE, SIG_IGN); \
+     } STMT_END
+#endif
+
+#ifndef PERL_SYS_FPU_INIT
+#  define PERL_SYS_FPU_INIT NOOP
+#endif
+
 #ifndef PERL_SYS_INIT3_BODY
 #  define PERL_SYS_INIT3_BODY(argvp,argcp,envp) PERL_SYS_INIT_BODY(argvp,argcp)
 #endif
@@ -4568,7 +4600,7 @@ EXTCONST char PL_no_dir_func[]
 EXTCONST char PL_no_func[]
   INIT("The %s function is unimplemented");
 EXTCONST char PL_no_myglob[]
-  INIT("\"%s\" variable %s can't be in a package");
+  INIT("\"%s\" %se %s can't be in a package");
 EXTCONST char PL_no_localize_ref[]
   INIT("Can't localize through a reference");
 EXTCONST char PL_memory_wrap[]