diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-06-01 13:38:36 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-06-11 10:11:53 -0400 |
commit | 9bbd6502f09dd46179e7ca4a713f2ae24bfa79ef (patch) | |
tree | 5fe20b810648c465df4779132beebc0fc61412b8 /src | |
parent | ad16c5528663489000ee3a7454a9bbff2e41f7f0 (diff) | |
download | tor-9bbd6502f09dd46179e7ca4a713f2ae24bfa79ef.tar.gz tor-9bbd6502f09dd46179e7ca4a713f2ae24bfa79ef.zip |
Use autoconf, not gcc version, to decide which warnings we have
This gives more accurate results under Clang, which can only help us
detect more warnings in more places.
Fixes bug 19216; bugfix on 0.2.0.1-alpha
Diffstat (limited to 'src')
-rw-r--r-- | src/common/torlog.h | 2 | ||||
-rw-r--r-- | src/common/tortls.c | 4 | ||||
-rw-r--r-- | src/ext/ed25519/donna/ed25519-donna-64bit-x86.h | 9 | ||||
-rw-r--r-- | src/or/config.c | 2 | ||||
-rw-r--r-- | src/test/test_bt_cl.c | 4 | ||||
-rw-r--r-- | src/test/test_dir_handle_get.c | 4 | ||||
-rw-r--r-- | src/test/test_helpers.c | 4 | ||||
-rw-r--r-- | src/test/test_microdesc.c | 4 |
8 files changed, 19 insertions, 14 deletions
diff --git a/src/common/torlog.h b/src/common/torlog.h index 578af7caea..80f37e0e48 100644 --- a/src/common/torlog.h +++ b/src/common/torlog.h @@ -176,7 +176,7 @@ void log_fn_ratelim_(struct ratelim_t *ratelim, int severity, const char *format, ...) CHECK_PRINTF(5,6); -#if defined(__GNUC__) +#if defined(__GNUC__) && __GNUC__ <= 3 /* These are the GCC varidaic macros, so that older versions of GCC don't * break. */ diff --git a/src/common/tortls.c b/src/common/tortls.c index fc684189b1..252da6295e 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -26,11 +26,9 @@ #include "compat.h" -#if GCC_VERSION >= 402 /* 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. */ DISABLE_GCC_WARNING(redundant-decls) -#endif #include <openssl/opensslv.h> #include "crypto.h" @@ -48,9 +46,7 @@ DISABLE_GCC_WARNING(redundant-decls) #include <openssl/bn.h> #include <openssl/rsa.h> -#if GCC_VERSION >= 402 ENABLE_GCC_WARNING(redundant-decls) -#endif #ifdef USE_BUFFEREVENTS #include <event2/bufferevent_ssl.h> diff --git a/src/ext/ed25519/donna/ed25519-donna-64bit-x86.h b/src/ext/ed25519/donna/ed25519-donna-64bit-x86.h index 30bd472762..f6b5570298 100644 --- a/src/ext/ed25519/donna/ed25519-donna-64bit-x86.h +++ b/src/ext/ed25519/donna/ed25519-donna-64bit-x86.h @@ -2,6 +2,11 @@ #define HAVE_GE25519_SCALARMULT_BASE_CHOOSE_NIELS +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Woverlength-strings" +#endif + DONNA_NOINLINE static void ge25519_scalarmult_base_choose_niels(ge25519_niels *t, const uint8_t table[256][96], uint32_t pos, signed char b) { int64_t breg = (int64_t)b; @@ -347,5 +352,9 @@ ge25519_scalarmult_base_choose_niels(ge25519_niels *t, const uint8_t table[256][ ); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #endif /* defined(ED25519_GCC_64BIT_X86_CHOOSE) */ diff --git a/src/or/config.c b/src/or/config.c index 13b2269676..ca1e17c4af 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -2683,7 +2683,7 @@ options_validate_cb(void *old_options, void *options, void *default_options, #define REJECT(arg) \ STMT_BEGIN *msg = tor_strdup(arg); return -1; STMT_END -#ifdef __GNUC__ +#if defined(__GNUC__) && __GNUC__ <= 3 #define COMPLAIN(args...) \ STMT_BEGIN log_warn(LD_CONFIG, args); STMT_END #else diff --git a/src/test/test_bt_cl.c b/src/test/test_bt_cl.c index ec03cedd0a..95b4f48f11 100644 --- a/src/test/test_bt_cl.c +++ b/src/test/test_bt_cl.c @@ -28,7 +28,7 @@ int a_tangled_web(int x) NOINLINE; int we_weave(int x) NOINLINE; static void abort_handler(int s) NORETURN; -#if GCC_VERSION >= 601 +#ifdef HAVE_CFLAG_WNULL_DEREFERENCE DISABLE_GCC_WARNING(null-dereference) #endif int @@ -50,7 +50,7 @@ crash(int x) crashtype *= x; return crashtype; } -#if GCC_VERSION >= 601 +#ifdef HAVE_CFLAG_WNULL_DEREFERENCE ENABLE_GCC_WARNING(null-dereference) #endif diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c index 2df705f197..44edaf850b 100644 --- a/src/test/test_dir_handle_get.c +++ b/src/test/test_dir_handle_get.c @@ -38,13 +38,13 @@ #include <dirent.h> #endif -#if GCC_VERSION >= 406 +#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS DISABLE_GCC_WARNING(overlength-strings) /* We allow huge string constants in the unit tests, but not in the code * at large. */ #endif #include "vote_descriptors.inc" -#if GCC_VERSION >= 406 +#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS ENABLE_GCC_WARNING(overlength-strings) #endif diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c index bf0365a0d2..ae9fc7a243 100644 --- a/src/test/test_helpers.c +++ b/src/test/test_helpers.c @@ -16,13 +16,13 @@ #include "test.h" #include "test_helpers.h" -#if GCC_VERSION >= 406 +#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS DISABLE_GCC_WARNING(overlength-strings) /* We allow huge string constants in the unit tests, but not in the code * at large. */ #endif #include "test_descriptors.inc" -#if GCC_VERSION >= 406 +#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS ENABLE_GCC_WARNING(overlength-strings) #endif diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c index 28c4f0706c..91884e692e 100644 --- a/src/test/test_microdesc.c +++ b/src/test/test_microdesc.c @@ -490,7 +490,7 @@ test_md_generate(void *arg) routerinfo_free(ri); } -#if GCC_VERSION >= 406 +#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS DISABLE_GCC_WARNING(overlength-strings) /* We allow huge string constants in the unit tests, but not in the code * at large. */ @@ -650,7 +650,7 @@ static const char MD_PARSE_TEST_DATA[] = "id rsa1024 2A8wYpHxnkKJ92orocvIQBzeHlE\n" "p6 allow 80\n" ; -#if GCC_VERSION >= 406 +#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS ENABLE_GCC_WARNING(overlength-strings) #endif |