This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The first three patches from:
authorMarcus Holland-Moritz <mhx-perl@gmx.net>
Mon, 1 Jan 2007 20:16:13 +0000 (21:16 +0100)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 4 Jan 2007 15:29:02 +0000 (15:29 +0000)
Subject: [PATCH] Cleanup SVf arguments (2nd try)
Message-ID: <20070101201613.4120d9ef@r2d2>

Adds (void*) casts to %-p and %p printf arguments

p4raw-id: //depot/perl@29686

13 files changed:
XSUB.h
doio.c
hv.c
mg.c
perl.c
perlio.c
pp.c
pp_hot.c
regcomp.c
regexec.c
scope.c
sv.c
util.c

diff --git a/XSUB.h b/XSUB.h
index 33795fd..47491e8 100644 (file)
--- a/XSUB.h
+++ b/XSUB.h
@@ -301,9 +301,9 @@ Rethrows a previously caught exception.  See L<perlguts/"Exception Handling">.
                _sv = new_version(_sv);                         \
            if ( vcmp(_sv,xssv) )                                       \
                Perl_croak(aTHX_ "%s object version %"SVf" does not match %s%s%s%s %"SVf,\
-                     module, vstringify(xssv),                         \
+                     module, (void*)vstringify(xssv),                  \
                      vn ? "$" : "", vn ? module : "", vn ? "::" : "",  \
-                     vn ? vn : "bootstrap parameter", vstringify(_sv));\
+                     vn ? vn : "bootstrap parameter", (void*)vstringify(_sv));\
        }                                                               \
     } STMT_END
 #else
diff --git a/doio.c b/doio.c
index e0a1fc5..a24d572 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -787,7 +787,7 @@ Perl_nextargv(pTHX_ register GV *gv)
                        if (ckWARN_d(WARN_INPLACE))     
                            Perl_warner(aTHX_ packWARN(WARN_INPLACE),
                              "Can't do inplace edit: %"SVf" would not be unique",
-                             sv);
+                             (void*)sv);
                        do_close(gv,FALSE);
                        continue;
                    }
@@ -815,7 +815,7 @@ Perl_nextargv(pTHX_ register GV *gv)
                        if (ckWARN_d(WARN_INPLACE))     
                            Perl_warner(aTHX_ packWARN(WARN_INPLACE),
                              "Can't rename %s to %"SVf": %s, skipping file",
-                             PL_oldname, sv, Strerror(errno) );
+                             PL_oldname, (void*)sv, Strerror(errno) );
                        do_close(gv,FALSE);
                        continue;
                    }
diff --git a/hv.c b/hv.c
index 3852754..bd6a223 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -214,7 +214,7 @@ S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen,
     if (flags & HVhek_UTF8) {
        SvUTF8_on(sv);
     }
-    Perl_croak(aTHX_ msg, sv);
+    Perl_croak(aTHX_ msg, (void*)sv);
 }
 
 /* (klen == HEf_SVKEY) is special for MAGICAL hv entries, meaning key slot
@@ -1144,7 +1144,7 @@ S_hsplit(pTHX_ HV *hv)
     int was_shared;
 
     /*PerlIO_printf(PerlIO_stderr(), "hsplit called for %p which had %d\n",
-      hv, (int) oldsize);*/
+      (void*)hv, (int) oldsize);*/
 
     if (HvPLACEHOLDERS_get(hv) && !SvREADONLY(hv)) {
       /* Can make this clear any placeholders first for non-restricted hashes,
@@ -1240,7 +1240,7 @@ S_hsplit(pTHX_ HV *hv)
     }
 
     /* Awooga. Awooga. Pathological data.  */
-    /*PerlIO_printf(PerlIO_stderr(), "%p %d of %d with %d/%d buckets\n", hv,
+    /*PerlIO_printf(PerlIO_stderr(), "%p %d of %d with %d/%d buckets\n", (void*)hv,
       longest_chain, HvTOTALKEYS(hv), HvFILL(hv),  1+HvMAX(hv));*/
 
     ++newsize;
@@ -2181,7 +2181,7 @@ Perl_hv_iternext_flags(pTHX_ HV *hv, I32 flags)
     }
 
     /*if (HvREHASH(hv) && entry && !HeKREHASH(entry))
-      PerlIO_printf(PerlIO_stderr(), "Awooga %p %p\n", hv, entry);*/
+      PerlIO_printf(PerlIO_stderr(), "Awooga %p %p\n", (void*)hv, (void*)entry);*/
 
     iter->xhv_eiter = entry; /* HvEITER(hv) = entry */
     return entry;
