[esnacc-dev] [PATCH 1/2] c-lib: Cleanup unused warnings

Aaron Conole aconole at bytheb.org
Thu Sep 8 16:34:35 UTC 2016


During compilation, a number of warnings are triggered by some compilers that
variables are being self-referenced.  Removing this reference would cause
a different warning - an 'unused variable' warning.  With this change, we
switch to indicating that the variable is not used.

At some point in the future, we should break API and ABI compat and remove
these.

Suggested-by: Arpad Tigyi <tigyi.arpad at gmail.com>
Signed-off-by: Aaron Conole <aconole at bytheb.org>
---
 AUTHORS              |  1 +
 c-lib/src/asn-bits.c |  4 +---
 c-lib/src/asn-int.c  | 11 +++--------
 c-lib/src/asn-octs.c |  3 +--
 c-lib/src/print.c    |  6 ++----
 5 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index f21cb34..95e2da3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -46,6 +46,7 @@ Name                                  Email
 Aftab Alam
 Angel Dimitrov
 Angus Comber
+Arpad Tigyi                           tigyi.arpad at gmail.com
 David O'Farrell
 Dennis Lim
 Dianne Marsh
diff --git a/c-lib/src/asn-bits.c b/c-lib/src/asn-bits.c
index 9cc747a..369c347 100644
--- a/c-lib/src/asn-bits.c
+++ b/c-lib/src/asn-bits.c
@@ -312,7 +312,7 @@ void
 PrintAsnBits PARAMS ((f,v, indent),
     FILE *f _AND_
     AsnBits *v _AND_
-    unsigned int indent)
+    unsigned int indent ESNACC_UNUSED)
 {
     int i;
     unsigned long octetLen;
@@ -326,8 +326,6 @@ PrintAsnBits PARAMS ((f,v, indent),
     for (i = 0; i < (int)octetLen; i++)
         fprintf (f,"%c%c", TO_HEX (v->bits[i] >> 4), TO_HEX (v->bits[i]));
     fprintf (f,"'H");
-    indent=indent;  /* referenced to avoid compiler warning. */
-
 } /* PrintAsnBits  */
 
 /*
diff --git a/c-lib/src/asn-int.c b/c-lib/src/asn-int.c
index eef7ac9..171e925 100644
--- a/c-lib/src/asn-int.c
+++ b/c-lib/src/asn-int.c
@@ -183,7 +183,7 @@ BEncAsnIntContent PARAMS ((b, data),
 void
 BDecAsnIntContent PARAMS ((b, tagId, len, result, bytesDecoded, env),
     GenBuf *b _AND_
-    AsnTag     tagId _AND_
+    AsnTag     tagId ESNACC_UNUSED _AND_
     AsnLen     len _AND_
     AsnInt    *result _AND_
     AsnLen *bytesDecoded _AND_
@@ -224,8 +224,6 @@ BDecAsnIntContent PARAMS ((b, tagId, len, result, bytesDecoded, env),
     (*bytesDecoded) += len;
 
     *result = retVal;
-    tagId=tagId;  /* referenced to avoid compiler warning. */
-
 }  /* BDecAsnIntContent */
 
 
@@ -237,10 +235,9 @@ void
 PrintAsnInt PARAMS ((f, v, indent),
     FILE *f _AND_
     AsnInt *v _AND_
-    unsigned int indent)
+    unsigned int indent ESNACC_UNUSED)
 {
     fprintf (f,"%d", *v);
-    indent=indent; /* referenced to avoid compiler warning. */
 }
 
 
@@ -364,7 +361,7 @@ BEncUAsnIntContent PARAMS ((b, data),
 void
 BDecUAsnIntContent PARAMS ((b, tag, len, result, bytesDecoded, env),
     GenBuf *b _AND_
-    AsnTag   tag _AND_
+    AsnTag   tag ESNACC_UNUSED _AND_
     AsnLen   len _AND_
     UAsnInt *result _AND_
     AsnLen  *bytesDecoded _AND_
@@ -410,8 +407,6 @@ BDecUAsnIntContent PARAMS ((b, tag, len, result, bytesDecoded, env),
     (*bytesDecoded) += len;
 
     *result = retVal;
-    tag=tag; /* referenced to avoid compiler warning. */
-
 }  /* BDecUAsnIntContent */
 
 
diff --git a/c-lib/src/asn-octs.c b/c-lib/src/asn-octs.c
index 0449819..30a647a 100644
--- a/c-lib/src/asn-octs.c
+++ b/c-lib/src/asn-octs.c
@@ -319,7 +319,7 @@ void
 PrintAsnOcts PARAMS ((f,v, indent),
     FILE *f _AND_
     AsnOcts *v _AND_
-    unsigned int indent)
+    unsigned int indent ESNACC_UNUSED)
 {
     int i;
 
@@ -343,7 +343,6 @@ PrintAsnOcts PARAMS ((f,v, indent),
 	  fprintf (f,".");
     }
     fprintf (f,"\" --");
-    indent=indent; /* referenced to avoid compiler warning. */
 }
 
 
diff --git a/c-lib/src/print.c b/c-lib/src/print.c
index 5f60979..fe14a7e 100644
--- a/c-lib/src/print.c
+++ b/c-lib/src/print.c
@@ -31,12 +31,10 @@ Indent PARAMS ((f, i),
 }
 
 void Asn1DefaultErrorHandler PARAMS ((str, severity),
-    char* str _AND_
-    int severity)
+    char* str ESNACC_UNUSED _AND_
+    int severity ESNACC_UNUSED)
 {
   /*  fprintf(stderr,"%s",str); DAD - temp removing for now*/
-   severity=severity;   /* referenced  */
-   str=str;
 }
 
 static Asn1ErrorHandler asn1CurrentErrorHandler = Asn1DefaultErrorHandler;
-- 
2.7.4




More information about the dev mailing list