This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Dispatch signals in infinite loops such as 1 while 1;
[perl5.git] / perl.h
diff --git a/perl.h b/perl.h
index 1a63b7c..960ba1a 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1310,7 +1310,25 @@ EXTERN_C char *crypt(const char *, const char *);
 #   define SS_NORMAL           0
 #endif
 
-#define ERRSV GvSV(PL_errgv)
+#define ERRSV GvSVn(PL_errgv)
+
+#define CLEAR_ERRSV() STMT_START {                                     \
+    if (!GvSV(PL_errgv)) {                                             \
+       sv_setpvs(GvSV(gv_add_by_type(PL_errgv, SVt_PV)), "");          \
+    } else if (SvREADONLY(GvSV(PL_errgv))) {                           \
+       SvREFCNT_dec(GvSV(PL_errgv));                                   \
+       GvSV(PL_errgv) = newSVpvs("");                                  \
+    } else {                                                           \
+       SV *const errsv = GvSV(PL_errgv);                               \
+       sv_setpvs(errsv, "");                                           \
+       if (SvMAGICAL(errsv)) {                                         \
+           mg_free(errsv);                                             \
+       }                                                               \
+       SvPOK_only(errsv);                                              \
+    }                                                                  \
+    } STMT_END
+
+
 #ifdef PERL_CORE
 # define DEFSV (0 + GvSVn(PL_defgv))
 #else
@@ -3800,8 +3818,10 @@ Gid_t getegid (void);
 
 
 #define DEBUG_SCOPE(where) \
-    DEBUG_l(WITH_THR(Perl_deb(aTHX_ "%s scope %ld at %s:%d\n", \
-                   where, (long)PL_scopestack_ix, __FILE__, __LINE__)));
+    DEBUG_l(WITH_THR( \
+    Perl_deb(aTHX_ "%s scope %ld (savestack=%ld) at %s:%d\n",  \
+                   where, (long)PL_scopestack_ix, (long)PL_savestack_ix, \
+                   __FILE__, __LINE__)));
 
 
 
@@ -4218,10 +4238,12 @@ EXTCONST char PL_warn_nl[]
   INIT("Unsuccessful %s on filename containing newline");
 EXTCONST char PL_no_wrongref[]
   INIT("Can't use %s ref as %s ref");
+/* The core no longer needs these here. If you require the string constant,
+   please inline a copy into your own code.  */
 EXTCONST char PL_no_symref[] __attribute__deprecated__
   INIT("Can't use string (\"%.32s\") as %s ref while \"strict refs\" in use");
-EXTCONST char PL_no_symref_sv[]
-  INIT("Can't use string (\"%" SVf32 "\"%s) as %s ref while \"strict refs\" in use");
+EXTCONST char PL_no_symref_sv[] __attribute__deprecated__
+  INIT("Can't use string (\"%" SVf32 "\") as %s ref while \"strict refs\" in use");
 EXTCONST char PL_no_usym[]
   INIT("Can't use an undefined value as %s reference");
 EXTCONST char PL_no_aelem[]
@@ -4753,7 +4775,7 @@ enum {            /* pass one of these to get_vtbl */
 #define HINT_BLOCK_SCOPE       0x00000100
 #define HINT_STRICT_SUBS       0x00000200 /* strict pragma */
 #define HINT_STRICT_VARS       0x00000400 /* strict pragma */
-#define HINT_UNI_8_BIT         0x00000800 /* unicode8bit pragma */
+#define HINT_UNI_8_BIT         0x00000800 /* unicode_strings feature */
 
 /* The HINT_NEW_* constants are used by the overload pragma */
 #define HINT_NEW_INTEGER       0x00001000
@@ -6127,8 +6149,6 @@ extern void moncontrol(int);
 
 #endif /* Include guard */
 
-#define CLEAR_ERRSV() STMT_START { sv_setpvn(ERRSV,"",0); if (SvMAGICAL(ERRSV)) { mg_free(ERRSV); } SvPOK_only(ERRSV); } STMT_END
-
 /*
  * Local variables:
  * c-indentation-style: bsd