This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: syntax errors in new SPARC files



>    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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]