-Wall is intolerably noisy with icc.
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index c8eff92..9d0ca5d 100644 (file)
--- a/op.c
+++ b/op.c
@@ -785,9 +785,9 @@ Perl_scalarvoid(pTHX_ OP *o)
                      built upon these three nroff macros being used in
                      void context. The pink camel has the details in
                      the script wrapman near page 319. */
-                   if (strnEQ(SvPVX(sv), "di", 2) ||
-                       strnEQ(SvPVX(sv), "ds", 2) ||
-                       strnEQ(SvPVX(sv), "ig", 2))
+                   if (strnEQ(SvPVX_const(sv), "di", 2) ||
+                       strnEQ(SvPVX_const(sv), "ds", 2) ||
+                       strnEQ(SvPVX_const(sv), "ig", 2))
                            useless = 0;
                }
            }
@@ -1379,12 +1379,12 @@ S_scalar_mod_type(pTHX_ const OP *o, I32 type)
 }
 
 STATIC bool
-S_is_handle_constructor(pTHX_ const OP *o, I32 argnum)
+S_is_handle_constructor(pTHX_ const OP *o, I32 numargs)
 {
     switch (o->op_type) {
     case OP_PIPE_OP:
     case OP_SOCKPAIR:
-       if (argnum == 2)
+       if (numargs == 2)
            return TRUE;
        /* FALL THROUGH */
     case OP_SYSOPEN:
@@ -1393,7 +1393,7 @@ S_is_handle_constructor(pTHX_ const OP *o, I32 argnum)
     case OP_SOCKET:
     case OP_OPEN_DIR:
     case OP_ACCEPT:
-       if (argnum == 1)
+       if (numargs == 1)
            return TRUE;
        /* FALL THROUGH */
     default:
@@ -1535,7 +1535,7 @@ S_apply_attrs(pTHX_ HV *stash, SV *target, OP *attrs, bool for_my)
     ENTER;             /* need to protect against side-effects of 'use' */
     SAVEINT(PL_expect);
     if (stash)
-       stashsv = newSVpv(HvNAME(stash), 0);
+       stashsv = newSVpvn(HvNAME_get(stash), HvNAMELEN_get(stash));
     else
        stashsv = &PL_sv_no;
 
@@ -1543,9 +1543,8 @@ S_apply_attrs(pTHX_ HV *stash, SV *target, OP *attrs, bool for_my)
 #define ATTRSMODULE_PM "attributes.pm"
 
     if (for_my) {
-       SV **svp;
        /* Don't force the C<use> if we don't need it. */
-       svp = hv_fetch(GvHVn(PL_incgv), ATTRSMODULE_PM,
+       SV **svp = hv_fetch(GvHVn(PL_incgv), ATTRSMODULE_PM,
                       sizeof(ATTRSMODULE_PM)-1, 0);
        if (svp && *svp != &PL_sv_undef)
            ;           /* already in %INC */
@@ -1589,7 +1588,7 @@ S_apply_attrs_my(pTHX_ HV *stash, OP *target, OP *attrs, OP **imopsp)
 
     /* Build up the real arg-list. */
     if (stash)
-       stashsv = newSVpv(HvNAME(stash), 0);
+       stashsv = newSVpvn(HvNAME_get(stash), HvNAMELEN_get(stash));
     else
        stashsv = &PL_sv_no;
     arg = newOP(OP_PADSV, 0);
@@ -1607,7 +1606,7 @@ S_apply_attrs_my(pTHX_ HV *stash, OP *target, OP *attrs, OP **imopsp)
     (void)SvIOK_on(meth);
     {
        U32 hash;
-       PERL_HASH(hash, SvPVX(meth), SvCUR(meth));
+       PERL_HASH(hash, SvPVX_const(meth), SvCUR(meth));
        SvUV_set(meth, hash);
     }
     imop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL|OPf_WANT_VOID,
@@ -3046,7 +3045,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
            (void)SvIOK_on(meth);
            {
                U32 hash;
-               PERL_HASH(hash, SvPVX(meth), SvCUR(meth));
+               PERL_HASH(hash, SvPVX_const(meth), SvCUR(meth));
                SvUV_set(meth, hash);
            }
            veop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL,
@@ -3074,7 +3073,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
        (void)SvIOK_on(meth);
        {
            U32 hash;
-           PERL_HASH(hash, SvPVX(meth), SvCUR(meth));
+           PERL_HASH(hash, SvPVX_const(meth), SvCUR(meth));
            SvUV_set(meth, hash);
        }
        imop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL,
@@ -3226,7 +3225,7 @@ Perl_newSLICEOP(pTHX_ I32 flags, OP *subscript, OP *listval)
 }
 
 STATIC I32
-S_list_assignment(pTHX_ register const OP *o)
+S_is_list_assignment(pTHX_ register const OP *o)
 {
     if (!o)
        return TRUE;
@@ -3235,8 +3234,8 @@ S_list_assignment(pTHX_ register const OP *o)
        o = cUNOPo->op_first;
 
     if (o->op_type == OP_COND_EXPR) {
-        const I32 t = list_assignment(cLOGOPo->op_first->op_sibling);
-        const I32 f = list_assignment(cLOGOPo->op_first->op_sibling->op_sibling);
+        const I32 t = is_list_assignment(cLOGOPo->op_first->op_sibling);
+        const I32 f = is_list_assignment(cLOGOPo->op_first->op_sibling->op_sibling);
 
        if (t && f)
            return TRUE;
@@ -3281,7 +3280,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
        }
     }
 
-    if (list_assignment(left)) {
+    if (is_list_assignment(left)) {
        OP *curop;
 
        PL_modcount = 0;
@@ -4090,7 +4089,7 @@ Perl_cv_undef(pTHX_ CV *cv)
 void
 Perl_cv_ckproto(pTHX_ const CV *cv, const GV *gv, const char *p)
 {
-    if (((!p != !SvPOK(cv)) || (p && strNE(p, SvPVX(cv)))) && ckWARN_d(WARN_PROTOTYPE)) {
+    if (((!p != !SvPOK(cv)) || (p && strNE(p, SvPVX_const(cv)))) && ckWARN_d(WARN_PROTOTYPE)) {
        SV* msg = sv_newmortal();
        SV* name = Nullsv;
 
@@ -4259,7 +4258,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
        Perl_sv_setpvf(aTHX_ sv, "%s[%s:%"IVdf"]",
                       PL_curstash ? "__ANON__" : "__ANON__::__ANON__",
                       CopFILE(PL_curcop), (IV)CopLINE(PL_curcop));
-       aname = SvPVX(sv);
+       aname = SvPVX_const(sv);
     }
     else
        aname = Nullch;
@@ -4509,9 +4508,9 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
                           CopFILE(PL_curcop),
                           (long)PL_subline, (long)CopLINE(PL_curcop));
            gv_efullname3(tmpstr, gv, Nullch);
-           hv_store(GvHV(PL_DBsub), SvPVX(tmpstr), SvCUR(tmpstr), sv, 0);
+           hv_store(GvHV(PL_DBsub), SvPVX_const(tmpstr), SvCUR(tmpstr), sv, 0);
            hv = GvHVn(db_postponed);
-           if (HvFILL(hv) > 0 && hv_exists(hv, SvPVX(tmpstr), SvCUR(tmpstr))
+           if (HvFILL(hv) > 0 && hv_exists(hv, SvPVX_const(tmpstr), SvCUR(tmpstr))
                && (pcv = GvCV(db_postponed)))
            {
                dSP;
@@ -4654,7 +4653,7 @@ Perl_newXS(pTHX_ const char *name, XSUBADDR_t subaddr, const char *filename)
        else if (CvROOT(cv) || CvXSUB(cv) || GvASSUMECV(gv)) {
            /* already defined (or promised) */
            if (ckWARN(WARN_REDEFINE) && !(CvGV(cv) && GvSTASH(CvGV(cv))
-                           && strEQ(HvNAME(GvSTASH(CvGV(cv))), "autouse"))) {
+                           && strEQ(HvNAME_get(GvSTASH(CvGV(cv))), "autouse"))) {
                const line_t oldline = CopLINE(PL_curcop);
                if (PL_copline != NOLINE)
                    CopLINE_set(PL_curcop, PL_copline);
@@ -5162,17 +5161,6 @@ Perl_ck_exists(pTHX_ OP *o)
     return o;
 }
 
-#if 0
-OP *
-Perl_ck_gvconst(pTHX_ register OP *o)
-{
-    o = fold_constants(o);
-    if (o->op_type == OP_CONST)
-       o->op_type = OP_GV;
-    return o;
-}
-#endif
-
 OP *
 Perl_ck_rvconst(pTHX_ register OP *o)
 {
@@ -5183,12 +5171,12 @@ Perl_ck_rvconst(pTHX_ register OP *o)
     if (kid->op_type == OP_CONST) {
        int iscv;
        GV *gv;
-       SV *kidsv = kid->op_sv;
+       SV * const kidsv = kid->op_sv;
 
        /* Is it a constant from cv_const_sv()? */
        if (SvROK(kidsv) && SvREADONLY(kidsv)) {
            SV *rsv = SvRV(kidsv);
-           int svtype = SvTYPE(rsv);
+           const int svtype = SvTYPE(rsv);
             const char *badtype = Nullch;
 
            switch (o->op_type) {
@@ -5841,10 +5829,10 @@ Perl_ck_method(pTHX_ OP *o)
     OP *kid = cUNOPo->op_first;
     if (kid->op_type == OP_CONST) {
        SV* sv = kSVOP->op_sv;
-       if (!(strchr(SvPVX(sv), ':') || strchr(SvPVX(sv), '\''))) {
+       if (!(strchr(SvPVX_const(sv), ':') || strchr(SvPVX_const(sv), '\''))) {
            OP *cmop;
            if (!SvREADONLY(sv) || !SvFAKE(sv)) {
-               sv = newSVpvn_share(SvPVX(sv), SvCUR(sv), 0);
+               sv = newSVpvn_share(SvPVX_const(sv), SvCUR(sv), 0);
            }
            else {
                kSVOP->op_sv = Nullsv;
@@ -5896,7 +5884,7 @@ Perl_ck_open(pTHX_ OP *o)
         OP *first = cLISTOPx(o)->op_first; /* The pushmark. */
         OP *last  = cLISTOPx(o)->op_last;  /* The bareword. */
         OP *oa;
-        char *mode;
+        const char *mode;
 
         if ((last->op_type == OP_CONST) &&             /* The bareword. */
             (last->op_private & OPpCONST_BARE) &&
@@ -5904,7 +5892,7 @@ Perl_ck_open(pTHX_ OP *o)
             (oa = first->op_sibling) &&                /* The fh. */
             (oa = oa->op_sibling) &&                   /* The mode. */
             SvPOK(((SVOP*)oa)->op_sv) &&
-            (mode = SvPVX(((SVOP*)oa)->op_sv)) &&
+            (mode = SvPVX_const(((SVOP*)oa)->op_sv)) &&
             mode[0] == '>' && mode[1] == '&' &&        /* A dup open. */
             (last == oa->op_sibling))                  /* The bareword. */
              last->op_private &= ~OPpCONST_STRICT;
@@ -6679,7 +6667,7 @@ Perl_peep(pTHX_ register OP *o)
            }
            else if ((o->op_private & OPpEARLY_CV) && ckWARN(WARN_PROTOTYPE)) {
                GV *gv = cGVOPo_gv;
-               if (SvTYPE(gv) == SVt_PVGV && GvCV(gv) && SvPVX(GvCV(gv))) {
+               if (SvTYPE(gv) == SVt_PVGV && GvCV(gv) && SvPVX_const(GvCV(gv))) {
                    /* XXX could check prototype here instead of just carping */
                    SV *sv = sv_newmortal();
                    gv_efullname3(sv, gv, Nullch);
@@ -6805,7 +6793,7 @@ Perl_peep(pTHX_ register OP *o)
            {
                Perl_croak(aTHX_ "No such class field \"%s\" " 
                           "in variable %s of type %s", 
-                     key, SvPV_nolen(lexname), HvNAME(SvSTASH(lexname)));
+                     key, SvPV_nolen(lexname), HvNAME_get(SvSTASH(lexname)));
            }
 
             break;
@@ -6862,7 +6850,7 @@ Perl_peep(pTHX_ register OP *o)
                {
                    Perl_croak(aTHX_ "No such class field \"%s\" "
                               "in variable %s of type %s",
-                         key, SvPV_nolen(lexname), HvNAME(SvSTASH(lexname)));
+                         key, SvPV_nolen(lexname), HvNAME_get(SvSTASH(lexname)));
                }
            }
            break;
@@ -7134,7 +7122,7 @@ const_sv_xsub(pTHX_ CV* cv)
     if (items != 0) {
 #if 0
         Perl_croak(aTHX_ "usage: %s::%s()",
-                   HvNAME(GvSTASH(CvGV(cv))), GvNAME(CvGV(cv)));
+                   HvNAME_get(GvSTASH(CvGV(cv))), GvNAME(CvGV(cv)));
 #endif
     }
     EXTEND(sp, 1);