diff --git a/mg.c b/mg.c
index c055b9a..918510f 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -2039,7 +2039,7 @@ Perl_vivify_defelem(pTHX_ SV *sv)
         if (he)
             value = HeVAL(he);
        if (!value || value == &PL_sv_undef)
-           Perl_croak(aTHX_ PL_no_helem_sv, mg->mg_obj);
+           Perl_croak(aTHX_ PL_no_helem_sv, (void*)mg->mg_obj);
     }
     else {
        AV* const av = (AV*)LvTARG(sv);
diff --git a/perl.c b/perl.c
index 7d0aeb0..480619f 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -1202,7 +1202,7 @@ perl_destruct(pTHXx)
                        " flags=0x%"UVxf
                        " refcnt=%"UVuf pTHX__FORMAT "\n"
                        "\tallocated at %s:%d %s %s%s\n",
-                       sv, sv->sv_flags, sv->sv_refcnt pTHX__VALUE,
+                       (void*)sv, sv->sv_flags, sv->sv_refcnt pTHX__VALUE,
                        sv->sv_debug_file ? sv->sv_debug_file : "(unknown)",
                        sv->sv_debug_line,
                        sv->sv_debug_inpad ? "for" : "by",
@@ -3280,7 +3280,7 @@ Perl_moreswitches(pTHX_ char *s)
 /* Adjust verbose output as in the perl that ships with the DG/UX OS from EMC */
        PerlIO_printf(PerlIO_stdout(),
                Perl_form(aTHX_ "\nThis is perl, %"SVf"\n",
-                   vstringify(PL_patchlevel)));
+                   (void*)vstringify(PL_patchlevel)));
        PerlIO_printf(PerlIO_stdout(),
                        Perl_form(aTHX_ "        built under %s at %s %s\n",
                                        OSNAME, __DATE__, __TIME__));
@@ -5216,7 +5216,7 @@ Perl_my_exit(pTHX_ U32 status)
 {
     dVAR;
     DEBUG_S(PerlIO_printf(Perl_debug_log, "my_exit: thread %p, status %lu\n",
-                         thr, (unsigned long) status));
+                         (void*)thr, (unsigned long) status));
     switch (status) {
     case 0:
        STATUS_ALL_SUCCESS;
index 603274e..17e1ee3 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -819,7 +819,7 @@ perlio_mg_set(pTHX_ SV *sv, MAGIC *mg)
        IO * const io = GvIOn((GV *) SvRV(sv));
        PerlIO * const ifp = IoIFP(io);
        PerlIO * const ofp = IoOFP(io);
-       Perl_warn(aTHX_ "set %" SVf " %p %p %p", sv, io, ifp, ofp);
+       Perl_warn(aTHX_ "set %" SVf " %p %p %p", (void*)sv, (void*)io, (void*)ifp, (void*)ofp);
     }
     return 0;
 }
@@ -831,7 +831,7 @@ perlio_mg_get(pTHX_ SV *sv, MAGIC *mg)
        IO * const io = GvIOn((GV *) SvRV(sv));
        PerlIO * const ifp = IoIFP(io);
        PerlIO * const ofp = IoOFP(io);
-       Perl_warn(aTHX_ "get %" SVf " %p %p %p", sv, io, ifp, ofp);
+       Perl_warn(aTHX_ "get %" SVf " %p %p %p", (void*)sv, (void*)io, (void*)ifp, (void*)ofp);
     }
     return 0;
 }
