diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-27 12:42:43 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-27 12:42:43 +0000 |
commit | 252aa0820e6bce274b33bd342cfc65e18a59a165 (patch) | |
tree | 1806e58de44b0a99806e6393ef563649f1e42438 /toke.c | |
parent | 2cc242586845107754f99fa3e09637c9a344d545 (diff) | |
download | perl-252aa0820e6bce274b33bd342cfc65e18a59a165.tar.gz |
Integer constants (0x, 0[0-7], 0b) now overflow fatally,
they used to be just optional lexical warnings.
Also, with warnings turned on, constants > 2**32-1
trigger a non-portability warning.
p4raw-id: //depot/cfgperl@3798
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -871,7 +871,6 @@ S_scan_const(pTHX_ char *start) I32 thisutf = (PL_lex_inwhat == OP_TRANS && PL_sublex_info.sub_op) ? (PL_sublex_info.sub_op->op_private & (PL_lex_repl ? OPpTRANS_FROM_UTF : OPpTRANS_TO_UTF)) : UTF; - /* leaveit is the set of acceptably-backslashed characters */ char *leaveit = PL_lex_inpat @@ -1074,7 +1073,6 @@ S_scan_const(pTHX_ char *start) d = (char*)uv_to_utf8((U8*)d, scan_hex(s + 1, e - s - 1, &len)); s = e + 1; - } else { UV uv = (UV)scan_hex(s, 2, &len); @@ -5978,7 +5976,6 @@ Perl_scan_num(pTHX_ char *start) dTHR; UV u; I32 shift; - bool overflowed = FALSE; /* check for hex */ if (s[1] == 'x') { @@ -6045,15 +6042,13 @@ Perl_scan_num(pTHX_ char *start) digit: n = u << shift; /* make room for the digit */ - if (!overflowed && (n >> shift) != u + if ((n >> shift) != u && !(PL_hints & HINT_NEW_BINARY)) { - if (ckWARN_d(WARN_UNSAFE)) - Perl_warner(aTHX_ WARN_UNSAFE, - "Integer overflow in %s number", - (shift == 4) ? "hex" - : ((shift == 3) ? "octal" : "binary")); - overflowed = TRUE; + Perl_croak(aTHX_ + "Integer overflow in %s number", + (shift == 4) ? "hexadecimal" + : ((shift == 3) ? "octal" : "binary")); } u = n | b; /* add the digit to the end */ break; |