return *s == '}';
}
-/* This is inline not for speed, but because it is so tiny */
-
-PERL_STATIC_INLINE char*
-S_form_short_octal_warning(pTHX_
- const char * const s, /* Points to first non-octal */
- const STRLEN len /* Length of octals string, so
- (s-len) points to first
- octal */
-)
-{
- /* Return a character string consisting of a warning message for when a
- * string constant in octal is weird, like "\078". */
-
- const char * sans_leading_zeros = s - len;
-
- PERL_ARGS_ASSERT_FORM_SHORT_OCTAL_WARNING;
-
- assert(*s == '8' || *s == '9');
-
- /* Remove the leading zeros, retaining one zero so won't be zero length */
- while (*sans_leading_zeros == '0') sans_leading_zeros++;
- if (sans_leading_zeros == s) {
- sans_leading_zeros--;
- }
-
- return Perl_form(aTHX_
- "'%.*s' resolved to '\\o{%.*s}%c'",
- (int) (len + 2), s - len - 1,
- (int) (s - sans_leading_zeros), sans_leading_zeros,
- *s);
-}
#endif /* PERL_DQUOTE_INLINE_H_ */
|NN const char * const send \
|const bool UTF \
|const bool braced
-EiR |char*|form_short_octal_warning|NN const char * const s \
- |const STRLEN len
EiRT |I32 |regcurly |NN const char *s
#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_DQUOTE_C)
# if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_DQUOTE_C)
#define form_alien_digit_msg(a,b,c,d,e,f) Perl_form_alien_digit_msg(aTHX_ a,b,c,d,e,f)
#define form_cp_too_large_msg(a,b,c,d) Perl_form_cp_too_large_msg(aTHX_ a,b,c,d)
-#define form_short_octal_warning(a,b) S_form_short_octal_warning(aTHX_ a,b)
#define grok_bslash_c(a,b,c,d) Perl_grok_bslash_c(aTHX_ a,b,c,d)
#define grok_bslash_o(a,b,c,d,e,f,g,h) Perl_grok_bslash_o(aTHX_ a,b,c,d,e,f,g,h)
#define grok_bslash_x(a,b,c,d,e,f,g,h) Perl_grok_bslash_x(aTHX_ a,b,c,d,e,f,g,h)
#define PERL_SCAN_TRAILING 0x10 /* grok_number_flags() allow trailing
and set IS_NUMBER_TRAILING */
-#ifdef PERL_CORE /* These are considered experimental, so not exposed
- publicly */
+/* These are considered experimental, so not exposed publicly */
+#if defined(PERL_CORE) || defined(PERL_EXT)
/* grok_??? don't warn about very large numbers which are <= UV_MAX;
* output: found such a number */
# define PERL_SCAN_SILENT_NON_PORTABLE 0x20
marking where precisely in the pattern it occured. In some instances
the text of the resolution has been clarified.
+=item *
+
+L<'%s' resolved to '\o{%s}%d'|perldiag/'%s' resolved to '\o{%s}%d'>
+
+As of Perl 5.32, this message is no longer generated. Instead,
+L<perldiag/Non-octal character '%c' terminates \o early. Resolved as "%s">
+is.
+
=back
=head1 Utility Changes
unexpectedly encountered that isn't octal. The resulting value
is as indicated.
+When not using C<\o{...}>, you wrote something like C<\08>, or C<\179>
+in a double-quotish string. The resolution is as indicated, with all
+but the last digit treated as a single character, specified in octal.
+The last digit is the next character in the string. To tell Perl that
+this is indeed what you want, you can use the C<\o{ }> syntax, or use
+exactly three digits to specify the octal for the character.
+
Note that, within braces, every character starting with the first
non-octal up to the ending brace is ignored.
=item '%s' resolved to '\o{%s}%d'
+As of Perl 5.32, this message is no longer generated. Instead, see
+L</Non-octal character '%c' terminates \o early. Resolved as "%s">.
(W misc, regexp) You wrote something like C<\08>, or C<\179> in a
double-quotish string. All but the last digit is treated as a single
character, specified in octal. The last digit is the next character in
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_FORM_CP_TOO_LARGE_MSG
-#ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE char* S_form_short_octal_warning(pTHX_ const char * const s, const STRLEN len)
- __attribute__warn_unused_result__;
-#define PERL_ARGS_ASSERT_FORM_SHORT_OCTAL_WARNING \
- assert(s)
-#endif
-
PERL_CALLCONV bool Perl_grok_bslash_c(pTHX_ const char source, U8 * result, const char** message, U32 * packed_warn)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_GROK_BSLASH_C \
/* FALLTHROUGH */
case '0':
{
- I32 flags = PERL_SCAN_SILENT_ILLDIGIT;
+ I32 flags = PERL_SCAN_SILENT_ILLDIGIT
+ | PERL_SCAN_NOTIFY_ILLDIGIT;
STRLEN numlen = 3;
ender = grok_oct(p, &numlen, &flags, NULL);
p += numlen;
- if ( isDIGIT(*p) /* like \08, \178 */
- && ckWARN(WARN_REGEXP)
- && numlen < 3)
+ if ( (flags & PERL_SCAN_NOTIFY_ILLDIGIT)
+ && isDIGIT(*p) /* like \08, \178 */
+ && ckWARN(WARN_REGEXP))
{
reg_warn_non_literal_string(
- p + 1,
- form_short_octal_warning(p, numlen));
+ p + 1,
+ form_alien_digit_msg(8, numlen, p,
+ RExC_end, UTF, FALSE));
}
}
break;
case '5': case '6': case '7':
{
/* Take 1-3 octal digits */
- I32 flags = PERL_SCAN_SILENT_ILLDIGIT;
+ I32 flags = PERL_SCAN_SILENT_ILLDIGIT
+ | PERL_SCAN_NOTIFY_ILLDIGIT;
numlen = (strict) ? 4 : 3;
value = grok_oct(--RExC_parse, &numlen, &flags, NULL);
RExC_parse += numlen;
: 1;
vFAIL("Need exactly 3 octal digits");
}
- else if ( numlen < 3 /* like \08, \178 */
+ else if ( (flags & PERL_SCAN_NOTIFY_ILLDIGIT)
&& RExC_parse < RExC_end
&& isDIGIT(*RExC_parse)
&& ckWARN(WARN_REGEXP))
{
reg_warn_non_literal_string(
RExC_parse + 1,
- form_short_octal_warning(RExC_parse, numlen));
+ form_alien_digit_msg(8, numlen, RExC_parse,
+ RExC_end, UTF, FALSE));
}
}
if (value < 256) {
=> '\N{} here is restricted to one character {#} m/[\x03-\N{U+100.300{#}}]/',
'm/[\N{LATIN CAPITAL LETTER A WITH MACRON AND GRAVE}-\x{10FFFF}]/' => 'Using just the first character returned by \N{} in character class {#} m/[\N{U+100.300}{#}-\x{10FFFF}]/',
=> '\N{} here is restricted to one character {#} m/[\N{U+100.300{#}}-\x{10FFFF}]/',
- '/[\08]/' => '\'\08\' resolved to \'\o{0}8\' {#} m/[\08{#}]/',
+ '/[\08]/' => 'Non-octal character \'8\' terminates \0 early. Resolved as "\0008" {#} m/[\08{#}]/',
=> 'Need exactly 3 octal digits {#} m/[\08{#}]/',
- '/[\018]/' => '\'\018\' resolved to \'\o{1}8\' {#} m/[\018{#}]/',
+ '/[\018]/' => 'Non-octal character \'8\' terminates \0 early. Resolved as "\0018" {#} m/[\018{#}]/',
=> 'Need exactly 3 octal digits {#} m/[\018{#}]/',
'/[\_\0]/' => "",
=> 'Need exactly 3 octal digits {#} m/[\_\0]{#}/',
'm/(?[[:word]])\x{100}/' => "Assuming NOT a POSIX class since there is no terminating ':' {#} m/(?[[:word{#}]])\\x{100}/",
"m'\\y\\x{100}'" => 'Unrecognized escape \y passed through {#} m/\y{#}\x{100}/',
'/x{3,1}/' => 'Quantifier {n,m} with n > m can\'t match {#} m/x{3,1}{#}/',
- '/\08/' => '\'\08\' resolved to \'\o{0}8\' {#} m/\08{#}/',
- '/\018/' => '\'\018\' resolved to \'\o{1}8\' {#} m/\018{#}/',
+ '/\08/' => 'Non-octal character \'8\' terminates \0 early. Resolved as "\0008" {#} m/\08{#}/',
+
+ '/\018/' => 'Non-octal character \'8\' terminates \0 early. Resolved as "\0018" {#} m/\018{#}/',
'/(?=a)*/' => '(?=a)* matches null string many times {#} m/(?=a)*{#}/',
'my $x = \'\m\'; qr/a$x/' => 'Unrecognized escape \m passed through {#} m/a\m{#}/',
'/\q/' => 'Unrecognized escape \q passed through {#} m/\q{#}/',
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
{
- I32 flags = PERL_SCAN_SILENT_ILLDIGIT;
+ I32 flags = PERL_SCAN_SILENT_ILLDIGIT
+ | PERL_SCAN_NOTIFY_ILLDIGIT;
STRLEN len = 3;
- uv = grok_oct(s, &len, &flags, NULL);
- s += len;
- if (len < 3 && s < send && isDIGIT(*s)
+ uv = grok_oct(s, &len, &flags, NULL);
+ s += len;
+ if ( (flags & PERL_SCAN_NOTIFY_ILLDIGIT)
+ && s < send
+ && isDIGIT(*s) /* like \08, \178 */
&& ckWARN(WARN_MISC))
{
- Perl_warner(aTHX_ packWARN(WARN_MISC),
- "%s", form_short_octal_warning(s, len));
+ Perl_warner(aTHX_ packWARN(WARN_MISC), "%s",
+ form_alien_digit_msg(8, len, s, send, UTF, FALSE));
}
}
goto NUM_ESCAPE_INSERT;