Subject: bug#4261 closed by Dan Nicolaescu <[email-masked]> (Re: bug#4434: add -Wdeclaration-after-statement to CFLAGS if supported)

From: [email-masked] (Emacs bug Tracking System)
Date: Fri, 20 Nov 2009 16:35:09 +0000

This is an automatic notification regarding your bug report
which was filed against the emacs package:

#4434: make gcc warn about c99 declarations

It has been closed by Dan Nicolaescu <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Dan Nicolaescu <[email-masked]> by
replying to this email.

-- 
4434: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4434
Emacs Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#4434: add -Wdeclaration-after-statement to CFLAGS if supported
From: Dan Nicolaescu <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked]
Date: Fri, 20 Nov 2009 08:30:51 -0800 (PST)

Stefan Monnier <[email-masked]> writes:

  > > Stefan, any reason not to check this in?
  > 
  > Try it,

Done. Thanks.

Subject: make gcc warn about c99 declarations
From: Dan Nicolaescu <[email-masked]>
To: bug-gnu-emacs <[email-masked]>
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
 unset SAVE_CFLAGS
 
+### Use -Wdeclaration-after-statement if the compiler supports it
+AC_MSG_CHECKING([whether gcc understands -Wdeclaration-after-statement])
+SAVE_CFLAGS="$CFLAGS"
+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"
+fi
+AC_MSG_RESULT($has_option)
+CFLAGS="$SAVE_CFLAGS"
+unset has_option
+unset SAVE_CFLAGS
+
 #### Some other nice autoconf tests.
 
 dnl checks for programs