Author: timbo
Date: Fri Jul 13 05:26:04 2012
New Revision: 15351

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.xs
   dbi/trunk/Perl.xs

Log:
Fixed unused variable / self-assignment compiler warnings

Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Fri Jul 13 05:26:04 2012
@@ -13,6 +13,8 @@
   Added logic to force destruction of children before parents
     during global destruction. Currently experimental.
 
+  Fixed unused variable / self-assignment compiler warnings.
+
 =head2 Changes in DBI 1.622 (svn r15327) 6th June 2012
 
   Fixed lack of =encoding in non-ASCII pod docs. RT#77588

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Fri Jul 13 05:26:04 2012
@@ -282,7 +282,7 @@
     CV *cv  = (CV*) mg->mg_ptr;
     CV *ncv = (CV*)ptr_table_fetch(PL_ptr_table, (cv));
 
-    (void)param; /* avoid 'unused variable' warning */
+    PERL_UNUSED_VAR(param);
     mg->mg_ptr = (char *)ncv;
     ima = (dbi_ima_t*) CvXSUBANY(cv).any_ptr;
     Newx(nima, 1, dbi_ima_t);
@@ -941,7 +941,7 @@
             return 0;
         }
         close_trace_file(aTHX);
-        SvREFCNT_inc(io);
+        (void)SvREFCNT_inc(io);
         DBIS->logfp_ref = io;
     }
     else if (isGV_with_GP(file)) {
@@ -951,7 +951,7 @@
             return 0;
         }
         close_trace_file(aTHX);
-        SvREFCNT_inc(io);
+        (void)SvREFCNT_inc(io);
         DBIS->logfp_ref = io;
     }
     else {
@@ -1238,7 +1238,7 @@
     SV *dbih_imp_sv;
     imp_xxh_t *imp;
     int trace_level;
-    (void)extra; /* unused arg */
+    PERL_UNUSED_VAR(extra);
 
     if ( (imp_stash = gv_stashpv(imp_class, FALSE)) == NULL)
         croak(errmsg, imp_class, "unknown package");
@@ -1822,7 +1822,7 @@
     int fields = DBIc_NUM_FIELDS(imp_sth);
 
     if (fields <= 0) {
-        attribs = attribs;      /* avoid 'unused variable' warning      */
+        PERL_UNUSED_VAR(attribs);
         croak("Statement has no result columns to bind%s",
             DBIc_ACTIVE(imp_sth)
                 ? "" : " (perhaps you need to call execute first)");
@@ -4384,10 +4384,10 @@
 BOOT:
     {
         MY_CXT_INIT;
-        (void)MY_CXT; /* avoid 'unused variable' warning */
+        PERL_UNUSED_VAR(MY_CXT);
     }
-    (void)cv;
-    (void)items; /* avoid 'unused variable' warning */
+    PERL_UNUSED_VAR(cv);
+    PERL_UNUSED_VAR(items);
     dbi_bootinit(NULL);
     /* make this sub into a fake XS so it can bee seen by DBD::* modules;
      * never actually call it as an XS sub, or it will crash and burn! */
@@ -4517,7 +4517,7 @@
     if (DBIS_TRACE_LEVEL >= 5) {
         PerlIO_printf(DBILOGFP, "    New %s (for %s, parent=%s, id=%s)\n",
             neatsvpv(class,0), SvPV_nolen(imp_class), neatsvpv(parent,0), 
neatsvpv(imp_datasv,0));
-        (void)cv; /* avoid unused warning */
+        PERL_UNUSED_VAR(cv);
     }
 
     (void)hv_store((HV*)SvRV(attr_ref), "ImplementorClass", 16, 
SvREFCNT_inc(imp_class), 0);
@@ -4701,7 +4701,7 @@
     dMY_CXT;
     IV level;
     if (!DBIS) {
-        ix=ix;          /* avoid 'unused variable' warnings     */
+        PERL_UNUSED_VAR(ix);
         croak("DBI not initialised");
     }
     /* Return old/current value. No change if new value not given.      */
@@ -4776,7 +4776,7 @@
     NV t2
     CODE:
     SV *leaf = &PL_sv_undef;
-    (void)cv;   /* avoid unused var warnings */
+    PERL_UNUSED_VAR(cv);
     if (SvROK(method))
         method = SvRV(method);
     if (dbih_inner(aTHX_ h, NULL)) {    /* is a DBI handle */
@@ -4817,8 +4817,8 @@
         if (!SvROK(dest) || SvTYPE(SvRV(dest)) != SVt_PVAV)
             croak("dbi_profile_merge_nodes(%s,...) destination is not an array 
reference", neatsvpv(dest,0));
         if (items <= 1) {
-            (void)cv;   /* avoid unused var warnings */
-            (void)ix;
+            PERL_UNUSED_VAR(cv);
+            PERL_UNUSED_VAR(ix);
             RETVAL = 0;
         }
         else {
@@ -4991,7 +4991,7 @@
     SV *imp_xxh_sv;
     SV **tmp_svp;
     CODE:
-    (void)cv; /* unused */
+    PERL_UNUSED_VAR(cv);
     /*
      * Remove and return the imp_xxh_t structure that's attached to the inner
      * hash of the handle. Effectively this removes the 'brain' of the handle
@@ -5169,7 +5169,7 @@
     PPCODE:
     SV *retsv;
     if (CvDEPTH(cv) == 99) {
-        ix = ix;        /* avoid 'unused variable' warning'             */
+        PERL_UNUSED_VAR(ix);
         croak("Deep recursion, probably fetchrow-fetch-fetchrow loop");
     }
     PUSHMARK(sp);
@@ -5281,7 +5281,7 @@
     CODE:
     int num_fields;
     if (CvDEPTH(cv) == 99) {
-        (void)ix; /* avoid 'unused variable' warning' */
+        PERL_UNUSED_VAR(ix);
         croak("Deep recursion. Probably fetch-fetchrow-fetch loop.");
     }
     PUSHMARK(sp);
@@ -5563,8 +5563,8 @@
         XSRETURN_NO;
     }
 
-    SvREFCNT_inc(h1i);
-    SvREFCNT_inc(h2i);
+    (void)SvREFCNT_inc(h1i);
+    (void)SvREFCNT_inc(h2i);
 
     sv_unmagic(h1, 'P');                /* untie(%$h1)          */
     sv_unmagic(h2, 'P');                /* untie(%$h2)          */

Modified: dbi/trunk/Perl.xs
==============================================================================
--- dbi/trunk/Perl.xs   (original)
+++ dbi/trunk/Perl.xs   Fri Jul 13 05:26:04 2012
@@ -41,7 +41,7 @@
 dbd_st_rows(SV *h, imp_sth_t *imp_sth)
 {
     dTHX;
-    h = h; /* silence unused var warning */
+    PERL_UNUSED_VAR(h);
     DBIh_SET_ERR_CHAR(h, imp_sth, 0, 1, "err msg", "12345", Nullch);
     return -1;
 }

Reply via email to