Date: Sun, 28 Apr 2002 04:34:03 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Marcel Moolenaar <marcel@xcllnt.net> Cc: cvs-committers@FreeBSD.org, <cvs-all@FreeBSD.org> Subject: Re: cvs commit: src/sys/kern subr_witness.c Message-ID: <20020428042233.E1235-100000@gamplex.bde.org> In-Reply-To: <20020427181656.GA315@dhcp01.pn.xcllnt.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 27 Apr 2002, Marcel Moolenaar wrote:
> On Sun, Apr 28, 2002 at 02:51:38AM +1000, Bruce Evans wrote:
> > On Fri, 26 Apr 2002, Marcel Moolenaar wrote:
> >
> > > marcel 2002/04/26 19:58:18 PDT
> > >
> > > Modified files:
> > > sys/kern subr_witness.c
> > > Log:
> > > Insert a semi-colon between label 'skip:' and the closing brace
> > > of the FOREACH loop to silence GCC 3.
> >
> > Why not do this to fix the syntax error?
>
> What syntax error?
The one complained about by gcc 3.
%%%
Script started on Sun Apr 28 04:21:03 2002
ttyp0:bde@besplex:/tmp> cat z.c
void
foo(void)
{
int i;
for (i = 0; i < 100; i++) {
bar();
skip:
}
}
ttyp0:bde@besplex:/tmp> gcc -c z.c
ttyp0:bde@besplex:/tmp> gcc -c -pedantic z.c
z.c: In function `foo':
z.c:10: warning: ANSI C forbids label at end of compound statement
ttyp0:bde@besplex:/tmp> tcc -c z.c
"z.c", line 9: Error:
[Syntax]: Parse error before '}'.
"z.c", line 10: Error:
[Syntax]: Parse error before '}'.
[Syntax]: Can't recover from this error.
ttyp0:bde@besplex:/tmp> exit
Script done on Sun Apr 28 04:21:21 2002
%%%
tcc normally gives references to ISO C90, but here it is confused too
the syntax error. The syntax error is just that labels must be followed
by a statement (there is no such thing as a label by itself; the syntax
only defines labeled statements). "} after "skip:" is not a statement.
The closest to a null statement is ";" or "{}".
Bruce
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020428042233.E1235-100000>
