This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: syntax errors in new SPARC files
- To: "David S. Miller" <davem at dm dot cobaltmicro dot com>
- Subject: Re: syntax errors in new SPARC files
- From: John Carr <jfc at tiac dot net>
- Date: Wed, 12 Aug 1998 16:53:29 EDT
- cc: egcs-bugs at cygnus dot com
> return with an expression in a function returning void is not allowed.
> Neither is a label without a following statement.
>
> Says who? ANSI C? The GNU coding standards? Some broken C compiler
> out there? Who?
K&R C, ANSI C, and C++ all agree that a label must be followed by a statement.
gcc, on request, will print this warning:
ANSI C forbids label at end of compound statement
I can't find my K&R to quote the return requirement, but note the following
in c-typeck.c:
if (pedantic || TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE)
pedwarn ("`return' with a value, in function returning void");
Sun's SPARC compiler reports errors in both cases.