X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=numeric.c;h=b116376916208929c2758638060a6be18a4a3e6d;hb=842c41230043ce99d4bf7b2c79aed85ce2908e89;hp=8d6bc971c5c4248f64f88c351ffb08c4c0898044;hpb=1129b882ced9d5881a47214405219a2e6e332a92;p=p5sagit%2Fp5-mst-13.2.git diff --git a/numeric.c b/numeric.c index 8d6bc97..b116376 100644 --- a/numeric.c +++ b/numeric.c @@ -9,8 +9,10 @@ */ /* - * "That only makes eleven (plus one mislaid) and not fourteen, unless - * wizards count differently to other people." + * "That only makes eleven (plus one mislaid) and not fourteen, + * unless wizards count differently to other people." --Beorn + * + * [p.115 of _The Hobbit_: "Queer Lodgings"] */ /* @@ -140,7 +142,7 @@ Perl_grok_bin(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) NV value_nv = 0; const UV max_div_2 = UV_MAX / 2; - const bool allow_underscores = (bool)(*flags & PERL_SCAN_ALLOW_UNDERSCORES); + const bool allow_underscores = cBOOL(*flags & PERL_SCAN_ALLOW_UNDERSCORES); bool overflowed = FALSE; char bit; @@ -174,9 +176,8 @@ Perl_grok_bin(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) continue; } /* Bah. We're just overflowed. */ - if (ckWARN_d(WARN_OVERFLOW)) - Perl_warner(aTHX_ packWARN(WARN_OVERFLOW), - "Integer overflow in binary number"); + Perl_ck_warner_d(aTHX_ packWARN(WARN_OVERFLOW), + "Integer overflow in binary number"); overflowed = TRUE; value_nv = (NV) value; } @@ -197,9 +198,9 @@ Perl_grok_bin(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) ++s; goto redo; } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT) && ckWARN(WARN_DIGIT)) - Perl_warner(aTHX_ packWARN(WARN_DIGIT), - "Illegal binary digit '%c' ignored", *s); + if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) + Perl_ck_warner(aTHX_ packWARN(WARN_DIGIT), + "Illegal binary digit '%c' ignored", *s); break; } @@ -208,9 +209,8 @@ Perl_grok_bin(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) || (!overflowed && value > 0xffffffff ) #endif ) { - if (ckWARN(WARN_PORTABLE)) - Perl_warner(aTHX_ packWARN(WARN_PORTABLE), - "Binary number > 0b11111111111111111111111111111111 non-portable"); + Perl_ck_warner(aTHX_ packWARN(WARN_PORTABLE), + "Binary number > 0b11111111111111111111111111111111 non-portable"); } *len_p = s - start; if (!overflowed) { @@ -259,7 +259,7 @@ Perl_grok_hex(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) UV value = 0; NV value_nv = 0; const UV max_div_16 = UV_MAX / 16; - const bool allow_underscores = (bool)(*flags & PERL_SCAN_ALLOW_UNDERSCORES); + const bool allow_underscores = cBOOL(*flags & PERL_SCAN_ALLOW_UNDERSCORES); bool overflowed = FALSE; PERL_ARGS_ASSERT_GROK_HEX; @@ -293,9 +293,8 @@ Perl_grok_hex(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) continue; } /* Bah. We're just overflowed. */ - if (ckWARN_d(WARN_OVERFLOW)) - Perl_warner(aTHX_ packWARN(WARN_OVERFLOW), - "Integer overflow in hexadecimal number"); + Perl_ck_warner_d(aTHX_ packWARN(WARN_OVERFLOW), + "Integer overflow in hexadecimal number"); overflowed = TRUE; value_nv = (NV) value; } @@ -316,8 +315,8 @@ Perl_grok_hex(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) ++s; goto redo; } - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT) && ckWARN(WARN_DIGIT)) - Perl_warner(aTHX_ packWARN(WARN_DIGIT), + if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) + Perl_ck_warner(aTHX_ packWARN(WARN_DIGIT), "Illegal hexadecimal digit '%c' ignored", *s); break; } @@ -327,9 +326,8 @@ Perl_grok_hex(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) || (!overflowed && value > 0xffffffff ) #endif ) { - if (ckWARN(WARN_PORTABLE)) - Perl_warner(aTHX_ packWARN(WARN_PORTABLE), - "Hexadecimal number > 0xffffffff non-portable"); + Perl_ck_warner(aTHX_ packWARN(WARN_PORTABLE), + "Hexadecimal number > 0xffffffff non-portable"); } *len_p = s - start; if (!overflowed) { @@ -375,7 +373,7 @@ Perl_grok_oct(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) UV value = 0; NV value_nv = 0; const UV max_div_8 = UV_MAX / 8; - const bool allow_underscores = (bool)(*flags & PERL_SCAN_ALLOW_UNDERSCORES); + const bool allow_underscores = cBOOL(*flags & PERL_SCAN_ALLOW_UNDERSCORES); bool overflowed = FALSE; PERL_ARGS_ASSERT_GROK_OCT; @@ -395,9 +393,8 @@ Perl_grok_oct(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) continue; } /* Bah. We're just overflowed. */ - if (ckWARN_d(WARN_OVERFLOW)) - Perl_warner(aTHX_ packWARN(WARN_OVERFLOW), - "Integer overflow in octal number"); + Perl_ck_warner_d(aTHX_ packWARN(WARN_OVERFLOW), + "Integer overflow in octal number"); overflowed = TRUE; value_nv = (NV) value; } @@ -422,9 +419,9 @@ Perl_grok_oct(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) * as soon as non-octal characters are seen, complain only if * someone seems to want to use the digits eight and nine). */ if (digit == 8 || digit == 9) { - if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT) && ckWARN(WARN_DIGIT)) - Perl_warner(aTHX_ packWARN(WARN_DIGIT), - "Illegal octal digit '%c' ignored", *s); + if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) + Perl_ck_warner(aTHX_ packWARN(WARN_DIGIT), + "Illegal octal digit '%c' ignored", *s); } break; } @@ -434,9 +431,8 @@ Perl_grok_oct(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) || (!overflowed && value > 0xffffffff ) #endif ) { - if (ckWARN(WARN_PORTABLE)) - Perl_warner(aTHX_ packWARN(WARN_PORTABLE), - "Octal number > 037777777777 non-portable"); + Perl_ck_warner(aTHX_ packWARN(WARN_PORTABLE), + "Octal number > 037777777777 non-portable"); } *len_p = s - start; if (!overflowed) {