Medley of -Wall cleanups from Michael Schwen, Hugo van der Sanden,
Jarkko Hietaniemi [Wed, 30 May 2001 13:36:28 +0000 (13:36 +0000)]
and Abhijit Menon-Sen.

p4raw-id: //depot/perl@10321

av.c
doio.c
doop.c
dump.c
ext/Digest/MD5/MD5.xs
malloc.c
op.c
perl.c
pp_sys.c
regcomp.c

diff --git a/av.c b/av.c
index 086c75e..4872f94 100644 (file)
--- a/av.c
+++ b/av.c
@@ -96,7 +96,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key)
        }
        else {
            if (AvALLOC(av)) {
-#ifndef STRANGE_MALLOC
+#if !defined(STRANGE_MALLOC) && !defined(MYMALLOC)
                MEM_SIZE bytes;
                IV itmp;
 #endif
diff --git a/doio.c b/doio.c
index 9c331f9..e20245a 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -232,7 +232,8 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
            len  = tend-type;
        }
        IoTYPE(io) = *type;
-       if ((*type == IoTYPE_RDWR) && ((!num_svs || tend > type+1 && tend[-1] != IoTYPE_PIPE))) { /* scary */
+       if ((*type == IoTYPE_RDWR) && /* scary */
+           ((!num_svs || (tend > type+1 && tend[-1] != IoTYPE_PIPE)))) {
            mode[1] = *type++;
            writing = 1;
        }
diff --git a/doop.c b/doop.c
index a5c1ce3..14495b1 100644 (file)
--- a/doop.c
+++ b/doop.c
@@ -646,9 +646,10 @@ Perl_do_join(pTHX_ register SV *sv, SV *del, register SV **mark, register SV **s
     register I32 items = sp - mark;
     register STRLEN len;
     STRLEN delimlen;
-    register char *delim = SvPV(del, delimlen);
     STRLEN tmplen;
 
+    (void) SvPV(del, delimlen); /* get the delimlen */
+
     mark++;
     len = (items > 0 ? (delimlen * (items - 1) ) : 0);
     (void)SvUPGRADE(sv, SVt_PV);
diff --git a/dump.c b/dump.c
index 0e11589..4547aea 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -712,41 +712,42 @@ Perl_gv_dump(pTHX_ GV *gv)
  */
 
 static struct { char type; char *name; } magic_names[] = {
-       PERL_MAGIC_sv,             "sv(\\0)",
-       PERL_MAGIC_arylen,         "arylen(#)",
-       PERL_MAGIC_glob,           "glob(*)",
-       PERL_MAGIC_pos,            "pos(.)",
-       PERL_MAGIC_backref,        "backref(<)",
-       PERL_MAGIC_overload,       "overload(A)",
-       PERL_MAGIC_bm,             "bm(B)",
-       PERL_MAGIC_regdata,        "regdata(D)",
-       PERL_MAGIC_env,            "env(E)",
-       PERL_MAGIC_isa,            "isa(I)",
-       PERL_MAGIC_dbfile,         "dbfile(L)",
-       PERL_MAGIC_tied,           "tied(P)",
-       PERL_MAGIC_sig,            "sig(S)",
-       PERL_MAGIC_uvar,           "uvar(U)",
-       PERL_MAGIC_overload_elem,  "overload_elem(a)",
-       PERL_MAGIC_overload_table, "overload_table(c)",
-       PERL_MAGIC_regdatum,       "regdatum(d)",
-       PERL_MAGIC_envelem,        "envelem(e)",
-       PERL_MAGIC_fm,             "fm(f)",
-       PERL_MAGIC_regex_global,   "regex_global(g)",
-       PERL_MAGIC_isaelem,        "isaelem(i)",
-       PERL_MAGIC_nkeys,          "nkeys(k)",
-       PERL_MAGIC_dbline,         "dbline(l)",
-       PERL_MAGIC_mutex,          "mutex(m)",
-       PERL_MAGIC_collxfrm,       "collxfrm(o)",
-       PERL_MAGIC_tiedelem,       "tiedelem(p)",
-       PERL_MAGIC_tiedscalar,     "tiedscalar(q)",
-       PERL_MAGIC_qr,             "qr(r)",
-       PERL_MAGIC_sigelem,        "sigelem(s)",
-       PERL_MAGIC_taint,          "taint(t)",
-       PERL_MAGIC_vec,            "vec(v)",
-       PERL_MAGIC_substr,         "substr(x)",
-       PERL_MAGIC_defelem,        "defelem(y)",
-       PERL_MAGIC_ext,            "ext(~)",
-       0,                         0 /* this null string terminates the list */
+       { PERL_MAGIC_sv,             "sv(\\0)" },
+       { PERL_MAGIC_arylen,         "arylen(#)" },
+       { PERL_MAGIC_glob,           "glob(*)" },
+       { PERL_MAGIC_pos,            "pos(.)" },
+       { PERL_MAGIC_backref,        "backref(<)" },
+       { PERL_MAGIC_overload,       "overload(A)" },
+       { PERL_MAGIC_bm,             "bm(B)" },
+       { PERL_MAGIC_regdata,        "regdata(D)" },
+       { PERL_MAGIC_env,            "env(E)" },
+       { PERL_MAGIC_isa,            "isa(I)" },
+       { PERL_MAGIC_dbfile,         "dbfile(L)" },
+       { PERL_MAGIC_tied,           "tied(P)" },
+       { PERL_MAGIC_sig,            "sig(S)" },
+       { PERL_MAGIC_uvar,           "uvar(U)" },
+       { PERL_MAGIC_overload_elem,  "overload_elem(a)" },
+       { PERL_MAGIC_overload_table, "overload_table(c)" },
+       { PERL_MAGIC_regdatum,       "regdatum(d)" },
+       { PERL_MAGIC_envelem,        "envelem(e)" },
+       { PERL_MAGIC_fm,             "fm(f)" },
+       { PERL_MAGIC_regex_global,   "regex_global(g)" },
+       { PERL_MAGIC_isaelem,        "isaelem(i)" },
+       { PERL_MAGIC_nkeys,          "nkeys(k)" },
+       { PERL_MAGIC_dbline,         "dbline(l)" },
+       { PERL_MAGIC_mutex,          "mutex(m)" },
+       { PERL_MAGIC_collxfrm,       "collxfrm(o)" },
+       { PERL_MAGIC_tiedelem,       "tiedelem(p)" },
+       { PERL_MAGIC_tiedscalar,     "tiedscalar(q)" },
+       { PERL_MAGIC_qr,             "qr(r)" },
+       { PERL_MAGIC_sigelem,        "sigelem(s)" },
+       { PERL_MAGIC_taint,          "taint(t)" },
+       { PERL_MAGIC_vec,            "vec(v)" },
+       { PERL_MAGIC_substr,         "substr(x)" },
+       { PERL_MAGIC_defelem,        "defelem(y)" },
+       { PERL_MAGIC_ext,            "ext(~)" },
+       /* this null string terminates the list */
+       { 0,                         0 },
 };
 
 void
index 6fd9b48..12642ae 100644 (file)
@@ -42,7 +42,8 @@ extern "C" {
 }
 #endif
 
-/*#define MD5_DEBUG /**/
+/* Define this to turn on verbose debugging prints */
+#undef MD5_DEBUG
 
 /* Perl does not guarantee that U32 is exactly 32 bits.  Some system
  * has no integral type with exactly 32 bits.  For instance, A Cray has
@@ -193,7 +194,9 @@ MD5Init(MD5_CTX *ctx)
 static void
 MD5Transform(MD5_CTX* ctx, const U8* buf, STRLEN blocks)
 {
+#ifdef MD5_DEBUG
     static int tcount = 0;
+#endif
 
     U32 A = ctx->A;
     U32 B = ctx->B;
index 0345ef9..f73e22d 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -1045,7 +1045,9 @@ Perl_malloc(register size_t nbytes)
            POW2_OPTIMIZE_ADJUST(nbytes);
            nbytes += M_OVERHEAD;
            nbytes = (nbytes + 3) &~ 3; 
+#if defined(PACK_MALLOC) && !defined(SMALL_BUCKET_VIA_TABLE)
          do_shifts:
+#endif
            shiftr = (nbytes - 1) >> START_SHIFT;
            bucket = START_SHIFTS_BUCKET;
            /* apart from this loop, this is O(1) */
diff --git a/op.c b/op.c
index a252a02..8cc57ec 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3194,7 +3194,6 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *id, OP *arg)
     OP *pack;
     OP *imop;
     OP *veop;
-    GV *gv;
 
     if (id->op_type != OP_CONST)
        Perl_croak(aTHX_ "Module name must be constant");
diff --git a/perl.c b/perl.c
index 2e39794..11dfd2b 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3317,8 +3317,8 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
     char *s;
     SV *sv;
     GV* tmpgv;
-    char **dup_env_base = 0;
 #ifdef NEED_ENVIRON_DUP_FOR_MODIFY
+    char **dup_env_base = 0;
     int dup_env_count = 0;
 #endif
 
index e9f761e..062cee0 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3970,7 +3970,7 @@ PP(pp_system)
 
     if (SP - MARK == 1) {
        if (PL_tainting) {
-           char *junk = SvPV(TOPs, n_a);
+           (void)SvPV_nolen(TOPs);      /* stringify for taint check */
            TAINT_ENV();
            TAINT_PROPER("system");
        }
@@ -4096,7 +4096,7 @@ PP(pp_exec)
 #endif
     else {
        if (PL_tainting) {
-           char *junk = SvPV(*SP, n_a);
+           (void)SvPV_nolen(*SP);      /* stringify for taint check */
            TAINT_ENV();
            TAINT_PROPER("exec");
        }
index e264715..e927ba0 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -877,10 +877,11 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
                int compat = 1;
 
                if (uc >= 0x100 ||
-                   !(data->start_class->flags & (ANYOF_CLASS | ANYOF_LOCALE))
+                   (!(data->start_class->flags & (ANYOF_CLASS | ANYOF_LOCALE))
                    && !ANYOF_BITMAP_TEST(data->start_class, uc)
                    && (!(data->start_class->flags & ANYOF_FOLD)
                        || !ANYOF_BITMAP_TEST(data->start_class, PL_fold[uc])))
+                    )
                    compat = 0;
                ANYOF_CLASS_ZERO(data->start_class);
                ANYOF_BITMAP_ZERO(data->start_class);
@@ -921,9 +922,9 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
                int compat = 1;
 
                if (uc >= 0x100 ||
-                   !(data->start_class->flags & (ANYOF_CLASS | ANYOF_LOCALE))
+                   (!(data->start_class->flags & (ANYOF_CLASS | ANYOF_LOCALE))
                    && !ANYOF_BITMAP_TEST(data->start_class, uc)
-                   && !ANYOF_BITMAP_TEST(data->start_class, PL_fold[uc]))
+                    && !ANYOF_BITMAP_TEST(data->start_class, PL_fold[uc])))
                    compat = 0;
                ANYOF_CLASS_ZERO(data->start_class);
                ANYOF_BITMAP_ZERO(data->start_class);
@@ -2615,7 +2616,6 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp)
 {
     register regnode *ret = 0;
     I32 flags;
-    char *parse_start = RExC_parse;
 
     *flagp = WORST;            /* Tentatively. */
 
@@ -3269,7 +3269,6 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state)
     bool need_class = 0;
     SV *listsv;
     register char *e;
-    char *parse_start = RExC_parse; /* MJD */
     UV n;
     bool optimize_invert = TRUE;
 
@@ -3851,9 +3850,9 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state)
 
     /* optimize case-insensitive simple patterns (e.g. /[a-z]/i) */
     if (!SIZE_ONLY &&
-       (ANYOF_FLAGS(ret) &
         /* If the only flag is folding (plus possibly inversion). */
-        (ANYOF_FLAGS_ALL ^ ANYOF_INVERT) == ANYOF_FOLD)) {
+       ((ANYOF_FLAGS(ret) & (ANYOF_FLAGS_ALL ^ ANYOF_INVERT)) == ANYOF_FOLD)
+       ) {
        for (value = 0; value < 256; ++value) {
            if (ANYOF_BITMAP_TEST(ret, value)) {
                IV fold = PL_fold[value];