X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/8f6ae13c8af6db5c57cde14346d77d89a10817d3..eb36cb72ef10b6174e7dbe1080bd1872ad79cd34:/pp_ctl.c diff --git a/pp_ctl.c b/pp_ctl.c index 74c99cc..c596fdb 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -117,7 +117,7 @@ PP(pp_regcomp) if (SvROK(tmpstr)) { SV * const sv = SvRV(tmpstr); if (SvTYPE(sv) == SVt_REGEXP) - re = sv; + re = (REGEXP*) sv; } if (re) { re = reg_temp_copy(re); @@ -128,16 +128,21 @@ PP(pp_regcomp) STRLEN len; const char *t = SvOK(tmpstr) ? SvPV_const(tmpstr, len) : ""; re = PM_GETRE(pm); + assert (re != (REGEXP*) &PL_sv_undef); /* Check against the last compiled regexp. */ - if (!re || !RX_PRECOMP(re) || RX_PRELEN(re) != (I32)len || + if (!re || !RX_PRECOMP(re) || RX_PRELEN(re) != len || memNE(RX_PRECOMP(re), t, len)) { const regexp_engine *eng = re ? RX_ENGINE(re) : NULL; U32 pm_flags = pm->op_pmflags & PMf_COMPILETIME; if (re) { ReREFCNT_dec(re); +#ifdef USE_ITHREADS + PM_SETRE(pm, (REGEXP*) &PL_sv_undef); +#else PM_SETRE(pm, NULL); /* crucial if regcomp aborts */ +#endif } else if (PL_curcop->cop_hints_hash) { SV *ptr = Perl_refcounted_he_fetch(aTHX_ PL_curcop->cop_hints_hash, 0, "regcomp", 7, 0, 0); @@ -1868,8 +1873,25 @@ PP(pp_enteriter) SvGETMAGIC(sv); SvGETMAGIC(right); if (RANGE_IS_NUMERIC(sv,right)) { - if ((SvOK(sv) && SvNV(sv) < IV_MIN) || - (SvOK(right) && SvNV(right) >= IV_MAX)) +#ifdef NV_PRESERVES_UV + if ((SvOK(sv) && ((SvNV(sv) < (NV)IV_MIN) || + (SvNV(sv) > (NV)IV_MAX))) + || + (SvOK(right) && ((SvNV(right) > (NV)IV_MAX) || + (SvNV(right) < (NV)IV_MIN)))) +#else + if ((SvOK(sv) && ((SvNV(sv) <= (NV)IV_MIN) + || + ((SvNV(sv) > 0) && + ((SvUV(sv) > (UV)IV_MAX) || + (SvNV(sv) > (NV)UV_MAX))))) + || + (SvOK(right) && ((SvNV(right) <= (NV)IV_MIN) + || + ((SvNV(right) > 0) && + ((SvUV(right) > (UV)IV_MAX) || + (SvNV(right) > (NV)UV_MAX)))))) +#endif DIE(aTHX_ "Range iterator outside integer range"); cx->blk_loop.iterix = SvIV(sv); cx->blk_loop.itermax = SvIV(right); @@ -2427,7 +2449,7 @@ PP(pp_goto) if (CvDEPTH(cv) < 2) SvREFCNT_inc_simple_void_NN(cv); else { - if (CvDEPTH(cv) == 100 && ckWARN(WARN_RECURSION)) + if (CvDEPTH(cv) == PERL_SUB_DEPTH_WARN && ckWARN(WARN_RECURSION)) sub_crush_depth(cv); pad_push(padlist, CvDEPTH(cv)); } @@ -3084,14 +3106,6 @@ PP(pp_require) sv = POPs; if ( (SvNIOKp(sv) || SvVOK(sv)) && PL_op->op_type != OP_DOFILE) { - if ( SvVOK(sv) && ckWARN(WARN_PORTABLE) ) { /* require v5.6.1 */ - HV * hinthv = GvHV(PL_hintgv); - SV ** ptr = NULL; - if (hinthv) ptr = hv_fetchs(hinthv, "v_string", FALSE); - if ( !(ptr && *ptr && SvIOK(*ptr) && SvIV(*ptr)) ) - Perl_warner(aTHX_ packWARN(WARN_PORTABLE), - "v-string in use/require non-portable"); - } sv = new_version(sv); if (!sv_derived_from(PL_patchlevel, "version")) upg_version(PL_patchlevel, TRUE); @@ -3143,26 +3157,14 @@ PP(pp_require) /* We do this only with use, not require. */ if (PL_compcv && - /* If we request a version >= 5.6.0, then v-string are OK - so set $^H{v_string} to suppress the v-string warning */ - vcmp(sv, sv_2mortal(upg_version(newSVnv(5.006), FALSE))) >= 0) { - HV * hinthv = GvHV(PL_hintgv); - if( hinthv ) { - SV *hint = newSViv(1); - (void)hv_stores(hinthv, "v_string", hint); - /* This will call through to Perl_magic_sethint() which in turn - sets PL_hints correctly. */ - SvSETMAGIC(hint); - } /* If we request a version >= 5.9.5, load feature.pm with the * feature bundle that corresponds to the required version. */ - if (vcmp(sv, sv_2mortal(upg_version(newSVnv(5.009005), FALSE))) >= 0) { + vcmp(sv, sv_2mortal(upg_version(newSVnv(5.009005), FALSE))) >= 0) { SV *const importsv = vnormal(sv); *SvPVX_mutable(importsv) = ':'; ENTER; Perl_load_module(aTHX_ 0, newSVpvs("feature"), NULL, importsv, NULL); LEAVE; - } } RETPUSHYES; @@ -3229,8 +3231,7 @@ PP(pp_require) if (vms_unixname) #endif { - namesv = newSV(0); - sv_upgrade(namesv, SVt_PV); + namesv = newSV_type(SVt_PV); for (i = 0; i <= AvFILL(ar); i++) { SV * const dirsv = *av_fetch(ar, i, TRUE); @@ -3914,11 +3915,11 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) # define SM_REGEX ( \ (SvROK(d) && (SvTYPE(This = SvRV(d)) == SVt_REGEXP) \ - && (this_regex = This) \ + && (this_regex = (REGEXP*) This) \ && (Other = e)) \ || \ (SvROK(e) && (SvTYPE(This = SvRV(e)) == SVt_REGEXP) \ - && (this_regex = This) \ + && (this_regex = (REGEXP*) This) \ && (Other = d)) ) @@ -3927,7 +3928,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) # define SM_OTHER_REGEX (SvROK(Other) \ && (SvTYPE(SvRV(Other)) == SVt_REGEXP) \ - && (other_regex = SvRV(Other))) + && (other_regex = (REGEXP*) SvRV(Other))) # define SM_SEEN_THIS(sv) hv_exists_ent(seen_this, \