Patch to warn about non-static declaration follows static one

Kaveh R. Ghazi
Thu Oct 22 19:02:00 GMT 1998

 > From: Mark Mitchell <>
 > >>>>> "Kaveh" == Kaveh R Ghazi <> writes:
 >     Kaveh> 	Although it is perhaps legal, a non-static decl
 >     Kaveh> following a static one isn't portable.  So I thought I'd
 >     Kaveh> make gcc warn about it like it already does for the
 >     Kaveh> opposite type of mismatch.
 > This should only be done at some extreme level of warning paranoia.
 > It's perfectly legal to omit the `static' despite the protestations of
 > some antiquated K&R compilers, and this warning will result in a *lot*
 > of noise on perfectly OK code.
 > -- 
 > Mark Mitchell

	Beyond the K&R compiler problem, I also happen to think this is
bad practice because you can't look at a function definition and know if
it is static or not because somewhere else (perhaps in another header
file) it might be declared static. 

	Gcc already warns about other coding styles, for example, "if (a
= b)" and makes you use "if ((a = b))" or ambiguous else clauses making
you add braces, even though both are "perfectly OK code" as you say. :-)
So I don't see a problem with warning about another.

Kaveh R. Ghazi			Engagement Manager / Project Services		Icon CMT Corp.

More information about the Gcc-patches mailing list