format and other warnings
Robin Barker [Thu, 9 May 2002 18:27:30 +0000 (19:27 +0100)]
Message-Id: <200205091727.SAA22792@tempest.npl.co.uk>

p4raw-id: //depot/perl@16532

Porting/pumpkin.pod
ext/Encode/Encode.xs
ext/Encode/Unicode/Unicode.xs
ext/Storable/Storable.xs
ext/Time/HiRes/HiRes.xs
ext/threads/shared/shared.xs
ext/threads/threads.xs

index fe4d9c8..141a60a 100644 (file)
@@ -755,7 +755,7 @@ and build everything else from that with -DCHECK_FORMAT
 
     make clean
     make miniperl      
-    make all OPTIMIZE=-DCHECK_FORMAT >& make.log  
+    make all OPTIMIZE='-DCHECK_FORMAT -Wformat' >& make.log  
                
 =item *
 
index 0f3f1d4..09918a1 100644 (file)
@@ -80,7 +80,7 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src,
        goto ENCODE_END;
     }
 
-    while (code = do_encode(dir, s, &slen, d, dlen, &dlen, !check))
+    while( (code = do_encode(dir, s, &slen, d, dlen, &dlen, !check)) ) 
     {
        SvCUR_set(dst, dlen+ddone);
        SvPOK_only(dst);
@@ -172,14 +172,14 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src,
            else {
                if (check & ENCODE_DIE_ON_ERR){
                    Perl_croak(aTHX_ ERR_DECODE_NOMAP,
-                              PTR2UV(enc->name[0]), (U8)s[slen]);
+                              enc->name[0], (UV)s[slen]);
                    return &PL_sv_undef; /* never reaches but be safe */
                }
                if (check & ENCODE_WARN_ON_ERR){
                    Perl_warner(
                        aTHX_ packWARN(WARN_UTF8),
                        ERR_DECODE_NOMAP,
-                       PTR2UV(enc->name[0]), (U8)s[slen]);
+                               enc->name[0], (UV)s[slen]);
                }
                if (check & ENCODE_RETURN_ON_ERR){
                    goto ENCODE_SET_SRC;
index e3ad82c..a330ea0 100644 (file)
@@ -212,7 +212,7 @@ CODE:
            if (!issurrogate(ord)){
                if (ucs2) {
                    if (check) {
-                       croak("%s:code point \"\\x{"UVxf"}\" too high",
+                       croak("%s:code point \"\\x{%"UVxf"}\" too high",
                              SvPV_nolen(
                                  *hv_fetch((HV *)SvRV(obj),"Name",4,0))
                              ,ord);
index 04e5c7e..8b7c0cc 100644 (file)
@@ -378,7 +378,7 @@ typedef struct stcxt {
 
 #define dSTCXT_PTR(T,name)                                                     \
        T name = ((perinterp_sv && SvIOK(perinterp_sv) && SvIVX(perinterp_sv)   \
-                               ? (T)SvPVX(SvRV((SV*)SvIVX(perinterp_sv))) : (T) 0))
+                               ? (T)SvPVX(SvRV(INT2PTR(SV*,SvIVX(perinterp_sv)))) : (T) 0))
 #define dSTCXT                                                                         \
        dSTCXT_SV;                                                                              \
        dSTCXT_PTR(stcxt_t *, cxt)
index 9d3586d..3db3902 100644 (file)
@@ -746,7 +746,7 @@ setitimer(which, seconds, interval = 0)
        struct itimerval oldit;
     PPCODE:
        if (seconds < 0.0 || interval < 0.0)
-           croak("Time::HiRes::setitimer(%"IVdf", %"NVgf", %"NVgf"): negative time not invented yet", which, seconds, interval);
+           croak("Time::HiRes::setitimer(%"IVdf", %"NVgf", %"NVgf"): negative time not invented yet", (IV)which, seconds, interval);
        newit.it_value.tv_sec  = seconds;
        newit.it_value.tv_usec =
          (seconds  - (NV)newit.it_value.tv_sec)    * 1000000.0;
index 3442213..477cdb4 100644 (file)
@@ -262,7 +262,7 @@ Perl_sharedsv_associate(pTHX_ SV **psv, SV *ssv, shared_sv *data)
 
     /* Try shared SV as 1st choice */
     if (!data && ssv && SvTYPE(ssv) >= SVt_PVMG) {
-       if (mg = mg_find(ssv, PERL_MAGIC_ext)) {
+       if( (mg = mg_find(ssv, PERL_MAGIC_ext)) ){
            data = (shared_sv *) mg->mg_ptr;
        }
     }
@@ -916,7 +916,7 @@ CODE:
        shared_sv *shared;
        if(SvROK(ref))
            ref = SvRV(ref);
-       if (shared = Perl_sharedsv_find(aTHX_ ref)) {
+       if( (shared = Perl_sharedsv_find(aTHX_ ref)) ){
            ST(0) = sv_2mortal(newSViv(PTR2IV(shared)));
            XSRETURN(1);
        }
@@ -930,17 +930,17 @@ CODE:
        shared_sv *shared;
        if(SvROK(ref))
            ref = SvRV(ref);
-       if (shared = Perl_sharedsv_find(aTHX_ ref)) {
+       if( (shared = Perl_sharedsv_find(aTHX_ ref)) ){
          if (SHAREDSvPTR(shared)) {
            ST(0) = sv_2mortal(newSViv(SvREFCNT(SHAREDSvPTR(shared))));
            XSRETURN(1);
          }
          else {
-            Perl_warn(aTHX_ "%_ s=%p has no shared SV",ST(0),shared);
+            Perl_warn(aTHX_ "%" SVf " s=%p has no shared SV",ST(0),shared);
          }
        }
        else {
-            Perl_warn(aTHX_ "%_ is not shared",ST(0));
+            Perl_warn(aTHX_ "%" SVf " is not shared",ST(0));
        }
        XSRETURN_UNDEF;
 
index 2ebbd83..1c2c133 100755 (executable)
@@ -143,7 +143,8 @@ Perl_ithread_hook(pTHX)
     int veto_cleanup = 0;
     MUTEX_LOCK(&create_destruct_mutex);
     if (aTHX == PL_curinterp && active_threads != 1) {
-       Perl_warn(aTHX_ "Cleanup skipped %d active threads", active_threads);
+       Perl_warn(aTHX_ "Cleanup skipped %" IVdf " active threads",
+                                               (IV)active_threads);
        veto_cleanup = 1;
     }
     MUTEX_UNLOCK(&create_destruct_mutex);
@@ -279,7 +280,7 @@ Perl_ithread_run(void * arg) {
                }
                PUTBACK;
                if (SvTRUE(ERRSV)) {
-                   Perl_warn(aTHX_ "Died:%_",ERRSV);
+                   Perl_warn(aTHX_ "Died:%" SVf,ERRSV);
                }
                FREETMPS;
                LEAVE;
@@ -467,7 +468,7 @@ Perl_ithread_CLONE(pTHX_ SV *obj)
   }
  else
   {
-   Perl_warn(aTHX_ "CLONE %_",obj);
+   Perl_warn(aTHX_ "CLONE %" SVf,obj);
   }
 }