On Sat, Apr 18, 2009 at 03:23:31AM +0800, KHMan wrote:
>     test.c:10: error: a label can only be part of a statement
>     and a declaration is not a statement
>
> IIRC it's not ISO C90 compliant. Nothing wrong with tcc. I'll leave the 
> digging up the ISO C standard to others.

According to the C grammar, a declaration is not a statement, but both
are block items.  The reason you can mix them in other contexts is
because a braced block contains block items rather than just
statements:

  compound-statement:
    '{' block-item-list-opt '}'

  block-item:
    declaration
    statement

A labeled statement is more strict and requires a statement rather
than a block item:

  labeled-statement:
    identifier ':' statement
    'case' constant-expr ':' statement
    'default' ':' statement

                                                  -Dave Dodge


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to