@@ -839,14 +839,14 @@ perlio_mg_get(pTHX_ SV *sv, MAGIC *mg)
 static int
 perlio_mg_clear(pTHX_ SV *sv, MAGIC *mg)
 {
-    Perl_warn(aTHX_ "clear %" SVf, sv);
+    Perl_warn(aTHX_ "clear %" SVf, (void*)sv);
     return 0;
 }
 
 static int
 perlio_mg_free(pTHX_ SV *sv, MAGIC *mg)
 {
-    Perl_warn(aTHX_ "free %" SVf, sv);
+    Perl_warn(aTHX_ "free %" SVf, (void*)sv);
     return 0;
 }
 
@@ -871,7 +871,7 @@ XS(XS_io_MODIFY_SCALAR_ATTRIBUTES)
     mg = mg_find(sv, PERL_MAGIC_ext);
     mg->mg_virtual = &perlio_vtab;
     mg_magical(sv);
-    Perl_warn(aTHX_ "attrib %" SVf, sv);
+    Perl_warn(aTHX_ "attrib %" SVf, (void*)sv);
     for (i = 2; i < items; i++) {
        STRLEN len;
        const char * const name = SvPV_const(ST(i), len);
@@ -2063,7 +2063,7 @@ PerlIOBase_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab)
     }
 #if 0
     PerlIO_debug("PerlIOBase_pushed f=%p %s %s fl=%08" UVxf " (%s)\n",
-                f, PerlIOBase(f)->tab->name, (omode) ? omode : "(Null)",
+                (void*)f, PerlIOBase(f)->tab->name, (omode) ? omode : "(Null)",
                 l->flags, PerlIO_modestr(f, temp));
 #endif
     return 0;
@@ -4258,7 +4258,7 @@ PerlIOCrlf_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab)
     code = PerlIOBuf_pushed(aTHX_ f, mode, arg, tab);
 #if 0
     PerlIO_debug("PerlIOCrlf_pushed f=%p %s %s fl=%08" UVxf "\n",
-                f, PerlIOBase(f)->tab->name, (mode) ? mode : "(Null)",
+                (void*)f, PerlIOBase(f)->tab->name, (mode) ? mode : "(Null)",
                 PerlIOBase(f)->flags);
 #endif
     {
@@ -4444,8 +4444,8 @@ PerlIOCrlf_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, SSize_t cnt)
 
        if (ptr != chk ) {
            Perl_croak(aTHX_ "ptr wrong %p != %p fl=%08" UVxf
-                      " nl=%p e=%p for %d", ptr, chk, flags, c->nl,
-                      b->end, cnt);
+                      " nl=%p e=%p for %d", (void*)ptr, (void*)chk,
+                      flags, c->nl, b->end, cnt);
        }
 #endif
     }
diff --git a/pp.c b/pp.c
index c3564f6..645ba62 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -4035,7 +4035,7 @@ PP(pp_hslice)
 
         if (lval) {
             if (!svp || *svp == &PL_sv_undef) {
-                DIE(aTHX_ PL_no_helem_sv, keysv);
+                DIE(aTHX_ PL_no_helem_sv, (void*)keysv);
             }
             if (localizing) {
                if (HvNAME_get(hv) && isGV(*svp))
index 4038629..bbe3efc 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1523,7 +1523,7 @@ yup:                                      /* Confirmed by INTUIT */
            if (DEBUG_C_TEST) {
                PerlIO_printf(Perl_debug_log,
                              "Copy on write: pp_match $& capture, type %d, truebase=%p, t=%p, difference %d\n",
-                             (int) SvTYPE(TARG), truebase, t,
+                             (int) SvTYPE(TARG), (void*)truebase, (void*)t,
                              (int)(t-truebase));
            }
            rx->saved_copy = sv_setsv_cow(rx->saved_copy, TARG);
@@ -1838,7 +1838,7 @@ PP(pp_helem)
            SV* lv;
            SV* key2;
            if (!defer) {
-               DIE(aTHX_ PL_no_helem_sv, keysv);
+               DIE(aTHX_ PL_no_helem_sv, (void*)keysv);
            }
            lv = sv_newmortal();
            sv_upgrade(lv, SVt_PVLV);
@@ -2865,7 +2865,7 @@ try_autoload:
            sub_crush_depth(cv);
 #if 0
        DEBUG_S(PerlIO_printf(Perl_debug_log,
-                             "%p entersub returning %p\n", thr, CvSTART(cv)));
+                             "%p entersub returning %p\n", (void*)thr, (void*)CvSTART(cv)));
 #endif
        RETURNOP(CvSTART(cv));
     }
