netlist: rename some macros. (nw)

Rename COPYASSIGN* and friends to PCOPYASSIGN*.
This commit is contained in:
couriersud 2020-04-25 21:26:53 +02:00
parent 462943bf9e
commit 0cf99a5310
26 changed files with 75 additions and 98 deletions

View File

@ -167,6 +167,7 @@
<ClCompile Include="..\devices\nld_tristate.cpp" />
<ClCompile Include="..\devices\nlid_proxy.cpp" />
<ClCompile Include="..\devices\nlid_truthtable.cpp" />
<ClCompile Include="..\generated\static_solvers.cpp" />
<ClCompile Include="..\macro\nlm_base.cpp" />
<ClCompile Include="..\macro\nlm_cd4xxx.cpp" />
<ClCompile Include="..\macro\nlm_opamp.cpp" />

View File

@ -261,6 +261,9 @@
<ClCompile Include="..\devices\nld_4006.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\generated\static_solvers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\nl_errstr.h">

View File

@ -80,6 +80,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)\..\..;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

0
src/lib/netlist/generated/static_solvers.cpp Executable file → Normal file
View File

View File

@ -259,7 +259,7 @@ namespace netlist
public:
logic_family_desc_t();
COPYASSIGNMOVE(logic_family_desc_t, delete)
PCOPYASSIGNMOVE(logic_family_desc_t, delete)
virtual ~logic_family_desc_t() noexcept = default;
@ -304,7 +304,7 @@ namespace netlist
{
public:
logic_family_t() : m_logic_family(nullptr) {}
COPYASSIGNMOVE(logic_family_t, delete)
PCOPYASSIGNMOVE(logic_family_t, delete)
const logic_family_desc_t *logic_family() const noexcept { return m_logic_family; }
void set_logic_family(const logic_family_desc_t *fam) noexcept { m_logic_family = fam; }
@ -485,7 +485,7 @@ namespace netlist
props::add(this, aname);
}
COPYASSIGNMOVE(object_t, delete)
PCOPYASSIGNMOVE(object_t, delete)
/// \brief return name of the object
///
/// \returns name of the object.
@ -516,7 +516,7 @@ namespace netlist
, m_netlist(nl)
{ }
COPYASSIGNMOVE(netlist_object_t, delete)
PCOPYASSIGNMOVE(netlist_object_t, delete)
netlist_state_t & state() noexcept;
const netlist_state_t & state() const noexcept;
@ -603,7 +603,7 @@ namespace netlist
state_e state, nldelegate delegate = nldelegate());
virtual ~core_terminal_t() noexcept = default;
COPYASSIGNMOVE(core_terminal_t, delete)
PCOPYASSIGNMOVE(core_terminal_t, delete)
/// \brief The object type.
/// \returns type of the object
@ -672,7 +672,7 @@ namespace netlist
net_t(netlist_state_t &nl, const pstring &aname, core_terminal_t *railterminal = nullptr);
COPYASSIGNMOVE(net_t, delete)
PCOPYASSIGNMOVE(net_t, delete)
virtual ~net_t() noexcept = default;
@ -1007,7 +1007,7 @@ namespace netlist
core_device_t(netlist_state_t &owner, const pstring &name);
core_device_t(core_device_t &owner, const pstring &name);
COPYASSIGNMOVE(core_device_t, delete)
PCOPYASSIGNMOVE(core_device_t, delete)
virtual ~core_device_t() noexcept = default;
@ -1085,7 +1085,7 @@ namespace netlist
device_t(netlist_state_t &owner, const pstring &name);
device_t(core_device_t &owner, const pstring &name);
COPYASSIGNMOVE(device_t, delete)
PCOPYASSIGNMOVE(device_t, delete)
~device_t() noexcept override = default;
@ -1124,7 +1124,7 @@ namespace netlist
param_t(device_t &device, const pstring &name);
COPYASSIGNMOVE(param_t, delete)
PCOPYASSIGNMOVE(param_t, delete)
param_type_t param_type() const noexcept(false);
@ -1377,7 +1377,7 @@ namespace netlist
netlist_state_t(const pstring &aname,
plib::unique_ptr<callbacks_t> &&callbacks);
COPYASSIGNMOVE(netlist_state_t, delete)
PCOPYASSIGNMOVE(netlist_state_t, delete)
/// \brief Destructor
///
@ -1645,7 +1645,7 @@ namespace netlist
explicit netlist_t(netlist_state_t &state);
COPYASSIGNMOVE(netlist_t, delete)
PCOPYASSIGNMOVE(netlist_t, delete)
virtual ~netlist_t() noexcept = default;

