"Stephen J. Turnbull" <stephen(a)xemacs.org> wrote:
>>>>> "Jerry" == Jerry James
<james(a)xemacs.org> writes:
Jerry> I would like to propose that we add
Jerry> -Wdeclaration-after-statement to the default warnings used
Jerry> when compiling with gcc 3.4+.
+1
With the overwhelming support that a whole vote implies, I took a look
at the configure script to see how do to this. We currently have a few
warning flags that are turned on only if using a GCC version >= 3.0 (via
the __GCC3 variable). That's not good enough for this warning flag; I
need to distinguish GCC versions < 3.4 from those >= 3.4.
We could change the __GCC3 variable into a set of variables to record
the values of __GNUC__, __GNUC_MINOR__ and, when it exists,
__GNUC_PATCHLEVEL__, then compare against those values to determine
which warning flags to use. That would be easy to whip up.
Or we could build a framework to test the compiler to see whether it
accepts various flags. That would take more work, but could be used for
more than just warning flags. On the other hand, multiple invocations
of the compiler to test for acceptance of command line flags will slow
down the configuration step. On the gripping hand, it probably won't
slow it down significantly, and who cares how long configuration takes?
Or I could just forget about GCC 3.4, make a __GCC4 variable and test
against that to add -Wdeclaration-after-statement.
I could easily whip up the 1st or 3rd options today. I don't know when
I'll have time to get to the 2nd option. Offers of help are welcome.
Any thoughts?
--
Jerry James, Assistant Professor james(a)xemacs.org
Computer Science Department
http://www.cs.usu.edu/~jerry/
Utah State University