svn rev #25054: trunk/src/lib/krb5/asn.1/

epeisach@MIT.EDU epeisach at MIT.EDU
Tue Jul 26 06:46:50 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=25054
Commit By: epeisach
Log Message:
For GCC compiles, use an attribute to suppress the variable set but
not used warnings.  Due to the nested macros, it would get very ugly
to try and remove the variables.

Removes ~75 warnings from the build.




Changed Files:
U   trunk/src/lib/krb5/asn.1/asn1_k_decode_macros.h
U   trunk/src/lib/krb5/asn.1/krb5_decode.c
U   trunk/src/lib/krb5/asn.1/krb5_decode_kdc.c
U   trunk/src/lib/krb5/asn.1/krb5_decode_macros.h
Modified: trunk/src/lib/krb5/asn.1/asn1_k_decode_macros.h
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_k_decode_macros.h	2011-07-26 00:05:06 UTC (rev 25053)
+++ trunk/src/lib/krb5/asn.1/asn1_k_decode_macros.h	2011-07-26 10:46:50 UTC (rev 25054)
@@ -32,15 +32,21 @@
 #include "asn1_get.h"
 #include "asn1_misc.h"
 
+#if __GNUC__ >= 3
+#define KRB5_ATTR_UNUSED __attribute__((unused))
+#else
+#define KRB5_ATTR_UNUSED
+#endif
+
 #define clean_return(val) { retval = val; goto error_out; }
 
 /* Declare useful decoder variables. */
-#define setup()                                 \
-    asn1_error_code retval;                     \
-    asn1_class asn1class;                       \
-    asn1_construction construction;             \
-    asn1_tagnum tagnum;                         \
-    unsigned int length, taglen
+#define setup()                                                  \
+    asn1_error_code retval;                                      \
+    asn1_class asn1class;                                        \
+    asn1_construction construction KRB5_ATTR_UNUSED;             \
+    asn1_tagnum tagnum;                                          \
+    unsigned int length, taglen KRB5_ATTR_UNUSED
 
 #define unused_var(x) if (0) { x = 0; x = x - x; }
 
@@ -262,7 +268,7 @@
 #define begin_choice()                                          \
     asn1buf subbuf;                                             \
     int seqindef;                                               \
-    int indef;                                                  \
+    int indef KRB5_ATTR_UNUSED;                                 \
     taginfo t;                                                  \
     retval = asn1_get_tag_2(buf, &t);                           \
     if (retval) clean_return(retval);                           \
@@ -290,12 +296,12 @@
  * meant to be called in an inner block that ends with a call to
  * end_sequence_of().
  */
-#define sequence_of(buf)                        \
-    unsigned int length, taglen;                \
-    asn1_class asn1class;                       \
-    asn1_construction construction;             \
-    asn1_tagnum tagnum;                         \
-    int indef;                                  \
+#define sequence_of(buf)                                \
+    unsigned int length, taglen KRB5_ATTR_UNUSED ;      \
+    asn1_class asn1class;                               \
+    asn1_construction construction KRB5_ATTR_UNUSED ;   \
+    asn1_tagnum tagnum;                                 \
+    int indef;                                          \
     sequence_of_common(buf)
 
 /*

Modified: trunk/src/lib/krb5/asn.1/krb5_decode.c
===================================================================
--- trunk/src/lib/krb5/asn.1/krb5_decode.c	2011-07-26 00:05:06 UTC (rev 25053)
+++ trunk/src/lib/krb5/asn.1/krb5_decode.c	2011-07-26 10:46:50 UTC (rev 25054)
@@ -864,8 +864,8 @@
     setup(krb5_enc_data *);
     alloc_field(rep);
     {
-        int indef;
-        unsigned int taglen;
+        int indef KRB5_ATTR_UNUSED;
+        unsigned int taglen KRB5_ATTR_UNUSED;
         next_tag_from_buf(buf);
         if (tagnum != 0)
             clean_return(ASN1_BAD_ID);

Modified: trunk/src/lib/krb5/asn.1/krb5_decode_kdc.c
===================================================================
--- trunk/src/lib/krb5/asn.1/krb5_decode_kdc.c	2011-07-26 00:05:06 UTC (rev 25053)
+++ trunk/src/lib/krb5/asn.1/krb5_decode_kdc.c	2011-07-26 10:46:50 UTC (rev 25054)
@@ -126,8 +126,8 @@
     alloc_field(rep);
     clear_field(rep, armor);
     {
-        int indef;
-        unsigned int taglen;
+        int indef KRB5_ATTR_UNUSED;
+        unsigned int taglen KRB5_ATTR_UNUSED;
         next_tag_from_buf(buf);
         if (tagnum != 0)
             clean_return(ASN1_BAD_ID);

Modified: trunk/src/lib/krb5/asn.1/krb5_decode_macros.h
===================================================================
--- trunk/src/lib/krb5/asn.1/krb5_decode_macros.h	2011-07-26 00:05:06 UTC (rev 25053)
+++ trunk/src/lib/krb5/asn.1/krb5_decode_macros.h	2011-07-26 10:46:50 UTC (rev 25054)
@@ -32,6 +32,12 @@
 #include "asn1_get.h"
 #include "asn1_misc.h"
 
+#if __GNUC__ >= 3
+#define KRB5_ATTR_UNUSED __attribute__((unused))
+#else
+#define KRB5_ATTR_UNUSED
+#endif
+
 /* setup *********************************************************/
 /* set up variables */
 /*
@@ -47,13 +53,13 @@
     retval = asn1buf_wrap_data(&buf,code);      \
     if (retval) return retval
 
-#define setup_no_tagnum(type)                   \
-    asn1_class asn1class;                       \
-    asn1_construction construction;             \
+#define setup_no_tagnum(type)                                    \
+    asn1_class asn1class KRB5_ATTR_UNUSED;                       \
+    asn1_construction construction KRB5_ATTR_UNUSED;             \
     setup_buf_only(type)
 
 #define setup_no_length(type)                   \
-    asn1_tagnum tagnum;                         \
+    asn1_tagnum tagnum KRB5_ATTR_UNUSED;        \
     setup_no_tagnum(type)
 
 #define setup(type)                             \
@@ -132,7 +138,7 @@
 
 /* decode sequence header and initialize tagnum with the first field */
 #define begin_structure()                                       \
-    unsigned int taglen;                                        \
+    unsigned int taglen KRB5_ATTR_UNUSED;                       \
     asn1buf subbuf;                                             \
     int seqindef;                                               \
     int indef;                                                  \




More information about the cvs-krb5 mailing list