On Fri, Dec 15, 2000 at 07:54:33PM +0100, Andrea Arcangeli wrote:
> On Fri, Dec 15, 2000 at 06:59:24PM +0100, Franz Sirl wrote:
> > It's required by ISO C, and since that's the standard now, gcc spits out a
> > warning. Just adding a ; is enough and already done for most stuff in
> > 2.4.0-test12.
>
> I'm not complaining gcc folks, I just dislike the new behaviour in general,
> it's inconsistent.
>
> This is wrong:
>
> x()
> {
>
> switch (1) {
> case 0:
> case 1:
> case 2:
> case 3:
> }
> }
>
> and this is right:
>
> x()
> {
>
> switch (1) {
> case 0:
> case 1:
> case 2:
> case 3:
> ;
> }
> }
>
> Why am I required to put a `;' only in the last case and not in all
> the previous ones? Or maybe gcc-latest is forgetting to complain about
> the previous ones ;)
Because neither
<label>: (nor)
case <expr>: (nor)
default:
are statements by themselves. They are an optional start of a statement. The
ebnf looks like:
statement:
labeled-statement
| expression-statem
| compoundstatement
| selection-statement
| iteration-statement
| jump-statement
labeled-statement:
identifier ':' statement
| 'case' constant-expression ':' statement
| 'default' ':' statement
-- Michael Meissner, Red Hat, Inc. (GCC group) PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA Work: meissner@redhat.com phone: +1 978-486-9304 Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Dec 15 2000 - 21:00:33 EST