This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Code points above 255 are portable
authorKarl Williamson <khw@cpan.org>
Thu, 16 Jan 2020 21:02:53 +0000 (14:02 -0700)
committerKarl Williamson <khw@cpan.org>
Thu, 23 Jan 2020 22:46:56 +0000 (15:46 -0700)
These tests are to generate warnings that the affected code is not
portable between ASCII and EBCDIC systems.  But, it was being too picky.
Code points above 255 are the same on both systems, so the warning
shouldn't be generated for those.

regcomp.c
t/re/reg_mesg.t

index 85d7555..a004217 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -17655,7 +17655,9 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
                     warn_non_literal_string(RExC_parse, packed_warn, message);
                 }
 
-                non_portable_endpoint++;
+                if (value < 256) {
+                    non_portable_endpoint++;
+                }
                break;
            case 'x':
                RExC_parse--;   /* function expects to be pointed at the 'x' */
@@ -17675,7 +17677,9 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
                     warn_non_literal_string(RExC_parse, packed_warn, message);
                 }
 
-                non_portable_endpoint++;
+                if (value < 256) {
+                    non_portable_endpoint++;
+                }
                break;
            case 'c':
                 if (! grok_bslash_c(*RExC_parse, &grok_c_char, &message,
@@ -17722,7 +17726,9 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
                                  form_short_octal_warning(RExC_parse, numlen));
                         }
                     }
-                    non_portable_endpoint++;
+                    if (value < 256) {
+                        non_portable_endpoint++;
+                    }
                    break;
                }
            default:
index 66ffa88..3376028 100644 (file)
@@ -662,7 +662,6 @@ my @warning_only_under_strict = (
     '/[a-\N{U+FF}]\x{100}/' => 'Ranges of ASCII printables should be some subset of "0-9", "A-Z", or "a-z" {#} m/[a-\N{U+FF}{#}]\x{100}/',
     '/[\N{U+00}-\a]\x{100}/' => "",
     '/[\a-\N{U+FF}]\x{100}/' => "",
-    '/[\N{U+FF}-\x{100}]/' => 'Both or neither range ends should be Unicode {#} m/[\N{U+FF}-\x{100}{#}]/',
     '/[\N{U+100}-\x{101}]/' => "",
     "/[%-%]/" => "",
     "/[:-\\x$colon_hex]\\x{100}/" => "\":-\\x$colon_hex\" is more clearly written simply as \":\" {#} m/[:-\\x$colon_hex\{#}]\\x{100}/",