summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-01-23 15:48:02 -0700
committerKarl Williamson <khw@cpan.org>2020-01-23 15:48:02 -0700
commit1198415d086c4846ab55871102a42c93be57d86b (patch)
tree23d41720126677c5f1b6c08ffdaa8de0f68fa653 /numeric.c
parent74a32ed2df4038377b621310e10e2cf3d7f9dcf5 (diff)
parent968b98d0805cb9895d7ea3171b0b29d5e2660082 (diff)
downloadperl-1198415d086c4846ab55871102a42c93be57d86b.tar.gz
Merge branch 'false_warning' into blead
This branch regularizes the warnings and errors generated when a hex or octal character constant contains an illegal character, and when such a constant evaluates to something that won't fit into a 32 bit word. It unifies where the text is generated, leading to a uniform syntax that no longer has slight spelling variances. And some messages previously gave outright false information. Some cases of a too-high code point weren't caught immediately; this is fixed. During pattern compilation, some messages could have become truncated or garbled. This is fixed. This resolves GH #17340 False warning that character is ignored
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/numeric.c b/numeric.c
index ad75f63373..4c2f12b8cd 100644
--- a/numeric.c
+++ b/numeric.c
@@ -513,12 +513,16 @@ Perl_grok_bin_oct_hex(pTHX_ const char *start,
if (! overflowed) {
overflowed = TRUE;
- Perl_ck_warner_d(aTHX_ packWARN(WARN_OVERFLOW),
+ if ( ! (input_flags & PERL_SCAN_SILENT_OVERFLOW)
+ && ckWARN_d(WARN_OVERFLOW))
+ {
+ Perl_warner(aTHX_ packWARN(WARN_OVERFLOW),
"Integer overflow in %s number",
(base == 16) ? "hexadecimal"
: (base == 2)
? "binary"
: "octal");
+ }
}
continue;
}
@@ -526,7 +530,13 @@ Perl_grok_bin_oct_hex(pTHX_ const char *start,
if ( *s == '_'
&& len
&& allow_underscores
- && _generic_isCC(s[1], class_bit))
+ && _generic_isCC(s[1], class_bit)
+
+ /* Don't allow a leading underscore if the only-medial bit is
+ * set */
+ && ( LIKELY(s > s0)
+ || UNLIKELY((input_flags & PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES)
+ != PERL_SCAN_ALLOW_MEDIAL_UNDERSCORES)))
{
--len;
++s;