summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Murdoch <Steven.Murdoch@cl.cam.ac.uk>2011-03-09 19:05:51 +0000
committerSebastian Hahn <sebastian@torproject.org>2011-03-10 01:54:43 +0100
commit56bdc844ba68ac0911efc7ad3398f1eafeaaac76 (patch)
treea1bd1ca46d6bb419c083c0f752083a579c4e68f1
parent473ff2656355a796761e9eb5e15b30cd853c58b6 (diff)
downloadtor-56bdc844ba68ac0911efc7ad3398f1eafeaaac76.tar.gz
tor-56bdc844ba68ac0911efc7ad3398f1eafeaaac76.zip
Fix compilation under LLVM/clang with --enable-gcc-warnings
- When compiling using clang (2.9 or lower) do not enable -Wnormalized=id or -Woverride-init when --enable-gcc-warnings or --enable-gcc-warnings-advisory is set as these options are unsupported.
-rw-r--r--configure.in17
1 files changed, 15 insertions, 2 deletions
diff --git a/configure.in b/configure.in
index f30402d5b5..9999f6034b 100644
--- a/configure.in
+++ b/configure.in
@@ -894,6 +894,11 @@ if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xy
#error
#endif])], have_gcc43=yes, have_gcc43=no)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
+#if !defined(__clang__) || (__clang_major__ > 2) || (__clang_major__ == 2 && __clang_minor__ > 9)
+#error
+#endif])], have_clang29orlower=yes, have_clang29orlower=no)
+
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wshorten-64-to-32"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], have_shorten64_flag=yes,
@@ -924,11 +929,19 @@ if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xy
if test x$have_gcc42 = xyes ; then
# These warnings break gcc 4.0.2 and work on gcc 4.2
# XXXX020 See if any of these work with earlier versions.
- CFLAGS="$CFLAGS -Waddress -Wmissing-noreturn -Wnormalized=id -Woverride-init -Wstrict-overflow=1"
+ CFLAGS="$CFLAGS -Waddress -Wmissing-noreturn -Wstrict-overflow=1"
+
# We used to use -Wstrict-overflow=5, but that breaks us heavily under 4.3.
fi
- if test x$have_gcc43 = xyes ; then
+ if test x$have_gcc42 = xyes && test x$have_clang29orlower = xno; then
+ # These warnings break gcc 4.0.2 and clang, but work on gcc 4.2
+ # We only disable these for clang 2.9 and lower, in case they are
+ # supported in later versions.
+ CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init"
+ fi
+
+ if test x$have_gcc43 = xyes ; then
# These warnings break gcc 4.2 and work on gcc 4.3
# XXXX020 See if any of these work with earlier versions.
CFLAGS="$CFLAGS -Wextra -Warray-bounds"