index 9f44c82..006855d 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -8211,7 +8211,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
            AV *list= (AV *)progi->data->data[progi->name_list_idx];
            SV **name= av_fetch(list, ARG(o), 0 );
            if (name)
-               Perl_sv_catpvf(aTHX_ sv, " '%"SVf"'", *name);
+               Perl_sv_catpvf(aTHX_ sv, " '%"SVf"'", (void*)*name);
         }          
     } else if (k == NREF) {
         if ( prog->paren_names ) {
@@ -8225,7 +8225,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
                     Perl_sv_catpvf(aTHX_ sv, "%s%"IVdf,
                                   (n ? "," : ""), (IV)nums[n]);
                 }
-                Perl_sv_catpvf(aTHX_ sv, " '%"SVf"'", *name );
+                Perl_sv_catpvf(aTHX_ sv, " '%"SVf"'", (void*)*name );
             }
         }
     } else if (k == GOSUB) 
@@ -8233,7 +8233,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
     else if (k == VERB) {
         if (!o->flags) 
             Perl_sv_catpvf(aTHX_ sv, ":%"SVf, 
-                (SV*)progi->data->data[ ARG( o ) ]);
+                (void*)(SV*)progi->data->data[ ARG( o ) ]);
     } else if (k == LOGICAL)
        Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags);     /* 2: embedded, otherwise 1 */
     else if (k == ANYOF) {
index 9ded511..9286bba 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -4842,7 +4842,7 @@ NULL
                         PerlIO_printf(Perl_debug_log,
                            "%*s  %ssetting cutpoint to mark:%"SVf"...%s\n",
                            REPORT_CODE_OFF+depth*2, "", 
-                           PL_colors[4], sv_commit, PL_colors[5]);
+                           PL_colors[4], (void*)sv_commit, PL_colors[5]);
                });
             }
             mark_state = ST.prev_mark;
diff --git a/scope.c b/scope.c
index d15d2d9..31a5ab0 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -642,7 +642,8 @@ Perl_leave_scope(pTHX_ I32 base)
            sv = *(SV**)ptr;
            DEBUG_S(PerlIO_printf(Perl_debug_log,
                                  "restore svref: %p %p:%s -> %p:%s\n",
-                                 ptr, sv, SvPEEK(sv), value, SvPEEK(value)));
+                                 (void*)ptr, (void*)sv, SvPEEK(sv),
+                                 (void*)value, SvPEEK(value)));
            *(SV**)ptr = value;
            SvREFCNT_dec(sv);
            PL_localizing = 2;
diff --git a/sv.c b/sv.c
index 9f2460d..42071f3 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -704,7 +704,7 @@ Perl_get_arena(pTHX_ int arena_size)
     Newxz(adesc->arena, arena_size, char);
     adesc->size = arena_size;
     DEBUG_m(PerlIO_printf(Perl_debug_log, "arena %d added: %p size %d\n", 
-                         curr, adesc->arena, arena_size));
+                         curr, (void*)adesc->arena, arena_size));
 
     return adesc->arena;
 }
@@ -1069,7 +1069,7 @@ S_more_bodies (pTHX_ svtype sv_type)
     /* computed count doesnt reflect the 1st slot reservation */
     DEBUG_m(PerlIO_printf(Perl_debug_log,
                          "arena %p end %p arena-size %d type %d size %d ct %d\n",
-                         start, end,
+                         (void*)start, (void*)end,
                          (int)bdp->arena_size, sv_type, (int)body_size,
                          (int)bdp->arena_size / (int)body_size));
 
