diff options
| author | 2026-04-14 00:18:48 +1000 | |
|---|---|---|
| committer | 2026-04-14 00:18:48 +1000 | |
| commit | 1b9abac1a72d3174442770e111c7320cfb6f92ce (patch) | |
| tree | 507c6333b6a575d1528258e0f31fee07bc812cae | |
| parent | a5ef17242dad29620875cedc646c14df288bfe6e (diff) | |
Revert "netlist: Remove redundant usages of fatal logger (#15218)"
This reverts commit 7689ad57e746a33dfeae9299821992e15dd63ea9.
The nl_exception doesn't inherently log anything, and whatever catches
it may send its log output to a different place to the netlist devices'
loggers if it end up logging the message. All the error conditions are
supposed to be sent to the netlist devices' own loggers to ensure you
have visibility.
| -rw-r--r-- | src/lib/netlist/analog/nld_opamps.cpp | 1 | ||||
| -rw-r--r-- | src/lib/netlist/core/netlist_state.h | 1 | ||||
| -rw-r--r-- | src/lib/netlist/core/param.h | 2 | ||||
| -rw-r--r-- | src/lib/netlist/nl_base.cpp | 7 | ||||
| -rw-r--r-- | src/lib/netlist/nl_factory.cpp | 2 | ||||
| -rw-r--r-- | src/lib/netlist/nl_factory.h | 2 | ||||
| -rw-r--r-- | src/lib/netlist/nl_parser.cpp | 1 | ||||
| -rw-r--r-- | src/lib/netlist/nl_setup.cpp | 36 | ||||
| -rw-r--r-- | src/lib/netlist/solver/nld_matrix_solver.cpp | 2 |
9 files changed, 53 insertions, 1 deletions
diff --git a/src/lib/netlist/analog/nld_opamps.cpp b/src/lib/netlist/analog/nld_opamps.cpp index 37e40521fab..b7e4ebfa762 100644 --- a/src/lib/netlist/analog/nld_opamps.cpp +++ b/src/lib/netlist/analog/nld_opamps.cpp @@ -119,6 +119,7 @@ namespace netlist { if (m_type < 1 || m_type > 3) { + log().fatal(MF_OPAMP_UNKNOWN_TYPE(m_type)); throw nl_exception(MF_OPAMP_UNKNOWN_TYPE(m_type)); } diff --git a/src/lib/netlist/core/netlist_state.h b/src/lib/netlist/core/netlist_state.h index d534fa93cbc..505665d9acf 100644 --- a/src/lib/netlist/core/netlist_state.h +++ b/src/lib/netlist/core/netlist_state.h @@ -174,6 +174,7 @@ namespace netlist if (d.first == name) { dev.release(); + log().fatal(MF_DUPLICATE_NAME_DEVICE_LIST(name)); throw nl_exception(MF_DUPLICATE_NAME_DEVICE_LIST(name)); } // m_devices.push_back(std::move(dev)); diff --git a/src/lib/netlist/core/param.h b/src/lib/netlist/core/param.h index 1a1cad96fa0..34e6c3b1b1e 100644 --- a/src/lib/netlist/core/param.h +++ b/src/lib/netlist/core/param.h @@ -311,6 +311,8 @@ namespace netlist bool ok = temp.set_from_string(p); if (!ok) { + device.state().log().fatal( + MF_INVALID_ENUM_CONVERSION_1_2(name, p)); throw nl_exception(MF_INVALID_ENUM_CONVERSION_1_2(name, p)); } m_param = temp; diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 14025a5abfe..ddb4f1bca6a 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -40,6 +40,7 @@ namespace netlist || plib::dynamic_downcast<const analog_output_t *>(this)) return terminal_type::OUTPUT; + state().log().fatal(MF_UNKNOWN_TYPE_FOR_OBJECT(name())); throw nl_exception(MF_UNKNOWN_TYPE_FOR_OBJECT(name())); // return terminal_type::TERMINAL; // please compiler } @@ -525,6 +526,7 @@ namespace netlist { if (ret != nullptr) { + m_log.fatal(MF_MORE_THAN_ONE_1_DEVICE_FOUND(classname)); throw nl_exception( MF_MORE_THAN_ONE_1_DEVICE_FOUND(classname)); } @@ -725,6 +727,8 @@ namespace netlist for (detail::core_terminal_t *t : m_core_terms) if (t == &terminal) { + state().log().fatal( + MF_NET_1_DUPLICATE_TERMINAL_2(this->name(), t->name())); throw nl_exception( MF_NET_1_DUPLICATE_TERMINAL_2(this->name(), t->name())); } @@ -757,6 +761,8 @@ namespace netlist for (detail::core_terminal_t *t : core_terms_ref()) if (t == &terminal) { + state().log().fatal( + MF_NET_1_DUPLICATE_TERMINAL_2(this->name(), t->name())); throw nl_exception( MF_NET_1_DUPLICATE_TERMINAL_2(this->name(), t->name())); } @@ -1005,6 +1011,7 @@ namespace netlist if (plib::dynamic_downcast<const param_ptr_t *>(this)) return POINTER; + state().log().fatal(MF_UNKNOWN_PARAM_TYPE(name())); throw nl_exception(MF_UNKNOWN_PARAM_TYPE(name())); } diff --git a/src/lib/netlist/nl_factory.cpp b/src/lib/netlist/nl_factory.cpp index 0131ea50a29..6ab9e84cafd 100644 --- a/src/lib/netlist/nl_factory.cpp +++ b/src/lib/netlist/nl_factory.cpp @@ -60,6 +60,7 @@ namespace netlist::factory { if (exists(factory->name())) { + m_log.fatal(MF_FACTORY_ALREADY_CONTAINS_1(factory->name())); throw nl_exception(MF_FACTORY_ALREADY_CONTAINS_1(factory->name())); } push_back(std::move(factory)); @@ -73,6 +74,7 @@ namespace netlist::factory return e.get(); } + m_log.fatal(MF_CLASS_1_NOT_FOUND(devname)); throw nl_exception(MF_CLASS_1_NOT_FOUND(devname)); } diff --git a/src/lib/netlist/nl_factory.h b/src/lib/netlist/nl_factory.h index 661b654a03b..ed4eb276c1f 100644 --- a/src/lib/netlist/nl_factory.h +++ b/src/lib/netlist/nl_factory.h @@ -195,7 +195,7 @@ namespace netlist::factory bool exists(const pstring &name) const noexcept; private: - [[maybe_unused]] log_type &m_log; + log_type &m_log; }; // ------------------------------------------------------------------------- diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp index ebc76736222..4d4638bea21 100644 --- a/src/lib/netlist/nl_parser.cpp +++ b/src/lib/netlist/nl_parser.cpp @@ -15,6 +15,7 @@ namespace netlist void parser_t::verror(const pstring &msg) { + m_setup.log().fatal("{1}", msg); throw nl_exception(plib::pfmt("{1}")(msg)); } diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 28f1b6459d3..30393603daa 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -44,6 +44,7 @@ namespace netlist .insert({alias, detail::alias_t(type, alias, points_to)}) .second) { + log().fatal(MF_ALIAS_ALREAD_EXISTS_1(alias)); throw nl_exception(MF_ALIAS_ALREAD_EXISTS_1(alias)); } } @@ -76,6 +77,8 @@ namespace netlist const auto list(plib::psplit(terms, pstring(", "))); if (list.empty() || (list.size() % 2) == 1) { + log().fatal( + MF_DIP_PINS_MUST_BE_AN_EQUAL_NUMBER_OF_PINS_1(build_fqn(""))); throw nl_exception( MF_DIP_PINS_MUST_BE_AN_EQUAL_NUMBER_OF_PINS_1(build_fqn(""))); } @@ -125,6 +128,7 @@ namespace netlist pstring key = build_fqn(name); if (device_exists(key)) { + log().fatal(MF_DEVICE_ALREADY_EXISTS_1(key)); throw nl_exception(MF_DEVICE_ALREADY_EXISTS_1(key)); } @@ -146,6 +150,7 @@ namespace netlist { auto err = MF_PARAM_COUNT_MISMATCH_2( name, params_and_connections.size()); + log().fatal(err); throw nl_exception(err); // break; } @@ -168,6 +173,7 @@ namespace netlist { auto err = MF_PARAM_COUNT_MISMATCH_2( name, params_and_connections.size()); + log().fatal(err); throw nl_exception(err); } pstring fully_qualified_name = name + "." + tp; @@ -184,6 +190,7 @@ namespace netlist { MF_PARAM_COUNT_EXCEEDED_2 err(name, params_and_connections.size()); + log().fatal(err); throw nl_exception(err); } } @@ -197,6 +204,7 @@ namespace netlist const auto name = build_fqn(object_name) + hint_name; if (!m_abstract.m_hints.insert({name, false}).second) { + log().fatal(MF_ADDING_HINT_1(name)); throw nl_exception(MF_ADDING_HINT_1(name)); } } @@ -212,6 +220,7 @@ namespace netlist const auto list(plib::psplit(terms, pstring(", "))); if (list.size() < 2) { + log().fatal(MF_NET_C_NEEDS_AT_LEAST_2_TERMINAL()); throw nl_exception(MF_NET_C_NEEDS_AT_LEAST_2_TERMINAL()); } for (std::size_t i = 1; i < list.size(); i++) @@ -226,6 +235,7 @@ namespace netlist [this, &netlist_name](source_netlist_t *src) { return src->parse(*this, netlist_name); })) return; + log().fatal(MF_NOT_FOUND_IN_SOURCE_COLLECTION(netlist_name)); throw nl_exception(MF_NOT_FOUND_IN_SOURCE_COLLECTION(netlist_name)); } @@ -266,6 +276,7 @@ namespace netlist { if (!m_abstract.m_param_values.insert({fqn, val}).second) { + log().fatal(MF_ADDING_PARAMETER_1_TO_PARAMETER_LIST(param)); throw nl_exception( MF_ADDING_PARAMETER_1_TO_PARAMETER_LIST(param)); } @@ -340,6 +351,7 @@ namespace netlist } if (!found) { + log().fatal(MF_FOUND_NO_OCCURRENCE_OF_1(attach)); throw nl_exception(MF_FOUND_NO_OCCURRENCE_OF_1(attach)); } register_connection(attach, frontier_name + ".Q"); @@ -469,6 +481,7 @@ namespace netlist } if (!found) { + log().fatal(MF_FOUND_NO_OCCURRENCE_OF_1(pin)); throw nl_exception(MF_FOUND_NO_OCCURRENCE_OF_1(pin)); } } @@ -582,6 +595,8 @@ namespace netlist log().debug("{1} {2}\n", termtype_as_str(term), term.name()); if (!m_terminals.insert({term.name(), &term}).second) { + log().fatal(MF_ADDING_1_2_TO_TERMINAL_LIST(termtype_as_str(term), + term.name())); throw nl_exception(MF_ADDING_1_2_TO_TERMINAL_LIST( termtype_as_str(term), term.name())); } @@ -602,6 +617,7 @@ namespace netlist if (!m_params.insert({param.name(), param_ref_t(param.device(), param)}) .second) { + log().fatal(MF_ADDING_PARAMETER_1_TO_PARAMETER_LIST(param.name())); throw nl_exception( MF_ADDING_PARAMETER_1_TO_PARAMETER_LIST(param.name())); } @@ -705,6 +721,7 @@ namespace netlist if (term == nullptr && required) { + log().fatal(MF_TERMINAL_1_2_NOT_FOUND(terminal_in, tname)); throw nl_exception(MF_TERMINAL_1_2_NOT_FOUND(terminal_in, tname)); } if (term != nullptr) @@ -729,6 +746,7 @@ namespace netlist } if (ret == m_terminals.end() && required) { + log().fatal(MF_TERMINAL_1_2_NOT_FOUND(terminal_in, tname)); throw nl_exception(MF_TERMINAL_1_2_NOT_FOUND(terminal_in, tname)); } detail::core_terminal_t *term = (ret == m_terminals.end() @@ -739,6 +757,7 @@ namespace netlist { if (required) { + log().fatal(MF_OBJECT_1_2_WRONG_TYPE(terminal_in, tname)); throw nl_exception( MF_OBJECT_1_2_WRONG_TYPE(terminal_in, tname)); } @@ -757,6 +776,8 @@ namespace netlist auto ret(m_params.find(resolved_param_name)); if (ret == m_params.end()) { + log().fatal( + MF_PARAMETER_1_2_NOT_FOUND(param_in, resolved_param_name)); throw nl_exception( MF_PARAMETER_1_2_NOT_FOUND(param_in, resolved_param_name)); } @@ -793,6 +814,8 @@ namespace netlist p->clear_net(); // de-link from all nets ... if (!connect(new_proxy->proxy_term(), *p)) { + log().fatal(MF_CONNECTING_1_TO_2(new_proxy->proxy_term().name(), + (*p).name())); throw nl_exception(MF_CONNECTING_1_TO_2( new_proxy->proxy_term().name(), (*p).name())); } @@ -851,6 +874,8 @@ namespace netlist p->clear_net(); // de-link from all nets ... if (!connect(ret->proxy_term(), *p)) { + log().fatal(MF_CONNECTING_1_TO_2( + ret->proxy_term().name(), (*p).name())); throw nl_exception(MF_CONNECTING_1_TO_2( ret->proxy_term().name(), (*p).name())); } @@ -888,6 +913,8 @@ namespace netlist if (this_net.is_rail_net() && other_net.is_rail_net()) { + log().fatal( + MF_MERGE_RAIL_NETS_1_AND_2(this_net.name(), other_net.name())); throw nl_exception( MF_MERGE_RAIL_NETS_1_AND_2(this_net.name(), other_net.name())); } @@ -909,6 +936,7 @@ namespace netlist { if (input.has_net() && input.net().is_rail_net()) { + log().fatal(MF_INPUT_1_ALREADY_CONNECTED(input.name())); throw nl_exception(MF_INPUT_1_ALREADY_CONNECTED(input.name())); } if (output.is_analog() && input.is_logic()) @@ -931,6 +959,8 @@ namespace netlist output.net().add_terminal(input); else { + log().fatal( + ME_TERMINALS_1_2_WITHOUT_NET(input.name(), output.name())); throw nl_exception( ME_TERMINALS_1_2_WITHOUT_NET(input.name(), output.name())); } @@ -960,6 +990,7 @@ namespace netlist } else { + log().fatal(MF_OBJECT_INPUT_TYPE_1(input.name())); throw nl_exception(MF_OBJECT_INPUT_TYPE_1(input.name())); } } @@ -997,6 +1028,7 @@ namespace netlist } else { + log().fatal(MF_OBJECT_OUTPUT_TYPE_1(output.name())); throw nl_exception(MF_OBJECT_OUTPUT_TYPE_1(output.name())); } } @@ -1227,6 +1259,8 @@ namespace netlist log().warning(MF_CONNECTING_1_TO_2(de_alias(link.first), de_alias(link.second))); + log().fatal( + MF_LINK_TRIES_EXCEEDED(m_netlist_params->m_max_link_loops())); throw nl_exception( MF_LINK_TRIES_EXCEEDED(m_netlist_params->m_max_link_loops())); } @@ -1318,6 +1352,7 @@ namespace netlist } if (err) { + log().fatal(MF_TERMINALS_WITHOUT_NET()); throw nl_exception(MF_TERMINALS_WITHOUT_NET()); } } @@ -1793,6 +1828,7 @@ namespace netlist if (error_count > 0) { + log().fatal(MF_ERRORS_FOUND(error_count)); throw nl_exception(MF_ERRORS_FOUND(error_count)); } } diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp index efbaa8af15b..d382da0f7d5 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.cpp +++ b/src/lib/netlist/solver/nld_matrix_solver.cpp @@ -184,6 +184,7 @@ namespace netlist::solver } break; case detail::terminal_type::OUTPUT: + log().fatal(MF_UNHANDLED_ELEMENT_1_FOUND(p->name())); throw nl_exception( MF_UNHANDLED_ELEMENT_1_FOUND(p->name())); } @@ -722,6 +723,7 @@ namespace netlist::solver } else { + log().fatal(MF_FOUND_TERM_WITH_MISSING_OTHERNET(term->name())); throw nl_exception( MF_FOUND_TERM_WITH_MISSING_OTHERNET(term->name())); } |
