summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2018-05-24 12:45:32 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2018-05-26 18:35:37 +0000
commit158590341e2f75aa87562181c9dfa8d5ddeacfb6 (patch)
treedb258ba6c44302ad330afbdf5f7146f258a2cf49
parent0f5d76ad336e3044c850b625df3af987625844ae (diff)
downloadgnutls-158590341e2f75aa87562181c9dfa8d5ddeacfb6.tar.gz
Fix more warnings in tests/
To not introduce larger code changes, these bugs are mostly fixed by #pragma understood by gcc and clang. A check for the minimal gcc/clang version prevents warnings about unknown pragmas with other or older compilers. Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
-rw-r--r--tests/gnutls_record_overhead.c5
-rw-r--r--tests/ocsp-common.h9
-rw-r--r--tests/test-chains.h10
-rw-r--r--tests/tls13/ext-parse.h9
4 files changed, 32 insertions, 1 deletions
diff --git a/tests/gnutls_record_overhead.c b/tests/gnutls_record_overhead.c
index f07f0b232b..541d7c5e82 100644
--- a/tests/gnutls_record_overhead.c
+++ b/tests/gnutls_record_overhead.c
@@ -48,8 +48,11 @@
#define gnutls_assert()
#define gnutls_assert_val(val) val
+/* #pragma doesn't work to suppress preprocessor warnings like -Wunused-macros.
+ * So we just use the above defined macros here. */
+#if defined _gnutls_debug_log && defined gnutls_assert && defined gnutls_assert_val
#include "../lib/algorithms.h"
-
+#endif
unsigned _gnutls_record_overhead(const version_entry_st *ver,
const cipher_entry_st *cipher,
diff --git a/tests/ocsp-common.h b/tests/ocsp-common.h
index 81b3e43b16..e17eea1e68 100644
--- a/tests/ocsp-common.h
+++ b/tests/ocsp-common.h
@@ -23,6 +23,11 @@
#ifndef OCSP_COMMON_H
#define OCSP_COMMON_H
+#if defined __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
/* Date for responses to be valid */
#define OCSP_RESP_DATE 1508329639
@@ -575,4 +580,8 @@ static gnutls_datum_t ocsp_subca3_unknown_pem = {
(void *)_ocsp_subca3_unknown_pem, sizeof(_ocsp_subca3_unknown_pem)-1
};
+#if defined __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+# pragma GCC diagnostic pop
+#endif
+
#endif
diff --git a/tests/test-chains.h b/tests/test-chains.h
index d00f8b3b65..934d743c0d 100644
--- a/tests/test-chains.h
+++ b/tests/test-chains.h
@@ -3773,6 +3773,11 @@ static const char *tls_feat_superset[] = {
NULL
};
+#if defined __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
static struct
{
const char *name;
@@ -3925,4 +3930,9 @@ static struct
{ "rsa pss: chain with changing hashes - ok", rsa_pss_chain_sha512_sha384_sha256_ok, &rsa_pss_chain_sha512_sha384_sha256_ok[3], 0, 0, 0, 1501159136},
{ NULL, NULL, NULL, 0, 0}
};
+
+#if defined __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+# pragma GCC diagnostic pop
+#endif
+
/* *INDENT-ON* */
diff --git a/tests/tls13/ext-parse.h b/tests/tls13/ext-parse.h
index ff8a200768..ae9c1c8afb 100644
--- a/tests/tls13/ext-parse.h
+++ b/tests/tls13/ext-parse.h
@@ -44,6 +44,11 @@ typedef void (*ext_parse_func)(void *priv, gnutls_datum_t *extdata);
#define HANDSHAKE_SESSION_ID_POS 34
+#if defined __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wunused-function"
+#endif
+
/* Returns 0 if the extension was not found, 1 otherwise.
*/
static unsigned find_client_extension(const gnutls_datum_t *msg, unsigned extnr, void *priv, ext_parse_func cb)
@@ -164,3 +169,7 @@ static unsigned find_server_extension(const gnutls_datum_t *msg, unsigned extnr,
return 0;
}
+
+#if defined __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+# pragma GCC diagnostic pop
+#endif