In perl.git, the branch smoke-me/mauke/overflow has been updated <https://perl5.git.perl.org/perl.git/commitdiff/0ca013ba2095f1e4cc1e63f716a11d4ae8cc0654?hp=82c76ddc179d6cdde6e203f99d72ad1342390c48>
- Log ----------------------------------------------------------------- commit 0ca013ba2095f1e4cc1e63f716a11d4ae8cc0654 Author: Lukas Mai <l....@web.de> Date: Tue Oct 24 21:59:07 2017 +0200 remove used feature macros from metaconfig.h commit 2cd9812ec4eee4adadec5e532185a92634076581 Author: Lukas Mai <l....@web.de> Date: Tue Oct 24 21:58:41 2017 +0200 indent nested #ifdefs ----------------------------------------------------------------------- Summary of changes: metaconfig.h | 3 --- pp.c | 36 ++++++++++++++++++------------------ pp_hot.c | 18 +++++++++--------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/metaconfig.h b/metaconfig.h index eea007328c..f88be5a4c4 100644 --- a/metaconfig.h +++ b/metaconfig.h @@ -13,9 +13,6 @@ * Symbols should only be here temporarily. Once they are actually used, * they should be removed from here. * - * HAS_BUILTIN_ADD_OVERFLOW - * HAS_BUILTIN_MUL_OVERFLOW - * HAS_BUILTIN_SUB_OVERFLOW * HAS_THREAD_SAFE_NL_LANGINFO_L * HAS_LOCALECONV_L * HAS_MBRLEN diff --git a/pp.c b/pp.c index 5d52683bba..3a2f352185 100644 --- a/pp.c +++ b/pp.c @@ -1246,10 +1246,10 @@ PP(pp_multiply) il = SvIVX(svl); ir = SvIVX(svr); -#ifdef HAS_BUILTIN_MUL_OVERFLOW +# ifdef HAS_BUILTIN_MUL_OVERFLOW do_iv: safe = !__builtin_mul_overflow(il, ir, &iresult); -#else +# else { UV topl, topr; do_iv: @@ -1272,7 +1272,7 @@ PP(pp_multiply) safe = FALSE; } } -#endif +# endif if (safe) { SP--; @@ -1289,12 +1289,12 @@ PP(pp_multiply) NV result; if ( -#if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) +# if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) !Perl_isnan(nl) && nl == (NV)(il = (IV)nl) && !Perl_isnan(nr) && nr == (NV)(ir = (IV)nr) -#else +# else nl == (NV)(il = (IV)nl) && nr == (NV)(ir = (IV)nr) -#endif +# endif ) /* nothing was lost by converting to IVs */ goto do_iv; @@ -1313,7 +1313,7 @@ PP(pp_multiply) generic: -#ifdef HAS_BUILTIN_MUL_OVERFLOW +# ifdef HAS_BUILTIN_MUL_OVERFLOW if (SvIV_please_nomg(svr) && SvIV_please_nomg(svl)) { bool overflowed, result_is_uv; IV iresult; @@ -1365,7 +1365,7 @@ PP(pp_multiply) RETURN; } } -#else +# else if (SvIV_please_nomg(svr)) { /* Unless the left argument is integer in range we are going to have to use NV maths. Hence only attempt to coerce the right argument if @@ -1478,7 +1478,7 @@ PP(pp_multiply) } /* ahigh && bhigh */ } /* SvIOK(svl) */ } /* SvIOK(svr) */ -#endif +# endif #endif { NV right = SvNV_nomg(svr); @@ -1899,10 +1899,10 @@ PP(pp_subtract) il = SvIVX(svl); ir = SvIVX(svr); -#ifdef HAS_BUILTIN_SUB_OVERFLOW +# ifdef HAS_BUILTIN_SUB_OVERFLOW do_iv: safe = !__builtin_sub_overflow(il, ir, &iresult); -#else +# else { UV topl, topr; do_iv: @@ -1920,7 +1920,7 @@ PP(pp_subtract) safe = FALSE; } } -#endif +# endif if (safe) { SP--; TARGi(iresult, 0); /* args not GMG, so can't be tainted */ @@ -1935,12 +1935,12 @@ PP(pp_subtract) NV nr = SvNVX(svr); if ( -#if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) +# if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) !Perl_isnan(nl) && nl == (NV)(il = (IV)nl) && !Perl_isnan(nr) && nr == (NV)(ir = (IV)nr) -#else +# else nl == (NV)(il = (IV)nl) && nr == (NV)(ir = (IV)nr) -#endif +# endif ) /* nothing was lost by converting to IVs */ goto do_iv; @@ -1954,7 +1954,7 @@ PP(pp_subtract) generic: useleft = USE_LEFT(svl); -#ifdef HAS_BUILTIN_SUB_OVERFLOW +# ifdef HAS_BUILTIN_SUB_OVERFLOW if (SvIV_please_nomg(svr)) { IV ivl = 0; UV uvl; @@ -2046,7 +2046,7 @@ PP(pp_subtract) } } } -#else +# else /* See comments in pp_add (in pp_hot.c) about Overflow, and how "bad things" happen if you rely on signed integers wrapping. */ if (SvIV_please_nomg(svr)) { @@ -2144,7 +2144,7 @@ PP(pp_subtract) } /* Overflow, drop through to NVs. */ } } -#endif +# endif #else useleft = USE_LEFT(svl); #endif diff --git a/pp_hot.c b/pp_hot.c index 700dc9dd67..de05e194c7 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -612,10 +612,10 @@ PP(pp_add) il = SvIVX(svl); ir = SvIVX(svr); -#ifdef HAS_BUILTIN_ADD_OVERFLOW +# ifdef HAS_BUILTIN_ADD_OVERFLOW do_iv: safe = !__builtin_add_overflow(il, ir, &iresult); -#else +# else { UV topl, topr; do_iv: @@ -633,7 +633,7 @@ PP(pp_add) safe = FALSE; } } -#endif +# endif if (safe) { SP--; @@ -649,12 +649,12 @@ PP(pp_add) NV nr = SvNVX(svr); if ( -#if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) +# if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) !Perl_isnan(nl) && nl == (NV)(il = (IV)nl) && !Perl_isnan(nr) && nr == (NV)(ir = (IV)nr) -#else +# else nl == (NV)(il = (IV)nl) && nr == (NV)(ir = (IV)nr) -#endif +# endif ) /* nothing was lost by converting to IVs */ goto do_iv; @@ -668,7 +668,7 @@ PP(pp_add) generic: useleft = USE_LEFT(svl); -#ifdef HAS_BUILTIN_ADD_OVERFLOW +# ifdef HAS_BUILTIN_ADD_OVERFLOW if (SvIV_please_nomg(svr)) { if (!useleft) { SP--; @@ -732,7 +732,7 @@ PP(pp_add) } } } -#else +# else /* We must see if we can perform the addition with integers if possible, as the integer code detects overflow while the NV code doesn't. If either argument hasn't had a numeric conversion yet attempt to get @@ -876,7 +876,7 @@ PP(pp_add) } /* Overflow, drop through to NVs. */ } } -#endif +# endif #else useleft = USE_LEFT(svl); -- Perl5 Master Repository