mirror of
https://github.com/holub/mame
synced 2025-07-06 18:39:28 +03:00
netlist: clang-tidy, srcclean and pedantic warnings fixed. (nw)
This commit is contained in:
parent
39d7e8063a
commit
6d35a38bf2
@ -134,6 +134,7 @@ namespace analog
|
||||
generic_capacitor_const(device_t &dev, const pstring &name)
|
||||
: m_gmin(nlconst::zero())
|
||||
{
|
||||
plib::unused_var(dev, name);
|
||||
}
|
||||
|
||||
// Returns { G, Ieq }
|
||||
|
@ -23,7 +23,8 @@ TIDY_FLAGSX += -bugprone-macro-parentheses,-misc-macro-parentheses,
|
||||
TIDY_FLAGSX += -bugprone-too-small-loop-variable,
|
||||
TIDY_FLAGSX += -modernize-use-trailing-return-type,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
TIDY_FLAGSX += -readability-magic-numbers,-readability-implicit-bool-conversion,-readability-braces-around-statements
|
||||
TIDY_FLAGSX += -readability-magic-numbers,-readability-implicit-bool-conversion,-readability-braces-around-statements,
|
||||
TIDY_FLAGSX += -readability-named-parameter,-readability-function-size
|
||||
|
||||
space :=
|
||||
space +=
|
||||
|
@ -123,10 +123,10 @@ namespace netlist
|
||||
const auto dfdz = 25.0/(R*sup) * m_R.deltaV();
|
||||
const auto Ieq = dfdz * in;
|
||||
m_R.set_mat( G, -G, 0.0,
|
||||
-G, G, 0.0);
|
||||
//VIN VR1
|
||||
-G, G, 0.0);
|
||||
//VIN VR1
|
||||
m_DUM1.set_mat( 0.0, 0.0, 0.0, // IIN
|
||||
dfdz, 0.0, Ieq); // IR1
|
||||
dfdz, 0.0, Ieq); // IR1
|
||||
m_DUM2.set_mat( 0.0, 0.0, 0.0, // IIN
|
||||
-dfdz, 0.0, -Ieq); // IR2
|
||||
}
|
||||
@ -134,9 +134,9 @@ namespace netlist
|
||||
|
||||
private:
|
||||
nld_power_pins m_supply;
|
||||
analog::nld_twoterm m_R;
|
||||
analog::nld_twoterm m_DUM1;
|
||||
analog::nld_twoterm m_DUM2;
|
||||
analog::nld_twoterm m_R;
|
||||
analog::nld_twoterm m_DUM1;
|
||||
analog::nld_twoterm m_DUM2;
|
||||
param_fp_t m_base_r;
|
||||
state_var<bool> m_last;
|
||||
};
|
||||
|
@ -25,7 +25,7 @@
|
||||
namespace netlist
|
||||
{
|
||||
|
||||
plib::unique_ptr<plib::dynlib_base> callbacks_t:: static_solver_lib() const
|
||||
plib::unique_ptr<plib::dynlib_base> callbacks_t:: static_solver_lib() const
|
||||
{
|
||||
return plib::make_unique<plib::dynlib_static>(nullptr);
|
||||
}
|
||||
|
@ -1341,7 +1341,7 @@ source_string_t::stream_ptr source_string_t::stream(const pstring &name)
|
||||
plib::unused_var(name);
|
||||
auto ret(plib::make_unique<std::istringstream>(m_str));
|
||||
ret->imbue(std::locale::classic());
|
||||
return std::move(ret);
|
||||
return std::move(ret); // FIXME: for c++11 clang builds
|
||||
}
|
||||
|
||||
source_mem_t::stream_ptr source_mem_t::stream(const pstring &name)
|
||||
@ -1349,7 +1349,7 @@ source_mem_t::stream_ptr source_mem_t::stream(const pstring &name)
|
||||
plib::unused_var(name);
|
||||
auto ret(plib::make_unique<std::istringstream>(m_str, std::ios_base::binary));
|
||||
ret->imbue(std::locale::classic());
|
||||
return std::move(ret);
|
||||
return std::move(ret); // FIXME: for c++11 clang builds
|
||||
}
|
||||
|
||||
source_file_t::stream_ptr source_file_t::stream(const pstring &name)
|
||||
|
@ -280,7 +280,7 @@ namespace netlist
|
||||
template <typename S, typename... Args>
|
||||
void register_source(Args&&... args)
|
||||
{
|
||||
static_assert(std::is_base_of<plib::psource_t, S>::value, "S must inherit from plib::psource_t");
|
||||
static_assert(std::is_base_of<plib::psource_t, S>::value, "S must inherit from plib::psource_t");
|
||||
|
||||
auto src(plib::make_unique<S>(std::forward<Args>(args)...));
|
||||
m_sources.add_source(std::move(src));
|
||||
@ -312,7 +312,7 @@ namespace netlist
|
||||
template <typename S, typename... Args>
|
||||
void add_include(Args&&... args)
|
||||
{
|
||||
static_assert(std::is_base_of<plib::psource_t, S>::value, "S must inherit from plib::psource_t");
|
||||
static_assert(std::is_base_of<plib::psource_t, S>::value, "S must inherit from plib::psource_t");
|
||||
|
||||
auto src(plib::make_unique<S>(std::forward<Args>(args)...));
|
||||
m_includes.add_source(std::move(src));
|
||||
|
@ -14,13 +14,13 @@
|
||||
|
||||
#include "nl_config.h"
|
||||
#include "plib/pchrono.h"
|
||||
#include "plib/pdynlib.h"
|
||||
#include "plib/pfmtlog.h"
|
||||
#include "plib/pmempool.h"
|
||||
#include "plib/pstate.h"
|
||||
#include "plib/pstring.h"
|
||||
#include "plib/ptime.h"
|
||||
#include "plib/putil.h"
|
||||
#include "plib/pdynlib.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
|
@ -21,7 +21,8 @@ namespace plib {
|
||||
public:
|
||||
explicit dynlib_base() : m_is_loaded(false) { }
|
||||
|
||||
virtual ~dynlib_base() { }
|
||||
virtual ~dynlib_base() = default;
|
||||
|
||||
COPYASSIGNMOVE(dynlib_base, delete)
|
||||
|
||||
bool isLoaded() const { return m_is_loaded; }
|
||||
@ -43,7 +44,7 @@ namespace plib {
|
||||
explicit dynlib(const pstring &libname);
|
||||
dynlib(const pstring &path, const pstring &libname);
|
||||
|
||||
~dynlib();
|
||||
~dynlib() override;
|
||||
|
||||
protected:
|
||||
void *getsym_p(const pstring &name) const noexcept override;
|
||||
|
@ -60,7 +60,7 @@ namespace plib {
|
||||
{
|
||||
if (m_stack.size() == 1)
|
||||
trail = trail_first;
|
||||
s = trail + plib::pfmt("{1}:{2}:0\n")(m_stack.back().m_name, m_stack.back().m_lineno) + s;
|
||||
s = plib::pfmt("{1}{2}:{3}:0\n{4}")(trail, m_stack.back().m_name, m_stack.back().m_lineno, s);
|
||||
m_stack.pop_back();
|
||||
}
|
||||
throw pexception("\n" + s + e + " " + m_line + "\n");
|
||||
|
@ -299,7 +299,7 @@ namespace plib {
|
||||
{
|
||||
if (m_source_location.size() == 1)
|
||||
trail = trail_first;
|
||||
s = trail + plib::pfmt("{1}:{2}:0\n")(m_source_location.back().file_name(), m_source_location.back().line()) + s;
|
||||
s = plib::pfmt("{1}{2}:{3}:0\n{4}")(trail, m_source_location.back().file_name(), m_source_location.back().line(), s);
|
||||
m_source_location.pop_back();
|
||||
}
|
||||
verror("\n" + s + e + " " + currentline_str() + "\n");
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
plib::option_bool opt_verb;
|
||||
plib::option_bool opt_quiet;
|
||||
plib::option_bool opt_prepro;
|
||||
plib::option_args opt_files;
|
||||
plib::option_args opt_files;
|
||||
plib::option_bool opt_version;
|
||||
plib::option_bool opt_help;
|
||||
|
||||
@ -199,7 +199,7 @@ public:
|
||||
return stream_ptr(nullptr);
|
||||
|
||||
strm->imbue(std::locale::classic());
|
||||
return std::move(strm);
|
||||
return std::move(strm); // FIXME: for c++11 clang builds;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -219,17 +219,13 @@ public:
|
||||
{
|
||||
if (m_app.opt_boostlib() == "builtin")
|
||||
return plib::make_unique<plib::dynlib_static>(nl_static_solver_syms);
|
||||
else if (m_app.opt_boostlib() == "generic")
|
||||
if (m_app.opt_boostlib() == "generic")
|
||||
return plib::make_unique<plib::dynlib_static>(nullptr);
|
||||
if (NL_DISABLE_DYNAMIC_LOAD)
|
||||
{
|
||||
throw netlist::nl_exception("Dynamic library loading not supported due to project security concerns.");
|
||||
}
|
||||
else
|
||||
{
|
||||
//pstring libpath = plib::util::environment("NL_BOOSTLIB", plib::util::buildpath({".", "nlboost.so"}));
|
||||
return plib::make_unique<plib::dynlib>(m_app.opt_boostlib());
|
||||
}
|
||||
|
||||
//pstring libpath = plib::util::environment("NL_BOOSTLIB", plib::util::buildpath({".", "nlboost.so"}));
|
||||
return plib::make_unique<plib::dynlib>(m_app.opt_boostlib());
|
||||
}
|
||||
|
||||
private:
|
||||
@ -629,7 +625,7 @@ void tool_app_t::static_compile()
|
||||
{
|
||||
std::map<pstring, pstring> map;
|
||||
|
||||
for (auto &f : opt_files())
|
||||
for (const auto &f : opt_files())
|
||||
{
|
||||
std::vector<pstring> names;
|
||||
if (opt_name.was_specified())
|
||||
@ -1079,7 +1075,7 @@ void tool_app_t::convert()
|
||||
if (opt_files().size() > 1)
|
||||
throw netlist::nl_exception("nltool: convert needs exactly one file");
|
||||
|
||||
if (opt_files().size() == 0 || opt_files()[0] == "-")
|
||||
if (opt_files().empty() || opt_files()[0] == "-")
|
||||
{
|
||||
plib::copystream(ostrm, std::cin);
|
||||
}
|
||||
|
@ -404,9 +404,9 @@ public:
|
||||
while (m_next_time < time && m_n < m_samples)
|
||||
{
|
||||
pstring o;
|
||||
for (auto e = m_buf.begin(); e != m_buf.end(); e++)
|
||||
for (auto &e : m_buf)
|
||||
{
|
||||
o += pstring(",") + plib::to_string(*e); // FIXME: locale!!
|
||||
o += pstring(",") + plib::to_string(e); // FIXME: locale!!
|
||||
}
|
||||
write(o.substr(1) + "\n");
|
||||
m_n++;
|
||||
|
@ -134,9 +134,9 @@ namespace solver
|
||||
}
|
||||
}
|
||||
for (auto &d : step_devices)
|
||||
m_step_funcs.push_back(nldelegate_ts(&core_device_t::timestep, d));
|
||||
m_step_funcs.emplace_back(nldelegate_ts(&core_device_t::timestep, d));
|
||||
for (auto &d : dynamic_devices)
|
||||
m_dynamic_funcs.push_back(nldelegate_dyn(&core_device_t::update_terminals, d));
|
||||
m_dynamic_funcs.emplace_back(nldelegate_dyn(&core_device_t::update_terminals, d));
|
||||
}
|
||||
|
||||
void matrix_solver_t::sort_terms(matrix_sort_type_e sort)
|
||||
|
@ -208,6 +208,7 @@ namespace solver
|
||||
|
||||
virtual std::pair<pstring, pstring> create_solver_code(solver::static_compile_target target)
|
||||
{
|
||||
plib::unused_var(target);
|
||||
return std::pair<pstring, pstring>("", plib::pfmt("/* solver doesn't support static compile */\n\n"));
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ namespace solver
|
||||
strm("\t{1};\n", terms);
|
||||
|
||||
//for (std::size_t i = 0; i < railstart; i++)
|
||||
// *tcr_r[i] += static_cast<FT>(go[i]);
|
||||
// *tcr_r[i] += static_cast<FT>(go[i]);
|
||||
|
||||
for (std::size_t i = 0; i < net.railstart(); i++)
|
||||
{
|
||||
@ -172,7 +172,7 @@ namespace solver
|
||||
for (std::size_t i=1; i < net.count(); i++)
|
||||
terms += plib::pfmt(" + Idr[{1}]")(this->m_Idrn.didx(k,i));
|
||||
//for (std::size_t i = railstart; i < term_count; i++)
|
||||
// RHS_t += (- go[i]) * *cnV[i];
|
||||
// RHS_t += (- go[i]) * *cnV[i];
|
||||
|
||||
for (std::size_t i = net.railstart(); i < net.count(); i++)
|
||||
terms += plib::pfmt(" - go[{1}] * *cnV[{1}]")(this->m_gonn.didx(k,i), this->m_connected_net_Vn.didx(k,i));
|
||||
|
@ -549,8 +549,8 @@ void nl_convert_spice_t::process_line(const pstring &line)
|
||||
pstring lastnet = tt[1];
|
||||
for (std::size_t i=0; i < static_cast<std::size_t>(n); i++)
|
||||
{
|
||||
pstring devname = tt[0] + plib::pfmt("{}")(i);
|
||||
pstring nextnet = (i<static_cast<std::size_t>(n)-1) ? tt[1] + "a" + plib::pfmt("{}")(i) : tt[2];
|
||||
pstring devname = plib::pfmt("{}{}")(tt[0], i);
|
||||
pstring nextnet = (i<static_cast<std::size_t>(n)-1) ? plib::pfmt("{}a{}")(tt[1], i) : tt[2];
|
||||
auto net2 = plib::psplit(plib::replace_all(plib::replace_all(tt[sce+i],")",""),"(",""),",");
|
||||
add_device("VCVS", devname, get_sp_val(tt[scoeff+i]));
|
||||
add_term(lastnet, devname, 0);
|
||||
@ -584,7 +584,7 @@ void nl_convert_spice_t::process_line(const pstring &line)
|
||||
}
|
||||
for (std::size_t i=0; i < static_cast<std::size_t>(n); i++)
|
||||
{
|
||||
pstring devname = tt[0] + plib::pfmt("{}")(i);
|
||||
pstring devname = plib::pfmt("{}{}")(tt[0], i);
|
||||
add_device("CCCS", devname, get_sp_val(tt[scoeff+i]));
|
||||
add_term(tt[1], devname, 0);
|
||||
add_term(tt[2], devname, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user