diff options
author | 2019-10-06 23:50:13 +0200 | |
---|---|---|
committer | 2019-10-06 23:50:13 +0200 | |
commit | 545f8069ef6d0095464479f4f90d3c7240d96a37 (patch) | |
tree | e6881a9ea485e5a38b13f143634831ddad2b83d0 | |
parent | 38fd19fe301c3be1cb7942ca4272687928ddf4e6 (diff) |
netlist: maintenance and lint fixes. (nw)
29 files changed, 107 insertions, 94 deletions
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index 03a2b7b98b5..2c5b9cc85a1 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -347,7 +347,7 @@ static bool rom_exists(device_t &root, pstring name) { if (ROMENTRY_ISREGION(romp)) // if this is a region, check for rom { - char const *const basetag = romp->name; + auto basetag(pstring(romp->name)); if (name == pstring(":") + basetag) return true; } @@ -1135,9 +1135,9 @@ void netlist_mame_device::device_start() common_dev_start(m_netlist.get()); - m_netlist->nlstate().save(*this, m_rem, this->name(), "m_rem"); - m_netlist->nlstate().save(*this, m_div, this->name(), "m_div"); - m_netlist->nlstate().save(*this, m_old, this->name(), "m_old"); + m_netlist->nlstate().save(*this, m_rem, pstring(this->name()), "m_rem"); + m_netlist->nlstate().save(*this, m_div, pstring(this->name()), "m_div"); + m_netlist->nlstate().save(*this, m_old, pstring(this->name()), "m_old"); save_state(); diff --git a/src/lib/netlist/analog/nlid_twoterm.h b/src/lib/netlist/analog/nlid_twoterm.h index a6743968b6e..f1931a2f81e 100644 --- a/src/lib/netlist/analog/nlid_twoterm.h +++ b/src/lib/netlist/analog/nlid_twoterm.h @@ -402,7 +402,7 @@ namespace analog register_subalias("P", m_P); register_subalias("N", m_N); if (m_func() != "") - m_compiled.compile(std::vector<pstring>({{"T"}}), m_func()); + m_compiled.compile(std::vector<pstring>({{pstring("T")}}), m_func()); } NETLIB_IS_TIMESTEP(m_func() != "") @@ -451,7 +451,7 @@ namespace analog register_subalias("P", m_P); register_subalias("N", m_N); if (m_func() != "") - m_compiled.compile(std::vector<pstring>({{"T"}}), m_func()); + m_compiled.compile(std::vector<pstring>({{pstring("T")}}), m_func()); } NETLIB_IS_TIMESTEP(m_func() != "") diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile index b0e69754b41..9918c90c48a 100644 --- a/src/lib/netlist/build/makefile +++ b/src/lib/netlist/build/makefile @@ -30,7 +30,7 @@ space += TIDY_FLAGS = $(subst $(space),,$(TIDY_FLAGSX)) TIDY_SOURCES = $(SOURCES) -#TIDY_SOURCES = $(SRC)/plib/pparser.cpp +#TIDY_SOURCES = $(SRC)/solver/nld_solver.cpp #TIDY_FLAGS = -checks=llvm-include-order,llvm-namespace-comment,modernize-use-override,modernize-use-using -fix #TIDY_FLAGS = -checks=llvm-include-order -fix diff --git a/src/lib/netlist/devices/net_lib.cpp b/src/lib/netlist/devices/net_lib.cpp index 1e2ff8aae09..d13f3271135 100644 --- a/src/lib/netlist/devices/net_lib.cpp +++ b/src/lib/netlist/devices/net_lib.cpp @@ -16,7 +16,7 @@ #define xstr(s) # s #define NETLIB_DEVICE_DECL(chip) extern factory::constructor_ptr_t decl_ ## chip -#define LIB_DECL(nic, decl) factory.register_device( decl ( pstring(xstr(nic))) ); +#define LIB_DECL(nic, decl) factory.register_device( decl ( xstr(nic)) ); #define LIB_ENTRY(nic) { NETLIB_DEVICE_DECL(nic); LIB_DECL(NETLIB_NAME(nic), decl_ ## nic) } namespace netlist diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h index 31e3ebcc7f4..8d9c4f86039 100644 --- a/src/lib/netlist/devices/nlid_system.h +++ b/src/lib/netlist/devices/nlid_system.h @@ -131,7 +131,7 @@ namespace devices , m_funcparam({0.0}) { if (m_func() != "") - m_compiled.compile(std::vector<pstring>({{"T"}}), m_func()); + m_compiled.compile(std::vector<pstring>({{pstring("T")}}), m_func()); connect(m_feedback, m_Q); } //NETLIB_RESETI(); @@ -435,7 +435,8 @@ namespace devices class nld_power_pins { public: - nld_power_pins(device_t &owner, const char *sVCC = "VCC", const char *sGND = "GND", bool force_analog_input = false) + nld_power_pins(device_t &owner, const pstring &sVCC = "VCC", + const pstring &sGND = "GND", bool force_analog_input = false) { if (owner.setup().is_validation() || force_analog_input) { diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index 5204ce55f01..9946bc8cd43 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -1384,12 +1384,12 @@ namespace netlist template<typename O, typename C> void save(O &owner, C &state, const pstring &module, const pstring &stname) { - this->run_state_manager().save_item(static_cast<void *>(&owner), state, module + pstring(".") + stname); + this->run_state_manager().save_item(static_cast<void *>(&owner), state, module + "." + stname); } template<typename O, typename C> void save(O &owner, C *state, const pstring &module, const pstring &stname, const std::size_t count) { - this->run_state_manager().save_state_ptr(static_cast<void *>(&owner), module + pstring(".") + stname, plib::state_manager_t::dtype<C>(), count, state); + this->run_state_manager().save_state_ptr(static_cast<void *>(&owner), module + "." + stname, plib::state_manager_t::dtype<C>(), count, state); } detail::net_t *find_net(const pstring &name) const; diff --git a/src/lib/netlist/nl_errstr.h b/src/lib/netlist/nl_errstr.h index bbdc9688d94..5e5a7037445 100644 --- a/src/lib/netlist/nl_errstr.h +++ b/src/lib/netlist/nl_errstr.h @@ -30,8 +30,8 @@ namespace netlist { - static constexpr const char * sHINT_NO_DEACTIVATE = ".HINT_NO_DEACTIVATE"; - static constexpr const char * sPowerDevRes = "_RVG"; + static constexpr const char sHINT_NO_DEACTIVATE[] = ".HINT_NO_DEACTIVATE"; + static constexpr const char sPowerDevRes[] = "_RVG"; // nl_base.cpp diff --git a/src/lib/netlist/nl_factory.h b/src/lib/netlist/nl_factory.h index 271bf72bf90..b0c73a6a198 100644 --- a/src/lib/netlist/nl_factory.h +++ b/src/lib/netlist/nl_factory.h @@ -28,7 +28,7 @@ static plib::unique_ptr<factory::element_t> NETLIB_NAME(p_alias ## _c) \ (const pstring &classname) \ { \ - return plib::make_unique<factory::device_element_t<ns :: NETLIB_NAME(chip)>>(p_name, classname, p_def_param, pstring(__FILE__)); \ + return plib::make_unique<factory::device_element_t<ns :: NETLIB_NAME(chip)>>(p_name, classname, p_def_param, __FILE__); \ } \ \ factory::constructor_ptr_t decl_ ## p_alias = NETLIB_NAME(p_alias ## _c); diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp index a2cc7b31b93..2ab43c99074 100644 --- a/src/lib/netlist/nl_parser.cpp +++ b/src/lib/netlist/nl_parser.cpp @@ -28,7 +28,6 @@ bool parser_t::parse(const pstring &nlname) { this->identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-") .number_chars(".0123456789", "0123456789eE-.") //FIXME: processing of numbers - //set_whitespace(pstring("").cat(' ').cat(9).cat(10).cat(13)); .whitespace(pstring("") + ' ' + static_cast<char>(9) + static_cast<char>(10) + static_cast<char>(13)) .comment("/*", "*/", "//"); m_tok_param_left = register_token("("); diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index f04eeaa13a0..5d6f283bf56 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -252,14 +252,14 @@ pstring setup_t::termtype_as_str(detail::core_terminal_t &in) const switch (in.type()) { case detail::terminal_type::TERMINAL: - return pstring("TERMINAL"); + return "TERMINAL"; case detail::terminal_type::INPUT: - return pstring("INPUT"); + return "INPUT"; case detail::terminal_type::OUTPUT: - return pstring("OUTPUT"); + return "OUTPUT"; } log().fatal(MF_UNKNOWN_OBJECT_TYPE_1(static_cast<unsigned>(in.type()))); - return pstring("Error"); + return "Error"; } pstring setup_t::get_initial_param_val(const pstring &name, const pstring &def) const @@ -577,7 +577,7 @@ void setup_t::connect_terminal_input(terminal_t &term, detail::core_terminal_t & else if (inp.is_logic()) { log().verbose("connect terminal {1} (in, {2}) to {3}\n", inp.name(), - inp.is_analog() ? pstring("analog") : inp.is_logic() ? pstring("logic") : pstring("?"), term.name()); + inp.is_analog() ? "analog" : inp.is_logic() ? "logic" : "?", term.name()); auto proxy = get_a_d_proxy(inp); //out.net().register_con(proxy->proxy_term()); diff --git a/src/lib/netlist/plib/gmres.h b/src/lib/netlist/plib/gmres.h index 42a869a172d..c76c257ce21 100644 --- a/src/lib/netlist/plib/gmres.h +++ b/src/lib/netlist/plib/gmres.h @@ -154,6 +154,7 @@ namespace plib template<typename V> void solve_LU_inplace(V &v) { + plib::unused_var(v); } plib::matrix_compressed_rows_t<FT, SIZE> m_mat; diff --git a/src/lib/netlist/plib/mat_cr.h b/src/lib/netlist/plib/mat_cr.h index d5d086f2fd3..340c6305e96 100644 --- a/src/lib/netlist/plib/mat_cr.h +++ b/src/lib/netlist/plib/mat_cr.h @@ -183,7 +183,7 @@ namespace plib /* build ilu_rows */ index_type p(0); - for (std::size_t k=1; k < size(); k++) + for (index_type k=1; k < size(); k++) if (row_idx[k] < diag[k]) ilu_rows[p++] = k; ilu_rows[p] = 0; // end of array @@ -421,9 +421,8 @@ namespace plib * */ - //for (std::size_t i = 1; i < size(); i++) // row i index_type p(0); - while (std::size_t i = ilu_rows[p++]) // row i + while (std::size_t i = ilu_rows[p++]) // NOLINT(bugprone-infinite-loop) { const std::size_t p_i_end = row_idx[i + 1]; // loop over all columns k left of diag in row i diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp index efbdcee6b6b..1e3c53cd7c6 100644 --- a/src/lib/netlist/plib/pfunction.cpp +++ b/src/lib/netlist/plib/pfunction.cpp @@ -115,7 +115,7 @@ void pfunction::compile_infix(const std::vector<pstring> &inputs, const pstring { // Shunting-yard infix parsing std::vector<pstring> sep = {"(", ")", ",", "*", "/", "+", "-", "^"}; - std::vector<pstring> sexpr(plib::psplit(plib::replace_all(expr, pstring(" "), pstring("")), sep)); + std::vector<pstring> sexpr(plib::psplit(plib::replace_all(expr, " ", ""), sep)); std::stack<pstring> opstk; std::vector<pstring> postfix; diff --git a/src/lib/netlist/plib/pmempool.h b/src/lib/netlist/plib/pmempool.h index 15948c88ea0..7dff02cf573 100644 --- a/src/lib/netlist/plib/pmempool.h +++ b/src/lib/netlist/plib/pmempool.h @@ -32,19 +32,19 @@ namespace plib { private: struct block { - block(mempool *mp, std::size_t min_bytes) + block(mempool &mp, std::size_t min_bytes) : m_num_alloc(0) , m_cur(0) , m_data(nullptr) , m_mempool(mp) { - min_bytes = std::max(mp->m_min_alloc, min_bytes); + min_bytes = std::max(mp.m_min_alloc, min_bytes); m_free = min_bytes; - std::size_t alloc_bytes = (min_bytes + mp->m_min_align); // - 1); // & ~(mp->m_min_align - 1); + std::size_t alloc_bytes = (min_bytes + mp.m_min_align); // - 1); // & ~(mp.m_min_align - 1); //m_data_allocated = ::operator new(alloc_bytes); m_data_allocated = new char[alloc_bytes]; void *r = m_data_allocated; - std::align(mp->m_min_align, min_bytes, r, alloc_bytes); + std::align(mp.m_min_align, min_bytes, r, alloc_bytes); m_data = reinterpret_cast<char *>(r); } ~block() @@ -63,7 +63,7 @@ namespace plib { std::size_t m_cur; char *m_data; char *m_data_allocated; - mempool *m_mempool; + mempool &m_mempool; }; struct info @@ -79,7 +79,7 @@ namespace plib { block * new_block(std::size_t min_bytes) { - auto *b = plib::pnew<block>(this, min_bytes); + auto *b = plib::pnew<block>(*this, min_bytes); m_blocks.push_back(b); return b; } @@ -170,12 +170,12 @@ namespace plib { //printf("Freeing in block %p %lu\n", b, b->m_num_alloc); if (b->m_num_alloc == 0) { - mempool *mp = b->m_mempool; - auto itb = std::find(mp->m_blocks.begin(), mp->m_blocks.end(), b); - if (itb == mp->m_blocks.end()) + mempool &mp = b->m_mempool; + auto itb = std::find(mp.m_blocks.begin(), mp.m_blocks.end(), b); + if (itb == mp.m_blocks.end()) plib::terminate("mempool::free - block not found\n"); - mp->m_blocks.erase(itb); + mp.m_blocks.erase(itb); plib::pdelete(b); } sinfo().erase(it); diff --git a/src/lib/netlist/plib/poptions.cpp b/src/lib/netlist/plib/poptions.cpp index fa9a343815e..01ef226cc26 100644 --- a/src/lib/netlist/plib/poptions.cpp +++ b/src/lib/netlist/plib/poptions.cpp @@ -111,7 +111,7 @@ namespace plib { if (!seen_other_args && plib::startsWith(arg, "--")) { auto v = psplit(arg.substr(2),"="); - if (v.size() && v[0] != pstring("")) + if (v.size() && v[0] != "") { opt = getopt_long(v[0]); has_equal_arg = (v.size() > 1); diff --git a/src/lib/netlist/plib/pparser.cpp b/src/lib/netlist/plib/pparser.cpp index d257de3d3a8..c2134e50afb 100644 --- a/src/lib/netlist/plib/pparser.cpp +++ b/src/lib/netlist/plib/pparser.cpp @@ -465,7 +465,7 @@ pstring ppreprocessor::process_line(pstring line) line = process_comments(m_line); - pstring lt = plib::trim(plib::replace_all(line, pstring("\t"), pstring(" "))); + pstring lt = plib::trim(plib::replace_all(line, "\t", " ")); pstring ret; // FIXME ... revise and extend macro handling if (plib::startsWith(lt, "#")) @@ -476,7 +476,7 @@ pstring ppreprocessor::process_line(pstring line) m_level++; std::size_t start = 0; lt = replace_macros(lt); - std::vector<pstring> t(psplit(replace_all(lt.substr(3), pstring(" "), pstring("")), m_expr_sep)); + std::vector<pstring> t(psplit(replace_all(lt.substr(3), " ", ""), m_expr_sep)); auto val = static_cast<int>(expr(t, start, 255)); if (val == 0) m_ifflag |= (1 << m_level); diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h index b6fb7f8d942..160a687c364 100644 --- a/src/lib/netlist/plib/pstream.h +++ b/src/lib/netlist/plib/pstream.h @@ -59,7 +59,7 @@ public: bool readline(pstring &line) { putf8string::code_t c = 0; - m_linebuf = ""; + m_linebuf = putf8string(""); if (!this->readcode(c)) { line = ""; @@ -74,7 +74,7 @@ public: if (!this->readcode(c)) break; } - line = m_linebuf.c_str(); + line = m_linebuf; return true; } @@ -153,7 +153,7 @@ public: void write(const pstring::value_type c) const { - pstring t = pstring("") + c; + pstring t(1,c); write(t); } @@ -301,7 +301,7 @@ namespace filesystem template< class Source > pstring /*path */ u8path( const Source& source ) { - return pstring(source); + return source; } } // namespace filesystem diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h index 4806c3c9fb3..c07fbeeae9d 100644 --- a/src/lib/netlist/plib/pstring.h +++ b/src/lib/netlist/plib/pstring.h @@ -94,20 +94,23 @@ public: pstring_t() = default; ~pstring_t() noexcept = default; - // FIXME: Do something with encoding - pstring_t(const mem_t *string) - : m_str(string) + pstring_t(const mem_t *string, const size_type len) + : m_str(string, len) { } - pstring_t(const mem_t *string, const size_type len) - : m_str(string, len) + /* mingw treats string constants as char* instead of char[N] */ +#if !defined(_WIN32) && !defined(_WIN64) + explicit +#endif + pstring_t(const mem_t *string) + : m_str(string) { } template<typename C, std::size_t N, class = typename std::enable_if<std::is_same<C, const mem_t>::value>::type> - pstring_t(C (*string)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays) + pstring_t(C (&string)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays) { static_assert(N > 0,"pstring from array of length 0"); if (string[N-1] != 0) @@ -115,7 +118,6 @@ public: m_str.assign(string, N - 1); } - explicit pstring_t(const string_type &string) : m_str(string) { } @@ -605,14 +607,14 @@ namespace plib return (right(str, arg.length()) == arg); } - template<typename T> - bool startsWith(const T &str, const char *arg) + template<typename T, typename TA> + bool startsWith(const T &str, const TA &arg) { return startsWith(str, static_cast<pstring>(arg)); } - template<typename T> - bool endsWith(const T &str, const char *arg) + template<typename T, typename TA> + bool endsWith(const T &str, const TA &arg) { return endsWith(str, static_cast<pstring>(arg)); } diff --git a/src/lib/netlist/plib/putil.cpp b/src/lib/netlist/plib/putil.cpp index c8c25d137e0..7b33bed8eff 100644 --- a/src/lib/netlist/plib/putil.cpp +++ b/src/lib/netlist/plib/putil.cpp @@ -134,7 +134,7 @@ namespace plib } - int penum_base::from_string_int(const char *str, const char *x) + int penum_base::from_string_int(const pstring &str, const pstring &x) { int cnt = 0; for (auto &s : psplit(str, ",", false)) @@ -146,7 +146,7 @@ namespace plib return -1; } - std::string penum_base::nthstr(int n, const char *str) + std::string penum_base::nthstr(int n, const pstring &str) { return psplit(str, ",", false)[static_cast<std::size_t>(n)]; } diff --git a/src/lib/netlist/plib/putil.h b/src/lib/netlist/plib/putil.h index 793b8e8eaf4..8fd74ac8b8c 100644 --- a/src/lib/netlist/plib/putil.h +++ b/src/lib/netlist/plib/putil.h @@ -199,11 +199,11 @@ namespace plib //&& (ret == T(0) || std::abs(ret) >= std::numeric_limits<T>::min() )) { if (cstr[idx] != 0) - throw pexception(pstring("Continuation after numeric value ends: ") + cstr); + throw pexception(pstring("Continuation after numeric value ends: ") + pstring(cstr)); } else { - throw pexception(pstring("Out of range: ") + cstr); + throw pexception(pstring("Out of range: ") + pstring(cstr)); } return static_cast<T>(ret); } @@ -230,8 +230,8 @@ namespace plib struct penum_base { protected: - static int from_string_int(const char *str, const char *x); - static std::string nthstr(int n, const char *str); + static int from_string_int(const pstring &str, const pstring &x); + static std::string nthstr(int n, const pstring &str); }; } // namespace plib @@ -241,16 +241,16 @@ namespace plib enum E { __VA_ARGS__ }; \ ename (E v) : m_v(v) { } \ template <typename T> explicit ename(T val) { m_v = static_cast<E>(val); } \ - bool set_from_string (const std::string &s) { \ - static char const *const strings = # __VA_ARGS__; \ - int f = from_string_int(strings, s.c_str()); \ + bool set_from_string (const pstring &s) { \ + static const pstring strings = # __VA_ARGS__; \ + int f = from_string_int(strings, s); \ if (f>=0) { m_v = static_cast<E>(f); return true; } else { return false; } \ } \ operator E() const {return m_v;} \ bool operator==(const ename &rhs) const {return m_v == rhs.m_v;} \ bool operator==(const E &rhs) const {return m_v == rhs;} \ std::string name() const { \ - static char const *const strings = # __VA_ARGS__; \ + static const pstring strings = # __VA_ARGS__; \ return nthstr(static_cast<int>(m_v), strings); \ } \ private: E m_v; }; diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index 26c06489fbf..a5795108753 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -622,7 +622,7 @@ void tool_app_t::create_header() { last_source = e->sourcefile(); pout("{1}\n", plib::rpad(pstring("// "), pstring("-"), opt_linewidth())); - pout("{1}{2}\n", pstring("// Source: "), plib::replace_all(e->sourcefile(), "../", "")); + pout("{1}{2}\n", "// Source: ", plib::replace_all(e->sourcefile(), "../", "")); pout("{1}\n", plib::rpad(pstring("// "), pstring("-"), opt_linewidth())); } header_entry(e.get()); diff --git a/src/lib/netlist/prg/nlwav.cpp b/src/lib/netlist/prg/nlwav.cpp index 5ebd2ce01fb..9c6ef9adff8 100644 --- a/src/lib/netlist/prg/nlwav.cpp +++ b/src/lib/netlist/prg/nlwav.cpp @@ -318,9 +318,9 @@ public: { // $var real 64 N1X1 N1X1 $end if (format == ANALOG) - write(pstring("$var real 64 ") + m_ids[i++] + " " + ch + " $end\n"); + write("$var real 64 " + m_ids[i++] + " " + ch + " $end\n"); else if (format == DIGITAL) - write(pstring("$var wire 1 ") + m_ids[i++] + " " + ch + " $end\n"); + write("$var wire 1 " + m_ids[i++] + " " + ch + " $end\n"); } write("$enddefinitions $end\n"); if (format == ANALOG) @@ -328,7 +328,7 @@ public: write("$dumpvars\n"); //r0.0 N1X1 for (i = 0; i < channels.size(); i++) - write(pstring("r0.0 ") + m_ids[i] + "\n"); + write("r0.0 " + m_ids[i] + "\n"); write("$end\n"); } @@ -338,7 +338,7 @@ public: { if (time > m_last_time) { - write(pstring("#") + plib::to_string(static_cast<std::int64_t>(m_last_time * 1e9)) + " "); + write("#" + plib::to_string(static_cast<std::int64_t>(m_last_time * 1e9)) + " "); write(m_buf + "\n"); m_buf = ""; m_last_time = time; @@ -348,9 +348,9 @@ public: else { if (outsam >= m_high_level) - m_buf += pstring("1") + m_ids[chan] + " "; + m_buf += "1" + m_ids[chan] + " "; else if (outsam <= m_low_level) - m_buf += pstring("0") + m_ids[chan] + " "; + m_buf += "0" + m_ids[chan] + " "; } } @@ -494,7 +494,7 @@ void nlwav_app::convert(std::ostream &ostrm) int nlwav_app::execute() { for (auto &i : opt_args()) - pout(pstring("Hello : ") + i + "\n"); + pout("Hello : " + i + "\n"); if (opt_help()) { pout(usage()); diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp index 6cf2ec66e81..3535424b421 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.cpp +++ b/src/lib/netlist/solver/nld_matrix_solver.cpp @@ -113,7 +113,7 @@ namespace devices if (net_proxy_output == nullptr) { - pstring nname = this->name() + "." + pstring(plib::pfmt("m{1}")(m_inps.size())); + pstring nname(this->name() + "." + pstring(plib::pfmt("m{1}")(m_inps.size()))); nl_assert(p->net().is_analog()); auto net_proxy_output_u = pool().make_poolptr<proxied_analog_output_t>(*this, nname, static_cast<analog_net_t *>(&p->net())); net_proxy_output = net_proxy_output_u.get(); diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h index 51dd4e976f8..888f2c79309 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.h +++ b/src/lib/netlist/solver/nld_matrix_solver.h @@ -59,7 +59,19 @@ namespace devices , m_use_gabs(parent, "USE_GABS", true) , m_use_linear_prediction(parent, "USE_LINEAR_PREDICTION", false) // // savings are eaten up by effort - {} + { + m_min_timestep = m_dynamic_min_ts(); + m_max_timestep = netlist_time::from_double(1.0 / m_freq()).as_double(); + + if (m_dynamic_ts) + { + m_max_timestep *= 1;//NL_FCONST(1000.0); + } + else + { + m_min_timestep = m_max_timestep; + } + } param_double_t m_freq; param_double_t m_gs_sor; diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h index 83a8a7123a7..0258c768e09 100644 --- a/src/lib/netlist/solver/nld_ms_gcr.h +++ b/src/lib/netlist/solver/nld_ms_gcr.h @@ -283,7 +283,12 @@ namespace devices strm.writeline("{\n"); csc_private(strm); strm.writeline("}\n"); + // mingw 5.3 workaround +#if !defined(_WIN32) && !defined(_WIN64) + return std::pair<pstring, pstring>(name, t.str()); +#else return std::pair<pstring, pstring>(name, pstring(t.str())); +#endif } template <typename FT, int SIZE> diff --git a/src/lib/netlist/solver/nld_ms_sm.h b/src/lib/netlist/solver/nld_ms_sm.h index d9b0e0d22fe..386a38fbe6f 100644 --- a/src/lib/netlist/solver/nld_ms_sm.h +++ b/src/lib/netlist/solver/nld_ms_sm.h @@ -210,7 +210,14 @@ namespace devices static constexpr const bool incremental = true; const std::size_t iN = size(); - std::array<float_type, storage_N> new_V; // = { 0.0 }; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) + std::array<float_type, storage_N> new_V; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) + std::array<float_type, m_pitch> v; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) + std::array<std::size_t, m_pitch> cols; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) + std::array<float_type, m_pitch> z; if ((m_cnt % 50) == 0) { @@ -227,8 +234,6 @@ namespace devices } for (std::size_t row = 0; row < iN; row ++) { - std::array<float_type, m_pitch> v = {0}; - std::array<std::size_t, m_pitch> cols; std::size_t colcount = 0; auto &nz = m_terms[row]->m_nz; @@ -246,7 +251,6 @@ namespace devices float_type lamba = 0.0; std::array<float_type, m_pitch> w = {0}; - std::array<float_type, m_pitch> z; /* compute w and lamba */ for (std::size_t i = 0; i < iN; i++) z[i] = Ainv(i, row); /* u is row'th column */ diff --git a/src/lib/netlist/solver/nld_ms_w.h b/src/lib/netlist/solver/nld_ms_w.h index 660b3eddbdc..34e2f42b35e 100644 --- a/src/lib/netlist/solver/nld_ms_w.h +++ b/src/lib/netlist/solver/nld_ms_w.h @@ -224,7 +224,12 @@ unsigned matrix_solver_w_t<FT, SIZE>::solve_non_dynamic(const bool newton_raphso { const auto iN = size(); - std::array<float_type, storage_N> new_V; // = { 0.0 }; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) + std::array<float_type, storage_N> new_V; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) + std::array<float_type, storage_N> t; // FIXME: convert to member + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) + std::array<float_type, storage_N> w; if ((m_cnt % 50) == 0) { @@ -262,7 +267,6 @@ unsigned matrix_solver_w_t<FT, SIZE>::solve_non_dynamic(const bool newton_raphso /* construct w = transform(V) * y * dim: rowcount x iN * */ - std::array<float_type, storage_N> w; for (unsigned i = 0; i < rowcount; i++) { const unsigned r = rows[i]; @@ -312,7 +316,6 @@ unsigned matrix_solver_w_t<FT, SIZE>::solve_non_dynamic(const bool newton_raphso } /* Back substitution */ //inv(H) w = t w = H t - std::array<float_type, storage_N> t; // FIXME: convert to member for (unsigned j = rowcount; j-- > 0; ) { float_type tmp = 0; diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index 0213ef02660..42bff9e88b4 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -226,19 +226,6 @@ namespace devices void NETLIB_NAME(solver)::post_start() { - m_params.m_min_timestep = m_params.m_dynamic_min_ts(); - m_params.m_max_timestep = netlist_time::from_double(1.0 / m_params.m_freq()).as_double(); - - if (m_params.m_dynamic_ts) - { - m_params.m_max_timestep *= 1;//NL_FCONST(1000.0); - } - else - { - m_params.m_min_timestep = m_params.m_max_timestep; - } - - //m_params.m_max_timestep = std::max(m_params.m_max_timestep, m_params.m_max_timestep::) log().verbose("Scanning net groups ..."); // determine net groups diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp index 3e705910bf4..8e8143d79f5 100644 --- a/src/lib/netlist/tools/nl_convert.cpp +++ b/src/lib/netlist/tools/nl_convert.cpp @@ -18,7 +18,7 @@ * define a model param on core device */ /* Format: external name,netlist device,model */ -static const char * s_lib_map = +static constexpr const char s_lib_map[] = "SN74LS00D, TTL_7400_DIP, 74LSXX\n" "SN74LS04D, TTL_7404_DIP, 74LSXX\n" "SN74ALS08D, TTL_7408_DIP, 74ALSXX\n" |