View File

@ -53,7 +53,7 @@ namespace factory {
const pstring &def_param, const pstring &sourcefile);
virtual ~element_t() = default;
COPYASSIGNMOVE(element_t, default)
PCOPYASSIGNMOVE(element_t, default)
virtual unique_pool_ptr<device_t> make_device(nlmempool &pool,
netlist_state_t &anetlist,
@ -109,7 +109,7 @@ namespace factory {
explicit list_t(log_type &alog);
~list_t() = default;
COPYASSIGNMOVE(list_t, delete)
PCOPYASSIGNMOVE(list_t, delete)
template<class device_class>
void register_device(const pstring &name, const pstring &classname,

View File

@ -186,7 +186,7 @@ namespace netlist
source_netlist_t() = default;
COPYASSIGNMOVE(source_netlist_t, delete)
PCOPYASSIGNMOVE(source_netlist_t, delete)
~source_netlist_t() noexcept override = default;
virtual bool parse(nlparse_t &setup, const pstring &name);
@ -200,7 +200,7 @@ namespace netlist
source_data_t() = default;
COPYASSIGNMOVE(source_data_t, delete)
PCOPYASSIGNMOVE(source_data_t, delete)
~source_data_t() noexcept override = default;
};
@ -373,7 +373,7 @@ namespace netlist
explicit setup_t(netlist_state_t &nlstate);
~setup_t() noexcept = default;
COPYASSIGNMOVE(setup_t, delete)
PCOPYASSIGNMOVE(setup_t, delete)
netlist_state_t &nlstate() { return m_nlstate; }
const netlist_state_t &nlstate() const { return m_nlstate; }

View File

@ -52,7 +52,7 @@ namespace netlist
callbacks_t() = default;
virtual ~callbacks_t() = default;
COPYASSIGNMOVE(callbacks_t, default)
PCOPYASSIGNMOVE(callbacks_t, default)
/// \brief logging callback.
///

View File

@ -36,7 +36,7 @@ namespace plib
static constexpr const int NSQ = (N < 0 ? -N * N : N * N);
static constexpr const int Np1 = (N == 0) ? 0 : (N < 0 ? N - 1 : N + 1);
COPYASSIGNMOVE(pmatrix_cr_t, default)
PCOPYASSIGNMOVE(pmatrix_cr_t, default)
enum constants_e
{
@ -249,7 +249,7 @@ namespace plib
using base = B;
using index_type = typename base::index_type;
COPYASSIGNMOVE(pGEmatrix_cr_t, default)
PCOPYASSIGNMOVE(pGEmatrix_cr_t, default)
explicit pGEmatrix_cr_t(std::size_t n)
: B(n)
@ -483,7 +483,7 @@ namespace plib
using base = B;
using index_type = typename base::index_type;
COPYASSIGNMOVE(pLUmatrix_cr_t, default)
PCOPYASSIGNMOVE(pLUmatrix_cr_t, default)
explicit pLUmatrix_cr_t(std::size_t n)
: B(n)

View File

@ -165,7 +165,7 @@ namespace plib {
}
}
COPYASSIGNMOVE(parray2D, default)
PCOPYASSIGNMOVE(parray2D, default)
~parray2D() noexcept = default;

View File

@ -196,7 +196,7 @@ namespace plib {
explicit guard_t(timer &m) noexcept : m_m(m) { m_m.m_time -= T::start(); }
~guard_t() noexcept { m_m.m_time += T::stop(); ++m_m.m_count; }
COPYASSIGNMOVE(guard_t, default)
PCOPYASSIGNMOVE(guard_t, default)
private:
timer &m_m;
@ -232,7 +232,7 @@ namespace plib {
struct guard_t
{
guard_t() = default;
COPYASSIGNMOVE(guard_t, default)
PCOPYASSIGNMOVE(guard_t, default)
// using default constructor will trigger warning on
// unused local variable.

View File

@ -16,14 +16,15 @@ namespace plib {
// pdynlib: dynamic loading of libraries ...
// ----------------------------------------------------------------------------------------
class dynlib_base : public nocopyassignmove
class dynlib_base
{
public:
explicit dynlib_base() : m_is_loaded(false) { }
virtual ~dynlib_base() = default;
COPYASSIGNMOVE(dynlib_base, delete)
PCOPYASSIGN(dynlib_base, delete)
PMOVEASSIGN(dynlib_base, default)
bool isLoaded() const { return m_is_loaded; }
@ -46,10 +47,8 @@ namespace plib {
~dynlib() override;
COPYASSIGN(dynlib, delete)
dynlib(dynlib &&) noexcept = default;
dynlib &operator=(dynlib &&) noexcept = default;
PCOPYASSIGN(dynlib, delete)
PMOVEASSIGN(dynlib, default)
protected:
void *getsym_p(const pstring &name) const noexcept override;

View File

@ -106,7 +106,7 @@ namespace plib {
public:
explicit fpsignalenabler(unsigned fpexceptions);
COPYASSIGNMOVE(fpsignalenabler, delete)
PCOPYASSIGNMOVE(fpsignalenabler, delete)
~fpsignalenabler();

View File

@ -195,7 +195,7 @@ namespace plib {
{
}
COPYASSIGNMOVE(pfmt, default)
PCOPYASSIGNMOVE(pfmt, default)
~pfmt() noexcept = default;
@ -208,12 +208,7 @@ namespace plib {
template <typename T>
typename std::enable_if<plib::is_floating_point<T>::value, pfmt &>::type
e(const T &x) {return format_element('e', x); }
#if 0
#if PUSE_FLOAT128
// FIXME: should use quadmath_snprintf
pfmt & e(const FLOAT128 &x) {return format_element('e', static_cast<long double>(x)); }
#endif
#endif
template <typename T>
typename std::enable_if<plib::is_floating_point<T>::value, pfmt &>::type
g(const T &x) {return format_element('g', x); }
@ -317,7 +312,7 @@ namespace plib {
public:
explicit pfmt_writer_t() : m_enabled(true) { }
COPYASSIGNMOVE(pfmt_writer_t, delete)
PCOPYASSIGNMOVE(pfmt_writer_t, delete)
// runtime enable
template<bool enabled, typename... Args>
@ -370,7 +365,7 @@ namespace plib {
public:
explicit plog_channel(T &b) : pfmt_writer_t<plog_channel, build_enabled>(), m_base(b) { }
COPYASSIGNMOVE(plog_channel, delete)
PCOPYASSIGNMOVE(plog_channel, delete)
~plog_channel() noexcept = default;
@ -398,7 +393,7 @@ namespace plib {
fatal(proxy)
{}
COPYASSIGNMOVE(plog_base, default)
PCOPYASSIGNMOVE(plog_base, default)
virtual ~plog_base() noexcept = default;
plog_channel<T, plog_level::DEBUG, debug_enabled> debug;

View File

@ -51,7 +51,7 @@ namespace plib {
{
}
COPYASSIGNMOVE(uninitialised_array_t, delete)
PCOPYASSIGNMOVE(uninitialised_array_t, delete)
~uninitialised_array_t() noexcept
{
if (m_initialized>=N)
@ -115,7 +115,7 @@ namespace plib {
constexpr element_t() : m_next(nullptr), m_prev(nullptr) {}
~element_t() noexcept = default;
COPYASSIGNMOVE(element_t, delete)
PCOPYASSIGNMOVE(element_t, delete)
constexpr LC *next() const noexcept { return m_next; }
constexpr LC *prev() const noexcept { return m_prev; }
@ -284,7 +284,7 @@ namespace plib {
// Use TS = true for a threadsafe queue
template <class T, bool TS>
class timed_queue_linear : nocopyassignmove
class timed_queue_linear
{
public:
@ -294,6 +294,8 @@ namespace plib {
clear();
}
PCOPYASSIGNMOVE(timed_queue_linear, delete)
std::size_t capacity() const noexcept { return m_list.capacity() - 1; }
bool empty() const noexcept { return (m_end == &m_list[1]); }
@ -412,7 +414,7 @@ namespace plib {
};
template <class T, bool TS>
class timed_queue_heap : nocopyassignmove
class timed_queue_heap
{
public:
@ -427,6 +429,8 @@ namespace plib {
clear();
}
PCOPYASSIGNMOVE(timed_queue_heap, delete)
std::size_t capacity() const noexcept { return m_list.capacity(); }
bool empty() const noexcept { return &m_list[0] == m_end; }

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

@ -35,7 +35,7 @@ namespace plib {
public:
app();
COPYASSIGNMOVE(app, delete)
PCOPYASSIGNMOVE(app, delete)
virtual ~app() = default;

View File

@ -47,7 +47,7 @@ namespace plib {
{
}
COPYASSIGNMOVE(mempool, delete)
PCOPYASSIGNMOVE(mempool, delete)
~mempool()
{
@ -63,13 +63,7 @@ namespace plib {
//::operator delete(b->m_data);
}
}
#if 0
static inline mempool &instance()
{
static mempool s_mempool;
return s_mempool;
}
#endif
void *allocate(size_t align, size_t size)
{
block *b = nullptr;
@ -216,7 +210,7 @@ namespace plib {
{
info(block *b, size_type p) : m_block(b), m_pos(p) { }
~info() = default;
COPYASSIGNMOVE(info, default)
PCOPYASSIGNMOVE(info, default)
block * m_block;
size_type m_pos;

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

@ -25,7 +25,7 @@ namespace plib {
option_base(options &parent, const pstring &help);
virtual ~option_base() = default;
COPYASSIGNMOVE(option_base, delete)
PCOPYASSIGNMOVE(option_base, delete)
pstring help() const { return m_help; }
private:
@ -217,13 +217,15 @@ namespace plib {
{}
};
class options : public nocopyassignmove
class options
{
public:
options();
explicit options(option **o);
PCOPYASSIGNMOVE(options, delete)
void register_option(option_base *opt);
int parse(int argc, char **argv);

View File

@ -44,7 +44,7 @@ namespace plib {
explicit ppreprocessor(psource_collection_t<> &sources, defines_map_type *defines = nullptr);
COPYASSIGN(ppreprocessor, delete)
PCOPYASSIGN(ppreprocessor, delete)
ppreprocessor &operator=(ppreprocessor &&src) = delete;
ppreprocessor(ppreprocessor &&s) noexcept
@ -87,7 +87,7 @@ namespace plib {
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)
PCOPYASSIGN(readbuffer, delete)
readbuffer &operator=(readbuffer &&src) = delete;
~readbuffer() override = default;

View File

@ -65,7 +65,7 @@ public:
protected:
callback_t() = default;
virtual ~callback_t() = default;
COPYASSIGNMOVE(callback_t, default)
PCOPYASSIGNMOVE(callback_t, default)
};
struct entry_t

View File

@ -36,7 +36,7 @@ class putf8_reader
{
public:
COPYASSIGN(putf8_reader, delete)
PCOPYASSIGN(putf8_reader, delete)
virtual ~putf8_reader() = default;
putf8_reader(putf8_reader &&rhs) noexcept
@ -118,7 +118,7 @@ public:
putf8_writer(putf8_writer &&src) noexcept : m_strm(src.m_strm) {}
COPYASSIGN(putf8_writer, delete)
PCOPYASSIGN(putf8_writer, delete)
putf8_writer &operator=(putf8_writer &&src) = delete;
virtual ~putf8_writer() = default;
@ -155,7 +155,7 @@ public:
{
}
COPYASSIGNMOVE(putf8_fmt_writer, delete)
PCOPYASSIGNMOVE(putf8_fmt_writer, delete)
~putf8_fmt_writer() override = default;
@ -179,7 +179,7 @@ public:
explicit pbinary_writer(std::ostream &strm) : m_strm(strm) {}
pbinary_writer(pbinary_writer &&src) noexcept : m_strm(src.m_strm) {}
COPYASSIGN(pbinary_writer, delete)
PCOPYASSIGN(pbinary_writer, delete)
pbinary_writer &operator=(pbinary_writer &&src) = delete;
virtual ~pbinary_writer() = default;
@ -216,7 +216,7 @@ public:
explicit pbinary_reader(std::istream &strm) : m_strm(strm) {}
pbinary_reader(pbinary_reader &&src) noexcept : m_strm(src.m_strm) { }
COPYASSIGN(pbinary_reader, delete)
PCOPYASSIGN(pbinary_reader, delete)
pbinary_reader &operator=(pbinary_reader &&src) = delete;
virtual ~pbinary_reader() = default;

View File

@ -35,7 +35,7 @@ namespace plib {
m_source_location.emplace_back(plib::source_location("Unknown", 0));
}
COPYASSIGNMOVE(ptokenizer, delete)
PCOPYASSIGNMOVE(ptokenizer, delete)
virtual ~ptokenizer() = default;

View File

@ -19,16 +19,20 @@
#endif
// noexcept on move operator -> issue with macosx clang
#define COPYASSIGNMOVE(name, def) \
#define PCOPYASSIGNMOVE(name, def) \
name(const name &) = def; \
name(name &&) noexcept = def; \
name &operator=(const name &) = def; \
name &operator=(name &&) noexcept = def;
#define COPYASSIGN(name, def) \
#define PCOPYASSIGN(name, def) \
name(const name &) = def; \
name &operator=(const name &) = def; \
#define PMOVEASSIGN(name, def) \
name(name &&) noexcept = def; \
name &operator=(name &&) noexcept = def;
namespace plib
{
template<typename T> struct is_integral : public std::is_integral<T> { };
@ -80,32 +84,6 @@ namespace plib
};
#endif
//============================================================
// prevent implicit copying
//============================================================
struct nocopyassignmove
{
nocopyassignmove(const nocopyassignmove &) = delete;
nocopyassignmove(nocopyassignmove &&) noexcept = delete;
nocopyassignmove &operator=(const nocopyassignmove &) = delete;
nocopyassignmove &operator=(nocopyassignmove &&) noexcept = delete;
protected:
nocopyassignmove() = default;
~nocopyassignmove() noexcept = default;
};
struct nocopyassign
{
nocopyassign(const nocopyassign &) = delete;
nocopyassign &operator=(const nocopyassign &) = delete;
protected:
nocopyassign() = default;
~nocopyassign() noexcept = default;
nocopyassign(nocopyassign &&) noexcept = default;
nocopyassign &operator=(nocopyassign &&) noexcept = default;
};
//============================================================
// Avoid unused variable warnings
//============================================================

View File

@ -136,7 +136,7 @@ namespace plib
psource_t() noexcept = default;
COPYASSIGNMOVE(psource_t, delete)
PCOPYASSIGNMOVE(psource_t, delete)
virtual ~psource_t() noexcept = default;
@ -159,7 +159,7 @@ namespace plib
: m_name(std::move(name)), m_str(std::move(str))
{}
COPYASSIGNMOVE(psource_str_t, delete)
PCOPYASSIGNMOVE(psource_str_t, delete)
~psource_str_t() noexcept override = default;
typename TS::stream_ptr stream(const pstring &name) override
@ -185,7 +185,7 @@ namespace plib
psource_collection_t() noexcept = default;
COPYASSIGNMOVE(psource_collection_t, delete)
PCOPYASSIGNMOVE(psource_collection_t, delete)
virtual ~psource_collection_t() noexcept = default;
void add_source(source_type &&src)

View File

@ -38,7 +38,7 @@ public:
write(m_data);
}
COPYASSIGNMOVE(wav_t, delete)
PCOPYASSIGNMOVE(wav_t, delete)
~wav_t()
{

2
src/lib/netlist/tools/nl_convert.h Normal file → Executable file
View File

@ -24,7 +24,7 @@ class nl_convert_base_t
public:
using str_list = std::vector<pstring>;
COPYASSIGNMOVE(nl_convert_base_t, delete)
PCOPYASSIGNMOVE(nl_convert_base_t, delete)
virtual ~nl_convert_base_t();