diff options
author | Miodrag Milanović <mmicko@gmail.com> | 2023-01-10 11:38:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 11:38:57 +0100 |
commit | 2677569d48ea6e84b8a09fb789f25a40e4a5da08 (patch) | |
tree | c9710038150127fc688d2de7c071b440cff105f4 | |
parent | 2b622258a2e886e381afa0e5bdedc80114e2c495 (diff) | |
parent | 40282576b08cb0c786f8088a128be7f5c7ea25a4 (diff) | |
download | yosys-2677569d48ea6e84b8a09fb789f25a40e4a5da08.tar.gz yosys-2677569d48ea6e84b8a09fb789f25a40e4a5da08.tar.bz2 yosys-2677569d48ea6e84b8a09fb789f25a40e4a5da08.zip |
Merge pull request #3616 from YosysHQ/register_error
Display error instead of assertion when pass exists
-rw-r--r-- | kernel/register.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/kernel/register.cc b/kernel/register.cc index ab391b10d..0e4d503be 100644 --- a/kernel/register.cc +++ b/kernel/register.cc @@ -108,7 +108,9 @@ Pass::Pass(std::string name, std::string short_help) : pass_name(name), short_he void Pass::run_register() { - log_assert(pass_register.count(pass_name) == 0); + if (pass_register.count(pass_name)) + log_error("Unable to register pass '%s', pass already exists!\n", pass_name.c_str()); + pass_register[pass_name] = this; } @@ -445,10 +447,13 @@ Frontend::Frontend(std::string name, std::string short_help) : void Frontend::run_register() { - log_assert(pass_register.count(pass_name) == 0); + if (pass_register.count(pass_name)) + log_error("Unable to register pass '%s', pass already exists!\n", pass_name.c_str()); pass_register[pass_name] = this; - log_assert(frontend_register.count(frontend_name) == 0); + if (frontend_register.count(frontend_name)) + log_error("Unable to register frontend '%s', frontend already exists!\n", frontend_name.c_str()); + frontend_register[frontend_name] = this; } @@ -626,10 +631,12 @@ Backend::Backend(std::string name, std::string short_help) : void Backend::run_register() { - log_assert(pass_register.count(pass_name) == 0); + if (pass_register.count(pass_name)) + log_error("Unable to register pass '%s', pass already exists!\n", pass_name.c_str()); pass_register[pass_name] = this; - log_assert(backend_register.count(backend_name) == 0); + if (backend_register.count(backend_name)) + log_error("Unable to register backend '%s', backend already exists!\n", backend_name.c_str()); backend_register[backend_name] = this; } |