[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/maint-0.3.3] Don't disable an unsupported compiler warning
commit a8bdb851eb23b6067e24ad955bb8f499b8348b95
Author: Taylor Yu <catalyst@xxxxxxxxxxxxxx>
Date: Thu Jul 26 12:32:34 2018 -0500
Don't disable an unsupported compiler warning
Conditionalize the pragma that temporarily disables
-Wunused-const-variable. Some versions of gcc don't support it. We
need to do this because of an apparent bug in some libzstd headers.
Fixes bug 26785; bugfix on 0.3.2.11.
---
changes/bug26785 | 4 ++++
configure.ac | 3 +++
src/common/compress_zstd.c | 4 ++++
3 files changed, 11 insertions(+)
diff --git a/changes/bug26785 b/changes/bug26785
new file mode 100644
index 000000000..e6392fcbd
--- /dev/null
+++ b/changes/bug26785
@@ -0,0 +1,4 @@
+ o Minor bugfixes (compilation, portability):
+ - Don't try to use a pragma to temporarily disable
+ -Wunused-const-variable if the compiler doesn't support it.
+ Fixes bug 26785; bugfix on 0.3.2.11.
diff --git a/configure.ac b/configure.ac
index c883279a6..37a78b779 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2143,6 +2143,9 @@ dnl -Wthread-safety-precise
if test "$tor_cv_cflags__Woverlength_strings" = "yes"; then
AC_DEFINE([HAVE_CFLAG_WOVERLENGTH_STRINGS], 1, [True if we have -Woverlength-strings])
fi
+ if test "$tor_cv_cflags__warn_unused_const_variable_2" = "yes"; then
+ AC_DEFINE([HAVE_CFLAG_WUNUSED_CONST_VARIABLE], 1, [True if we have -Wunused-const-variable])
+ fi
if test "x$enable_fatal_warnings" = "xyes"; then
# I'd like to use TOR_CHECK_CFLAGS here, but I can't, since the
diff --git a/src/common/compress_zstd.c b/src/common/compress_zstd.c
index baa7749f0..1a7d21d48 100644
--- a/src/common/compress_zstd.c
+++ b/src/common/compress_zstd.c
@@ -19,10 +19,14 @@
#include "compress_zstd.h"
#ifdef HAVE_ZSTD
+#ifdef HAVE_CFLAG_WUNUSED_CONST_VARIABLE
DISABLE_GCC_WARNING(unused-const-variable)
+#endif
#include <zstd.h>
+#ifdef HAVE_CFLAG_WUNUSED_CONST_VARIABLE
ENABLE_GCC_WARNING(unused-const-variable)
#endif
+#endif
/** Total number of bytes allocated for Zstandard state. */
static atomic_counter_t total_zstd_allocation;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits