diff options
author | whitequark <whitequark@whitequark.org> | 2020-04-14 12:39:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 12:39:28 +0000 |
commit | 0e1beb6f308da18b952e562b85504258d20ffcc7 (patch) | |
tree | 99f56133ab440b6165d3bb0db8607c7021c5a03b /frontends | |
parent | f44b287f8e36684607447beb05556f1a5a34d625 (diff) | |
parent | dbfd6b75305f6006a0c1e1d150c291875e5451d5 (diff) | |
download | yosys-0e1beb6f308da18b952e562b85504258d20ffcc7.tar.gz yosys-0e1beb6f308da18b952e562b85504258d20ffcc7.tar.bz2 yosys-0e1beb6f308da18b952e562b85504258d20ffcc7.zip |
Merge pull request #1880 from jjj11x/duplicate_enum
duplicated enum item names should result in an error
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/ast/simplify.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index b87af0f8c..3fde26fab 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -420,9 +420,10 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage, current_scope[node->str] = node; for (auto enode : node->children) { log_assert(enode->type==AST_ENUM_ITEM); - if (current_scope.count(enode->str) == 0) { + if (current_scope.count(enode->str) == 0) current_scope[enode->str] = enode; - } + else + log_file_error(filename, location.first_line, "enum item %s already exists\n", enode->str.c_str()); } } } |