summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2018-05-26 19:43:24 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2018-05-26 19:43:24 +0000
commit18577229613aceaebb4b060aebf7945a0380ef0f (patch)
treedb258ba6c44302ad330afbdf5f7146f258a2cf49
parent76e5e8708cf045b9a79d413f97b3eb93710c5c44 (diff)
parent158590341e2f75aa87562181c9dfa8d5ddeacfb6 (diff)
downloadgnutls-18577229613aceaebb4b060aebf7945a0380ef0f.tar.gz
Merge branch 'fix-warnings' into 'master'
Fix some warnings in test suite See merge request gnutls/gnutls!647
-rw-r--r--tests/alerts.c6
-rw-r--r--tests/gnutls_record_overhead.c5
-rw-r--r--tests/ocsp-common.h9
-rw-r--r--tests/record-retvals.c3
-rw-r--r--tests/send-client-cert.c4
-rw-r--r--tests/test-chains.h10
-rw-r--r--tests/tls-ext-register.c3
-rw-r--r--tests/tls-session-supplemental.c6
-rw-r--r--tests/tls13/ext-parse.h9
-rw-r--r--tests/x509self.c4
10 files changed, 41 insertions, 18 deletions
diff --git a/tests/alerts.c b/tests/alerts.c
index 03f5738bd2..dc17c6b7ab 100644
--- a/tests/alerts.c
+++ b/tests/alerts.c
@@ -68,7 +68,6 @@ static void client_log_func(int level, const char *str)
static void client(int fd, const char *prio, int ign)
{
int ret;
- unsigned i, vers;
char buffer[64];
const char* err;
gnutls_certificate_credentials_t x509_cred;
@@ -157,7 +156,6 @@ static void terminate(void)
static void server(int fd, const char *prio, int ign)
{
int ret;
- unsigned i;
const char* err;
char buffer[64];
gnutls_session_t session;
@@ -225,7 +223,7 @@ static void server(int fd, const char *prio, int ign)
if (ret != GNUTLS_E_WARNING_ALERT_RECEIVED ||
gnutls_alert_get(session) != GNUTLS_A_USER_CANCELED) {
fail("client: Error: %s\n", gnutls_strerror(ret));
- }
+ }
do {
do {
@@ -239,7 +237,7 @@ static void server(int fd, const char *prio, int ign)
if (ret != GNUTLS_E_FATAL_ALERT_RECEIVED ||
gnutls_alert_get(session) != GNUTLS_A_DECRYPT_ERROR) {
fail("client: Error: %s\n", gnutls_strerror(ret));
- }
+ }
close(fd);
gnutls_deinit(session);
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/record-retvals.c b/tests/record-retvals.c
index b3166607f9..84328b9652 100644
--- a/tests/record-retvals.c
+++ b/tests/record-retvals.c
@@ -115,7 +115,7 @@ const gnutls_datum_t server_key = { server_key_pem,
static void client(int fd, const char *prio, int ign)
{
int ret;
- unsigned i, vers;
+ unsigned i;
char buffer[MAX_BUF + 1];
const char* err;
gnutls_anon_client_credentials_t anoncred;
@@ -344,7 +344,6 @@ static void server(int fd, const char *prio, int ign)
i++;
} while (ret > 0);
-next:
if (ret < 0) {
fail("client: Error: %s\n", gnutls_strerror(ret));
exit(1);
diff --git a/tests/send-client-cert.c b/tests/send-client-cert.c
index 90809ba6cc..34f8f0bd93 100644
--- a/tests/send-client-cert.c
+++ b/tests/send-client-cert.c
@@ -117,7 +117,7 @@ static void try(const char *prio, unsigned expect, unsigned ca_type)
if (ret < 0)
exit(1);
- ret = gnutls_certificate_set_x509_key_mem(clientx509cred,
+ ret = gnutls_certificate_set_x509_key_mem(clientx509cred,
&cli_ca3_cert_chain, &cli_ca3_key,
GNUTLS_X509_FMT_PEM);
if (ret < 0)
@@ -173,7 +173,7 @@ static void try(const char *prio, unsigned expect, unsigned ca_type)
gnutls_dh_params_deinit(dh_params);
}
-void start(const char *prio)
+static void start(const char *prio)
{
global_init();
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/tls-ext-register.c b/tests/tls-ext-register.c
index 15113a3e91..1eee470856 100644
--- a/tests/tls-ext-register.c
+++ b/tests/tls-ext-register.c
@@ -70,7 +70,7 @@ static int TLSEXT_TYPE_server_sent = 0;
static int TLSEXT_TYPE_server_received = 0;
static const unsigned char ext_data[] =
-{
+{
0xFE,
0xED
};
@@ -235,7 +235,6 @@ static void server(int sd, const char *prio)
gnutls_certificate_credentials_t serverx509cred;
int ret;
gnutls_session_t session;
- unsigned i;
/* this must be called once in the program
*/
diff --git a/tests/tls-session-supplemental.c b/tests/tls-session-supplemental.c
index b7421c3925..36f99102aa 100644
--- a/tests/tls-session-supplemental.c
+++ b/tests/tls-session-supplemental.c
@@ -67,7 +67,7 @@ static int TLS_SUPPLEMENTALDATA_server_sent = 0;
static int TLS_SUPPLEMENTALDATA_server_received = 0;
static const unsigned char supp_data[] =
-{
+{
0xFE,
0xED
};
@@ -180,10 +180,8 @@ end:
static void server(int sd, const char *prio)
{
- int err, ret;
- char topbuf[512];
+ int ret;
gnutls_session_t session;
- int optval = 1;
gnutls_certificate_credentials_t serverx509cred;
/* this must be called once in the program
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
diff --git a/tests/x509self.c b/tests/x509self.c
index f1c674a8e5..b22dfea2b9 100644
--- a/tests/x509self.c
+++ b/tests/x509self.c
@@ -204,11 +204,9 @@ static void client(int sd, const char *prio)
static void server(int sd, const char *prio)
{
- int err, ret;
- char topbuf[512];
+ int ret;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
- int optval = 1;
gnutls_certificate_credentials_t x509_cred;
global_init();