misc warnings patch (installed)

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Sun May 21 05:59:00 GMT 2000


 > From: Zack Weinberg <zack@wolery.cumb.org>
 > 
 > > Zack,
 > > 
 > > I'm pretty sure this last bit is a K&R no-no.
 > 
 > Mm, no more and no less than the void return type.

No, all the other *_section() functions have a void return type and
many K&R compilers can build gcc.  If any K&R compilers exist which
don't handle void return types their users haven't complained so far.

E.g. this compiles with cc on SunOS4:

 > void
 > foo() {}

whereas this does not:

 > void
 > foo(void) {}
 > line 2: syntax error at or near type word "void"

The issue here is not whether we accept the void keyword, its whether
we accept ANSI style prototype specifiers in the parameter list of the
function definition.


 >   Somewhere, we
 > #define void to nothing if not __STDC__ - I can't find it right now,
 > but void wasn't a keyword in K+R C, so it must be there somewhere...
 > zw

AFAICT, this is not the case.  Gcc only handles void* as char* via the
PTR macro in include/ansidecl.h.  The void keyword alone is not
touched.  The output on sunos4 of cc -E on any gcc/*.c proves this
pretty conclusively.  (The only package I know of that went so far as
to handle all uses of the void keyword is perl.)  The convention for
gcc has been to use it in and return types but not for the specific
case here as in function definition prototype style.

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions


More information about the Gcc-patches mailing list