summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/prg/nltool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/prg/nltool.cpp')
-rw-r--r--src/lib/netlist/prg/nltool.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index ed4659a12b1..0bfb324c607 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -181,7 +181,7 @@ public:
, m_app(app)
{ }
- void vlog(const plib::plog_level &l, const pstring &ls) const override;
+ void vlog(const plib::plog_level &l, const pstring &ls) const noexcept override;
private:
tool_app_t &m_app;
@@ -266,7 +266,7 @@ public:
size += s->m_dt.size * s->m_count;
if (buf.size() != size)
- throw netlist::nl_exception("Size different during load state.");
+ plib::pthrow<netlist::nl_exception>("Size different during load state.");
char *p = buf.data();
@@ -288,7 +288,7 @@ protected:
private:
};
-void netlist_tool_callbacks_t::vlog(const plib::plog_level &l, const pstring &ls) const
+void netlist_tool_callbacks_t::vlog(const plib::plog_level &l, const pstring &ls) const noexcept
{
pstring err = plib::pfmt("{}: {}\n")(l.name())(ls.c_str());
if (l == plib::plog_level::WARNING)
@@ -296,12 +296,8 @@ void netlist_tool_callbacks_t::vlog(const plib::plog_level &l, const pstring &ls
if (l == plib::plog_level::ERROR)
m_app.m_errors++;
if (l == plib::plog_level::FATAL)
- {
m_app.m_errors++;
- throw netlist::nl_exception(err);
- }
- else
- m_app.pout("{}", err);
+ m_app.pout("{}", err);
}
struct input_t
@@ -316,7 +312,7 @@ struct input_t
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
int e = std::sscanf(line.c_str(), "%lf,%[^,],%lf", &t, buf.data(), &val);
if (e != 3)
- throw netlist::nl_exception(plib::pfmt("error {1} scanning line {2}\n")(e)(line));
+ plib::pthrow<netlist::nl_exception>(plib::pfmt("error {1} scanning line {2}\n")(e)(line));
m_value = static_cast<nl_fptype>(val);
m_time = netlist::netlist_time::from_fp(t);
m_param = setup.find_param(pstring(buf.data()), true);
@@ -328,7 +324,7 @@ struct input_t
{
case netlist::param_t::STRING:
case netlist::param_t::POINTER:
- throw netlist::nl_exception(plib::pfmt("param {1} is not numeric\n")(m_param->name()));
+ plib::pthrow<netlist::nl_exception>(plib::pfmt("param {1} is not numeric\n")(m_param->name()));
case netlist::param_t::DOUBLE:
static_cast<netlist::param_fp_t*>(m_param)->setTo(m_value);
break;
@@ -353,7 +349,7 @@ static std::vector<input_t> read_input(const netlist::setup_t &setup, const pstr
{
plib::putf8_reader r = plib::putf8_reader(std::ifstream(plib::filesystem::u8path(fname)));
if (r.stream().fail())
- throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(fname));
+ plib::pthrow<netlist::nl_exception>(netlist::MF_FILE_OPEN_ERROR(fname));
r.stream().imbue(std::locale::classic());
pstring l;
while (r.readline(l))
@@ -410,7 +406,7 @@ void tool_app_t::run()
{
std::ifstream strm(plib::filesystem::u8path(opt_loadstate()));
if (strm.fail())
- throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(opt_loadstate()));
+ plib::pthrow<netlist::nl_exception>(netlist::MF_FILE_OPEN_ERROR(opt_loadstate()));
strm.imbue(std::locale::classic());
plib::pbinary_reader reader(strm);
std::vector<char> loadstate;
@@ -448,7 +444,7 @@ void tool_app_t::run()
auto savestate = nt.save_state();
std::ofstream strm(plib::filesystem::u8path(opt_savestate()), std::ios_base::binary);
if (strm.fail())
- throw plib::file_open_e(opt_savestate());
+ plib::pthrow<plib::file_open_e>(opt_savestate());
strm.imbue(std::locale::classic());
plib::pbinary_writer writer(strm);
@@ -496,14 +492,14 @@ void tool_app_t::validate()
//pout("Validation errors: {}\n", m_errors);
if (m_warnings + m_errors > 0)
- throw netlist::nl_exception("validation: {1} errors {2} warnings", m_errors, m_warnings);
+ plib::pthrow<netlist::nl_exception>("validation: {1} errors {2} warnings", m_errors, m_warnings);
}
void tool_app_t::static_compile()
{
if (!opt_dir.was_specified())
- throw netlist::nl_exception("--dir option needs to be specified");
+ plib::pthrow<netlist::nl_exception>("--dir option needs to be specified");
netlist_tool_t nt(*this, "netlist");
@@ -763,7 +759,7 @@ void tool_app_t::convert()
{
std::ifstream strm(plib::filesystem::u8path(opt_file()));
if (strm.fail())
- throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(opt_file()));
+ plib::pthrow<netlist::nl_exception>(netlist::MF_FILE_OPEN_ERROR(opt_file()));
strm.imbue(std::locale::classic());
plib::copystream(ostrm, strm);
}