Patch to warn about non-static declaration follows static one

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Fri Oct 23 08:53:00 GMT 1998


 > From: Mark Mitchell <mark@markmitchell.com>
 > 
 > [...]
 > The warning on:
 > 
 >   void f();
 >   static void f() {}
 > 
 > makes a lot more sense since this isn't legal C/C++, and is therefore
 > much less portable than the code you propose warning about which is
 > documented as working in K&R II, and which even many K&R compilers
 > deal with correctly.
 > 
 > I think the warning is fine, but it should be a -W??? and not part of
 > -Wall or even -W.  It would be fine to enable this warning when
 > compiling GCC, since GCC does need to build with even the most broken
 > K&R compilers, and since many of us don't use those compilers, and so
 > are prone to writing code that you then have to fix for us. :-) You
 > might consider not making a *separate* option for this warning and
 > instead using `-Wkr-portability' (bad name, think of a better one!) to
 > cover this and any other warnings whose primary purpose is to ensure
 > this kind of backward compatibility.
 > -- 
 > Mark Mitchell 			mark@markmitchell.com



	Okay, perhaps this warning should go in -Wtraditional instead of
-W or -Wall. 

I'd like to add this flag to the gcc bootstrap procedure, however I
would prefer not to have it done for the whole bootstrap, just the gcc
top level directory.  The language subdirectories aren't supposed to
be compiled with a K&R compiler, so they don't need to be bothered
with this flag.

	Is there an easy way to set this up?  (If not, I can just add
-Wtraditional to WARN_CFLAGS.)  Or, I'll just hack something up...

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Icon CMT Corp.



More information about the Gcc-patches mailing list