netlist: clang-tidy, header order fixes. (nw)

This commit is contained in:
couriersud 2020-06-01 19:59:14 +02:00
parent ef11941a92
commit 37258b7439
28 changed files with 58 additions and 59 deletions

View File

@ -51,7 +51,7 @@ TIDY_SOURCES = $(SOURCES)
#TIDY_SOURCES = $(SRC)/devices/nld_7442.cpp $(SRC)/devices/nld_7492.cpp #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-include-order -fix
#TIDY_FLAGS = -checks=llvm-namespace-comment -fix #TIDY_FLAGS = -checks=llvm-namespace-comment -fix
#TIDY_FLAGS = -checks=modernize-use-override -fix #TIDY_FLAGS = -checks=modernize-use-override -fix
@ -72,11 +72,11 @@ endif
TIDY_DB = $(OBJ)/compile_commands.json 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)/../.. CCOREFLAGS = -g -O3 -std=c++14 -I$(CURDIR)/.. -I$(CURDIR)/../..
CFLAGS = $(LTO) $(CCOREFLAGS) $(CEXTRAFLAGS) CFLAGS = $(LTO) $(CCOREFLAGS) $(CEXTRAFLAGS)
LDFLAGS = $(LTO) -g -O3 -std=c++14 $(LDEXTRAFLAGS) LDFLAGS = $(LTO) -g -O3 -std=c++14 $(LDEXTRAFLAGS)
LIBS = -lpthread -ldl $(EXTRALIBS) LIBS = -lpthread -ldl $(EXTRALIBS)
@ -85,7 +85,7 @@ CC = g++
LD = @g++ LD = @g++
MD = @mkdir MD = @mkdir
RM = @rm RM = @rm
CLANG_TIDY = clang-tidy-11 CLANG_TIDY = clang-tidy-10
DEPENDCC=$(CC) DEPENDCC=$(CC)
@ -232,7 +232,7 @@ ALL_TIDY_FILES = $(ALL_OBJS:.o=.json)
SOURCES = $(patsubst $(OBJ)%, $(SRC)%, $(ALL_OBJS:.o=.cpp)) SOURCES = $(patsubst $(OBJ)%, $(SRC)%, $(ALL_OBJS:.o=.cpp))
ALLFILES = $(SOURCES) $(VSBUILDS) $(DOCS) 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/ \ # git archive HEAD --prefix=project-name-version/ \
@ -242,7 +242,7 @@ MAKEFILE_TARGETS_WITHOUT_INCLUDE := clean doc clang mingw nvcc clang-libc
# PHONY # PHONY
#------------------------------------------------- #-------------------------------------------------
.PHONY: clang clang-5 mingw doc native maketree $(DEPEND) depend .PHONY: all gcc9 clang clang-5 mingw doc native maketree $(DEPEND) depend
#------------------------------------------------- #-------------------------------------------------
# all # all
@ -287,13 +287,13 @@ native:
$(MAKE) CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra " $(MAKE) CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra "
gcc9: 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: 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 -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 \ $(MAKE) CC=clang++-11 LD=clang++-11 OBJ=obj/clang CEXTRAFLAGS="-march=native \
-mllvm -inline-threshold=2000 \ -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 \ -Werror -Wno-padded -Wno-weak-vtables -Wno-weak-template-vtables -Wno-unused-template \
-Wno-missing-variable-declarations -Wno-float-equal -Wconversion \ -Wno-missing-variable-declarations -Wno-float-equal -Wconversion \
-Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral \ -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 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 \ $(MAKE) CC=clang++-11 LD=clang++-11 OBJ=obj/clang-libc CEXTRAFLAGS="-march=native \
-stdlib=libc++ -mllvm -inline-threshold=2000 \ -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 \ -Werror -Wno-padded -Wno-weak-vtables -Wno-weak-template-vtables -Wno-unused-template \
-Wno-missing-variable-declarations -Wno-float-equal -Wconversion \ -Wno-missing-variable-declarations -Wno-float-equal -Wconversion \
-Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral \ -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral \

View File

@ -104,8 +104,8 @@
#include "netlist/macro/nlm_cd4xxx.h" #include "netlist/macro/nlm_cd4xxx.h"
#include "netlist/macro/nlm_opamp.h" #include "netlist/macro/nlm_opamp.h"
#include "netlist/macro/nlm_other.h" #include "netlist/macro/nlm_other.h"
#include "netlist/macro/nlm_ttl74xx.h"
#include "netlist/macro/nlm_roms.h" #include "netlist/macro/nlm_roms.h"
#include "netlist/macro/nlm_ttl74xx.h"
#include "netlist/analog/nld_bjt.h" #include "netlist/analog/nld_bjt.h"
#include "netlist/analog/nld_fourterm.h" #include "netlist/analog/nld_fourterm.h"

