This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #120841) document ERRSV and CLEAR_ERRSV()
[perl5.git] / perl.h
diff --git a/perl.h b/perl.h
index ce40030..ff42636 100644 (file)
--- a/perl.h
+++ b/perl.h
 #   define TAINT_WARN_get       0
 #   define TAINT_WARN_set(s)    NOOP
 #else
+    /* Set to tainted if we are running under tainting mode */
 #   define TAINT               (PL_tainted = PL_tainting)
-#   define TAINT_NOT   (PL_tainted = FALSE)
-#   define TAINT_IF(c) if (UNLIKELY(c)) { PL_tainted = PL_tainting; }
+
+#   define TAINT_NOT   (PL_tainted = FALSE)        /* Untaint */
+#   define TAINT_IF(c) if (UNLIKELY(c)) { TAINT; } /* Conditionally taint */
 #   define TAINT_ENV() if (UNLIKELY(PL_tainting)) { taint_env(); }
-#   define TAINT_PROPER(s)     if (UNLIKELY(PL_tainting)) { taint_proper(NULL, s); }
+                                /* croak or warn if tainting */
+#   define TAINT_PROPER(s)     if (UNLIKELY(PL_tainting)) {                \
+                                    taint_proper(NULL, s);                  \
+                                }
 #   define TAINT_set(s)                (PL_tainted = (s))
-#   define TAINT_get           (PL_tainted)
-#   define TAINTING_get                (PL_tainting)
+#   define TAINT_get           (PL_tainted)    /* Is something tainted? */
+#   define TAINTING_get                (PL_tainting)   /* Is taint checking enabled? */
 #   define TAINTING_set(s)     (PL_tainting = (s))
-#   define TAINT_WARN_get       (PL_taint_warn)
+#   define TAINT_WARN_get       (PL_taint_warn) /* FALSE => tainting violations
+                                                            are fatal
+                                                   TRUE =>  they're just
+                                                            warnings */
 #   define TAINT_WARN_set(s)    (PL_taint_warn = (s))
 #endif
 
 
 #include <sys/types.h>
 
-/* EVC 4 SDK headers includes a bad definition of MB_CUR_MAX in stdlib.h
-  which is included from stdarg.h. Bad definition not present in SD 2008
-  SDK headers. wince.h is not yet included, so we cant fix this from there
-  since by then MB_CUR_MAX will be defined from stdlib.h.
-  cewchar.h includes a correct definition of MB_CUR_MAX and it is copied here
-  since cewchar.h can't be included this early */
-#if defined(UNDER_CE) && (_MSC_VER < 1300)
-#  define MB_CUR_MAX 1uL
-#endif
-
 # include <stdarg.h>
 
 #ifdef I_STDINT
@@ -1337,6 +1335,22 @@ EXTERN_C char *crypt(const char *, const char *);
 #   define RESTORE_ERRNO  (errno = saved_errno)
 #endif
 
+/*
+=head1 Warning and Dieing
+
+=for apidoc Amn|SV *|ERRSV
+
+Returns the SV for C<$@>, creating it if needed.
+
+=for apidoc Am|void|CLEAR_ERRSV
+
+Clear the contents of C<$@>, setting it to the empty string.
+
+This replaces any read-only SV with a fresh SV and removes any magic.
+
+=cut
+*/
+
 #define ERRSV GvSVn(PL_errgv)
 
 /* contains inlined gv_add_by_type */
@@ -1667,8 +1681,6 @@ EXTERN_C char *crypt(const char *, const char *);
 
 #ifdef HAS_STRLCAT
 #  define my_strlcat    strlcat
-#else
-#  define my_strlcat    Perl_my_strlcat
 #endif
 
 #if defined(PERL_CORE) || defined(PERL_EXT)
@@ -1681,14 +1693,10 @@ EXTERN_C char *crypt(const char *, const char *);
 
 #ifdef HAS_STRLCPY
 #  define my_strlcpy   strlcpy
-#else
-#  define my_strlcpy   Perl_my_strlcpy
 #endif
 
 #ifdef HAS_STRNLEN
 #  define my_strnlen   strnlen
