]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Only add -Wdeclaration-after-statement if the compiler supports it.
authorTom Hughes <tom@compton.nu>
Wed, 12 Oct 2005 11:27:33 +0000 (11:27 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 12 Oct 2005 11:27:33 +0000 (11:27 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4909

Makefile.core.am
Makefile.tool-flags.am
configure.in

index 257b3b0706946d95b5ed7742a720bd553abf2850..1859e0c59c0b8ff585804faac4a396bae86df745 100644 (file)
@@ -9,7 +9,7 @@ add_includes = -I$(top_srcdir)/coregrind \
                -DVGO_$(VG_OS)=1 \
                -DVGP_$(VG_ARCH)_$(VG_OS)=1
 
-BASE_AM_CFLAGS = @ARCH_CORE_AM_CFLAGS@ -Wmissing-prototypes -Wdeclaration-after-statement -Winline -Wall -Wshadow -O -g
+BASE_AM_CFLAGS = @ARCH_CORE_AM_CFLAGS@ -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
 
 PIC_AM_CFLAGS = $(BASE_AM_CFLAGS) -fpic -fno-omit-frame-pointer
 
index c56892f1186354a047aa31bb747ff61206fdf494..7e1517e2c47f232181aa8fd583b5a8bc7e894640 100644 (file)
@@ -5,6 +5,6 @@ add_includes = -I$(top_srcdir)/include \
                -DVGP_$(VG_ARCH)_$(VG_OS)=1
 
 AM_CPPFLAGS = $(add_includes)
-AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Wdeclaration-after-statement -Winline -Wall -Wshadow -O -g @ARCH_TOOL_AM_CFLAGS@
+AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g @ARCH_TOOL_AM_CFLAGS@
 AM_CCASFLAGS = $(add_includes)
 
index d7da4451dc272f3747e5fe80afc08103950e3332..5faac3402ce280bfdde715dad051eed3e44cb07f 100644 (file)
@@ -418,6 +418,29 @@ if test x$no_pointer_sign = xyes; then
 fi
 
 
+# does this compiler support -Wdeclaration-after-statement ?
+AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ])
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="-Wdeclaration-after-statement"
+
+AC_TRY_COMPILE(, [
+int main () { return 0 ; }
+],
+[
+no_pointer_sign=yes
+AC_MSG_RESULT([yes])
+], [
+no_pointer_sign=no
+AC_MSG_RESULT([no])
+])
+CFLAGS=$safe_CFLAGS
+
+if test x$no_pointer_sign = xyes; then
+  CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+fi
+
+
 # Check for TLS support in the compiler and linker
 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
               [AC_ARG_ENABLE(tls, [  --enable-tls            platform supports TLS],