View File

@ -94,10 +94,6 @@ namespace netlist
{ {
} }
void printer(pstring a)
{
printf("printer %s\n", a.c_str());
}
private: private:
NETLIB_RESETI() NETLIB_RESETI()
{ {

View File

@ -6,8 +6,8 @@
*/ */
#include "nlid_proxy.h" #include "nlid_proxy.h"
#include "solver/nld_solver.h"
#include "nl_errstr.h" #include "nl_errstr.h"
#include "solver/nld_solver.h"
namespace netlist namespace netlist
{ {
@ -187,7 +187,7 @@ namespace netlist
nlconst::zero()); nlconst::zero());
break; break;
default: 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; m_last_state = state;

View File

@ -11,8 +11,8 @@
#ifndef NLID_PROXY_H_ #ifndef NLID_PROXY_H_
#define NLID_PROXY_H_ #define NLID_PROXY_H_
#include "netlist/nl_base.h"
#include "netlist/analog/nlid_twoterm.h" #include "netlist/analog/nlid_twoterm.h"
#include "netlist/nl_base.h"
namespace netlist namespace netlist
{ {

View File

@ -10,8 +10,8 @@
#include "netlist/analog/nlid_twoterm.h" #include "netlist/analog/nlid_twoterm.h"
#include "netlist/nl_base.h" #include "netlist/nl_base.h"
#include "netlist/nl_factory.h" #include "netlist/nl_factory.h"
#include "netlist/plib/putil.h"
#include "netlist/plib/prandom.h" #include "netlist/plib/prandom.h"
#include "netlist/plib/putil.h"
#include <random> #include <random>
@ -417,7 +417,7 @@ namespace devices
if (state != m_last_state) if (state != m_last_state)
{ {
m_last_state = 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]() m_R.change_state([this, &R]()
{ {
@ -476,8 +476,8 @@ namespace devices
{ {
m_last_state = state; m_last_state = state;
//printf("Here %d\n", state); //printf("Here %d\n", state);
const nl_fptype G1 = state ? m_GON() : m_GOFF(); const nl_fptype G1 = (state != 0) ? m_GON() : m_GOFF();
const nl_fptype G2 = state ? m_GOFF() : m_GON(); const nl_fptype G2 = (state != 0) ? m_GOFF() : m_GON();
if (m_R1.solver() == m_R2.solver()) if (m_R1.solver() == m_R2.solver())
{ {
m_R1.change_state([this, &G1, &G2]() m_R1.change_state([this, &G1, &G2]()

View File

@ -1106,7 +1106,7 @@ namespace netlist
if (!m_force_logic) if (!m_force_logic)
if (v != m_tristate) 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; m_tristate = v;
} }
} }
@ -2329,11 +2329,11 @@ namespace netlist
return net().Q_Analog(); 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()); m_my_net.toggle_and_push_to_queue(netlist_time::quantum());
} }
} }

View File

@ -13,9 +13,9 @@
#include "plib/ptypes.h" #include "plib/ptypes.h"
#include "plib/putil.h" #include "plib/putil.h"
#include <vector>
#include <tuple> #include <tuple>
#include <utility> #include <utility>
#include <vector>
#define NETLIB_DEVICE_IMPL_ALIAS(p_alias, chip, p_name, p_def_param) \ #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) \ NETLIB_DEVICE_IMPL_BASE(devices, p_alias, chip, p_name, p_def_param) \

View File

@ -11,12 +11,10 @@
#define NLINTERFACE_H_ #define NLINTERFACE_H_
#include "nl_base.h" #include "nl_base.h"
#include "nl_setup.h"
#include <initializer_list>
#include <memory> #include <memory>
#include <stack> #include <array>
#include <unordered_map>
#include <vector>
namespace netlist namespace netlist
{ {

6
src/lib/netlist/nl_setup.cpp Executable file → Normal file
View File

@ -2,8 +2,6 @@
// copyright-holders:Couriersud // copyright-holders:Couriersud
#include "plib/palloc.h" #include "plib/palloc.h"
#include "plib/putil.h"
#include "plib/penum.h"
#include "analog/nld_twoterm.h" #include "analog/nld_twoterm.h"
#include "devices/nlid_proxy.h" #include "devices/nlid_proxy.h"
#include "devices/nlid_system.h" #include "devices/nlid_system.h"
@ -12,6 +10,8 @@
#include "nl_factory.h" #include "nl_factory.h"
#include "nl_parser.h" #include "nl_parser.h"
#include "nl_setup.h" #include "nl_setup.h"
#include "plib/penum.h"
#include "plib/putil.h"
#include "solver/nld_solver.h" #include "solver/nld_solver.h"
@ -55,7 +55,7 @@ namespace netlist
std::initializer_list<const char *> more_parameters) std::initializer_list<const char *> more_parameters)
{ {
std::vector<pstring> params; std::vector<pstring> params;
auto i(more_parameters.begin()); const auto *i(more_parameters.begin());
pstring name(*i); pstring name(*i);
++i; ++i;
for (; i != more_parameters.end(); ++i) for (; i != more_parameters.end(); ++i)

View File

@ -8,10 +8,10 @@
#ifndef PFMT_H_ #ifndef PFMT_H_
#define PFMT_H_ #define PFMT_H_
#include "penum.h"
#include "pstring.h" #include "pstring.h"
#include "ptypes.h" #include "ptypes.h"
#include "putil.h" #include "putil.h"
#include "penum.h"
#include <limits> #include <limits>
#include <locale> #include <locale>

View File

@ -10,9 +10,9 @@
#include "putil.h" #include "putil.h"
#include <array> #include <array>
#include <map>
#include <stack> #include <stack>
#include <type_traits> #include <type_traits>
#include <map>
#include <utility> #include <utility>
namespace plib { namespace plib {

View File

@ -70,7 +70,7 @@ namespace plib {
} }
if (icount()-- == 1) if (icount()-- == 1)
{ {
if (sinfo().size() != 0) if (!sinfo().empty())
plib::perrlogger("Still found {} info blocks after last mempool deleted\n", sinfo().size()); plib::perrlogger("Still found {} info blocks after last mempool deleted\n", sinfo().size());
} }
} }

View File

@ -223,7 +223,7 @@ namespace plib {
{ {
line += "="; line += "=";
auto *ol = dynamic_cast<option_str_limit_base *>(opt); auto *ol = dynamic_cast<option_str_limit_base *>(opt);
if (ol) if (ol != nullptr)
{ {
for (const auto &v : ol->limit()) for (const auto &v : ol->limit())
{ {
@ -274,7 +274,7 @@ namespace plib {
for (const auto & optbase : m_opts) for (const auto & optbase : m_opts)
{ {
auto *opt = dynamic_cast<option *>(optbase); auto *opt = dynamic_cast<option *>(optbase);
if (opt && arg != "" && opt->short_opt() == arg) if (opt != nullptr && arg != "" && opt->short_opt() == arg)
return opt; return opt;
} }
return nullptr; return nullptr;
@ -284,7 +284,7 @@ namespace plib {
for (const auto & optbase : m_opts) for (const auto & optbase : m_opts)
{ {
auto *opt = dynamic_cast<option *>(optbase); auto *opt = dynamic_cast<option *>(optbase);
if (opt && arg !="" && opt->long_opt() == arg) if (opt != nullptr && arg !="" && opt->long_opt() == arg)
return opt; return opt;
} }
return nullptr; return nullptr;

2
src/lib/netlist/plib/poptions.h Executable file → Normal file
View File

@ -8,10 +8,10 @@
/// \file poptions.h /// \file poptions.h
/// ///
#include "pfmtlog.h"
#include "pstonum.h" #include "pstonum.h"
#include "pstring.h" #include "pstring.h"
#include "putil.h" #include "putil.h"
#include "pfmtlog.h"
namespace plib { namespace plib {

6
src/lib/netlist/plib/ppmf.h Executable file → Normal file
View File

@ -34,9 +34,9 @@
#include "pconfig.h" #include "pconfig.h"
#include <algorithm>
#include <cstdint> // uintptr_t #include <cstdint> // uintptr_t
#include <utility> #include <utility>
#include <algorithm>
//============================================================ //============================================================
// Macro magic // Macro magic
@ -97,6 +97,8 @@
#if defined(__clang__) #if defined(__clang__)
#pragma clang diagnostic ignored "-Wundefined-reinterpret-cast" #pragma clang diagnostic ignored "-Wundefined-reinterpret-cast"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif #endif
#if (PPMF_TYPE == PPMF_TYPE_GNUC_PMF_CONV) #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); 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 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); func = reinterpret_cast<generic_function>(m_function);
else else
{ {

View File

@ -556,7 +556,7 @@ namespace plib {
pstring n = args.next(); pstring n = args.next();
if (!is_valid_token(n)) if (!is_valid_token(n))
error("define expected identifier"); error("define expected identifier");
auto prevdef = get_define(n); auto *prevdef = get_define(n);
if (lti.size() == 2) if (lti.size() == 2)
{ {
if (prevdef != nullptr && prevdef->m_replace != "") if (prevdef != nullptr && prevdef->m_replace != "")

View File

@ -9,6 +9,7 @@
/// ///
#include "pconfig.h" #include "pconfig.h"
#include "pmath.h"
#include "ptypes.h" #include "ptypes.h"
//#include <algorithm> //#include <algorithm>

View File

@ -132,7 +132,7 @@ public:
explicit pstring_t(size_type n, code_t code) explicit pstring_t(size_type n, code_t code)
{ {
while (n--) while (n-- != 0)
*this += code; *this += code;
} }

View File

@ -170,7 +170,7 @@ namespace plib
std::size_t strlen(const T *str) std::size_t strlen(const T *str)
{ {
const T *p = str; const T *p = str;
while (*p) while (*p != 0)
p++; p++;
return static_cast<std::size_t>(p - str); return static_cast<std::size_t>(p - str);
} }

View File

@ -10,8 +10,8 @@
#include "palloc.h" #include "palloc.h"
#include "pchrono.h" #include "pchrono.h"
#include "pstring.h"
#include "pmulti_threading.h" #include "pmulti_threading.h"
#include "pstring.h"
#include <algorithm> #include <algorithm>
#include <mutex> #include <mutex>

View File

@ -29,7 +29,7 @@ namespace plib {
void ptokenizer::skipeol() void ptokenizer::skipeol()
{ {
pstring::value_type c = getc(); pstring::value_type c = getc();
while (c) while (c != 0)
{ {
if (c == 10) if (c == 10)
{ {

View File

@ -11,8 +11,8 @@
#include "pstream.h" #include "pstream.h"
#include "pstring.h" #include "pstring.h"
#include "putil.h" // psource_t
#include "penum.h" #include "penum.h"
#include "putil.h" // psource_t
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>

View File

@ -2,9 +2,9 @@
// copyright-holders:Couriersud // copyright-holders:Couriersud
#include "putil.h" #include "putil.h"
#include "penum.h"
#include "pstrutil.h" #include "pstrutil.h"
#include "ptypes.h" #include "ptypes.h"
#include "penum.h"
#include <algorithm> #include <algorithm>
#include <cstdlib> // needed for getenv ... #include <cstdlib> // needed for getenv ...

View File

@ -123,6 +123,8 @@ namespace plib
PCOPYASSIGNMOVE(source_location, default) PCOPYASSIGNMOVE(source_location, default)
~source_location() = default;
unsigned line() const noexcept { return m_line; } unsigned line() const noexcept { return m_line; }
unsigned column() const noexcept { return m_col; } unsigned column() const noexcept { return m_col; }
pstring file_name() const noexcept { return m_file; } pstring file_name() const noexcept { return m_file; }

View File

@ -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", 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.") "Create static solvers for the MAME project.")
{} {}
public:
int execute() override; int execute() override;
pstring usage() override; pstring usage() override;
@ -153,7 +153,7 @@ private:
struct compile_map_entry 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) { } : m_module(mod), m_code(code) { }
pstring m_module; pstring m_module;
pstring m_code; pstring m_code;
@ -216,7 +216,7 @@ private:
class netlist_tool_callbacks_t : public netlist::callbacks_t class netlist_tool_callbacks_t : public netlist::callbacks_t
{ {
public: 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) : 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; 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"); throw netlist::nl_exception("either --dir or --output option needed");
if (opt_dir.was_specified()) 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() 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()); 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()); netlist_tool_t nt(*this, "netlist", opt_boostlib());
@ -878,9 +878,9 @@ void tool_app_t::create_header()
for (auto &e : nt.parser().factory()) 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); found |= (e->name().find(p) != pstring::npos);
if (found) if (found)

View File

@ -75,7 +75,7 @@ public:
void write(const T &val) void write(const T &val)
{ {
static_assert(sizeof(std::ostream::char_type) == 1, "char_type size must be 1"); 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)); m_f.write(ptr, sizeof(T));
} }
@ -718,7 +718,7 @@ pstring nlwav_app::usage()
} }
template <typename F> 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 != "-") if (fname != "-")
{ {

View File

@ -12,10 +12,10 @@
#include "netlist/nl_errstr.h" #include "netlist/nl_errstr.h"
#include "netlist/plib/mat_cr.h" #include "netlist/plib/mat_cr.h"
#include "netlist/plib/palloc.h" #include "netlist/plib/palloc.h"
#include "netlist/plib/penum.h"
#include "netlist/plib/pmatrix2d.h" #include "netlist/plib/pmatrix2d.h"
#include "netlist/plib/putil.h" #include "netlist/plib/putil.h"
#include "netlist/plib/vector_ops.h" #include "netlist/plib/vector_ops.h"
#include "netlist/plib/penum.h"
#include <numeric> #include <numeric>