-#else
-#  define my_strnlen   Perl_my_strnlen
 #endif
 
 /*
@@ -2290,10 +2298,6 @@ extern long double Perl_my_frexpl(long double x, int *e);
     (Perl_fp_class_pdenorm(x) || Perl_fp_class_ndenorm(x))
 #endif
 
-#ifdef UNDER_CE
-int isnan(double d);
-#endif
-
 #ifndef Perl_isnan
 #   ifdef Perl_fp_class_nan
 #       define Perl_isnan(x) Perl_fp_class_nan(x)
@@ -3521,9 +3525,9 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex)
 #  define NOT_REACHED
 #elif defined(DEBUGGING) && (__has_builtin(__builtin_unreachable) \
      || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5 || __GNUC__ > 4)) /* 4.5 -> */
-#  define NOT_REACHED STMT_START { ASSUME(0); __builtin_unreachable(); } STMT_END
+#  define NOT_REACHED STMT_START { ASSUME(!"UNREACHABLE"); __builtin_unreachable(); } STMT_END
 #else
-#  define NOT_REACHED ASSUME(0)
+#  define NOT_REACHED ASSUME(!"UNREACHABLE")
 #endif
 
 /* Some unistd.h's give a prototype for pause() even though
@@ -3898,7 +3902,7 @@ my_swap16(const U16 x) {
 #endif
 
 #ifndef __cplusplus
-#if !(defined(WIN32) || defined(UNDER_CE) || defined(SYMBIAN))
+#if !(defined(WIN32) || defined(SYMBIAN))
 Uid_t getuid (void);
 Uid_t geteuid (void);
 Gid_t getgid (void);
@@ -6248,7 +6252,7 @@ typedef struct am_table_short AMTS;
             else {                                                          \
                 PL_lc_numeric_mutex_depth++;                                \
                 DEBUG_Lv(PerlIO_printf(Perl_debug_log,                      \
-                        "%s: %d: avoided lc_numeric_lock; depth=%d\n",      \
+                        "%s: %d: avoided lc_numeric_lock; new depth=%d\n",  \
                         __FILE__, __LINE__, PL_lc_numeric_mutex_depth));    \
                 if (cond_to_panic_if_already_locked) {                      \
                     Perl_croak_nocontext("panic: %s: %d: Trying to change"  \
@@ -6270,7 +6274,7 @@ typedef struct am_table_short AMTS;
             else {                                                          \
                 PL_lc_numeric_mutex_depth--;                                \
                 DEBUG_Lv(PerlIO_printf(Perl_debug_log,                      \
-                        "%s: %d: avoided lc_numeric_unlock; depth=%d\n",    \
+                        "%s: %d: avoided lc_numeric_unlock; new depth=%d\n",\
                         __FILE__, __LINE__, PL_lc_numeric_mutex_depth));    \
             }                                                               \
         } STMT_END                                                          \
@@ -6530,9 +6534,10 @@ expression, but with an empty argument list, like this:
 #define Atof                           my_atof
 #define Strtod                          my_strtod
 
-#if    defined(HAS_STRTOD) || defined(USE_QUADMATH)                 \
-    || defined(HAS_STRTOLD) && defined(HAS_LONG_DOUBLE)             \
-                            && defined(USE_LONG_DOUBLE)
+#if    defined(HAS_STRTOD)                                          \
+   ||  defined(USE_QUADMATH)                                        \
+   || (defined(HAS_STRTOLD) && defined(HAS_LONG_DOUBLE)             \
+                            && defined(USE_LONG_DOUBLE))
 #  define Perl_strtod   Strtod
 #endif
 
@@ -6850,10 +6855,6 @@ extern void moncontrol(int);
 #define PERL_GPROF_MONCONTROL(x)
 #endif
 
-#ifdef UNDER_CE
-#include "wince.h"
-#endif
-
 /* ISO 6429 NEL - C1 control NExt Line */
 /* See http://www.unicode.org/unicode/reports/tr13/ */
 #define NEXT_LINE_CHAR NEXT_LINE_NATIVE