From: Jeff Wang Date: Tue, 7 Apr 2020 06:30:11 +0000 (-0400) Subject: duplicated enum item names should result in an error X-Git-Tag: working-ls180~662^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dbfd6b75305f6006a0c1e1d150c291875e5451d5;p=yosys.git duplicated enum item names should result in an error --- 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()); } } }