@@ -3339,14 +3339,14 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags)
 
     if (SvIS_FREED(dstr)) {
        Perl_croak(aTHX_ "panic: attempt to copy value %" SVf
-                  " to a freed scalar %p", sstr, dstr);
+                  " to a freed scalar %p", (void*)sstr, (void*)dstr);
     }
     SV_CHECK_THINKFIRST_COW_DROP(dstr);
     if (!sstr)
        sstr = &PL_sv_undef;
     if (SvIS_FREED(sstr)) {
-       Perl_croak(aTHX_ "panic: attempt to copy freed scalar %p to %p", sstr,
-                  dstr);
+       Perl_croak(aTHX_ "panic: attempt to copy freed scalar %p to %p",
+                  (void*)sstr, (void*)dstr);
     }
     stype = SvTYPE(sstr);
     dtype = SvTYPE(dstr);
@@ -3778,7 +3778,7 @@ Perl_sv_setsv_cow(pTHX_ SV *dstr, SV *sstr)
 
     if (DEBUG_C_TEST) {
        PerlIO_printf(Perl_debug_log, "Fast copy on write: %p -> %p\n",
-                     sstr, dstr);
+                     (void*)sstr, (void*)dstr);
        sv_dump(sstr);
        if (dstr)
                    sv_dump(dstr);
@@ -8411,7 +8411,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
     }
     if (args && patlen == 3 && pat[0] == '%' &&
                pat[1] == '-' && pat[2] == 'p') {
-       argsv = va_arg(*args, SV*);
+       argsv = (SV*)va_arg(*args, void*);
        sv_catsv(sv, argsv);
        return;
     }
@@ -8567,7 +8567,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
                        precis = n;
                        has_precis = TRUE;
                    }
-                   argsv = va_arg(*args, SV*);
+                   argsv = (SV*)va_arg(*args, void*);
                    eptr = SvPVx_const(argsv, elen);
                    if (DO_UTF8(argsv))
                        is_utf8 = TRUE;
@@ -9934,7 +9934,7 @@ Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param)
 #ifdef DEBUGGING
     if (SvANY(sstr) && PL_watch_pvx && SvPVX_const(sstr) == PL_watch_pvx)
        PerlIO_printf(Perl_debug_log, "watch at %p hit, found string \"%s\"\n",
-                     PL_watch_pvx, SvPVX_const(sstr));
+                     (void*)PL_watch_pvx, SvPVX_const(sstr));
 #endif
 
     /* don't clone objects whose class has asked us not to */
diff --git a/util.c b/util.c
index f67b3ba..360ec28 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1271,7 +1271,7 @@ S_vdie_croak_common(pTHX_ const char* pat, va_list* args, STRLEN* msglen,
 
     DEBUG_S(PerlIO_printf(Perl_debug_log,
                          "%p: die/croak: message = %s\ndiehook = %p\n",
-                         thr, message, PL_diehook));
+                         (void*)thr, message, (void*)PL_diehook));
     if (PL_diehook) {
        S_vdie_common(aTHX_ message, *msglen, *utf8, FALSE);
     }
@@ -1289,7 +1289,7 @@ Perl_vdie(pTHX_ const char* pat, va_list *args)
 
     DEBUG_S(PerlIO_printf(Perl_debug_log,
                          "%p: die: curstack = %p, mainstack = %p\n",
-                         thr, PL_curstack, PL_mainstack));
+                         (void*)thr, (void*)PL_curstack, (void*)PL_mainstack));
 
     message = vdie_croak_common(pat, args, &msglen, &utf8);
 
@@ -1297,7 +1297,7 @@ Perl_vdie(pTHX_ const char* pat, va_list *args)
     SvFLAGS(ERRSV) |= utf8;
     DEBUG_S(PerlIO_printf(Perl_debug_log,
          "%p: die: restartop = %p, was_in_eval = %d, top_env = %p\n",
-         thr, PL_restartop, was_in_eval, PL_top_env));
+         (void*)thr, (void*)PL_restartop, was_in_eval, (void*)PL_top_env));
     if ((!PL_restartop && was_in_eval) || PL_top_env->je_prev)
        JMPENV_JUMP(3);
     return PL_restartop;