diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-04-12 10:37:58 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-05-21 17:27:45 +0200 |
commit | 86edd142e6fa4483cf5cb057ffac4cb548a9374c (patch) | |
tree | abcb73adc2efa9f2755d2ef820528b9d2975c76c | |
parent | 4a71ea1810242c08f66afe16ef9ec0b917439023 (diff) | |
download | sparse-86edd142e6fa4483cf5cb057ffac4cb548a9374c.tar.gz |
bad-goto: simplify testing of undeclared labels
There is no need to do a lookup: checking if the label's
symbol is in the NS_LABEL namespace and is lacking an
associated statement is enough and much simpler.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | evaluate.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -3747,7 +3747,8 @@ static void evaluate_goto_statement(struct statement *stmt) evaluate_expression(stmt->goto_expression); return; } - if (!label->stmt && label->ident && !lookup_keyword(label->ident, NS_KEYWORD)) { + + if (label->namespace == NS_LABEL && !label->stmt) { sparse_error(stmt->pos, "label '%s' was not declared", show_ident(label->ident)); } } |