For GCC compiles, use an attribute to suppress the variable set but
authorEzra Peisach <epeisach@mit.edu>
Tue, 26 Jul 2011 10:46:50 +0000 (10:46 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 26 Jul 2011 10:46:50 +0000 (10:46 +0000)
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.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25054 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/asn.1/asn1_k_decode_macros.h
src/lib/krb5/asn.1/krb5_decode.c
src/lib/krb5/asn.1/krb5_decode_kdc.c
src/lib/krb5/asn.1/krb5_decode_macros.h

index e3e7fc08bb6fb590645e521cb5652b2f7695c7a8..de433c2da06b968b3fb16059c3a733c9e57b102f 100644 (file)
 #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 @@ asn1_get_eoc_tag (asn1buf *buf)
 #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 @@ asn1_get_eoc_tag (asn1buf *buf)
  * 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)
 
 /*
index 6cee3d681dab2be6300ba939fe381accd1d7c388..10ebcac1cd1842c7415fc218aad5b854da3bafd0 100644 (file)
@@ -864,8 +864,8 @@ decode_krb5_pa_fx_fast_reply(const krb5_data *code, krb5_enc_data **repptr)
     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);
index 21a3ec232ff8df4de1aa18004e545938def09733..36380c2fbd56012ecbef6fcc4902a808d5e709e3 100644 (file)
@@ -126,8 +126,8 @@ decode_krb5_pa_fx_fast_request(const krb5_data *code, krb5_fast_armored_req **re
     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);
index fc86705001a760a44928e690b4379d26883c0db4..16ae6fe2fe5c7faaf5b853f233e14d1ef915e0ab 100644 (file)
 #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 */
 /*
     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 @@ asn1_get_eoc_tag (asn1buf *buf)
 
 /* 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;                                                  \