aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kbdc/compile-layout.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-11 05:13:45 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-11 05:13:45 +0100
commitd00e178cd2040f612aeebfd9971b05e250c65d8c (patch)
tree2f2ce16e8274cfff990c76a21382602d73e7031e /src/mds-kbdc/compile-layout.c
parentdefine help-functions inside assumption-clauses (diff)
downloadmds-d00e178cd2040f612aeebfd9971b05e250c65d8c.tar.gz
mds-d00e178cd2040f612aeebfd9971b05e250c65d8c.tar.bz2
mds-d00e178cd2040f612aeebfd9971b05e250c65d8c.tar.xz
mds-kbdc: compile-layout: do not warn about non-shadowing after a for-loop
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-kbdc/compile-layout.c5
1 files changed, 3 insertions, 2 deletions
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)