[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Avoid warnings in tortls.h includes



commit 0ead9a58b989887235a62511b0c664307d1226b6
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Oct 2 15:57:33 2015 +0200

    Avoid warnings in tortls.h includes
---
 src/common/tortls.h    |    3 ---
 src/test/test_tortls.c |   34 ++++++++++++++++++++++++++++------
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/src/common/tortls.h b/src/common/tortls.h
index 6db0e8b..2f467a2 100644
--- a/src/common/tortls.h
+++ b/src/common/tortls.h
@@ -11,9 +11,6 @@
  * \brief Headers for tortls.c
  **/
 
-#include <openssl/ssl.h>
-#include <openssl/ssl3.h>
-
 #include "crypto.h"
 #include "compat.h"
 #include "testsupport.h"
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index de900be..67b645c 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -5,19 +5,41 @@
 #define LOG_PRIVATE
 #include "orconfig.h"
 
-#include "or.h"
-#include "torlog.h"
-#include "config.h"
-#include "tortls.h"
+#ifdef __GNUC__
+#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
+#endif
 
-#include "test.h"
-#include "log_test_helpers.h"
+#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
+
+#include <openssl/opensslv.h>
 
 #include <openssl/ssl.h>
 #include <openssl/ssl3.h>
 #include <openssl/err.h>
 #include <openssl/asn1t.h>
 
+#if __GNUC__ && GCC_VERSION >= 402
+#if GCC_VERSION >= 406
+#pragma GCC diagnostic pop
+#else
+#pragma GCC diagnostic warning "-Wredundant-decls"
+#endif
+#endif
+
+#include "or.h"
+#include "torlog.h"
+#include "config.h"
+#include "tortls.h"
+
+#include "test.h"
+#include "log_test_helpers.h"
 #define NS_MODULE tortls
 
 extern tor_tls_context_t *server_tls_context;

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits