summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
authorGravatarGravatar couriersud <couriersud@gmx.org>2019-11-04 22:04:11 +0100
committerGravatarGravatar couriersud <couriersud@gmx.org>2019-11-04 22:04:11 +0100
commit2cf61b2e4c72a80eb688d1b6ffcacfdeaf55bf26 (patch)
tree0d056f80f69db1a17a680c6e3d8fac06aa6b3e45 /src/lib
parente89f009945652ea15d941d4491cb8d9c0d2e3b65 (diff)
netlist: code maintenance. (nw)
- more const - explicitly raise exceptions instead of leaving this to log.fatal() - correct a number of cppcheck findings. - dead code removal - clang lint corrections, e.g. include order
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/netlist/analog/nld_generic_models.h4
-rw-r--r--src/lib/netlist/analog/nld_mosfet.cpp6
-rw-r--r--src/lib/netlist/analog/nld_opamps.cpp3
-rw-r--r--src/lib/netlist/devices/nld_tms4800.cpp4
-rw-r--r--src/lib/netlist/devices/nlid_system.h2
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.cpp8
-rw-r--r--src/lib/netlist/nl_base.cpp28
-rw-r--r--src/lib/netlist/nl_base.h42
-rw-r--r--src/lib/netlist/nl_factory.cpp5
-rw-r--r--src/lib/netlist/nl_parser.cpp2
-rw-r--r--src/lib/netlist/nl_setup.cpp93
-rw-r--r--src/lib/netlist/nl_setup.h16
-rw-r--r--src/lib/netlist/nltypes.h2
-rw-r--r--src/lib/netlist/plib/gmres.h2
-rw-r--r--src/lib/netlist/plib/mat_cr.h4
-rw-r--r--src/lib/netlist/plib/pchrono.h2
-rw-r--r--src/lib/netlist/plib/pexception.h20
-rw-r--r--src/lib/netlist/plib/pfmtlog.cpp25
-rw-r--r--src/lib/netlist/plib/pfmtlog.h30
-rw-r--r--src/lib/netlist/plib/pfunction.cpp4
-rw-r--r--src/lib/netlist/plib/pfunction.h2
-rw-r--r--src/lib/netlist/plib/plists.h24
-rw-r--r--src/lib/netlist/plib/pmath.h2
-rw-r--r--src/lib/netlist/plib/pmempool.h2
-rw-r--r--src/lib/netlist/plib/poptions.h10
-rw-r--r--src/lib/netlist/plib/ppreprocessor.cpp2
-rw-r--r--src/lib/netlist/plib/ppreprocessor.h7
-rw-r--r--src/lib/netlist/plib/pstate.h2
-rw-r--r--src/lib/netlist/plib/pstonum.h2
-rw-r--r--src/lib/netlist/plib/pstream.h4
-rw-r--r--src/lib/netlist/plib/pstring.cpp4
-rw-r--r--src/lib/netlist/plib/ptime.h6
-rw-r--r--src/lib/netlist/plib/ptokenizer.cpp2
-rw-r--r--src/lib/netlist/plib/ptokenizer.h4
-rw-r--r--src/lib/netlist/prg/nltool.cpp21
-rw-r--r--src/lib/netlist/prg/nlwav.cpp6
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.cpp16
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.h4
-rw-r--r--src/lib/netlist/solver/nld_ms_gmres.h2
-rw-r--r--src/lib/netlist/solver/nld_ms_sm.h3
-rw-r--r--src/lib/netlist/solver/nld_ms_w.h3
-rw-r--r--src/lib/netlist/tools/nl_convert.cpp2
-rw-r--r--src/lib/netlist/tools/nl_convert.h22
43 files changed, 263 insertions, 191 deletions
diff --git a/src/lib/netlist/analog/nld_generic_models.h b/src/lib/netlist/analog/nld_generic_models.h
index f094e6412a2..6c510f1d25d 100644
--- a/src/lib/netlist/analog/nld_generic_models.h
+++ b/src/lib/netlist/analog/nld_generic_models.h
@@ -43,7 +43,7 @@ namespace analog
{
}
- capacitor_e type() const { return capacitor_e::VARIABLE_CAPACITY; }
+ static capacitor_e type() { return capacitor_e::VARIABLE_CAPACITY; }
// Circuit Simulation, page 284, 5.360
// q(un+1) - q(un) = int(un, un+1, C(U)) = (C0+C1)/2 * (un+1-un)
@@ -95,7 +95,7 @@ namespace analog
{
}
- capacitor_e type() const { return capacitor_e::CONSTANT_CAPACITY; }
+ static capacitor_e type() { return capacitor_e::CONSTANT_CAPACITY; }
nl_fptype G(nl_fptype cap) const { return cap * m_h + m_gmin; }
nl_fptype Ieq(nl_fptype cap, nl_fptype v) const
{
diff --git a/src/lib/netlist/analog/nld_mosfet.cpp b/src/lib/netlist/analog/nld_mosfet.cpp
index 9a3084094b8..bb3116a6960 100644
--- a/src/lib/netlist/analog/nld_mosfet.cpp
+++ b/src/lib/netlist/analog/nld_mosfet.cpp
@@ -218,7 +218,7 @@ namespace analog
connect(m_DG.m_P, m_SD.m_N);
set_qtype((m_model.type() == "NMOS_DEFAULT") ? FET_NMOS : FET_PMOS);
- m_polarity = qtype() == nlconst::magic(FET_NMOS ? 1.0 : -1.0);
+ m_polarity = qtype() == nlconst::magic((FET_NMOS ? 1.0 : -1.0));
m_capmod = m_model.m_CAPMOD;
// printf("capmod %d %g %g\n", m_capmod, (nl_fptype)m_model.m_VTO, m_polarity);
@@ -416,8 +416,8 @@ namespace analog
else
{
// linear
- const nl_fptype Sqr1 = static_cast<nl_fptype>(plib::pow(Vdsat - Vds, 2));
- const nl_fptype Sqr2 = static_cast<nl_fptype>(plib::pow(nlconst::two() * Vdsat - Vds, 2));
+ const auto Sqr1(static_cast<nl_fptype>(plib::pow(Vdsat - Vds, 2)));
+ const auto Sqr2(static_cast<nl_fptype>(plib::pow(nlconst::two() * Vdsat - Vds, 2)));
Cgb = 0;
Cgs = m_CoxWL * (nlconst::one() - Sqr1 / Sqr2) * nlconst::magic(2.0 / 3.0);
Cgd = m_CoxWL * (nlconst::one() - Vdsat * Vdsat / Sqr2) * nlconst::magic(2.0 / 3.0);
diff --git a/src/lib/netlist/analog/nld_opamps.cpp b/src/lib/netlist/analog/nld_opamps.cpp
index 7ba550cc639..e2d7d5d4cb7 100644
--- a/src/lib/netlist/analog/nld_opamps.cpp
+++ b/src/lib/netlist/analog/nld_opamps.cpp
@@ -114,7 +114,10 @@ namespace netlist
{
m_type = static_cast<int>(m_model.m_TYPE);
if (m_type < 1 || m_type > 3)
+ {
log().fatal(MF_OPAMP_UNKNOWN_TYPE(m_type));
+ plib::pthrow<nl_exception>(MF_OPAMP_UNKNOWN_TYPE(m_type));
+ }
if (m_type == 1)
{
diff --git a/src/lib/netlist/devices/nld_tms4800.cpp b/src/lib/netlist/devices/nld_tms4800.cpp
index 24729b10e72..dbe9977f6a8 100644
--- a/src/lib/netlist/devices/nld_tms4800.cpp
+++ b/src/lib/netlist/devices/nld_tms4800.cpp
@@ -71,10 +71,9 @@ namespace netlist
};
// FIXME: timing!
+ // FIXME: CS: The code looks odd, looks like m_last_data should be pushed out.
NETLIB_UPDATE(TMS4800)
{
- unsigned d = 0x00;
-
netlist_time delay = NLTIME_FROM_NS(450);
if (m_AR())
{
@@ -86,6 +85,7 @@ namespace netlist
}
else
{
+ unsigned d = 0x00;
for (std::size_t i=0; i<4; i++)
{
if (m_OE1())
diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h
index b69d7ee75c2..65c0437c020 100644
--- a/src/lib/netlist/devices/nlid_system.h
+++ b/src/lib/netlist/devices/nlid_system.h
@@ -435,7 +435,7 @@ namespace devices
class nld_power_pins
{
public:
- nld_power_pins(device_t &owner, const pstring &sVCC = "VCC",
+ explicit nld_power_pins(device_t &owner, const pstring &sVCC = "VCC",
const pstring &sGND = "GND", bool force_analog_input = false)
{
if (owner.state().setup().is_extended_validation() || force_analog_input)
diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp
index 2d3b1fcd2e2..ef9850b1d05 100644
--- a/src/lib/netlist/devices/nlid_truthtable.cpp
+++ b/src/lib/netlist/devices/nlid_truthtable.cpp
@@ -35,7 +35,7 @@ namespace netlist
sbitset &reset(const std::size_t bit) { m_bs &= ~(static_cast<T>(1) << bit); return *this; }
sbitset invert() const { return sbitset(~m_bs); }
- std::size_t count()
+ std::size_t count() const
{
std::size_t ret = 0;
for (T v = m_bs; v != 0; v = v >> 1)
@@ -153,13 +153,13 @@ namespace netlist
{
}
- void parse(const std::vector<pstring> &desc);
+ void parse(const std::vector<pstring> &truthtable);
private:
void parseline(unsigned cur, std::vector<pstring> list,
tt_bitset state, uint_least64_t val, std::vector<uint_least8_t> &timing_index);
- tt_bitset calculate_ignored_inputs(tt_bitset i);
+ tt_bitset calculate_ignored_inputs(tt_bitset i) const;
unsigned m_NO;
unsigned m_NI;
@@ -252,7 +252,7 @@ namespace netlist
unique_pool_ptr<typename nld_truthtable_t<m_NI, m_NO>::truthtable_t> m_ttbl;
};
- tt_bitset truthtable_parser::calculate_ignored_inputs(tt_bitset state)
+ tt_bitset truthtable_parser::calculate_ignored_inputs(tt_bitset state) const
{
// Determine all inputs which may be ignored ...
tt_bitset ignore = 0;
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index 0ccfc788d9f..485f1b47f80 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -161,7 +161,7 @@ namespace netlist
{
}
- detail::terminal_type detail::core_terminal_t::type() const
+ detail::terminal_type detail::core_terminal_t::type() const noexcept(false)
{
if (dynamic_cast<const terminal_t *>(this) != nullptr)
return terminal_type::TERMINAL;
@@ -174,7 +174,8 @@ namespace netlist
else
{
state().log().fatal(MF_UNKNOWN_TYPE_FOR_OBJECT(name()));
- return terminal_type::TERMINAL; // please compiler
+ plib::pthrow<nl_exception>(MF_UNKNOWN_TYPE_FOR_OBJECT(name()));
+ //return terminal_type::TERMINAL; // please compiler
}
}
@@ -494,7 +495,10 @@ namespace netlist
if (cc(d.second.get()))
{
if (ret != nullptr)
+ {
m_log.fatal(MF_MORE_THAN_ONE_1_DEVICE_FOUND(classname));
+ plib::pthrow<nl_exception>(MF_MORE_THAN_ONE_1_DEVICE_FOUND(classname));
+ }
else
ret = d.second.get();
}
@@ -604,7 +608,10 @@ namespace netlist
void device_t::connect_post_start(detail::core_terminal_t &t1, detail::core_terminal_t &t2)
{
if (!state().setup().connect(t1, t2))
+ {
log().fatal(MF_ERROR_CONNECTING_1_TO_2(t1.name(), t2.name()));
+ plib::pthrow<nl_exception>(MF_ERROR_CONNECTING_1_TO_2(t1.name(), t2.name()));
+ }
}
@@ -681,18 +688,21 @@ namespace netlist
}
}
- void detail::net_t::add_terminal(detail::core_terminal_t &terminal) NL_NOEXCEPT
+ void detail::net_t::add_terminal(detail::core_terminal_t &terminal) noexcept(false)
{
for (auto &t : m_core_terms)
if (t == &terminal)
+ {
state().log().fatal(MF_NET_1_DUPLICATE_TERMINAL_2(name(), t->name()));
+ plib::pthrow<nl_exception>(MF_NET_1_DUPLICATE_TERMINAL_2(name(), t->name()));
+ }
terminal.set_net(this);
m_core_terms.push_back(&terminal);
}
- void detail::net_t::remove_terminal(detail::core_terminal_t &terminal) NL_NOEXCEPT
+ void detail::net_t::remove_terminal(detail::core_terminal_t &terminal) noexcept(false)
{
if (plib::container::contains(m_core_terms, &terminal))
{
@@ -700,7 +710,10 @@ namespace netlist
plib::container::remove(m_core_terms, &terminal);
}
else
+ {
state().log().fatal(MF_REMOVE_TERMINAL_1_FROM_NET_2(terminal.name(), this->name()));
+ plib::pthrow<nl_exception>(MF_REMOVE_TERMINAL_1_FROM_NET_2(terminal.name(), this->name()));
+ }
}
void detail::net_t::move_connections(detail::net_t &dest_net)
@@ -872,7 +885,7 @@ namespace netlist
device.state().setup().register_param_t(this->name(), *this);
}
- param_t::param_type_t param_t::param_type() const
+ param_t::param_type_t param_t::param_type() const noexcept(false)
{
if (dynamic_cast<const param_str_t *>(this) != nullptr)
return STRING;
@@ -887,7 +900,7 @@ namespace netlist
else
{
state().log().fatal(MF_UNKNOWN_PARAM_TYPE(name()));
- return POINTER; /* Please compiler */
+ plib::pthrow<nl_exception>(MF_UNKNOWN_PARAM_TYPE(name()));
}
}
@@ -928,7 +941,8 @@ namespace netlist
void param_model_t::changed()
{
- state().log().fatal(MF_MODEL_1_CAN_NOT_BE_CHANGED_AT_RUNTIME(name()));
+ // FIXME: should we really throw here ?
+ plib::pthrow<nl_exception>(MF_MODEL_1_CAN_NOT_BE_CHANGED_AT_RUNTIME(name()));
}
const pstring param_model_t::value_str(const pstring &entity)
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index 586000b7b0e..5665e48d497 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -20,9 +20,9 @@
#include "plib/pmempool.h"
#include "plib/ppmf.h"
#include "plib/pstate.h"
+#include "plib/pstonum.h"
#include "plib/pstream.h"
#include "plib/ptime.h"
-#include "plib/pstonum.h"
#include "nl_errstr.h"
#include "nltypes.h"
@@ -167,7 +167,7 @@ class NETLIB_NAME(name) : public device_t
#define nl_assert(x) do { if (0) if (!(x)) { /*throw nl_exception(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); */} } while (0)
#define NL_NOEXCEPT noexcept
#endif
-#define nl_assert_always(x, msg) do { if (!(x)) throw nl_exception("Fatal error: {1}\nCaused by assert: {2}:{3}: {4}", msg, __FILE__, __LINE__, #x); } while (0)
+#define nl_assert_always(x, msg) do { if (!(x)) plib::pthrow<nl_exception>("Fatal error: {1}\nCaused by assert: {2}:{3}: {4}", msg, __FILE__, __LINE__, #x); } while (0)
//============================================================
// Namespace starts
@@ -562,7 +562,7 @@ namespace netlist
/*! The object type.
* \returns type of the object
*/
- terminal_type type() const;
+ terminal_type type() const noexcept(false);
/*! Checks if object is of specified type.
* \param atype type to check object against.
* \returns true if object is of specified type else false.
@@ -587,7 +587,7 @@ namespace netlist
state_e terminal_state() const noexcept { return m_state; }
void set_state(state_e astate) noexcept { m_state = astate; }
- void reset() noexcept { set_state(is_type(OUTPUT) ? STATE_OUT : STATE_INP_ACTIVE); }
+ void reset() noexcept { set_state(is_type(terminal_type::OUTPUT) ? STATE_OUT : STATE_INP_ACTIVE); }
nldelegate m_delegate;
#if NL_USE_COPY_INSTEAD_OF_REFERENCE
@@ -658,8 +658,8 @@ namespace netlist
/* setup stuff */
- void add_terminal(core_terminal_t &terminal) NL_NOEXCEPT;
- void remove_terminal(core_terminal_t &terminal) NL_NOEXCEPT;
+ void add_terminal(core_terminal_t &terminal) noexcept(false);
+ void remove_terminal(core_terminal_t &terminal) noexcept(false);
bool is_logic() const noexcept;
bool is_analog() const noexcept;
@@ -763,17 +763,17 @@ namespace netlist
nl_fptype operator ()() const noexcept;
- void set_conductivity(const nl_fptype G) noexcept
+ void set_conductivity(const nl_fptype G) const noexcept
{
set_go_gt_I(-G, G, nlconst::zero());
}
- void set_go_gt(const nl_fptype GO, const nl_fptype GT) noexcept
+ void set_go_gt(const nl_fptype GO, const nl_fptype GT) const noexcept
{
set_go_gt_I(GO, GT, nlconst::zero());
}
- void set_go_gt_I(const nl_fptype GO, const nl_fptype GT, const nl_fptype I) noexcept
+ void set_go_gt_I(const nl_fptype GO, const nl_fptype GT, const nl_fptype I) const noexcept
{
if (m_go1 != nullptr)
{
@@ -786,7 +786,7 @@ namespace netlist
void solve_now();
void schedule_solve_after(const netlist_time after);
- void set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept;
+ void set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept(false);
terminal_t *connected_terminal() const noexcept { return m_connected_terminal; }
private:
@@ -833,7 +833,7 @@ namespace netlist
logic_input_t(core_device_t &dev, const pstring &aname,
nldelegate delegate = nldelegate());
- netlist_sig_t operator()() const noexcept
+ netlist_sig_t operator()() const NL_NOEXCEPT
{
return Q();
}
@@ -973,7 +973,7 @@ namespace netlist
COPYASSIGNMOVE(param_t, delete)
- param_type_t param_type() const;
+ param_type_t param_type() const noexcept(false);
protected:
virtual ~param_t() noexcept = default; /* not intended to be destroyed */
@@ -1309,7 +1309,7 @@ namespace netlist
using base_queue = timed_queue<plib::pqentry_t<net_t *, netlist_time>, false>;
using entry_t = plib::pqentry_t<net_t *, netlist_time>;
explicit queue_t(netlist_state_t &nl);
- virtual ~queue_t() noexcept = default;
+ virtual ~queue_t() noexcept override = default;
queue_t(const queue_t &) = delete;
queue_t(queue_t &&) = delete;
@@ -1328,7 +1328,7 @@ namespace netlist
std::vector<std::size_t> m_net_ids;
};
- }
+ } // namespace detail
// -----------------------------------------------------------------------------
// netlist_state__t
@@ -1452,13 +1452,14 @@ namespace netlist
* @param dev Device to be registered
*/
template <typename T>
- void register_device(const pstring &name, owned_pool_ptr<T> &&dev)
+ void register_device(const pstring &name, owned_pool_ptr<T> &&dev) noexcept(false)
{
for (auto & d : m_devices)
if (d.first == name)
{
dev.release();
log().fatal(MF_DUPLICATE_NAME_DEVICE_LIST(name));
+ plib::pthrow<nl_exception>(MF_DUPLICATE_NAME_DEVICE_LIST(name));
}
//m_devices.push_back(std::move(dev));
m_devices.insert(m_devices.end(), { name, std::move(dev) });
@@ -1680,7 +1681,10 @@ namespace netlist
bool err = false;
auto vald = plib::pstonum_ne<T>(p, err);
if (err)
+ {
device.state().log().fatal(MF_INVALID_NUMBER_CONVERSION_1_2(name, p));
+ plib::pthrow<nl_exception>(MF_INVALID_NUMBER_CONVERSION_1_2(name, p));
+ }
m_param = vald;
}
else
@@ -1700,7 +1704,10 @@ namespace netlist
T temp(val);
bool ok = temp.set_from_string(p);
if (!ok)
+ {
device.state().log().fatal(MF_INVALID_ENUM_CONVERSION_1_2(name, p));
+ plib::pthrow<nl_exception>(MF_INVALID_ENUM_CONVERSION_1_2(name, p));
+ }
m_param = temp;
}
@@ -1825,10 +1832,13 @@ namespace netlist
inline nl_fptype terminal_t::operator ()() const noexcept { return net().Q_Analog(); }
- inline void terminal_t::set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept
+ inline void terminal_t::set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept(false)
{
if (!(gt && go && Idr) && (gt || go || Idr))
+ {
state().log().fatal("Inconsistent nullptrs for terminal {}", name());
+ plib::pthrow<nl_exception>("Inconsistent nullptrs for terminal {}", name());
+ }
else
{
m_gt1 = gt;
diff --git a/src/lib/netlist/nl_factory.cpp b/src/lib/netlist/nl_factory.cpp
index 74e91ea2ee1..624d35975ad 100644
--- a/src/lib/netlist/nl_factory.cpp
+++ b/src/lib/netlist/nl_factory.cpp
@@ -56,7 +56,10 @@ namespace netlist { namespace factory
{
for (auto & e : *this)
if (e->name() == factory->name())
+ {
m_log.fatal(MF_FACTORY_ALREADY_CONTAINS_1(factory->name()));
+ plib::pthrow<nl_exception>(MF_FACTORY_ALREADY_CONTAINS_1(factory->name()));
+ }
push_back(std::move(factory));
}
@@ -69,7 +72,7 @@ namespace netlist { namespace factory
}
m_log.fatal(MF_CLASS_1_NOT_FOUND(devname));
- return nullptr; // appease code analysis
+ plib::pthrow<nl_exception>(MF_CLASS_1_NOT_FOUND(devname));
}
// -----------------------------------------------------------------------------
diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp
index 786365359b5..bcbf6d83525 100644
--- a/src/lib/netlist/nl_parser.cpp
+++ b/src/lib/netlist/nl_parser.cpp
@@ -19,7 +19,7 @@ namespace netlist
void parser_t::verror(const pstring &msg)
{
m_setup.log().fatal("{1}", msg);
-
+ plib::pthrow<nl_exception>(plib::pfmt("{1}")(msg));
//throw error;
}
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index 37eb34c5f97..67f441674b0 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -41,7 +41,10 @@ namespace netlist
{
std::vector<pstring> list(plib::psplit(terms,", "));
if (list.size() == 0 || (list.size() % 2) == 1)
+ {
log().fatal(MF_DIP_PINS_MUST_BE_AN_EQUAL_NUMBER_OF_PINS_1(build_fqn("")));
+ plib::pthrow<nl_exception>(MF_DIP_PINS_MUST_BE_AN_EQUAL_NUMBER_OF_PINS_1(build_fqn("")));
+ }
std::size_t n = list.size();
for (std::size_t i = 0; i < n / 2; i++)
{
@@ -54,14 +57,20 @@ namespace netlist
{
auto f = m_factory.factory_by_name(classname);
if (f == nullptr)
+ {
log().fatal(MF_CLASS_1_NOT_FOUND(classname));
+ plib::pthrow<nl_exception>(MF_CLASS_1_NOT_FOUND(classname));
+ }
else
{
/* make sure we parse macro library entries */
f->macro_actions(*this, name);
pstring key = build_fqn(name);
if (device_exists(key))
+ {
log().fatal(MF_DEVICE_ALREADY_EXISTS_1(name));
+ plib::pthrow<nl_exception>(MF_DEVICE_ALREADY_EXISTS_1(name));
+ }
else
m_device_factory.insert(m_device_factory.end(), {key, f});
}
@@ -76,7 +85,10 @@ namespace netlist
{
std::vector<pstring> list(plib::psplit(terms,", "));
if (list.size() < 2)
+ {
log().fatal(MF_NET_C_NEEDS_AT_LEAST_2_TERMINAL());
+ plib::pthrow<nl_exception>(MF_NET_C_NEEDS_AT_LEAST_2_TERMINAL());
+ }
for (std::size_t i = 1; i < list.size(); i++)
{
register_link(list[0], list[i]);
@@ -85,21 +97,13 @@ namespace netlist
void nlparse_t::include(const pstring &netlist_name)
{
-#if 0
- for (auto &base : m_sources)
- {
- auto source(dynamic_cast<source_netlist_t *>(base.get()));
- if (source && source->parse(*this, netlist_name))
- return;
- }
- log().fatal(MF_NOT_FOUND_IN_SOURCE_COLLECTION(netlist_name));
-#endif
if (m_sources.for_all<source_netlist_t>([this, &netlist_name] (source_netlist_t *src)
{
return src->parse(*this, netlist_name);
}))
return;
log().fatal(MF_NOT_FOUND_IN_SOURCE_COLLECTION(netlist_name));
+ plib::pthrow<nl_exception>(MF_NOT_FOUND_IN_SOURCE_COLLECTION(netlist_name));
}
@@ -134,7 +138,10 @@ namespace netlist
if (idx == m_param_values.end())
{
if (!m_param_values.insert({fqn, value}).second)
+ {
log().fatal(MF_ADDING_PARAMETER_1_TO_PARAMETER_LIST(param));
+ plib::pthrow<nl_exception>(MF_ADDING_PARAMETER_1_TO_PARAMETER_LIST(param));
+ }
}
else
{
@@ -174,7 +181,10 @@ namespace netlist
}
}
if (!found)
+ {
log().fatal(MF_FOUND_NO_OCCURRENCE_OF_1(attach));
+ plib::pthrow<nl_exception>(MF_FOUND_NO_OCCURRENCE_OF_1(attach));
+ }
register_link(attach, frontier_name + ".Q");
}
@@ -196,7 +206,11 @@ namespace netlist
void nlparse_t::register_alias_nofqn(const pstring &alias, const pstring &out)
{
if (!m_alias.insert({alias, out}).second)
+ {
log().fatal(MF_ADDING_ALI1_TO_ALIAS_LIST(alias));
+ plib::pthrow<nl_exception>(MF_ADDING_ALI1_TO_ALIAS_LIST(alias));
+ }
+
}
void nlparse_t::register_link_fqn(const pstring &sin, const pstring &sout)
@@ -245,10 +259,6 @@ setup_t::setup_t(netlist_state_t &nlstate)
{
}
-setup_t::~setup_t() noexcept
-{
-}
-
pstring setup_t::termtype_as_str(detail::core_terminal_t &in) const
{
switch (in.type())
@@ -260,8 +270,9 @@ pstring setup_t::termtype_as_str(detail::core_terminal_t &in) const
case detail::terminal_type::OUTPUT:
return "OUTPUT";
}
- log().fatal(MF_UNKNOWN_OBJECT_TYPE_1(static_cast<unsigned>(in.type())));
- return "Error";
+ // FIXME: in.type() will have thrown already
+ // log().fatal(MF_UNKNOWN_OBJECT_TYPE_1(static_cast<unsigned>(in.type())));
+ return "Error"; // Tease gcc
}
pstring setup_t::get_initial_param_val(const pstring &name, const pstring &def) const
@@ -275,11 +286,12 @@ pstring setup_t::get_initial_param_val(const pstring &name, const pstring &def)
void setup_t::register_term(detail::core_terminal_t &term)
{
+ 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()));
+ plib::pthrow<nl_exception>(MF_ADDING_1_2_TO_TERMINAL_LIST(termtype_as_str(term), term.name()));
}
- log().debug("{1} {2}\n", termtype_as_str(term), term.name());
}
void setup_t::remove_connections(const pstring &pin)
@@ -299,13 +311,19 @@ void setup_t::remove_connections(const pstring &pin)
link++;
}
if (!found)
+ {
log().fatal(MF_FOUND_NO_OCCURRENCE_OF_1(pin));
+ plib::pthrow<nl_exception>(MF_FOUND_NO_OCCURRENCE_OF_1(pin));
+ }
}
void setup_t::register_param_t(const pstring &name, param_t &param)
{
if (!m_params.insert({param.name(), param_ref_t(param.name(), param.device(), param)}).second)
+ {
log().fatal(MF_ADDING_PARAMETER_1_TO_PARAMETER_LIST(name));
+ plib::pthrow<nl_exception>(MF_ADDING_PARAMETER_1_TO_PARAMETER_LIST(name));
+ }
}
pstring setup_t::resolve_alias(const pstring &name) const
@@ -398,7 +416,10 @@ detail::core_terminal_t *setup_t::find_terminal(const pstring &terminal_in, bool
detail::core_terminal_t *term = (ret == m_terminals.end() ? nullptr : ret->second);
if (term == nullptr && required)
+ {
log().fatal(MF_TERMINAL_1_2_NOT_FOUND(terminal_in, tname));
+ plib::pthrow<nl_exception>(MF_TERMINAL_1_2_NOT_FOUND(terminal_in, tname));
+ }
if (term != nullptr)
log().debug("Found input {1}\n", tname);
return term;
@@ -416,14 +437,19 @@ detail::core_terminal_t *setup_t::find_terminal(const pstring &terminal_in,
ret = m_terminals.find(tname + ".Q");
}
if (ret == m_terminals.end() && required)
+ {
log().fatal(MF_TERMINAL_1_2_NOT_FOUND(terminal_in, tname));
-
+ plib::pthrow<nl_exception>(MF_TERMINAL_1_2_NOT_FOUND(terminal_in, tname));
+ }
detail::core_terminal_t *term = (ret == m_terminals.end() ? nullptr : ret->second);
if (term != nullptr && term->type() != atype)
{
if (required)
+ {
log().fatal(MF_OBJECT_1_2_WRONG_TYPE(terminal_in, tname));
+ plib::pthrow<nl_exception>(MF_OBJECT_1_2_WRONG_TYPE(terminal_in, tname));
+ }
else
term = nullptr;
}
@@ -440,7 +466,10 @@ param_t *setup_t::find_param(const pstring &param_in, bool required) const
const pstring &outname = resolve_alias(param_in_fqn);
auto ret = m_params.find(outname);
if (ret == m_params.end() && required)
+ {
log().fatal(MF_PARAMETER_1_2_NOT_FOUND(param_in_fqn, outname));
+ plib::pthrow<nl_exception>(MF_PARAMETER_1_2_NOT_FOUND(param_in_fqn, outname));
+ }
if (ret != m_params.end())
log().debug("Found parameter {1}\n", outname);
return (ret == m_params.end() ? nullptr : &ret->second.m_param);
@@ -466,8 +495,12 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(detail::core_terminal_t &out)
{
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()));
+ plib::pthrow<nl_exception>(MF_CONNECTING_1_TO_2(
+ new_proxy->proxy_term().name(), (*p).name()));
+ }
}
out.net().core_terms().clear(); // clear the list
@@ -509,8 +542,13 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp)
{
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()));
+ plib::pthrow<nl_exception>(MF_CONNECTING_1_TO_2(
+ ret->proxy_term().name(), (*p).name()));
+
+ }
}
inp.net().core_terms().clear(); // clear the list
}
@@ -530,7 +568,10 @@ void setup_t::merge_nets(detail::net_t &thisnet, detail::net_t &othernet)
}
if (thisnet.isRailNet() && othernet.isRailNet())
+ {
log().fatal(MF_MERGE_RAIL_NETS_1_AND_2(thisnet.name(), othernet.name()));
+ plib::pthrow<nl_exception>(MF_MERGE_RAIL_NETS_1_AND_2(thisnet.name(), othernet.name()));
+ }
if (othernet.isRailNet())
{
@@ -589,6 +630,7 @@ void setup_t::connect_terminal_input(terminal_t &term, detail::core_terminal_t &
else
{
log().fatal(MF_OBJECT_INPUT_TYPE_1(inp.name()));
+ plib::pthrow<nl_exception>(MF_OBJECT_INPUT_TYPE_1(inp.name()));
}
}
@@ -613,6 +655,7 @@ void setup_t::connect_terminal_output(terminal_t &in, detail::core_terminal_t &o
else
{
log().fatal(MF_OBJECT_OUTPUT_TYPE_1(out.name()));
+ plib::pthrow<nl_exception>(MF_OBJECT_OUTPUT_TYPE_1(out.name()));
}
}
@@ -703,13 +746,19 @@ bool setup_t::connect(detail::core_terminal_t &t1_in, detail::core_terminal_t &t
if (t1.is_type(detail::terminal_type::OUTPUT) && t2.is_type(detail::terminal_type::INPUT))
{
if (t2.has_net() && t2.net().isRailNet())
+ {
log().fatal(MF_INPUT_1_ALREADY_CONNECTED(t2.name()));
+ plib::pthrow<nl_exception>(MF_INPUT_1_ALREADY_CONNECTED(t2.name()));
+ }
connect_input_output(t2, t1);
}
else if (t1.is_type(detail::terminal_type::INPUT) && t2.is_type(detail::terminal_type::OUTPUT))
{
if (t1.has_net() && t1.net().isRailNet())
+ {
log().fatal(MF_INPUT_1_ALREADY_CONNECTED(t1.name()));
+ plib::pthrow<nl_exception>(MF_INPUT_1_ALREADY_CONNECTED(t1.name()));
+ }
connect_input_output(t1, t2);
}
else if (t1.is_type(detail::terminal_type::OUTPUT) && t2.is_type(detail::terminal_type::TERMINAL))
@@ -774,6 +823,7 @@ void setup_t::resolve_inputs()
log().warning(MF_CONNECTING_1_TO_2(setup().de_alias(link.first), setup().de_alias(link.second)));
log().fatal(MF_LINK_TRIES_EXCEEDED(m_netlist_params->m_max_link_loops()));
+ plib::pthrow<nl_exception>(MF_LINK_TRIES_EXCEEDED(m_netlist_params->m_max_link_loops()));
}
log().verbose("deleting empty nets ...");
@@ -808,7 +858,10 @@ void setup_t::resolve_inputs()
}
}
if (err)
+ {
log().fatal(MF_TERMINALS_WITHOUT_NET());
+ plib::pthrow<nl_exception>(MF_TERMINALS_WITHOUT_NET());
+ }
}
@@ -1125,7 +1178,10 @@ void setup_t::prepare_to_run()
bool err(false);
auto v = plib::pstonum_ne<nl_fptype>(p->second, err);
if (err || plib::abs(v - plib::floor(v)) > nlconst::magic(1e-6) )
+ {
log().fatal(MF_HND_VAL_NOT_SUPPORTED(p->second));
+ plib::pthrow<nl_exception>(MF_HND_VAL_NOT_SUPPORTED(p->second));
+ }
// FIXME comparison with zero
d.second->set_hint_deactivate(v == nlconst::zero());
}
@@ -1164,7 +1220,10 @@ void setup_t::prepare_to_run()
{
for (auto &p : m_nlstate.nets())
if (p->is_analog())
+ {
log().fatal(MF_NO_SOLVER());
+ plib::pthrow<nl_exception>(MF_NO_SOLVER());
+ }
}
else
solver->post_start();
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index 9c6e91e68dc..695c9553193 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -358,7 +358,7 @@ namespace netlist
public:
explicit setup_t(netlist_state_t &nlstate);
- ~setup_t() noexcept;
+ ~setup_t() noexcept = default;
COPYASSIGNMOVE(setup_t, delete)
@@ -369,9 +369,9 @@ namespace netlist
pstring get_initial_param_val(const pstring &name, const pstring &def) const;
- void register_term(detail::core_terminal_t &obj);
+ void register_term(detail::core_terminal_t &term);
- void remove_connections(const pstring &attach);
+ void remove_connections(const pstring &pin);
bool connect(detail::core_terminal_t &t1, detail::core_terminal_t &t2);
@@ -400,7 +400,7 @@ namespace netlist
/* needed by proxy */
detail::core_terminal_t *find_terminal(const pstring &outname_in, const detail::terminal_type atype, bool required = true) const;
- detail::core_terminal_t *find_terminal(const pstring &outname_in, bool required = true) const;
+ detail::core_terminal_t *find_terminal(const pstring &terminal_in, bool required = true) const;
/* core net handling */
@@ -425,7 +425,7 @@ namespace netlist
void merge_nets(detail::net_t &thisnet, detail::net_t &othernet);
- void connect_terminals(detail::core_terminal_t &in, detail::core_terminal_t &out);
+ void connect_terminals(detail::core_terminal_t &t1, detail::core_terminal_t &t2);
void connect_input_output(detail::core_terminal_t &in, detail::core_terminal_t &out);
void connect_terminal_output(terminal_t &in, detail::core_terminal_t &out);
void connect_terminal_input(terminal_t &term, detail::core_terminal_t &inp);
@@ -455,7 +455,7 @@ namespace netlist
{
public:
- source_string_t(const pstring &source)
+ explicit source_string_t(const pstring &source)
: source_netlist_t(), m_str(source)
{
}
@@ -471,7 +471,7 @@ namespace netlist
{
public:
- source_file_t(const pstring &filename)
+ explicit source_file_t(const pstring &filename)
: source_netlist_t(), m_filename(filename)
{
}
@@ -486,7 +486,7 @@ namespace netlist
class source_mem_t : public source_netlist_t
{
public:
- source_mem_t(const char *mem)
+ explicit source_mem_t(const char *mem)
: source_netlist_t(), m_str(mem)
{
}
diff --git a/src/lib/netlist/nltypes.h b/src/lib/netlist/nltypes.h
index 90c672af84c..a2ec1fa4ac1 100644
--- a/src/lib/netlist/nltypes.h
+++ b/src/lib/netlist/nltypes.h
@@ -104,7 +104,7 @@ namespace netlist
namespace detail {
/*! Enum specifying the type of object */
- enum terminal_type {
+ enum class terminal_type {
TERMINAL = 0, /*!< object is an analog terminal */
INPUT = 1, /*!< object is an input */
OUTPUT = 2, /*!< object is an output */
diff --git a/src/lib/netlist/plib/gmres.h b/src/lib/netlist/plib/gmres.h
index 992b8bab2a5..ab7e72bcb76 100644
--- a/src/lib/netlist/plib/gmres.h
+++ b/src/lib/netlist/plib/gmres.h
@@ -218,7 +218,7 @@ namespace plib
// FIXME: dirty hack to make this compile
static constexpr const std::size_t storage_N = plib::sizeabs<FT, SIZE>::ABS();
- gmres_t(std::size_t size)
+ explicit gmres_t(std::size_t size)
: residual(size)
, Ax(size)
, m_ht(RESTART +1, RESTART)
diff --git a/src/lib/netlist/plib/mat_cr.h b/src/lib/netlist/plib/mat_cr.h
index 96f3379c21b..c6dabbb9b22 100644
--- a/src/lib/netlist/plib/mat_cr.h
+++ b/src/lib/netlist/plib/mat_cr.h
@@ -13,11 +13,11 @@
#include "palloc.h"
#include "parray.h"
#include "pconfig.h"
+#include "pmath.h"
#include "pomp.h"
#include "pstate.h"
#include "ptypes.h"
#include "putil.h"
-#include "pmath.h"
#include <algorithm>
#include <array>
@@ -178,7 +178,7 @@ namespace plib
/* throws error if P(source)>P(destination) */
template <typename LUMAT>
- void slim_copy_from(LUMAT & src) noexcept
+ void slim_copy_from(LUMAT & src)
{
for (std::size_t r=0; r<src.size(); r++)
{
diff --git a/src/lib/netlist/plib/pchrono.h b/src/lib/netlist/plib/pchrono.h
index 869998cc1df..63c21a419d3 100644
--- a/src/lib/netlist/plib/pchrono.h
+++ b/src/lib/netlist/plib/pchrono.h
@@ -195,7 +195,7 @@ namespace plib {
struct guard_t
{
guard_t() = delete;
- guard_t(timer &m) noexcept : m_m(m) { m_m.m_time -= T::start(); }
+ explicit guard_t(timer &m) noexcept : m_m(m) { m_m.m_time -= T::start(); }
~guard_t() { m_m.m_time += T::stop(); ++m_m.m_count; }
COPYASSIGNMOVE(guard_t, default)
diff --git a/src/lib/netlist/plib/pexception.h b/src/lib/netlist/plib/pexception.h
index e6c350a04b3..ba99b71cf73 100644
--- a/src/lib/netlist/plib/pexception.h
+++ b/src/lib/netlist/plib/pexception.h
@@ -15,16 +15,26 @@
namespace plib {
- //============================================================
- // terminate
- //============================================================
-
- /*! Terminate the program
+ /*! Terminate the program.
*
* \note could be enhanced by setting a termination handler
*/
[[noreturn]] void terminate(const pstring &msg) noexcept;
+
+ ///! throw an exception.
+ ///
+ /// throws an exception E. The purpose is to clearly identify exception
+ /// throwing in the code
+ ///
+ /// @tparam E Type of exception to be thrown
+ ///
+ template<typename E, typename... Args>
+ [[noreturn]] static inline void pthrow(Args&&... args) noexcept(false)
+ {
+ throw E(std::forward<Args>(args)...);
+ }
+
//============================================================
// exception base
//============================================================
diff --git a/src/lib/netlist/plib/pfmtlog.cpp b/src/lib/netlist/plib/pfmtlog.cpp
index 44801e2d96b..8f6836fee0c 100644
--- a/src/lib/netlist/plib/pfmtlog.cpp
+++ b/src/lib/netlist/plib/pfmtlog.cpp
@@ -7,8 +7,8 @@
#include "pfmtlog.h"
#include "palloc.h"
-#include "pstrutil.h"
#include "pstonum.h"
+#include "pstrutil.h"
#include <algorithm>
#include <array>
@@ -48,6 +48,7 @@ pfmt::rtype pfmt::setfmt(std::stringstream &strm, char32_t cfmt_spec)
pstring fmt;
pstring search("{");
search += plib::to_string(m_arg);
+
rtype r;
r.sl = search.size();
@@ -93,17 +94,19 @@ pfmt::rtype pfmt::setfmt(std::stringstream &strm, char32_t cfmt_spec)
if (r.p != pstring::npos)
{
// a.b format here ...
+ char32_t pend(0);
+ int width(0);
if (fmt != "" && pstring("duxofge").find(static_cast<pstring::value_type>(cfmt_spec)) != pstring::npos)
{
- r.pend = static_cast<char32_t>(fmt.at(fmt.size() - 1));
- if (pstring("duxofge").find(static_cast<pstring::value_type>(r.pend)) == pstring::npos)
- r.pend = cfmt_spec;
+ pend = static_cast<char32_t>(fmt.at(fmt.size() - 1));
+ if (pstring("duxofge").find(static_cast<pstring::value_type>(pend)) == pstring::npos)
+ pend = cfmt_spec;
else
fmt = plib::left(fmt, fmt.size() - 1);
}
else
// FIXME: Error
- r.pend = cfmt_spec;
+ pend = cfmt_spec;
auto pdot(fmt.find('.'));
@@ -112,12 +115,18 @@ pfmt::rtype pfmt::setfmt(std::stringstream &strm, char32_t cfmt_spec)
else if (pdot != pstring::npos)
{
strm << std::setprecision(pstonum_ne_def<int>(fmt.substr(pdot + 1), 6));
- r.width = pstonum_ne_def<int>(left(fmt,pdot), 0);
+ width = pstonum_ne_def<int>(left(fmt,pdot), 0);
}
else if (fmt != "")
- r.width = pstonum_ne_def<int>(fmt, 0);
+ width = pstonum_ne_def<int>(fmt, 0);
+
+ auto aw(plib::abs(width));
+
+ strm << std::setw(aw);
+ if (width < 0)
+ strm << std::left;
- switch (r.pend)
+ switch (pend)
{
case 'x':
strm << std::hex;
diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h
index 489e16aea8e..fecb3dd95bd 100644
--- a/src/lib/netlist/plib/pfmtlog.h
+++ b/src/lib/netlist/plib/pfmtlog.h
@@ -28,7 +28,6 @@ P_ENUM(plog_level,
template <typename T>
struct ptype_traits_base
{
- static constexpr const T cast(const T &x) { return x; }
static constexpr const bool is_signed = std::numeric_limits<T>::is_signed;
static char32_t fmt_spec() { return 'u'; }
static inline void streamify(std::ostream &s, const T &v)
@@ -42,7 +41,6 @@ template <>
struct ptype_traits_base<__float128>
{
// FIXME: need native support at some time
- static constexpr const long double cast(const __float128 &x) { return static_cast<long double>(x); }
static constexpr const bool is_signed = true;
static char32_t fmt_spec() { return 'f'; }
static inline void streamify(std::ostream &s, const __float128 &v)
@@ -155,14 +153,12 @@ struct ptype_traits<__float128> : ptype_traits_base<__float128>
template<>
struct ptype_traits<char *> : ptype_traits_base<char *>
{
- static const char *cast(const char *x) { return x; }
static char32_t fmt_spec() { return 's'; }
};
template<>
struct ptype_traits<const char *> : ptype_traits_base<const char *>
{
- static const char *cast(const char *x) { return x; }
static char32_t fmt_spec() { return 's'; }
};
@@ -175,7 +171,6 @@ struct ptype_traits<std::string> : ptype_traits_base<std::string>
template<>
struct ptype_traits<const void *> : ptype_traits_base<const void *>
{
- static const void *cast(const void *x) { return x; }
static char32_t fmt_spec() { return 'p'; }
};
@@ -264,13 +259,10 @@ protected:
struct rtype
{
- rtype() : ret(0), p(0), sl(0), pend(0), width(0) {}
+ rtype() : ret(0), p(0), sl(0) {}
int ret;
pstring::size_type p;
pstring::size_type sl;
- char32_t pend;
- int width;
-
};
rtype setfmt(std::stringstream &strm, char32_t cfmt_spec);
@@ -283,8 +275,6 @@ protected:
template <typename T>
pfmt &format_element(const char32_t cfmt_spec, T &&v)
{
- //auto val = ptype_traits<typename std::decay<T>::type>::cast(std::forward<T>(v));
-
rtype ret;
m_arg++;
@@ -295,19 +285,9 @@ protected:
ret = setfmt(strm, cfmt_spec);
if (ret.ret>=0)
{
- //strm << val;
ptype_traits<typename std::decay<T>::type>::streamify(strm, std::forward<T>(v));
-
const pstring ps(strm.str());
- pstring pad("");
- auto aw(static_cast<std::size_t>(std::abs(ret.width)));
- if (aw > ps.length())
- pad = pstring(aw - ps.length(), ' ');
-
- if (ret.width > 0)
- m_str = m_str.substr(0, ret.p) + pad + ps + m_str.substr(ret.p + ret.sl);
- else
- m_str = m_str.substr(0, ret.p) + ps + pad + m_str.substr(ret.p + ret.sl);
+ m_str = m_str.substr(0, ret.p) + ps + m_str.substr(ret.p + ret.sl);
}
} while (ret.ret == 1);
@@ -332,7 +312,7 @@ public:
/* runtime enable */
template<bool enabled, typename... Args>
- void log(const pstring & fmt, Args&&... args) const
+ void log(const pstring & fmt, Args&&... args) const noexcept
{
if (build_enabled && enabled && m_enabled)
{
@@ -342,7 +322,7 @@ public:
}
template<typename... Args>
- void operator ()(const pstring &fmt, Args&&... args) const
+ void operator ()(const pstring &fmt, Args&&... args) const noexcept
{
if (build_enabled && m_enabled)
{
@@ -386,7 +366,7 @@ public:
~plog_channel() noexcept = default;
protected:
- void vdowrite(const pstring &ls) const
+ void vdowrite(const pstring &ls) const noexcept
{
m_base.vlog(L, ls);
}
diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp
index 5c3df2ed05d..5ac7478e197 100644
--- a/src/lib/netlist/plib/pfunction.cpp
+++ b/src/lib/netlist/plib/pfunction.cpp
@@ -8,10 +8,10 @@
#include "pfunction.h"
#include "pexception.h"
#include "pfmtlog.h"
-#include "pstrutil.h"
-#include "putil.h"
#include "pmath.h"
#include "pstonum.h"
+#include "pstrutil.h"
+#include "putil.h"
#include <stack>
diff --git a/src/lib/netlist/plib/pfunction.h b/src/lib/netlist/plib/pfunction.h
index e41efac4ac9..d62d79cc00d 100644
--- a/src/lib/netlist/plib/pfunction.h
+++ b/src/lib/netlist/plib/pfunction.h
@@ -8,10 +8,10 @@
#ifndef PFUNCTION_H_
#define PFUNCTION_H_
+#include "pmath.h"
#include "pstate.h"
#include "pstring.h"
#include "putil.h"
-#include "pmath.h"
#include <vector>
diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h
index 05514048f41..da75380d760 100644
--- a/src/lib/netlist/plib/plists.h
+++ b/src/lib/netlist/plib/plists.h
@@ -33,17 +33,17 @@ namespace plib {
{
public:
- typedef C value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef value_type* iterator;
- typedef const value_type* const_iterator;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ using value_type = C;
+ using pointer = value_type *;
+ using const_pointer = const value_type *;
+ using reference = value_type &;
+ using const_reference = const value_type &;
+ using iterator = value_type *;
+ using const_iterator = const value_type *;
+ using size_type = std::size_t;
+ using difference_type = std::ptrdiff_t;
+ using reverse_iterator = std::reverse_iterator<iterator>;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
//uninitialised_array_t() noexcept = default;
uninitialised_array_t() noexcept
@@ -55,7 +55,7 @@ namespace plib {
~uninitialised_array_t() noexcept
{
if (m_initialized>=N)
- for (size_type i=0; i<N; i++)
+ for (size_type i=0; i<N; ++i)
(*this)[i].~C();
}
diff --git a/src/lib/netlist/plib/pmath.h b/src/lib/netlist/plib/pmath.h
index acacd0a5ab1..1bfa12c5f26 100644
--- a/src/lib/netlist/plib/pmath.h
+++ b/src/lib/netlist/plib/pmath.h
@@ -11,8 +11,8 @@
#include "pconfig.h"
#include <algorithm>
-#include <type_traits>
#include <cmath>
+#include <type_traits>
#if (PUSE_FLOAT128)
#include <quadmath.h>
diff --git a/src/lib/netlist/plib/pmempool.h b/src/lib/netlist/plib/pmempool.h
index 3c87622bb07..1d4bb52694d 100644
--- a/src/lib/netlist/plib/pmempool.h
+++ b/src/lib/netlist/plib/pmempool.h
@@ -225,7 +225,7 @@ namespace plib {
}
}
- bool operator ==(const mempool &rhs) noexcept { return this == &rhs; }
+ bool operator ==(const mempool &rhs) const noexcept { return this == &rhs; }
};
diff --git a/src/lib/netlist/plib/poptions.h b/src/lib/netlist/plib/poptions.h
index b8d65e7832a..8420cf7e587 100644
--- a/src/lib/netlist/plib/poptions.h
+++ b/src/lib/netlist/plib/poptions.h
@@ -9,9 +9,9 @@
#define POPTIONS_H_
#include "plists.h"
+#include "pstonum.h"
#include "pstring.h"
#include "putil.h"
-#include "pstonum.h"
namespace plib {
/***************************************************************************
@@ -63,10 +63,10 @@ public:
/* no_argument options will be called with "" argument */
- pstring short_opt() { return m_short; }
- pstring long_opt() { return m_long; }
- bool has_argument() { return m_has_argument ; }
- bool was_specified() { return m_specified; }
+ pstring short_opt() const { return m_short; }
+ pstring long_opt() const { return m_long; }
+ bool has_argument() const { return m_has_argument ; }
+ bool was_specified() const { return m_specified; }
int do_parse(const pstring &argument)
{
diff --git a/src/lib/netlist/plib/ppreprocessor.cpp b/src/lib/netlist/plib/ppreprocessor.cpp
index 78146e7a18b..810e77e3d87 100644
--- a/src/lib/netlist/plib/ppreprocessor.cpp
+++ b/src/lib/netlist/plib/ppreprocessor.cpp
@@ -7,8 +7,8 @@
#include "ppreprocessor.h"
#include "palloc.h"
-#include "putil.h"
#include "pstonum.h"
+#include "putil.h"
namespace plib {
diff --git a/src/lib/netlist/plib/ppreprocessor.h b/src/lib/netlist/plib/ppreprocessor.h
index 1df9c2e5975..3dc924d3f67 100644
--- a/src/lib/netlist/plib/ppreprocessor.h
+++ b/src/lib/netlist/plib/ppreprocessor.h
@@ -31,7 +31,7 @@ namespace plib {
define_t(const pstring &name, const pstring &replace)
: m_name(name), m_replace(replace), m_has_params(false)
{}
- define_t(const pstring &name)
+ explicit define_t(const pstring &name)
: m_name(name), m_replace(""), m_has_params(false)
{}
pstring m_name;
@@ -54,9 +54,11 @@ namespace plib {
, m_expr_sep(std::move(s.m_expr_sep))
, m_if_flag(s.m_if_flag)
, m_if_level(s.m_if_level)
+ , m_stack(std::move(s.m_stack))
, m_outbuf(std::move(s.m_outbuf))
, m_pos(s.m_pos)
, m_state(s.m_state)
+ , m_line(std::move(s.m_line))
, m_comment(s.m_comment)
, m_debug_out(s.m_debug_out)
{
@@ -82,7 +84,8 @@ namespace plib {
class readbuffer : public std::streambuf
{
public:
- readbuffer(ppreprocessor *strm) : m_strm(strm), m_buf() { setg(nullptr, nullptr, nullptr); }
+ explicit readbuffer(ppreprocessor *strm) : m_strm(strm), m_buf()
+ { setg(nullptr, nullptr, nullptr); }
readbuffer(readbuffer &&rhs) noexcept : m_strm(rhs.m_strm), m_buf() {}
COPYASSIGN(readbuffer, delete)
readbuffer &operator=(readbuffer &&src) = delete;
diff --git a/src/lib/netlist/plib/pstate.h b/src/lib/netlist/plib/pstate.h
index f0f9e49db20..8dc6bf9424a 100644
--- a/src/lib/netlist/plib/pstate.h
+++ b/src/lib/netlist/plib/pstate.h
@@ -58,7 +58,7 @@ public:
virtual void on_post_load(state_manager_t &manager) = 0;
protected:
callback_t() = default;
- ~callback_t() = default;
+ virtual ~callback_t() = default;
COPYASSIGNMOVE(callback_t, default)
};
diff --git a/src/lib/netlist/plib/pstonum.h b/src/lib/netlist/plib/pstonum.h
index c73a348db9b..11c83603cfa 100644
--- a/src/lib/netlist/plib/pstonum.h
+++ b/src/lib/netlist/plib/pstonum.h
@@ -10,8 +10,8 @@
#include "pconfig.h"
#include "pexception.h"
-#include "pstring.h"
#include "pmath.h" // for pstonum
+#include "pstring.h"
#include <algorithm>
#include <initializer_list>
diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h
index 13903caa9b4..6b438e83c1a 100644
--- a/src/lib/netlist/plib/pstream.h
+++ b/src/lib/netlist/plib/pstream.h
@@ -117,13 +117,13 @@ private:
template <>
struct constructor_helper<putf8_reader>
{
- plib::unique_ptr<std::istream> operator()(putf8_reader &&s) { return std::move(s.m_strm); }
+ plib::unique_ptr<std::istream> operator()(putf8_reader &&s) const { return std::move(s.m_strm); }
};
template <>
struct constructor_helper<plib::unique_ptr<std::istream>>
{
- plib::unique_ptr<std::istream> operator()(plib::unique_ptr<std::istream> &&s) { return std::move(s); }
+ plib::unique_ptr<std::istream> operator()(plib::unique_ptr<std::istream> &&s) const { return std::move(s); }
};
diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp
index 359b61e247f..357bce847f1 100644
--- a/src/lib/netlist/plib/pstring.cpp
+++ b/src/lib/netlist/plib/pstring.cpp
@@ -27,8 +27,8 @@ int pstring_t<F>::compare(const pstring_t &right) const
auto ri = right.begin();
while (si != this->end() && ri != right.end() && *si == *ri)
{
- ri++;
- si++;
+ ++ri;
+ ++si;
}
if (si != this->end() && ri != right.end())
diff --git a/src/lib/netlist/plib/ptime.h b/src/lib/netlist/plib/ptime.h
index 77e1deb8307..4f1b5af445f 100644
--- a/src/lib/netlist/plib/ptime.h
+++ b/src/lib/netlist/plib/ptime.h
@@ -8,8 +8,8 @@
#define PTIME_H_
#include "pconfig.h"
-#include "ptypes.h"
#include "pmath.h" // std::floor
+#include "ptypes.h"
// ----------------------------------------------------------------------------------------
// netlist_time
@@ -42,8 +42,8 @@ namespace plib
constexpr explicit ptime(const internal_type nom, const internal_type den) noexcept
: m_time(nom * (RES / den)) { }
- C14CONSTEXPR ptime &operator+=(const ptime rhs) noexcept { m_time += rhs.m_time; return *this; }
- C14CONSTEXPR ptime &operator-=(const ptime rhs) noexcept { m_time -= rhs.m_time; return *this; }
+ C14CONSTEXPR ptime &operator+=(const ptime &rhs) noexcept { m_time += rhs.m_time; return *this; }
+ C14CONSTEXPR ptime &operator-=(const ptime &rhs) noexcept { m_time -= rhs.m_time; return *this; }
C14CONSTEXPR ptime &operator*=(const mult_type factor) noexcept { m_time *= static_cast<internal_type>(factor); return *this; }
friend constexpr const ptime operator-(ptime lhs, const ptime rhs) noexcept
diff --git a/src/lib/netlist/plib/ptokenizer.cpp b/src/lib/netlist/plib/ptokenizer.cpp
index bd5b7f09af3..0e8cabe4e8b 100644
--- a/src/lib/netlist/plib/ptokenizer.cpp
+++ b/src/lib/netlist/plib/ptokenizer.cpp
@@ -7,8 +7,8 @@
#include "ptokenizer.h"
#include "palloc.h"
-#include "putil.h"
#include "pstonum.h"
+#include "putil.h"
namespace plib {
diff --git a/src/lib/netlist/plib/ptokenizer.h b/src/lib/netlist/plib/ptokenizer.h
index cb6b0dac7f9..b6f8411eaa3 100644
--- a/src/lib/netlist/plib/ptokenizer.h
+++ b/src/lib/netlist/plib/ptokenizer.h
@@ -23,7 +23,7 @@ namespace plib {
{
public:
template <typename T>
- ptokenizer(T &&strm) // NOLINT(misc-forwarding-reference-overload, bugprone-forwarding-reference-overload)
+ explicit ptokenizer(T &&strm) // NOLINT(misc-forwarding-reference-overload, bugprone-forwarding-reference-overload)
: m_strm(std::forward<T>(strm))
, m_cur_line("")
, m_px(m_cur_line.begin())
@@ -139,7 +139,7 @@ namespace plib {
pstring::value_type getc();
void ungetc(pstring::value_type c);
- bool eof() { return m_strm.eof(); }
+ bool eof() const { return m_strm.eof(); }
putf8_reader m_strm;
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index d1d9ceb89e0..ed4659a12b1 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -150,7 +150,7 @@ NETLIST_END()
class netlist_data_folder_t : public netlist::source_data_t
{
public:
- netlist_data_folder_t(const pstring &folder)
+ explicit netlist_data_folder_t(const pstring &folder)
: netlist::source_data_t()
, m_folder(folder)
{
@@ -176,7 +176,7 @@ private:
class netlist_tool_callbacks_t : public netlist::callbacks_t
{
public:
- netlist_tool_callbacks_t(tool_app_t &app)
+ explicit netlist_tool_callbacks_t(tool_app_t &app)
: netlist::callbacks_t()
, m_app(app)
{ }
@@ -196,10 +196,6 @@ public:
{
}
- void init()
- {
- }
-
netlist::setup_t &setup() { return nlstate().setup(); }
void read_netlist(const pstring &filename, const pstring &name,
@@ -384,7 +380,6 @@ void tool_app_t::run()
//plib::perftime_t<plib::exact_ticks> t;
nt.enable_stats(opt_stats());
- nt.init();
if (!opt_verb())
nt.log().verbose.set_enabled(false);
@@ -470,7 +465,6 @@ void tool_app_t::run()
void tool_app_t::validate()
{
- std::vector<input_t> inps;
netlist_tool_t nt(*this, "netlist");
if (!opt_verb())
@@ -485,8 +479,6 @@ void tool_app_t::validate()
try
{
- nt.init();
-
nt.read_netlist(opt_file(), opt_name(),
opt_logs(),
m_defines, opt_rfolders(), opt_includes());
@@ -515,8 +507,6 @@ void tool_app_t::static_compile()
netlist_tool_t nt(*this, "netlist");
- nt.init();
-
nt.log().verbose.set_enabled(false);
nt.log().info.set_enabled(false);
nt.log().warning.set_enabled(false);
@@ -623,8 +613,6 @@ void tool_app_t::create_header()
{
netlist_tool_t nt(*this, "netlist");
- nt.init();
-
nt.log().verbose.set_enabled(false);
nt.log().info.set_enabled(false);
@@ -667,8 +655,6 @@ void tool_app_t::create_docheader()
{
netlist_tool_t nt(*this, "netlist");
- nt.init();
-
nt.log().verbose.set_enabled(false);
nt.log().info.set_enabled(false);
@@ -716,7 +702,6 @@ void tool_app_t::create_docheader()
void tool_app_t::listdevices()
{
netlist_tool_t nt(*this, "netlist");
- nt.init();
nt.log().verbose.set_enabled(false);
nt.log().info.set_enabled(false);
@@ -726,8 +711,6 @@ void tool_app_t::listdevices()
nt.setup().register_source(plib::make_unique<netlist::source_proc_t>("dummy", &netlist_dummy));
nt.setup().include("dummy");
-
-
nt.setup().prepare_to_run();
std::vector<netlist::unique_pool_ptr<netlist::core_device_t>> devs;
diff --git a/src/lib/netlist/prg/nlwav.cpp b/src/lib/netlist/prg/nlwav.cpp
index d2ae6f14c28..fdc038c68c9 100644
--- a/src/lib/netlist/prg/nlwav.cpp
+++ b/src/lib/netlist/prg/nlwav.cpp
@@ -53,8 +53,8 @@ public:
}
}
- std::size_t channels() { return m_fmt.channels; }
- std::size_t sample_rate() { return m_fmt.sample_rate; }
+ std::size_t channels() const { return m_fmt.channels; }
+ std::size_t sample_rate() const { return m_fmt.sample_rate; }
template <typename T>
void write(const T &val)
@@ -101,7 +101,7 @@ private:
struct riff_data_t
{
- riff_data_t(uint32_t alen) : len(alen) {}
+ explicit riff_data_t(uint32_t alen) : len(alen) {}
std::array<uint8_t, 4> signature = {{'d','a','t','a'}};
uint32_t len;
// data follows
diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp
index 6082ebb3194..0a368207233 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.cpp
+++ b/src/lib/netlist/solver/nld_matrix_solver.cpp
@@ -77,7 +77,7 @@ namespace solver
{
analog_net_t *net = nets[k];
- log().debug("setting up net\n");
+ log().debug("adding net with {1} populated connections\n", net->core_terms().size());
net->set_solver(this);
@@ -125,10 +125,9 @@ namespace solver
break;
case detail::terminal_type::OUTPUT:
log().fatal(MF_UNHANDLED_ELEMENT_1_FOUND(p->name()));
- break;
+ plib::pthrow<nl_exception>(MF_UNHANDLED_ELEMENT_1_FOUND(p->name()));
}
}
- log().debug("added net with {1} populated connections\n", net->core_terms().size());
}
}
@@ -401,7 +400,7 @@ namespace solver
void matrix_solver_t::step(const netlist_time &delta)
{
- const nl_fptype dd = delta.as_fp<nl_fptype>();
+ const auto dd(delta.as_fp<nl_fptype>());
for (auto &d : m_step_devices)
d->timestep(dd);
}
@@ -521,24 +520,25 @@ namespace solver
}
}
- void matrix_solver_t::add_term(std::size_t k, terminal_t *term)
+ void matrix_solver_t::add_term(std::size_t net_idx, terminal_t *term)
{
if (term->connected_terminal()->net().isRailNet())
{
- m_rails_temp[k].add_terminal(term, -1, false);
+ m_rails_temp[net_idx].add_terminal(term, -1, false);
}
else
{
int ot = get_net_idx(&term->connected_terminal()->net());
if (ot>=0)
{
- m_terms[k].add_terminal(term, ot, true);
+ m_terms[net_idx].add_terminal(term, ot, true);
}
/* Should this be allowed ? */
else // if (ot<0)
{
- m_rails_temp[k].add_terminal(term, ot, true);
+ m_rails_temp[net_idx].add_terminal(term, ot, true);
log().fatal(MF_FOUND_TERM_WITH_MISSING_OTHERNET(term->name()));
+ plib::pthrow<nl_exception>(MF_FOUND_TERM_WITH_MISSING_OTHERNET(term->name()));
}
}
}
diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h
index fba615e5af8..90c13e6a974 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.h
+++ b/src/lib/netlist/solver/nld_matrix_solver.h
@@ -205,7 +205,7 @@ namespace solver
public:
int get_net_idx(const analog_net_t *net) const noexcept;
- std::pair<int, int> get_left_right_of_diag(std::size_t row, std::size_t diag);
+ std::pair<int, int> get_left_right_of_diag(std::size_t irow, std::size_t idiag);
nl_fptype get_weight_around_diag(std::size_t row, std::size_t diag);
virtual void log_stats();
@@ -231,7 +231,7 @@ namespace solver
virtual unsigned vsolve_non_dynamic(const bool newton_raphson) = 0;
virtual netlist_time compute_next_timestep(const nl_fptype cur_ts) = 0;
- void add_term(std::size_t net_idx, terminal_t *term);
+ void add_term(std::size_t net_idx, terminal_t *term);
std::size_t max_railstart() const noexcept
{
diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h
index acd90c7fdaf..fbc59fef598 100644
--- a/src/lib/netlist/solver/nld_ms_gmres.h
+++ b/src/lib/netlist/solver/nld_ms_gmres.h
@@ -109,7 +109,7 @@ namespace solver
this->m_new_V[k] = this->m_terms[k].template getV<float_type>();
}
- const float_type accuracy = static_cast<float_type>(this->m_params.m_accuracy);
+ const auto accuracy(static_cast<float_type>(this->m_params.m_accuracy));
auto iter = std::max(plib::constants<std::size_t>::one(), this->m_params.m_gs_loops());
auto gsl = m_gmres.solve(m_ops, this->m_new_V, this->m_RHS, iter, accuracy);
diff --git a/src/lib/netlist/solver/nld_ms_sm.h b/src/lib/netlist/solver/nld_ms_sm.h
index 0d62911bc3d..13a38c34946 100644
--- a/src/lib/netlist/solver/nld_ms_sm.h
+++ b/src/lib/netlist/solver/nld_ms_sm.h
@@ -84,7 +84,7 @@ namespace solver
template <typename T1, typename T2>
float_ext_type &Ainv(const T1 &r, const T2 &c) { return m_Ainv[r][c]; }
template <typename T1>
- float_ext_type &RHS(const T1 &r) { return m_RHS[r]; }
+ float_ext_type &RHS(const T1 &r) { return this->m_RHS[r]; }
template <typename T1, typename T2>
@@ -99,7 +99,6 @@ namespace solver
array2D<float_ext_type, storage_N, m_pitch> m_A;
array2D<float_ext_type, storage_N, m_pitch> m_Ainv;
array2D<float_ext_type, storage_N, m_pitch> m_W;
- std::array<float_ext_type, storage_N> m_RHS; // right hand side - contains currents
array2D<float_ext_type, storage_N, m_pitch> m_lA;
array2D<float_ext_type, storage_N, m_pitch> m_lAinv;
diff --git a/src/lib/netlist/solver/nld_ms_w.h b/src/lib/netlist/solver/nld_ms_w.h
index 5e47e93d171..eaf793146d3 100644
--- a/src/lib/netlist/solver/nld_ms_w.h
+++ b/src/lib/netlist/solver/nld_ms_w.h
@@ -93,7 +93,7 @@ namespace solver
template <typename T1, typename T2>
float_ext_type &Ainv(const T1 &r, const T2 &c) { return m_Ainv[c][r]; }
template <typename T1>
- float_ext_type &RHS(const T1 &r) { return m_RHS[r]; }
+ float_ext_type &RHS(const T1 &r) { return this->m_RHS[r]; }
template <typename T1, typename T2>
@@ -107,7 +107,6 @@ namespace solver
array2D<float_ext_type, storage_N, m_pitch> m_A;
array2D<float_ext_type, storage_N, m_pitch> m_Ainv;
array2D<float_ext_type, storage_N, m_pitch> m_W;
- std::array<float_ext_type, storage_N> m_RHS; // right hand side - contains currents
array2D<float_ext_type, storage_N, m_pitch> m_lA;
diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp
index 53e2c539198..4e5dc6632ff 100644
--- a/src/lib/netlist/tools/nl_convert.cpp
+++ b/src/lib/netlist/tools/nl_convert.cpp
@@ -6,8 +6,8 @@
*/
#include "plib/palloc.h"
-#include "plib/putil.h"
#include "plib/pstonum.h"
+#include "plib/putil.h"
#include "nl_convert.h"
diff --git a/src/lib/netlist/tools/nl_convert.h b/src/lib/netlist/tools/nl_convert.h
index 6c8765e7d16..13af926a5af 100644
--- a/src/lib/netlist/tools/nl_convert.h
+++ b/src/lib/netlist/tools/nl_convert.h
@@ -60,10 +60,10 @@ private:
explicit net_t(pstring aname)
: m_name(std::move(aname)), m_no_export(false) {}
- const pstring &name() { return m_name;}
- std::vector<pstring> &terminals() { return m_terminals; }
+ const pstring &name() const { return m_name;}
+ std::vector<pstring> &terminals(){ return m_terminals; }
void set_no_export() { m_no_export = true; }
- bool is_no_export() { return m_no_export; }
+ bool is_no_export() const { return m_no_export; }
private:
pstring m_name;
@@ -98,13 +98,13 @@ private:
, m_has_val(false)
{}
- const pstring &name() { return m_name;}
- const pstring &type() { return m_type;}
- const pstring &model() { return m_model;}
- double value() { return m_val;}
+ const pstring &name() const { return m_name;}
+ const pstring &type() const { return m_type;}
+ const pstring &model() const { return m_model;}
+ double value() const { return m_val;}
- bool has_model() { return m_model != ""; }
- bool has_value() { return m_has_val; }
+ bool has_model() const { return m_model != ""; }
+ bool has_value() const { return m_has_val; }
private:
pstring m_type;
@@ -126,8 +126,8 @@ private:
pin_alias_t(pstring name, pstring alias)
: m_name(std::move(name)), m_alias(std::move(alias))
{}
- const pstring &name() { return m_name; }
- const pstring &alias() { return m_alias; }
+ const pstring &name() const { return m_name; }
+ const pstring &alias() const { return m_alias; }
private:
pstring m_name;
pstring m_alias;