[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4261: make gcc warn about c99 declarations

From: Dan Nicolaescu
Subject: bug#4261: make gcc warn about c99 declarations
Date: Tue, 25 Aug 2009 16:16:39 -0700 (PDT)

There were several patch proposals recently that had c99 style
declarations in the middle of a block.
There's a gcc flag that warns about that.

The configure.in patch below enables the flag if gcc supports it,
following the model for -Wno-pointer-sign

Please apply if appropriate.

Index: configure.in
RCS file: /cvsroot/emacs/emacs/configure.in,v
retrieving revision 1.607
diff -u -3 -p -u -p -r1.607 configure.in
--- configure.in 23 Aug 2009 02:15:00 -0000     1.607
+++ configure.in 25 Aug 2009 23:11:58 -0000
@@ -757,6 +757,19 @@ CFLAGS="$SAVE_CFLAGS"
 unset has_option
+### Use -Wdeclaration-after-statement if the compiler supports it
+AC_MSG_CHECKING([whether gcc understands -Wdeclaration-after-statement])
+CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
+if test $has_option = yes; then
+   C_WARNINGS_SWITCH="-Wdeclaration-after-statement $C_WARNINGS_SWITCH"
+unset has_option
 #### Some other nice autoconf tests.
 dnl checks for programs

reply via email to

[Prev in Thread] Current Thread [Next in Thread]