syntax errors in new SPARC files
John Carr
jfc@tiac.net
Wed Aug 12 13:54:00 GMT 1998
> 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.
More information about the Gcc-bugs
mailing list