changeset 4826:53ff1a59cdd5 HEAD

Enable -Wstrict-aliasing=2 with gcc 4.
author Timo Sirainen <tss@iki.fi>
date Sat, 18 Nov 2006 16:12:34 +0200
parents 66287003e3cc
children 966f7b3fb03c
files configure.in
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Sat Nov 18 16:11:40 2006 +0200
+++ b/configure.in	Sat Nov 18 16:12:34 2006 +0200
@@ -352,12 +352,20 @@
 
 dnl * gcc specific options
 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
-	# -Wcast-qual -Wcast-align -Wconversion # too many warnings
+	# -Wcast-qual -Wcast-align -Wconversion -Wunreachable-code # too many warnings
 	# -Wstrict-prototypes -Wredundant-decls # may give warnings in some systems
 	# -Wmissing-format-attribute -Wmissing-noreturn -Wwrite-strings # a couple of warnings
-	# -Wstrict-aliasing=2 # requires new gcc
 	CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast"
 
+	AC_TRY_COMPILE([
+	#if __GNUC__ < 4
+	#  error old gcc
+	#endif
+	],,[
+	  # gcc4
+	  CFLAGS="$CFLAGS -Wstrict-aliasing=2"
+	])
+
 	# Use std=gnu99 if we have new enough gcc
 	old_cflags=$CFLAGS
 	CFLAGS="-std=gnu99"