Improve error recovery in parse_do() and do not return an error statement.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 26 Apr 2012 11:17:25 +0000 (13:17 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 26 Apr 2012 13:19:18 +0000 (15:19 +0200)
parser.c

index 0f7f557..d96e598 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -9483,19 +9483,18 @@ static statement_t *parse_do(void)
        statement->do_while.body = parse_loop_body(statement);
        rem_anchor_token(T_while);
 
-       expect(T_while, end_error);
+       expect(T_while, end_error0);
+end_error0:;
        expression_t *const cond = parse_condition();
        statement->do_while.condition = cond;
        /* ยง6.8.5:2    The controlling expression of an iteration statement shall
         *             have scalar type. */
        semantic_condition(cond, "condition of 'do-while'-statement");
-       expect(';', end_error);
+       expect(';', end_error1);
+end_error1:
 
        POP_PARENT();
        return statement;
-end_error:
-       POP_PARENT();
-       return create_error_statement();
 }
 
 /**