This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use dNOOP for otherwise empty declarations
authorKarl Williamson <khw@cpan.org>
Sun, 26 Apr 2020 00:09:15 +0000 (18:09 -0600)
committerJames E Keenan <jkeenan@cpan.org>
Sun, 26 Apr 2020 11:30:13 +0000 (07:30 -0400)
Otherwise, the semi-colon the code has afterwards can be interpreted by
some compilers as ending the block of declarations, and treat any later
declarations in the same block as erors in C89.

For an example, see the ticket this fixes #17725

perl.h
regcomp.c
regcomp.h

diff --git a/perl.h b/perl.h
index bd92bfc..cc6363e 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -6835,7 +6835,7 @@ cannot have changed since the precalculation.
 #  define SET_NUMERIC_STANDARD()
 #  define SET_NUMERIC_UNDERLYING()
 #  define IS_NUMERIC_RADIX(a, b)               (0)
-#  define DECLARATION_FOR_LC_NUMERIC_MANIPULATION
+#  define DECLARATION_FOR_LC_NUMERIC_MANIPULATION  dNOOP
 #  define STORE_LC_NUMERIC_SET_STANDARD()
 #  define STORE_LC_NUMERIC_FORCE_TO_UNDERLYING()
 #  define STORE_LC_NUMERIC_SET_TO_NEEDED_IN(in_lc_numeric)
index ee9a2d2..6582a19 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -23514,7 +23514,7 @@ S_handle_user_defined_property(pTHX_
 #    define CUR_CONTEXT      aTHX
 #    define ORIGINAL_CONTEXT save_aTHX
 #  else
-#    define DECLARATION_FOR_GLOBAL_CONTEXT
+#    define DECLARATION_FOR_GLOBAL_CONTEXT    dNOOP
 #    define SWITCH_TO_GLOBAL_CONTEXT          NOOP
 #    define RESTORE_CONTEXT                   NOOP
 #    define CUR_CONTEXT                       NULL
index 9634e94..312c905 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -1162,10 +1162,10 @@ re.pm, especially to the documentation.
     
 #else /* if not DEBUGGING */
 
-#define DECLARE_AND_GET_RE_DEBUG_FLAGS
-#define RE_PV_COLOR_DECL(rpv,rlen,isuni,dsv,pv,l,m,c1,c2)
+#define DECLARE_AND_GET_RE_DEBUG_FLAGS  dNOOP
+#define RE_PV_COLOR_DECL(rpv,rlen,isuni,dsv,pv,l,m,c1,c2)  dNOOP
 #define RE_SV_ESCAPE(rpv,isuni,dsv,sv,m)
-#define RE_PV_QUOTED_DECL(rpv,isuni,dsv,pv,l,m)
+#define RE_PV_QUOTED_DECL(rpv,isuni,dsv,pv,l,m)  dNOOP
 #define RE_SV_DUMPLEN(ItEm)
 #define RE_SV_TAIL(ItEm)
 #define isDEBUG_WILDCARD 0