This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document SvGAMAGIC(), and its significance w.r.t. the side effects of
[perl5.git] / pp_ctl.c
index 485a004..f88d401 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1454,7 +1454,7 @@ Perl_qerror(pTHX_ SV *err)
     else if (PL_errors)
        sv_catsv(PL_errors, err);
     else
-       Perl_warn(aTHX_ "%"SVf, err);
+       Perl_warn(aTHX_ "%"SVf, (void*)err);
     ++PL_error_count;
 }
 
@@ -2016,7 +2016,7 @@ PP(pp_return)
            /* Unassume the success we assumed earlier. */
            SV * const nsv = cx->blk_eval.old_namesv;
            (void)hv_delete(GvHVn(PL_incgv), SvPVX_const(nsv), SvCUR(nsv), G_DISCARD);
-           DIE(aTHX_ "%"SVf" did not return a true value", nsv);
+           DIE(aTHX_ "%"SVf" did not return a true value", (void*)nsv);
        }
        break;
     case CXt_FORMAT:
@@ -2324,7 +2324,7 @@ PP(pp_goto)
                        goto retry;
                    tmpstr = sv_newmortal();
                    gv_efullname3(tmpstr, gv, NULL);
-                   DIE(aTHX_ "Goto undefined subroutine &%"SVf"",tmpstr);
+                   DIE(aTHX_ "Goto undefined subroutine &%"SVf"",(void*)tmpstr);
                }
                DIE(aTHX_ "Goto undefined subroutine");
            }
@@ -3026,10 +3026,11 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq)
 }
 
 STATIC PerlIO *
-S_check_type_and_open(pTHX_ const char *name, const char *mode)
+S_check_type_and_open(const char *name, const char *mode)
 {
     Stat_t st;
     const int st_rc = PerlLIO_stat(name, &st);
+
     if (st_rc < 0 || S_ISDIR(st.st_mode) || S_ISBLK(st.st_mode)) {
        return NULL;
     }
@@ -3096,12 +3097,12 @@ PP(pp_require)
        if (cUNOP->op_first->op_type == OP_CONST && cUNOP->op_first->op_private & OPpCONST_NOVER) {
            if ( vcmp(sv,PL_patchlevel) < 0 )
                DIE(aTHX_ "Perls since %"SVf" too modern--this is %"SVf", stopped",
-                   vnormal(sv), vnormal(PL_patchlevel));
+                   (void*)vnormal(sv), (void*)vnormal(PL_patchlevel));
        }
        else {
            if ( vcmp(sv,PL_patchlevel) > 0 )
                DIE(aTHX_ "Perl %"SVf" required--this is only %"SVf", stopped",
-                   vnormal(sv), vnormal(PL_patchlevel));
+                   (void*)vnormal(sv), (void*)vnormal(PL_patchlevel));
        }
 
            RETPUSHYES;
@@ -3147,7 +3148,7 @@ PP(pp_require)
        {
            namesv = newSV(0);
            for (i = 0; i <= AvFILL(ar); i++) {
-               SV *dirsv = *av_fetch(ar, i, TRUE);
+               SV * const dirsv = *av_fetch(ar, i, TRUE);
 
                if (SvROK(dirsv)) {
                    int count;
@@ -3200,7 +3201,7 @@ PP(pp_require)
                        }
 
                        if (SvTYPE(arg) == SVt_PVGV) {
-                           IO *io = GvIO((GV *)arg);
+                           IO * const io = GvIO((GV *)arg);
 
                            ++filter_has_file;
 
@@ -3583,7 +3584,7 @@ PP(pp_leaveeval)
        /* Unassume the success we assumed earlier. */
        SV * const nsv = cx->blk_eval.old_namesv;
        (void)hv_delete(GvHVn(PL_incgv), SvPVX_const(nsv), SvCUR(nsv), G_DISCARD);
-       retop = Perl_die(aTHX_ "%"SVf" did not return a true value", nsv);
+       retop = Perl_die(aTHX_ "%"SVf" did not return a true value", (void*)nsv);
        /* die_where() did LEAVE, or we won't be here */
     }
     else {
@@ -3644,7 +3645,7 @@ Perl_create_eval_scope(pTHX_ U32 flags)
 PP(pp_entertry)
 {
     dVAR;
-    PERL_CONTEXT *cx = create_eval_scope(0);
+    PERL_CONTEXT * const cx = create_eval_scope(0);
     cx->blk_eval.retop = cLOGOP->op_other->op_next;
     return DOCATCH(PL_op->op_next);
 }
@@ -3914,7 +3915,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
        if (c == 0)
            PUSHs(&PL_sv_no);
        else if (SvTEMP(TOPs))
-           SvREFCNT_inc(TOPs);
+           SvREFCNT_inc_void(TOPs);
        FREETMPS;
        LEAVE;
        RETURN;
@@ -4155,7 +4156,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
        if (c == 0)
            PUSHs(&PL_sv_undef);
        else if (SvTEMP(TOPs))
-           SvREFCNT_inc(TOPs);
+           SvREFCNT_inc_void(TOPs);
 
        if (SM_OTHER_REF(PVCV)) {
            /* This one has to be null-proto'd too.
@@ -4166,7 +4167,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
            if (c == 0)
                PUSHs(&PL_sv_undef);
            else if (SvTEMP(TOPs))
-               SvREFCNT_inc(TOPs);
+               SvREFCNT_inc_void(TOPs);
            FREETMPS;
            LEAVE;
            PUTBACK;
@@ -4560,7 +4561,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
     int status = 0;
     SV *upstream;
     STRLEN got_len;
-    const char *got_p;
+    const char *got_p = NULL;
     const char *prune_from = NULL;
     bool read_from_cache = FALSE;
     STRLEN umaxlen;