Update the #pragma GCC diagnostic usage
authorThiago Macieira <thiago.macieira@intel.com>
Thu, 4 Sep 2014 23:58:47 +0000 (16:58 -0700)
committerErich Keane <erich.keane@intel.com>
Thu, 11 Sep 2014 17:54:06 +0000 (10:54 -0700)
Don't force pedantic back on. Instead, push and pop the current state.

Don't pass these options to Clang and ICC, since they don't have the
-pedantic option anyway.

Change-Id: I302f7fcfe974f23423ca2ac7711a7c4a8ac39d88
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
csdk/libcoap-4.1.1/async.h
csdk/libcoap-4.1.1/pdu.h

index f455d97..cf0554b 100644 (file)
@@ -51,9 +51,14 @@ typedef struct coap_async_state_t {
 
   coap_address_t peer;         /**< the peer to notify */
   size_t tokenlen;             /**< length of the token */
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
+#pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-pedantic"
+#endif
   __extension__ unsigned char token[]; /**< the token to use in a response */
-#pragma GCC diagnostic warning "-pedantic"
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
+#pragma GCC diagnostic pop
+#endif
 } coap_async_state_t;
 
 /* Definitions for Async Status Flags These flags can be used to
index 0a203e6..058dac8 100644 (file)
@@ -161,7 +161,10 @@ const char *coap_response_phrase(unsigned char code);
 typedef int coap_tid_t;
 #define COAP_INVALID_TID -1
 
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
+#pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-pedantic"
+#endif
 #ifdef WORDS_BIGENDIAN
 typedef struct {
   unsigned int version:2;      /* protocol version */
@@ -181,7 +184,9 @@ typedef struct {
   __extension__ unsigned char token[0];        /* the actual token, if any */
 } coap_hdr_t;
 #endif
-#pragma GCC diagnostic warning "-pedantic"
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
+#pragma GCC diagnostic pop
+#endif
 
 #define COAP_MESSAGE_IS_EMPTY(MSG)    ((MSG)->code == 0)
 #define COAP_MESSAGE_IS_REQUEST(MSG)  (!COAP_MESSAGE_IS_EMPTY(MSG)     \