Browse Source

Use ENABLE/DISABLE_GCC_WARNING in masater.

Nick Mathewson 7 years ago
parent
commit
227d3b3d6b
3 changed files with 7 additions and 52 deletions
  1. 2 19
      src/common/aes.c
  2. 3 12
      src/common/crypto.c
  3. 2 21
      src/test/test_microdesc.c

+ 2 - 19
src/common/aes.c

@@ -23,18 +23,7 @@
 #error "We require OpenSSL >= 1.0.0"
 #endif
 
-#ifdef __GNUC__
-#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
-#endif
-
-#if __GNUC__ && GCC_VERSION >= 402
-#if GCC_VERSION >= 406
-#pragma GCC diagnostic push
-#endif
-/* Some versions of OpenSSL declare SSL_get_selected_srtp_profile twice in
- * srtp.h. Suppress the GCC warning so we can build with -Wredundant-decl. */
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#endif
+DISABLE_GCC_WARNING(redundant-decls)
 
 #include <assert.h>
 #include <stdlib.h>
@@ -44,13 +33,7 @@
 #include <openssl/engine.h>
 #include <openssl/modes.h>
 
-#if __GNUC__ && GCC_VERSION >= 402
-#if GCC_VERSION >= 406
-#pragma GCC diagnostic pop
-#else
-#pragma GCC diagnostic warning "-Wredundant-decls"
-#endif
-#endif
+ENABLE_GCC_WARNING(redundant-decls)
 
 #include "compat.h"
 #include "aes.h"

+ 3 - 12
src/common/crypto.c

@@ -29,18 +29,7 @@
 #include "crypto_ed25519.h"
 #include "crypto_format.h"
 
-#ifdef __GNUC__
-#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
-#endif
-
-#if __GNUC__ && GCC_VERSION >= 402
-#if GCC_VERSION >= 406
-#pragma GCC diagnostic push
-#endif
-/* Some versions of OpenSSL declare X509_STORE_CTX_set_verify_cb twice.
- * Suppress the GCC warning so we can build with -Wredundant-decl. */
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#endif
+DISABLE_GCC_WARNING(redundant-decls)
 
 #include <openssl/err.h>
 #include <openssl/rsa.h>
@@ -53,6 +42,8 @@
 #include <openssl/conf.h>
 #include <openssl/hmac.h>
 
+ENABLE_GCC_WARNING(redundant-decls)
+
 #if __GNUC__ && GCC_VERSION >= 402
 #if GCC_VERSION >= 406
 #pragma GCC diagnostic pop

+ 2 - 21
src/test/test_microdesc.c

@@ -14,30 +14,11 @@
 
 #include "test.h"
 
-#ifdef __GNUC__
-#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
-#endif
-
-#if __GNUC__ && GCC_VERSION >= 402
-#if GCC_VERSION >= 406
-#pragma GCC diagnostic push
-#endif
-/* Some versions of OpenSSL declare X509_STORE_CTX_set_verify_cb twice.
- * Suppress the GCC warning so we can build with -Wredundant-decl. */
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#endif
-
+DISABLE_GCC_WARNING(redundant-decls)
 #include <openssl/rsa.h>
 #include <openssl/bn.h>
 #include <openssl/pem.h>
-
-#if __GNUC__ && GCC_VERSION >= 402
-#if GCC_VERSION >= 406
-#pragma GCC diagnostic pop
-#else
-#pragma GCC diagnostic warning "-Wredundant-decls"
-#endif
-#endif
+ENABLE_GCC_WARNING(redundant-decls)
 
 #ifdef _WIN32
 /* For mkdir() */