ref: 31704f8d6cf7fe145c2e7c0109f46bf9a175bd21
parent: da310fbe77b3276fa9554b91c3e28dd53399fe22
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Aug 11 12:11:26 EDT 2015
Fix labelled statements After a label was allowed only an expression, but the C grammar allows any statement.
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -43,16 +43,14 @@
static void
stmtexp(Symbol *lbreak, Symbol *lcont, Caselist *lswitch)
{
- Node *np;
-
- if (ahead() == ':')
+ if (accept(';'))
+ return;
+ if (ahead() == ':') {
label();
-
- if (yytoken != ';') {
- np = expr();
- emit(OEXPR, np);
+ stmt(lbreak, lcont, lswitch);
+ return;
}
-
+ emit(OEXPR, expr());
expect(';');
}