blead: format warnings
Jarkko Hietaniemi [Sat, 7 Jan 2006 21:42:08 +0000 (23:42 +0200)]
Message-ID: <43C01990.6020207@gmail.com>

p4raw-id: //depot/perl@26708

mg.c
regcomp.c
sv.c

diff --git a/mg.c b/mg.c
index aa7ef7d..db0d4de 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1003,13 +1003,13 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
     case '(':
        sv_setiv(sv, (IV)PL_gid);
 #ifdef HAS_GETGROUPS
-       Perl_sv_setpvf(aTHX_ sv, "%"Gid_t_f, (long unsigned int)PL_gid);
+       Perl_sv_setpvf(aTHX_ sv, "%"Gid_t_f, PL_gid);
 #endif
        goto add_groups;
     case ')':
        sv_setiv(sv, (IV)PL_egid);
 #ifdef HAS_GETGROUPS
-       Perl_sv_setpvf(aTHX_ sv, "%"Gid_t_f, (long unsigned int)PL_egid);
+       Perl_sv_setpvf(aTHX_ sv, "%"Gid_t_f, PL_egid);
 #endif
       add_groups:
 #ifdef HAS_GETGROUPS
@@ -1020,7 +1020,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
             num_groups = getgroups(num_groups, gary);
            while (--num_groups >= 0)
                Perl_sv_catpvf(aTHX_ sv, " %"Gid_t_f,
-                    (long unsigned int)gary[num_groups]);
+                              gary[num_groups]);
             Safefree(gary);
        }
 #endif
index 83b9015..86b9140 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -3847,7 +3847,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp)
     if (!SIZE_ONLY && !(flags&HASWIDTH) && max > REG_INFTY/3 && ckWARN(WARN_REGEXP)) {
        vWARN3(RExC_parse,
               "%.*s matches null string many times",
-              RExC_parse - origparse,
+              (int)(RExC_parse >= origparse ? RExC_parse - origparse : 0),
               origparse);
     }
 
@@ -4850,12 +4850,16 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state)
            /* a bad range like a-\d, a-[:digit:] ? */
            if (range) {
                if (!SIZE_ONLY) {
-                   if (ckWARN(WARN_REGEXP))
+                   if (ckWARN(WARN_REGEXP)) {
+                       int w =
+                           RExC_parse >= rangebegin ?
+                           RExC_parse - rangebegin : 0;
                        vWARN4(RExC_parse,
                               "False [] range \"%*.*s\"",
-                              RExC_parse - rangebegin,
-                              RExC_parse - rangebegin,
+                              w,
+                              w,
                               rangebegin);
+                   }
                    if (prevvalue < 256) {
                        ANYOF_BITMAP_SET(ret, prevvalue);
                        ANYOF_BITMAP_SET(ret, '-');
@@ -5259,12 +5263,16 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state)
 
                /* a bad range like \w-, [:word:]- ? */
                if (namedclass > OOB_NAMEDCLASS) {
-                   if (ckWARN(WARN_REGEXP))
+                   if (ckWARN(WARN_REGEXP)) {
+                       int w =
+                           RExC_parse >= rangebegin ?
+                           RExC_parse - rangebegin : 0;
                        vWARN4(RExC_parse,
                               "False [] range \"%*.*s\"",
-                              RExC_parse - rangebegin,
-                              RExC_parse - rangebegin,
+                              w,
+                              w,
                               rangebegin);
+                   }
                    if (!SIZE_ONLY)
                        ANYOF_BITMAP_SET(ret, '-');
                } else
diff --git a/sv.c b/sv.c
index 8800ddf..b2cd1d8 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1152,7 +1152,8 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 new_type)
            SvPV_set(sv, 0);
        break;
     default:
-       Perl_croak(aTHX_ "panic: sv_upgrade to unknown type %lu", new_type);
+       Perl_croak(aTHX_ "panic: sv_upgrade to unknown type %lu",
+                  (unsigned long)new_type);
     }
 
     if (old_type_details->size) {