diff options
author | 2020-07-25 14:44:11 +0200 | |
---|---|---|
committer | 2020-07-25 14:47:20 +0200 | |
commit | c29a37c3931c811fb3c19e387aecd6cb61322ad4 (patch) | |
tree | 3a6a9f07e3b110f0237d58dd64fb109a09d08c36 | |
parent | 3a9ab286c6c03567ae037a192025d7dbd02e5099 (diff) |
netlist: fix some clang tidy warnings.
-rw-r--r-- | src/lib/netlist/devices/nld_log.cpp | 2 | ||||
-rw-r--r-- | src/lib/netlist/plib/palloc.h | 7 | ||||
-rw-r--r-- | src/lib/netlist/plib/pstream.h | 6 | ||||
-rw-r--r-- | src/lib/netlist/plib/ptests.h | 16 |
4 files changed, 25 insertions, 6 deletions
diff --git a/src/lib/netlist/devices/nld_log.cpp b/src/lib/netlist/devices/nld_log.cpp index 36ee7619e6f..b00dc62ff0d 100644 --- a/src/lib/netlist/devices/nld_log.cpp +++ b/src/lib/netlist/devices/nld_log.cpp @@ -46,6 +46,8 @@ namespace netlist m_sem_r.acquire(); } + PCOPYASSIGNMOVE(NETLIB_NAME(log), delete) + NETLIB_DESTRUCTOR(log) { if (m_reset) diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h index d082efc5d41..230b05f03c4 100644 --- a/src/lib/netlist/plib/palloc.h +++ b/src/lib/netlist/plib/palloc.h @@ -12,6 +12,7 @@ #include "pgsl.h" #include "pmath.h" // FIXME: only uses lcm ... move to ptypes. #include "ptypes.h" +#include "pgsl.h" #include <algorithm> #include <cstddef> // for std::max_align_t (usually long long) @@ -253,7 +254,7 @@ namespace plib { : m_a(arena_type::instance()) { } - //~arena_allocator() noexcept = default; + ~arena_allocator() noexcept = default; PCOPYASSIGNMOVE(arena_allocator, default) @@ -626,9 +627,7 @@ namespace plib { class paged_arena : public arena_base<paged_arena<BASEARENA, PAGESIZE>, true, true> { public: - paged_arena() - { - } + paged_arena() = default; PCOPYASSIGNMOVE(paged_arena, delete) diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h index 96da8b91c1f..21d5531848c 100644 --- a/src/lib/netlist/plib/pstream.h +++ b/src/lib/netlist/plib/pstream.h @@ -32,6 +32,7 @@ namespace plib { { using ct = typename S::char_type; static_assert((sizeof(T) % sizeof(ct)) == 0, "istream_read sizeof issue"); + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) return is.read(reinterpret_cast<ct *>(data), gsl::narrow<std::streamsize>(len * sizeof(T))); } @@ -42,6 +43,7 @@ namespace plib { { using ct = typename S::char_type; static_assert((sizeof(T) % sizeof(ct)) == 0, "ostream_write sizeof issue"); + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) return os.write(reinterpret_cast<const ct *>(data), gsl::narrow<std::streamsize>(len * sizeof(T))); } @@ -108,6 +110,7 @@ public: m_strm->read(&b[0], 1); if (m_strm->eof()) return false; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) const std::size_t l = putf8string::traits_type::codelen(reinterpret_cast<putf8string::traits_type::mem_t *>(&b)); for (std::size_t i = 1; i < l; i++) { @@ -115,6 +118,7 @@ public: if (m_strm->eof()) return false; } + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) c = putf8string::traits_type::code(reinterpret_cast<putf8string::traits_type::mem_t *>(&b)); return true; } @@ -212,7 +216,7 @@ public: void write(const pstring &s) { - auto *sm = s.c_str(); + const auto *sm = s.c_str(); const auto sl(std::char_traits<pstring::mem_t>::length(sm)); write(sl); ostream_write(m_strm, sm, sl); diff --git a/src/lib/netlist/plib/ptests.h b/src/lib/netlist/plib/ptests.h index 7369e74a20d..9755d49c240 100644 --- a/src/lib/netlist/plib/ptests.h +++ b/src/lib/netlist/plib/ptests.h @@ -69,7 +69,14 @@ namespace testing class Test { public: - virtual ~Test() {} + Test() = default; + virtual ~Test() = default; + + Test(const Test &) = delete; + Test &operator=(const Test &) = delete; + Test(Test &&) noexcept = delete; + Test &operator=(Test &&) noexcept = delete; + virtual void run() {} virtual void SetUp() {} virtual void TearDown() {} @@ -83,7 +90,14 @@ namespace testing { registry().push_back(this); } + + reg_entry_base(const reg_entry_base &) = delete; + reg_entry_base &operator=(const reg_entry_base &) = delete; + reg_entry_base(reg_entry_base &&) noexcept = delete; + reg_entry_base &operator=(reg_entry_base &&) noexcept = delete; + virtual ~reg_entry_base() = default; + virtual Test *create() const { return nullptr; } std::string name; |