GNU bug report logs - #4434
add -Wdeclaration-after-statement to CFLAGS if supported

Previous Next

Package: emacs;

Reported by: Dan Nicolaescu <dann <at> ics.uci.edu>

Date: Mon, 14 Sep 2009 19:25:07 UTC

Severity: normal

Tags: patch

Merged with 4261

Done: Dan Nicolaescu <dann <at> ics.uci.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4434 in the body.
You can then email your comments to 4434 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4434; Package emacs. (Mon, 14 Sep 2009 19:25:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dan Nicolaescu <dann <at> ics.uci.edu>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 14 Sep 2009 19:25:08 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: add -Wdeclaration-after-statement to CFLAGS if supported
Date: Mon, 14 Sep 2009 12:16:16 -0700 (PDT)
Recently we've had a few instances of declarations being added in the
middle of a block.

gcc has a flag to warn about this.

Here's a patch to add this flag to CFLAGS (it mirrors what we already do
for  -Wno-pointer-sign).

OK to check in?



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 14 Sep 2009 18:46:36 -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




Merged 4261 4434. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> emacsbugs.donarmstrong.com. (Thu, 22 Oct 2009 09:40:07 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> emacsbugs.donarmstrong.com. (Thu, 22 Oct 2009 09:40:09 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4434; Package emacs. (Thu, 19 Nov 2009 17:05:05 GMT) Full text and rfc822 format available.

Message #12 received at 4434 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 4434 <at> debbugs.gnu.org
Subject: Re: bug#4434: add -Wdeclaration-after-statement to CFLAGS if supported
Date: Thu, 19 Nov 2009 08:55:34 -0800 (PST)
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

  > Recently we've had a few instances of declarations being added in the
  > middle of a block.
  > 
  > gcc has a flag to warn about this.
  > 
  > Here's a patch to add this flag to CFLAGS (it mirrors what we already do
  > for  -Wno-pointer-sign).
  > 
  > OK to check in?

Stefan, any reason not to check this in?

I just run into compilation errors when compiling the current CVS on an
old machine that uses gcc-2.96, 3-4 files need fixing.


  > 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 14 Sep 2009 18:46:36 -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



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4434; Package emacs. (Thu, 19 Nov 2009 21:15:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 19 Nov 2009 21:15:04 GMT) Full text and rfc822 format available.

Message #17 received at 4434 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 4434 <at> debbugs.gnu.org
Subject: Re: bug#4434: add -Wdeclaration-after-statement to CFLAGS if supported
Date: Thu, 19 Nov 2009 16:09:03 -0500
> Stefan, any reason not to check this in?

Try it,


        Stefan



Reply sent to Dan Nicolaescu <dann <at> ics.uci.edu>:
You have taken responsibility. (Fri, 20 Nov 2009 16:35:08 GMT) Full text and rfc822 format available.

Notification sent to Dan Nicolaescu <dann <at> ics.uci.edu>:
bug acknowledged by developer. (Fri, 20 Nov 2009 16:35:09 GMT) Full text and rfc822 format available.

Message #22 received at 4434-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 4434-done <at> debbugs.gnu.org
Subject: Re: bug#4434: add -Wdeclaration-after-statement to CFLAGS if supported
Date: Fri, 20 Nov 2009 08:30:51 -0800 (PST)
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

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

Done. Thanks.



Reply sent to Dan Nicolaescu <dann <at> ics.uci.edu>:
You have taken responsibility. (Fri, 20 Nov 2009 16:35:09 GMT) Full text and rfc822 format available.

Notification sent to Dan Nicolaescu <dann <at> ics.uci.edu>:
bug acknowledged by developer. (Fri, 20 Nov 2009 16:35:09 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 19 Dec 2009 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 264 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.