From 5ff281461ac3bee013a7af2f51774095531a8f66 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Tue, 18 Nov 2008 19:10:33 +0000 Subject: [PATCH] Simplify if-cascade. [r23775] --- parser.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/parser.c b/parser.c index 0761251..c26568a 100644 --- a/parser.c +++ b/parser.c @@ -9864,22 +9864,20 @@ static statement_t *parse_for(void) expect('('); add_anchor_token(')'); - if (token.type != ';') { - if (is_declaration_specifier(&token, false)) { - parse_declaration(record_entity); - } else { - add_anchor_token(';'); - expression_t *const init = parse_expression(); - statement->fors.initialisation = init; - mark_vars_read(init, VAR_ANY); - if (warning.unused_value && !expression_has_effect(init)) { - warningf(&init->base.source_position, - "initialisation of 'for'-statement has no effect"); - } - rem_anchor_token(';'); - expect(';'); - } + if (token.type == ';') { + next_token(); + } else if (is_declaration_specifier(&token, false)) { + parse_declaration(record_entity); } else { + add_anchor_token(';'); + expression_t *const init = parse_expression(); + statement->fors.initialisation = init; + mark_vars_read(init, VAR_ANY); + if (warning.unused_value && !expression_has_effect(init)) { + warningf(&init->base.source_position, + "initialisation of 'for'-statement has no effect"); + } + rem_anchor_token(';'); expect(';'); } -- 2.20.1