silence warnings under NO_TAINT_SUPPORT
authorDavid Mitchell <davem@iabyn.com>
Thu, 9 May 2013 13:23:38 +0000 (14:23 +0100)
committerDavid Mitchell <davem@iabyn.com>
Thu, 9 May 2013 13:34:00 +0000 (14:34 +0100)
The are lots of places where local vars aren't used when compiled
with NO_TAINT_SUPPORT.

doio.c
hv.c
mg.c
op.c
pp_ctl.c
pp_hot.c
scope.c
taint.c
util.c

diff --git a/doio.c b/doio.c
index 56c1019..2d65d54 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -1589,6 +1589,8 @@ Perl_apply(pTHX_ I32 type, SV **mark, SV **sp)
 
     PERL_ARGS_ASSERT_APPLY;
 
+    PERL_UNUSED_VAR(what); /* may not be used depending on compile options */
+
     /* Doing this ahead of the switch statement preserves the old behaviour,
        where attempting to use kill as a taint test test would fail on
        platforms where kill was not defined.  */
diff --git a/hv.c b/hv.c
index 76b0a8c..6476f51 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -526,7 +526,7 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
            bool needs_store;
            hv_magic_check (hv, &needs_copy, &needs_store);
            if (needs_copy) {
-               const bool save_taint = TAINT_get; /* Unused var warning under NO_TAINT_SUPPORT */
+               const bool save_taint = TAINT_get;
                if (keysv || is_utf8) {
                    if (!keysv) {
                        keysv = newSVpvn_utf8(key, klen, TRUE);
@@ -540,6 +540,9 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
                }
 
                TAINT_IF(save_taint);
+#ifdef NO_TAINT_SUPPORT
+                PERL_UNUSED_VAR(save_taint);
+#endif
                if (!needs_store) {
                    if (flags & HVhek_FREEKEY)
                        Safefree(key);
diff --git a/mg.c b/mg.c
index 6811727..c3dc4dd 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -2220,6 +2220,9 @@ Perl_magic_gettaint(pTHX_ SV *sv, MAGIC *mg)
 
     PERL_ARGS_ASSERT_MAGIC_GETTAINT;
     PERL_UNUSED_ARG(sv);
+#ifdef NO_TAINT_SUPPORT
+    PERL_UNUSED_ARG(mg);
+#endif
 
     TAINT_IF((PL_localizing != 1) && (mg->mg_len & 1));
     return 0;
diff --git a/op.c b/op.c
index a46d68b..8457869 100644 (file)
--- a/op.c
+++ b/op.c
@@ -9103,9 +9103,12 @@ Perl_ck_index(pTHX_ OP *o)
        if (kid)
            kid = kid->op_sibling;                      /* get past "big" */
        if (kid && kid->op_type == OP_CONST) {
-           const bool save_taint = TAINT_get; /* accepted unused var warning if NO_TAINT_SUPPORT */
+           const bool save_taint = TAINT_get;
            fbm_compile(((SVOP*)kid)->op_sv, 0);
            TAINT_set(save_taint);
+#ifdef NO_TAINT_SUPPORT
+            PERL_UNUSED_VAR(save_taint);
+#endif
        }
     }
     return ck_fun(o);
index 0b8ab98..07d1d9f 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -153,6 +153,9 @@ PP(pp_regcomp)
               modified by get-magic), to avoid incorrectly setting the
               RXf_TAINTED flag with RX_TAINT_on further down. */
            TAINT_set(was_tainted);
+#if NO_TAINT_SUPPORT
+            PERL_UNUSED_VAR(was_tainted);
+#endif
        }
        tmp = reg_temp_copy(NULL, new_re);
        ReREFCNT_dec(new_re);
index 361b488..dd9e5f1 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1243,6 +1243,12 @@ PP(pp_aassign)
            tmp_egid = PerlProc_getegid();
        }
        TAINTING_set( TAINTING_get | (tmp_uid && (tmp_euid != tmp_uid || tmp_egid != tmp_gid)) );
+#ifdef NO_TAINT_SUPPORT
+        PERL_UNUSED_VAR(tmp_uid);
+        PERL_UNUSED_VAR(tmp_euid);
+        PERL_UNUSED_VAR(tmp_gid);
+        PERL_UNUSED_VAR(tmp_egid);
+#endif
     }
     PL_delaymagic = 0;
 
diff --git a/scope.c b/scope.c
index 4f9d771..abfd539 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -916,7 +916,9 @@ Perl_leave_scope(pTHX_ I32 base)
            break;
        case SAVEt_BOOL:                        /* bool reference */
            *(bool*)ARG0_PTR = cBOOL(uv >> 8);
-#if !NO_TAINT_SUPPORT
+#ifdef NO_TAINT_SUPPORT
+            PERL_UNUSED_VAR(was);
+#else
            if (ARG0_PTR == &(TAINT_get)) {
                /* If we don't update <was>, to reflect what was saved on the
                 * stack for PL_tainted, then we will overwrite this attempt to
diff --git a/taint.c b/taint.c
index 4ebba5b..fab98ec 100644 (file)
--- a/taint.c
+++ b/taint.c
@@ -110,6 +110,9 @@ Perl_taint_env(pTHX)
            taint_proper("%%ENV is aliased to %%%s%s", name);
        /* this statement is reached under -t or -U */
        TAINT_set(was_tainted);
+#ifdef NO_TAINT_SUPPORT
+        PERL_UNUSED_VAR(was_tainted);
+#endif
     }
 
 #ifdef VMS
@@ -157,7 +160,11 @@ Perl_taint_env(pTHX)
        const bool was_tainted = TAINT_get;
        const char *t = SvPV_const(*svp, len);
        const char * const e = t + len;
+
        TAINT_set(was_tainted);
+#ifdef NO_TAINT_SUPPORT
+        PERL_UNUSED_VAR(was_tainted);
+#endif
        if (t < e && isWORDCHAR(*t))
            t++;
        while (t < e && (isWORDCHAR(*t) || strchr("-_.+", *t)))
diff --git a/util.c b/util.c
index ec9cc5e..da5959f 100644 (file)
--- a/util.c
+++ b/util.c
@@ -6423,7 +6423,7 @@ Perl_get_db_sub(pTHX_ SV **svp, CV *cv)
 {
     dVAR;
     SV * const dbsv = GvSVn(PL_DBsub);
-    const bool save_taint = TAINT_get; /* Accepted unused var warning under NO_TAINT_SUPPORT */
+    const bool save_taint = TAINT_get;
 
     /* When we are called from pp_goto (svp is null),
      * we do not care about using dbsv to call CV;
@@ -6474,6 +6474,9 @@ Perl_get_db_sub(pTHX_ SV **svp, CV *cv)
        SvIV_set(dbsv, PTR2IV(cv));     /* Do it the quickest way  */
     }
     TAINT_IF(save_taint);
+#ifdef NO_TAINT_SUPPORT
+    PERL_UNUSED_VAR(save_taint);
+#endif
 }
 
 int