summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-06-01 19:59:14 +0200
committer couriersud <couriersud@gmx.org>2020-06-01 19:59:54 +0200
commit37258b7439c9a08b24702cbaddab1d5abd4cd3bf (patch)
tree64f30fc80dc1263613601c3e3b36faf944e4bd4d
parentef11941a92fa2a51ee2ab3d83ca500b7826dcc52 (diff)
netlist: clang-tidy, header order fixes. (nw)
-rw-r--r--src/lib/netlist/build/makefile18
-rw-r--r--src/lib/netlist/devices/net_lib.h2
-rw-r--r--src/lib/netlist/devices/nld_7493.cpp4
-rw-r--r--src/lib/netlist/devices/nlid_proxy.cpp4
-rw-r--r--src/lib/netlist/devices/nlid_proxy.h2
-rw-r--r--src/lib/netlist/devices/nlid_system.h8
-rw-r--r--src/lib/netlist/nl_base.h8
-rw-r--r--src/lib/netlist/nl_factory.h2
-rw-r--r--src/lib/netlist/nl_interface.h6
-rw-r--r--[-rwxr-xr-x]src/lib/netlist/nl_setup.cpp6
-rw-r--r--src/lib/netlist/plib/pfmtlog.h2
-rw-r--r--src/lib/netlist/plib/pfunction.cpp2
-rw-r--r--src/lib/netlist/plib/pmempool.h2
-rw-r--r--src/lib/netlist/plib/poptions.cpp6
-rw-r--r--[-rwxr-xr-x]src/lib/netlist/plib/poptions.h2
-rw-r--r--[-rwxr-xr-x]src/lib/netlist/plib/ppmf.h6
-rw-r--r--src/lib/netlist/plib/ppreprocessor.cpp2
-rw-r--r--src/lib/netlist/plib/prandom.h1
-rw-r--r--src/lib/netlist/plib/pstring.h2
-rw-r--r--src/lib/netlist/plib/pstrutil.h2
-rw-r--r--src/lib/netlist/plib/ptimed_queue.h2
-rw-r--r--src/lib/netlist/plib/ptokenizer.cpp2
-rw-r--r--src/lib/netlist/plib/ptokenizer.h2
-rw-r--r--src/lib/netlist/plib/putil.cpp2
-rw-r--r--src/lib/netlist/plib/putil.h2
-rw-r--r--src/lib/netlist/prg/nltool.cpp14
-rwxr-xr-xsrc/lib/netlist/prg/nlwav.cpp4
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.h2
28 files changed, 58 insertions, 59 deletions
diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile
index 1db27900583..8f07a8b92d1 100644
--- a/src/lib/netlist/build/makefile
+++ b/src/lib/netlist/build/makefile
@@ -51,7 +51,7 @@ TIDY_SOURCES = $(SOURCES)
#TIDY_SOURCES = $(SRC)/devices/nld_7442.cpp $(SRC)/devices/nld_7492.cpp
-#TIDY_FLAGS = -checks=llvm-include-order,llvm-namespace-comment,modernize-use-override,modernize-use-using -fix
+#TIDY_FLAGS = -p $(OBJ) -checks=llvm-include-order,llvm-namespace-comment,modernize-use-override,modernize-use-using -fix
#TIDY_FLAGS = -checks=llvm-include-order -fix
#TIDY_FLAGS = -checks=llvm-namespace-comment -fix
#TIDY_FLAGS = -checks=modernize-use-override -fix
@@ -72,11 +72,11 @@ endif
TIDY_DB = $(OBJ)/compile_commands.json
-# LTO = -flto=4 -fuse-linker-plugin -flto-partition=balanced -Wodr
+#LTO decreases performance :-(
+#LTO = -flto=4 -fuse-linker-plugin -Wodr
CCOREFLAGS = -g -O3 -std=c++14 -I$(CURDIR)/.. -I$(CURDIR)/../..
-
CFLAGS = $(LTO) $(CCOREFLAGS) $(CEXTRAFLAGS)
LDFLAGS = $(LTO) -g -O3 -std=c++14 $(LDEXTRAFLAGS)
LIBS = -lpthread -ldl $(EXTRALIBS)
@@ -85,7 +85,7 @@ CC = g++
LD = @g++
MD = @mkdir
RM = @rm
-CLANG_TIDY = clang-tidy-11
+CLANG_TIDY = clang-tidy-10
DEPENDCC=$(CC)
@@ -232,7 +232,7 @@ ALL_TIDY_FILES = $(ALL_OBJS:.o=.json)
SOURCES = $(patsubst $(OBJ)%, $(SRC)%, $(ALL_OBJS:.o=.cpp))
ALLFILES = $(SOURCES) $(VSBUILDS) $(DOCS)
-MAKEFILE_TARGETS_WITHOUT_INCLUDE := clean doc clang mingw nvcc clang-libc
+MAKEFILE_TARGETS_WITHOUT_INCLUDE := gcc9 clang clang-5 mingw doc native maketree
# git archive HEAD --prefix=project-name-version/ \
@@ -242,7 +242,7 @@ MAKEFILE_TARGETS_WITHOUT_INCLUDE := clean doc clang mingw nvcc clang-libc
# PHONY
#-------------------------------------------------
-.PHONY: clang clang-5 mingw doc native maketree $(DEPEND) depend
+.PHONY: all gcc9 clang clang-5 mingw doc native maketree $(DEPEND) depend
#-------------------------------------------------
# all
@@ -287,13 +287,13 @@ native:
$(MAKE) CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra "
gcc9:
- $(MAKE) CC=g++-9 LD=g++-9 CEXTRAFLAGS="-march=native -finline-limit=100 -fpermissive -fext-numeric-literals -msse4.2 -Wall -pedantic -Wpedantic -Wsign-compare -Wextra " EXTRALIBS="-lquadmath"
+ $(MAKE) CC=g++-9 LD=g++-9 CEXTRAFLAGS="-march=native -fext-numeric-literals -Wall -pedantic -Wpedantic -Wsign-compare -Wextra" EXTRALIBS="-lquadmath"
clang:
#$(MAKE) CC=clang++-11 LD=clang++-11 OBJ=obj/clang CEXTRAFLAGS="-march=native -msse4.2 -Weverything -Wall -pedantic -Wpedantic -Wunused-private-field -Wno-padded -Wno-unused-template -Wno-missing-variable-declarations -Wno-float-equal -Wconversion -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-exit-time-destructors"
$(MAKE) CC=clang++-11 LD=clang++-11 OBJ=obj/clang CEXTRAFLAGS="-march=native \
-mllvm -inline-threshold=2000 \
- -msse4.2 -Weverything -Wall -pedantic -Wpedantic -Wunused-private-field \
+ -Weverything -Wall -pedantic -Wpedantic -Wunused-private-field \
-Werror -Wno-padded -Wno-weak-vtables -Wno-weak-template-vtables -Wno-unused-template \
-Wno-missing-variable-declarations -Wno-float-equal -Wconversion \
-Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral \
@@ -303,7 +303,7 @@ clang-libc:
#$(MAKE) CC=clang++-11 LD=clang++-11 OBJ=obj/clang CEXTRAFLAGS="-march=native -msse4.2 -Weverything -Wall -pedantic -Wpedantic -Wunused-private-field -Wno-padded -Wno-unused-template -Wno-missing-variable-declarations -Wno-float-equal -Wconversion -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-exit-time-destructors"
$(MAKE) CC=clang++-11 LD=clang++-11 OBJ=obj/clang-libc CEXTRAFLAGS="-march=native \
-stdlib=libc++ -mllvm -inline-threshold=2000 \
- -msse4.2 -Weverything -Wall -pedantic -Wpedantic -Wunused-private-field \
+ -Weverything -Wall -pedantic -Wpedantic -Wunused-private-field \
-Werror -Wno-padded -Wno-weak-vtables -Wno-weak-template-vtables -Wno-unused-template \
-Wno-missing-variable-declarations -Wno-float-equal -Wconversion \
-Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral \
diff --git a/src/lib/netlist/devices/net_lib.h b/src/lib/netlist/devices/net_lib.h
index 95a44cbe78a..ae788f06ba4 100644
--- a/src/lib/netlist/devices/net_lib.h
+++ b/src/lib/netlist/devices/net_lib.h
@@ -104,8 +104,8 @@
#include "netlist/macro/nlm_cd4xxx.h"
#include "netlist/macro/nlm_opamp.h"
#include "netlist/macro/nlm_other.h"
-#include "netlist/macro/nlm_ttl74xx.h"
#include "netlist/macro/nlm_roms.h"
+#include "netlist/macro/nlm_ttl74xx.h"
#include "netlist/analog/nld_bjt.h"
#include "netlist/analog/nld_fourterm.h"
diff --git a/src/lib/netlist/devices/nld_7493.cpp b/src/lib/netlist/devices/nld_7493.cpp
index a2315dc6a8a..f220a6dc4bd 100644
--- a/src/lib/netlist/devices/nld_7493.cpp
+++ b/src/lib/netlist/devices/nld_7493.cpp
@@ -94,10 +94,6 @@ namespace netlist
{
}
- void printer(pstring a)
- {
- printf("printer %s\n", a.c_str());
- }
private:
NETLIB_RESETI()
{
diff --git a/src/lib/netlist/devices/nlid_proxy.cpp b/src/lib/netlist/devices/nlid_proxy.cpp
index 1631d4f753b..d804988c6fd 100644
--- a/src/lib/netlist/devices/nlid_proxy.cpp
+++ b/src/lib/netlist/devices/nlid_proxy.cpp
@@ -6,8 +6,8 @@
*/
#include "nlid_proxy.h"
-#include "solver/nld_solver.h"
#include "nl_errstr.h"
+#include "solver/nld_solver.h"
namespace netlist
{
@@ -187,7 +187,7 @@ namespace netlist
nlconst::zero());
break;
default:
- throw nl_exception("unknown state for proxy: this should never happen! %d\n", static_cast<int>(state));
+ plib::terminate("unknown state for proxy: this should never happen!");
}
});
m_last_state = state;
diff --git a/src/lib/netlist/devices/nlid_proxy.h b/src/lib/netlist/devices/nlid_proxy.h
index e31c2c027c6..46c14116c58 100644
--- a/src/lib/netlist/devices/nlid_proxy.h
+++ b/src/lib/netlist/devices/nlid_proxy.h
@@ -11,8 +11,8 @@
#ifndef NLID_PROXY_H_
#define NLID_PROXY_H_
-#include "netlist/nl_base.h"
#include "netlist/analog/nlid_twoterm.h"
+#include "netlist/nl_base.h"
namespace netlist
{
diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h
index cc102f18521..e7827f24935 100644
--- a/src/lib/netlist/devices/nlid_system.h
+++ b/src/lib/netlist/devices/nlid_system.h
@@ -10,8 +10,8 @@
#include "netlist/analog/nlid_twoterm.h"
#include "netlist/nl_base.h"
#include "netlist/nl_factory.h"
-#include "netlist/plib/putil.h"
#include "netlist/plib/prandom.h"
+#include "netlist/plib/putil.h"
#include <random>
@@ -417,7 +417,7 @@ namespace devices
if (state != m_last_state)
{
m_last_state = state;
- const nl_fptype R = state ? m_RON() : m_ROFF();
+ const nl_fptype R = (state != 0) ? m_RON() : m_ROFF();
m_R.change_state([this, &R]()
{
@@ -476,8 +476,8 @@ namespace devices
{
m_last_state = state;
//printf("Here %d\n", state);
- const nl_fptype G1 = state ? m_GON() : m_GOFF();
- const nl_fptype G2 = state ? m_GOFF() : m_GON();
+ const nl_fptype G1 = (state != 0) ? m_GON() : m_GOFF();
+ const nl_fptype G2 = (state != 0) ? m_GOFF() : m_GON();
if (m_R1.solver() == m_R2.solver())
{
m_R1.change_state([this, &G1, &G2]()
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index 67f03773cc2..53d9eb9cdfd 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -1106,7 +1106,7 @@ namespace netlist
if (!m_force_logic)
if (v != m_tristate)
{
- logic_output_t::push(v ? OUT_TRISTATE() : m_last_logic, v ? ts_off_on : ts_on_off);
+ logic_output_t::push((v != 0) ? OUT_TRISTATE() : m_last_logic, v ? ts_off_on : ts_on_off);
m_tristate = v;
}
}
@@ -2329,11 +2329,11 @@ namespace netlist
return net().Q_Analog();
}
- inline void analog_output_t::push(nl_fptype newQ) noexcept
+ inline void analog_output_t::push(nl_fptype val) noexcept
{
- if (newQ != m_my_net.Q_Analog())
+ if (val != m_my_net.Q_Analog())
{
- m_my_net.set_Q_Analog(newQ);
+ m_my_net.set_Q_Analog(val);
m_my_net.toggle_and_push_to_queue(netlist_time::quantum());
}
}
diff --git a/src/lib/netlist/nl_factory.h b/src/lib/netlist/nl_factory.h
index de5265bee69..ca9fd93b7ab 100644
--- a/src/lib/netlist/nl_factory.h
+++ b/src/lib/netlist/nl_factory.h
@@ -13,9 +13,9 @@
#include "plib/ptypes.h"
#include "plib/putil.h"
-#include <vector>
#include <tuple>
#include <utility>
+#include <vector>
#define NETLIB_DEVICE_IMPL_ALIAS(p_alias, chip, p_name, p_def_param) \
NETLIB_DEVICE_IMPL_BASE(devices, p_alias, chip, p_name, p_def_param) \
diff --git a/src/lib/netlist/nl_interface.h b/src/lib/netlist/nl_interface.h
index d145286d9b5..17d6496c4ff 100644
--- a/src/lib/netlist/nl_interface.h
+++ b/src/lib/netlist/nl_interface.h
@@ -11,12 +11,10 @@
#define NLINTERFACE_H_
#include "nl_base.h"
+#include "nl_setup.h"
-#include <initializer_list>
#include <memory>
-#include <stack>
-#include <unordered_map>
-#include <vector>
+#include <array>
namespace netlist
{
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index 8e535a45a83..5960cae62d6 100755..100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -2,8 +2,6 @@
// copyright-holders:Couriersud
#include "plib/palloc.h"
-#include "plib/putil.h"
-#include "plib/penum.h"
#include "analog/nld_twoterm.h"
#include "devices/nlid_proxy.h"
#include "devices/nlid_system.h"
@@ -12,6 +10,8 @@
#include "nl_factory.h"
#include "nl_parser.h"
#include "nl_setup.h"
+#include "plib/penum.h"
+#include "plib/putil.h"
#include "solver/nld_solver.h"
@@ -55,7 +55,7 @@ namespace netlist
std::initializer_list<const char *> more_parameters)
{
std::vector<pstring> params;
- auto i(more_parameters.begin());
+ const auto *i(more_parameters.begin());
pstring name(*i);
++i;
for (; i != more_parameters.end(); ++i)
diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h
index aae6ee9c085..6710beba6c4 100644
--- a/src/lib/netlist/plib/pfmtlog.h
+++ b/src/lib/netlist/plib/pfmtlog.h
@@ -8,10 +8,10 @@
#ifndef PFMT_H_
#define PFMT_H_
+#include "penum.h"
#include "pstring.h"
#include "ptypes.h"
#include "putil.h"
-#include "penum.h"
#include <limits>
#include <locale>
diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp
index 056d96d737e..b424aae7e2d 100644
--- a/src/lib/netlist/plib/pfunction.cpp
+++ b/src/lib/netlist/plib/pfunction.cpp
@@ -10,9 +10,9 @@
#include "putil.h"
#include <array>
+#include <map>
#include <stack>
#include <type_traits>
-#include <map>
#include <utility>
namespace plib {
diff --git a/src/lib/netlist/plib/pmempool.h b/src/lib/netlist/plib/pmempool.h
index 746e710f751..10c1fe58f53 100644
--- a/src/lib/netlist/plib/pmempool.h
+++ b/src/lib/netlist/plib/pmempool.h
@@ -70,7 +70,7 @@ namespace plib {
}
if (icount()-- == 1)
{
- if (sinfo().size() != 0)
+ if (!sinfo().empty())
plib::perrlogger("Still found {} info blocks after last mempool deleted\n", sinfo().size());
}
}
diff --git a/src/lib/netlist/plib/poptions.cpp b/src/lib/netlist/plib/poptions.cpp
index b0bade9ada6..ff102bba851 100644
--- a/src/lib/netlist/plib/poptions.cpp
+++ b/src/lib/netlist/plib/poptions.cpp
@@ -223,7 +223,7 @@ namespace plib {
{
line += "=";
auto *ol = dynamic_cast<option_str_limit_base *>(opt);
- if (ol)
+ if (ol != nullptr)
{
for (const auto &v : ol->limit())
{
@@ -274,7 +274,7 @@ namespace plib {
for (const auto & optbase : m_opts)
{
auto *opt = dynamic_cast<option *>(optbase);
- if (opt && arg != "" && opt->short_opt() == arg)
+ if (opt != nullptr && arg != "" && opt->short_opt() == arg)
return opt;
}
return nullptr;
@@ -284,7 +284,7 @@ namespace plib {
for (const auto & optbase : m_opts)
{
auto *opt = dynamic_cast<option *>(optbase);
- if (opt && arg !="" && opt->long_opt() == arg)
+ if (opt != nullptr && arg !="" && opt->long_opt() == arg)
return opt;
}
return nullptr;
diff --git a/src/lib/netlist/plib/poptions.h b/src/lib/netlist/plib/poptions.h
index b960b45acb9..54927756412 100755..100644
--- a/src/lib/netlist/plib/poptions.h
+++ b/src/lib/netlist/plib/poptions.h
@@ -8,10 +8,10 @@
/// \file poptions.h
///
+#include "pfmtlog.h"
#include "pstonum.h"
#include "pstring.h"
#include "putil.h"
-#include "pfmtlog.h"
namespace plib {
diff --git a/src/lib/netlist/plib/ppmf.h b/src/lib/netlist/plib/ppmf.h
index 010271ce179..f957ff54a4a 100755..100644
--- a/src/lib/netlist/plib/ppmf.h
+++ b/src/lib/netlist/plib/ppmf.h
@@ -34,9 +34,9 @@
#include "pconfig.h"
+#include <algorithm>
#include <cstdint> // uintptr_t
#include <utility>
-#include <algorithm>
//============================================================
// Macro magic
@@ -97,6 +97,8 @@
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wundefined-reinterpret-cast"
+#elif defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
#if (PPMF_TYPE == PPMF_TYPE_GNUC_PMF_CONV)
@@ -144,7 +146,7 @@ namespace plib {
auto *o_p_delta = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta);
// if the low bit of the vtable index is clear, then it is just a raw function pointer
- if (!(m_function & 1))
+ if ((m_function & 1) == 0)
func = reinterpret_cast<generic_function>(m_function);
else
{
diff --git a/src/lib/netlist/plib/ppreprocessor.cpp b/src/lib/netlist/plib/ppreprocessor.cpp
index 61baadbb608..d8909449403 100644
--- a/src/lib/netlist/plib/ppreprocessor.cpp
+++ b/src/lib/netlist/plib/ppreprocessor.cpp
@@ -556,7 +556,7 @@ namespace plib {
pstring n = args.next();
if (!is_valid_token(n))
error("define expected identifier");
- auto prevdef = get_define(n);
+ auto *prevdef = get_define(n);
if (lti.size() == 2)
{
if (prevdef != nullptr && prevdef->m_replace != "")
diff --git a/src/lib/netlist/plib/prandom.h b/src/lib/netlist/plib/prandom.h
index 5e7ffbf2134..65cdb3e1cf2 100644
--- a/src/lib/netlist/plib/prandom.h
+++ b/src/lib/netlist/plib/prandom.h
@@ -9,6 +9,7 @@
///
#include "pconfig.h"
+#include "pmath.h"
#include "ptypes.h"
//#include <algorithm>
diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h
index b8d02ad2d72..139c34fd483 100644
--- a/src/lib/netlist/plib/pstring.h
+++ b/src/lib/netlist/plib/pstring.h
@@ -132,7 +132,7 @@ public:
explicit pstring_t(size_type n, code_t code)
{
- while (n--)
+ while (n-- != 0)
*this += code;
}
diff --git a/src/lib/netlist/plib/pstrutil.h b/src/lib/netlist/plib/pstrutil.h
index 608f42cb4c2..651e5bfd558 100644
--- a/src/lib/netlist/plib/pstrutil.h
+++ b/src/lib/netlist/plib/pstrutil.h
@@ -170,7 +170,7 @@ namespace plib
std::size_t strlen(const T *str)
{
const T *p = str;
- while (*p)
+ while (*p != 0)
p++;
return static_cast<std::size_t>(p - str);
}
diff --git a/src/lib/netlist/plib/ptimed_queue.h b/src/lib/netlist/plib/ptimed_queue.h
index a3fb6df6d82..191657b60c0 100644
--- a/src/lib/netlist/plib/ptimed_queue.h
+++ b/src/lib/netlist/plib/ptimed_queue.h
@@ -10,8 +10,8 @@
#include "palloc.h"
#include "pchrono.h"
-#include "pstring.h"
#include "pmulti_threading.h"
+#include "pstring.h"
#include <algorithm>
#include <mutex>
diff --git a/src/lib/netlist/plib/ptokenizer.cpp b/src/lib/netlist/plib/ptokenizer.cpp
index 48d079ee314..a0542b61a86 100644
--- a/src/lib/netlist/plib/ptokenizer.cpp
+++ b/src/lib/netlist/plib/ptokenizer.cpp
@@ -29,7 +29,7 @@ namespace plib {
void ptokenizer::skipeol()
{
pstring::value_type c = getc();
- while (c)
+ while (c != 0)
{
if (c == 10)
{
diff --git a/src/lib/netlist/plib/ptokenizer.h b/src/lib/netlist/plib/ptokenizer.h
index ce73d4a3512..5a71990aca7 100644
--- a/src/lib/netlist/plib/ptokenizer.h
+++ b/src/lib/netlist/plib/ptokenizer.h
@@ -11,8 +11,8 @@
#include "pstream.h"
#include "pstring.h"
-#include "putil.h" // psource_t
#include "penum.h"
+#include "putil.h" // psource_t
#include <unordered_map>
#include <vector>
diff --git a/src/lib/netlist/plib/putil.cpp b/src/lib/netlist/plib/putil.cpp
index f1459c1b00e..56ada5c2dd9 100644
--- a/src/lib/netlist/plib/putil.cpp
+++ b/src/lib/netlist/plib/putil.cpp
@@ -2,9 +2,9 @@
// copyright-holders:Couriersud
#include "putil.h"
+#include "penum.h"
#include "pstrutil.h"
#include "ptypes.h"
-#include "penum.h"
#include <algorithm>
#include <cstdlib> // needed for getenv ...
diff --git a/src/lib/netlist/plib/putil.h b/src/lib/netlist/plib/putil.h
index d10b11b60f4..502aa433f06 100644
--- a/src/lib/netlist/plib/putil.h
+++ b/src/lib/netlist/plib/putil.h
@@ -123,6 +123,8 @@ namespace plib
PCOPYASSIGNMOVE(source_location, default)
+ ~source_location() = default;
+
unsigned line() const noexcept { return m_line; }
unsigned column() const noexcept { return m_col; }
pstring file_name() const noexcept { return m_file; }
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index 02231c1b8b5..1f024ce99f3 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -89,7 +89,7 @@ public:
opt_ex4(*this, "nltool --cmd static --output src/lib/netlist/generated/static_solvers.cpp src/mame/audio/nl_*.cpp src/mame/machine/nl_*.cpp",
"Create static solvers for the MAME project.")
{}
-public:
+
int execute() override;
pstring usage() override;
@@ -153,7 +153,7 @@ private:
struct compile_map_entry
{
- compile_map_entry(pstring mod, pstring code)
+ compile_map_entry(const pstring &mod, const pstring &code)
: m_module(mod), m_code(code) { }
pstring m_module;
pstring m_code;
@@ -216,7 +216,7 @@ private:
class netlist_tool_callbacks_t : public netlist::callbacks_t
{
public:
- explicit netlist_tool_callbacks_t(tool_app_t &app, pstring boostlib)
+ explicit netlist_tool_callbacks_t(tool_app_t &app, const pstring &boostlib)
: m_app(app), m_boostlib(boostlib)
{ }
@@ -594,7 +594,7 @@ void tool_app_t::static_compile()
netlist::solver::static_compile_target target = netlist::solver::CXX_STATIC;
- if (!(opt_dir.was_specified() ^ opt_out.was_specified()))
+ if ((opt_dir.was_specified() ^ opt_out.was_specified()) == 0)
throw netlist::nl_exception("either --dir or --output option needed");
if (opt_dir.was_specified())
@@ -851,7 +851,7 @@ void tool_app_t::mac(const netlist::factory::element_t *e)
void tool_app_t::create_header()
{
- if (opt_files().size() > 0)
+ if (!opt_files().empty())
throw netlist::nl_exception("Header doesn't support input files, but {1} where given", opt_files().size());
netlist_tool_t nt(*this, "netlist", opt_boostlib());
@@ -878,9 +878,9 @@ void tool_app_t::create_header()
for (auto &e : nt.parser().factory())
{
- bool found(opt_pattern().size() == 0);
+ bool found(opt_pattern().empty());
- for (auto &p : opt_pattern())
+ for (const auto &p : opt_pattern())
found |= (e->name().find(p) != pstring::npos);
if (found)
diff --git a/src/lib/netlist/prg/nlwav.cpp b/src/lib/netlist/prg/nlwav.cpp
index 7c2847eb38d..288e14ae028 100755
--- a/src/lib/netlist/prg/nlwav.cpp
+++ b/src/lib/netlist/prg/nlwav.cpp
@@ -75,7 +75,7 @@ public:
void write(const T &val)
{
static_assert(sizeof(std::ostream::char_type) == 1, "char_type size must be 1");
- auto ptr(reinterpret_cast<const std::ostream::char_type *>(&val));
+ const auto *ptr(reinterpret_cast<const std::ostream::char_type *>(&val));
m_f.write(ptr, sizeof(T));
}
@@ -718,7 +718,7 @@ pstring nlwav_app::usage()
}
template <typename F>
-static void open_ostream_and_exec(pstring fname, bool binary, F func)
+static void open_ostream_and_exec(const pstring &fname, bool binary, F func)
{
if (fname != "-")
{
diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h
index 2e164171478..09d210fcf55 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.h
+++ b/src/lib/netlist/solver/nld_matrix_solver.h
@@ -12,10 +12,10 @@
#include "netlist/nl_errstr.h"
#include "netlist/plib/mat_cr.h"
#include "netlist/plib/palloc.h"
+#include "netlist/plib/penum.h"
#include "netlist/plib/pmatrix2d.h"
#include "netlist/plib/putil.h"
#include "netlist/plib/vector_ops.h"
-#include "netlist/plib/penum.h"
#include <numeric>