From d00e178cd2040f612aeebfd9971b05e250c65d8c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 11 Dec 2014 05:13:45 +0100 Subject: mds-kbdc: compile-layout: do not warn about non-shadowing after a for-loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/compile-layout.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mds-kbdc/compile-layout.c') diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c index 8eac14c..477ba33 100644 --- a/src/mds-kbdc/compile-layout.c +++ b/src/mds-kbdc/compile-layout.c @@ -167,8 +167,8 @@ static int let(size_t variable, const char32_t* restrict string, const mds_kbdc_ int saved_errno; /* Warn if this is a possible shadow attempt. */ - if (possibile_shadow_attempt && variables_let_will_override(variable) && - statement && (statement->processed != PROCESS_LEVEL)) + if (possibile_shadow_attempt && variables_let_will_override(variable) && statement && + (variables_has_been_used_in_for(variable) == 0) && (statement->processed != PROCESS_LEVEL)) { statement->processed = PROCESS_LEVEL; NEW_ERROR(statement, WARNING, "does not shadow existing definition"); @@ -2110,6 +2110,7 @@ static int compile_for(mds_kbdc_tree_for_t* restrict tree) if (*first == *last) break; } + fail_if (variables_was_used_in_for(variable)); /* Catch `break` and `continue`, they may not propagate further. */ if (break_level < 3) -- cgit v1.2.3-70-g09d2