This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Fix MSWin32 compilation error
authorKarl Williamson <khw@cpan.org>
Tue, 1 Oct 2019 03:50:09 +0000 (21:50 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 1 Oct 2019 05:07:43 +0000 (23:07 -0600)
On DEBUGGING builds, the asserts in the expansion of this macro build up
too large of literal strings for the Win32 compiler.  Solve this by
storing to an intermediary.

regcomp.c

index e8e4efb..f007d90 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -14902,6 +14902,11 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
                     }
                     else if (node_type == EXACTF) {  /* Means is /di */
 
+                        /* This intermediate variable is needed solely because
+                         * the asserts in the macro where used exceed Win32's
+                         * literal string capacity */
+                        char first_char = * STRING(REGNODE_p(ret));
+
                         /* If 'maybe_exactfu' is clear, then we need to stay
                          * /di.  If it is set, it means there are no code
                          * points that match differently depending on UTF8ness
@@ -14910,7 +14915,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
                         if (! maybe_exactfu) {
                             RExC_seen_d_op = TRUE;
                         }
-                        else if (   isALPHA_FOLD_EQ(* STRING(REGNODE_p(ret)), 's')
+                        else if (   isALPHA_FOLD_EQ(first_char, 's')
                                  || isALPHA_FOLD_EQ(ender, 's'))
                         {
                             /* But, if the node begins or ends in an 's' we