mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
netlist: tick off some issues clang-tidy highlights. (nw)
This commit is contained in:
parent
ccd5479997
commit
6207d7d2d3
@ -14,7 +14,7 @@ VSBUILD = $(SRC)/buildVS
|
||||
DOC = $(SRC)/documentation
|
||||
TIDY_DB = ../compile_commands.json
|
||||
|
||||
TIDY_FLAGSX = -checks=*,-google*,-hicpp*,-readability*,-fuchsia*,-cert-*,-android-*,
|
||||
TIDY_FLAGSX = -checks=*,-google*,-hicpp*,-readability*,-fuchsia*,cert-*,-android-*,
|
||||
TIDY_FLAGSX += -llvm-header-guard,-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-owning-memory,
|
||||
TIDY_FLAGSX += -modernize-use-default-member-init,-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
|
@ -22,11 +22,12 @@ namespace netlist
|
||||
, m_clk(*this, "CLK", NETLIB_DELEGATE(74107A, clk))
|
||||
, m_Q(*this, "Q")
|
||||
, m_QQ(*this, "QQ")
|
||||
, m_delay(delay_107A)
|
||||
, m_J(*this, "J")
|
||||
, m_K(*this, "K")
|
||||
, m_clrQ(*this, "CLRQ")
|
||||
{
|
||||
m_delay[0] = delay_107A[0];
|
||||
m_delay[1] = delay_107A[1];
|
||||
}
|
||||
|
||||
friend class NETLIB_NAME(74107_dip);
|
||||
@ -43,7 +44,7 @@ namespace netlist
|
||||
logic_output_t m_Q;
|
||||
logic_output_t m_QQ;
|
||||
|
||||
const netlist_time *m_delay;
|
||||
netlist_time m_delay[2];
|
||||
|
||||
logic_input_t m_J;
|
||||
logic_input_t m_K;
|
||||
@ -61,7 +62,8 @@ namespace netlist
|
||||
public:
|
||||
NETLIB_CONSTRUCTOR_DERIVED(74107, 74107A)
|
||||
{
|
||||
m_delay = delay_107;
|
||||
m_delay[0] = delay_107[0];
|
||||
m_delay[1] = delay_107[1];
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,6 @@ namespace detail
|
||||
ret = ::operator new(size);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
void object_t::operator delete (void * mem)
|
||||
{
|
||||
if (mem)
|
||||
@ -55,6 +54,7 @@ namespace detail
|
||||
::operator delete(mem);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
@ -71,7 +71,7 @@ class NETLIB_NAME(name) : public device_t
|
||||
/*! Used to define the destructor of a netlist device.
|
||||
* The use of a destructor for netlist device should normally not be necessary.
|
||||
*/
|
||||
#define NETLIB_DESTRUCTOR(name) public: virtual ~NETLIB_NAME(name)()
|
||||
#define NETLIB_DESTRUCTOR(name) public: virtual ~NETLIB_NAME(name)() noexcept
|
||||
|
||||
/*! Define an extended constructor and add further parameters to it.
|
||||
* The macro allows to add further parameters to a device constructor. This is
|
||||
@ -418,11 +418,12 @@ namespace netlist
|
||||
*/
|
||||
pstring name() const;
|
||||
|
||||
#if 0
|
||||
void * operator new (size_t size, void *ptr) { plib::unused_var(size); return ptr; }
|
||||
void operator delete (void *ptr, void *) { plib::unused_var(ptr); }
|
||||
|
||||
void * operator new (size_t size) = delete;
|
||||
void operator delete (void * mem);
|
||||
void operator delete (void * mem) = delete;
|
||||
#endif
|
||||
protected:
|
||||
~object_t() noexcept = default; // only childs should be destructible
|
||||
|
||||
@ -451,7 +452,7 @@ namespace netlist
|
||||
const netlist_t & exec() const noexcept { return m_netlist; }
|
||||
|
||||
protected:
|
||||
~netlist_ref() = default; // prohibit polymorphic destruction
|
||||
~netlist_ref() noexcept = default; // prohibit polymorphic destruction
|
||||
|
||||
private:
|
||||
netlist_t & m_netlist;
|
||||
@ -941,7 +942,7 @@ namespace netlist
|
||||
param_type_t param_type() const;
|
||||
|
||||
protected:
|
||||
virtual ~param_t() = default; /* not intended to be destroyed */
|
||||
virtual ~param_t() noexcept = default; /* not intended to be destroyed */
|
||||
|
||||
void update_param();
|
||||
|
||||
@ -1182,7 +1183,7 @@ namespace netlist
|
||||
|
||||
COPYASSIGNMOVE(device_t, delete)
|
||||
|
||||
~device_t() override = default;
|
||||
~device_t() noexcept override = default;
|
||||
|
||||
setup_t &setup();
|
||||
const setup_t &setup() const;
|
||||
|
@ -28,7 +28,7 @@
|
||||
* Your mileage may vary.
|
||||
*
|
||||
*/
|
||||
#define USE_MEMPOOL (0)
|
||||
#define USE_MEMPOOL (1)
|
||||
|
||||
/*! Store input values in logic_terminal_t.
|
||||
*
|
||||
|
@ -141,9 +141,9 @@ namespace netlist
|
||||
// MACROS
|
||||
//============================================================
|
||||
|
||||
template <typename T> inline constexpr netlist_time NLTIME_FROM_NS(T &&t) { return netlist_time::from_nsec(t); }
|
||||
template <typename T> inline constexpr netlist_time NLTIME_FROM_US(T &&t) { return netlist_time::from_usec(t); }
|
||||
template <typename T> inline constexpr netlist_time NLTIME_FROM_MS(T &&t) { return netlist_time::from_msec(t); }
|
||||
template <typename T> inline constexpr netlist_time NLTIME_FROM_NS(T &&t) noexcept { return netlist_time::from_nsec(t); }
|
||||
template <typename T> inline constexpr netlist_time NLTIME_FROM_US(T &&t) noexcept { return netlist_time::from_usec(t); }
|
||||
template <typename T> inline constexpr netlist_time NLTIME_FROM_MS(T &&t) noexcept { return netlist_time::from_msec(t); }
|
||||
|
||||
} // namespace netlist
|
||||
|
||||
|
@ -113,7 +113,7 @@ namespace plib {
|
||||
r.release();
|
||||
}
|
||||
|
||||
~owned_ptr()
|
||||
~owned_ptr() noexcept
|
||||
{
|
||||
if (m_is_owned && (m_ptr != nullptr))
|
||||
{
|
||||
@ -142,7 +142,6 @@ namespace plib {
|
||||
bool m_is_owned;
|
||||
};
|
||||
|
||||
|
||||
template<typename T, typename... Args>
|
||||
std::unique_ptr<T> make_unique(Args&&... args)
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "pfmtlog.h"
|
||||
|
||||
#include <cfenv>
|
||||
#include <iostream>
|
||||
|
||||
#if (defined(__x86_64__) || defined(__i386__)) && defined(__linux__)
|
||||
#define HAS_FEENABLE_EXCEPT (1)
|
||||
@ -17,101 +18,113 @@
|
||||
#endif
|
||||
|
||||
namespace plib {
|
||||
//============================================================
|
||||
// Exceptions
|
||||
//============================================================
|
||||
|
||||
pexception::pexception(const pstring &text)
|
||||
: m_text(text)
|
||||
{
|
||||
}
|
||||
//============================================================
|
||||
// terminate
|
||||
//============================================================
|
||||
|
||||
|
||||
file_e::file_e(const pstring &fmt, const pstring &filename)
|
||||
: pexception(pfmt(fmt)(filename))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
file_open_e::file_open_e(const pstring &filename)
|
||||
: file_e("File open failed: {}", filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
file_read_e::file_read_e(const pstring &filename)
|
||||
: file_e("File read failed: {}", filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
file_write_e::file_write_e(const pstring &filename)
|
||||
: file_e("File write failed: {}", filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
null_argument_e::null_argument_e(const pstring &argument)
|
||||
: pexception(pfmt("Null argument passed: {}")(argument))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
out_of_mem_e::out_of_mem_e(const pstring &location)
|
||||
: pexception(pfmt("Out of memory: {}")(location))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
fpexception_e::fpexception_e(const pstring &text)
|
||||
: pexception(pfmt("Out of memory: {}")(text))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool fpsignalenabler::m_enable = false;
|
||||
|
||||
fpsignalenabler::fpsignalenabler(unsigned fpexceptions)
|
||||
{
|
||||
#if HAS_FEENABLE_EXCEPT
|
||||
if (m_enable)
|
||||
void terminate(pstring msg) noexcept
|
||||
{
|
||||
int b = 0;
|
||||
if (fpexceptions & plib::FP_INEXACT) b = b | FE_INEXACT;
|
||||
if (fpexceptions & plib::FP_DIVBYZERO) b = b | FE_DIVBYZERO;
|
||||
if (fpexceptions & plib::FP_UNDERFLOW) b = b | FE_UNDERFLOW;
|
||||
if (fpexceptions & plib::FP_OVERFLOW) b = b | FE_OVERFLOW;
|
||||
if (fpexceptions & plib::FP_INVALID) b = b | FE_INVALID;
|
||||
m_last_enabled = feenableexcept(b);
|
||||
std::cerr << msg.c_str() << "\n";
|
||||
std::terminate();
|
||||
}
|
||||
#else
|
||||
m_last_enabled = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
fpsignalenabler::~fpsignalenabler()
|
||||
{
|
||||
#if HAS_FEENABLE_EXCEPT
|
||||
if (m_enable)
|
||||
//============================================================
|
||||
// Exceptions
|
||||
//============================================================
|
||||
|
||||
pexception::pexception(const pstring &text)
|
||||
: m_text(text)
|
||||
{
|
||||
fedisableexcept(FE_ALL_EXCEPT); // Enable all floating point exceptions but FE_INEXACT
|
||||
feenableexcept(m_last_enabled); // Enable all floating point exceptions but FE_INEXACT
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool fpsignalenabler::supported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool fpsignalenabler::global_enable(bool enable)
|
||||
{
|
||||
bool old = m_enable;
|
||||
m_enable = enable;
|
||||
return old;
|
||||
}
|
||||
file_e::file_e(const pstring &fmt, const pstring &filename)
|
||||
: pexception(pfmt(fmt)(filename))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
file_open_e::file_open_e(const pstring &filename)
|
||||
: file_e("File open failed: {}", filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
file_read_e::file_read_e(const pstring &filename)
|
||||
: file_e("File read failed: {}", filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
file_write_e::file_write_e(const pstring &filename)
|
||||
: file_e("File write failed: {}", filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
null_argument_e::null_argument_e(const pstring &argument)
|
||||
: pexception(pfmt("Null argument passed: {}")(argument))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
out_of_mem_e::out_of_mem_e(const pstring &location)
|
||||
: pexception(pfmt("Out of memory: {}")(location))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
fpexception_e::fpexception_e(const pstring &text)
|
||||
: pexception(pfmt("Out of memory: {}")(text))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool fpsignalenabler::m_enable = false;
|
||||
|
||||
fpsignalenabler::fpsignalenabler(unsigned fpexceptions)
|
||||
{
|
||||
#if HAS_FEENABLE_EXCEPT
|
||||
if (m_enable)
|
||||
{
|
||||
int b = 0;
|
||||
if (fpexceptions & plib::FP_INEXACT) b = b | FE_INEXACT;
|
||||
if (fpexceptions & plib::FP_DIVBYZERO) b = b | FE_DIVBYZERO;
|
||||
if (fpexceptions & plib::FP_UNDERFLOW) b = b | FE_UNDERFLOW;
|
||||
if (fpexceptions & plib::FP_OVERFLOW) b = b | FE_OVERFLOW;
|
||||
if (fpexceptions & plib::FP_INVALID) b = b | FE_INVALID;
|
||||
m_last_enabled = feenableexcept(b);
|
||||
}
|
||||
#else
|
||||
m_last_enabled = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
fpsignalenabler::~fpsignalenabler()
|
||||
{
|
||||
#if HAS_FEENABLE_EXCEPT
|
||||
if (m_enable)
|
||||
{
|
||||
fedisableexcept(FE_ALL_EXCEPT); // Enable all floating point exceptions but FE_INEXACT
|
||||
feenableexcept(m_last_enabled); // Enable all floating point exceptions but FE_INEXACT
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool fpsignalenabler::supported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool fpsignalenabler::global_enable(bool enable)
|
||||
{
|
||||
bool old = m_enable;
|
||||
m_enable = enable;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
} // namespace plib
|
||||
|
@ -14,98 +14,109 @@
|
||||
#include "ptypes.h"
|
||||
|
||||
namespace plib {
|
||||
//============================================================
|
||||
// exception base
|
||||
//============================================================
|
||||
|
||||
class pexception : public std::exception
|
||||
{
|
||||
public:
|
||||
explicit pexception(const pstring &text);
|
||||
//============================================================
|
||||
// terminate
|
||||
//============================================================
|
||||
|
||||
const pstring &text() { return m_text; }
|
||||
const char* what() const noexcept override { return m_text.c_str(); }
|
||||
/*! Terminate the program
|
||||
*
|
||||
* \note could be enhanced by setting a termination handler
|
||||
*/
|
||||
[[noreturn]] void terminate(pstring msg) noexcept;
|
||||
|
||||
private:
|
||||
pstring m_text;
|
||||
};
|
||||
//============================================================
|
||||
// exception base
|
||||
//============================================================
|
||||
|
||||
class file_e : public plib::pexception
|
||||
{
|
||||
public:
|
||||
file_e(const pstring &fmt, const pstring &filename);
|
||||
};
|
||||
class pexception : public std::exception
|
||||
{
|
||||
public:
|
||||
explicit pexception(const pstring &text);
|
||||
|
||||
class file_open_e : public file_e
|
||||
{
|
||||
public:
|
||||
explicit file_open_e(const pstring &filename);
|
||||
};
|
||||
const pstring &text() { return m_text; }
|
||||
const char* what() const noexcept override { return m_text.c_str(); }
|
||||
|
||||
class file_read_e : public file_e
|
||||
{
|
||||
public:
|
||||
explicit file_read_e(const pstring &filename);
|
||||
};
|
||||
private:
|
||||
pstring m_text;
|
||||
};
|
||||
|
||||
class file_write_e : public file_e
|
||||
{
|
||||
public:
|
||||
explicit file_write_e(const pstring &filename);
|
||||
};
|
||||
class file_e : public plib::pexception
|
||||
{
|
||||
public:
|
||||
file_e(const pstring &fmt, const pstring &filename);
|
||||
};
|
||||
|
||||
class null_argument_e : public plib::pexception
|
||||
{
|
||||
public:
|
||||
explicit null_argument_e(const pstring &argument);
|
||||
};
|
||||
class file_open_e : public file_e
|
||||
{
|
||||
public:
|
||||
explicit file_open_e(const pstring &filename);
|
||||
};
|
||||
|
||||
class out_of_mem_e : public plib::pexception
|
||||
{
|
||||
public:
|
||||
explicit out_of_mem_e(const pstring &location);
|
||||
};
|
||||
class file_read_e : public file_e
|
||||
{
|
||||
public:
|
||||
explicit file_read_e(const pstring &filename);
|
||||
};
|
||||
|
||||
/* FIXME: currently only a stub for later use. More use could be added by
|
||||
* using “-fnon-call-exceptions" and sigaction to enable c++ exception supported.
|
||||
*/
|
||||
class file_write_e : public file_e
|
||||
{
|
||||
public:
|
||||
explicit file_write_e(const pstring &filename);
|
||||
};
|
||||
|
||||
class fpexception_e : public pexception
|
||||
{
|
||||
public:
|
||||
explicit fpexception_e(const pstring &text);
|
||||
};
|
||||
class null_argument_e : public plib::pexception
|
||||
{
|
||||
public:
|
||||
explicit null_argument_e(const pstring &argument);
|
||||
};
|
||||
|
||||
static constexpr unsigned FP_INEXACT = 0x0001;
|
||||
static constexpr unsigned FP_DIVBYZERO = 0x0002;
|
||||
static constexpr unsigned FP_UNDERFLOW = 0x0004;
|
||||
static constexpr unsigned FP_OVERFLOW = 0x0008;
|
||||
static constexpr unsigned FP_INVALID = 0x00010;
|
||||
static constexpr unsigned FP_ALL = 0x0001f;
|
||||
class out_of_mem_e : public plib::pexception
|
||||
{
|
||||
public:
|
||||
explicit out_of_mem_e(const pstring &location);
|
||||
};
|
||||
|
||||
/*
|
||||
* Catch SIGFPE on linux for debugging purposes.
|
||||
*/
|
||||
/* FIXME: currently only a stub for later use. More use could be added by
|
||||
* using “-fnon-call-exceptions" and sigaction to enable c++ exception supported.
|
||||
*/
|
||||
|
||||
class fpsignalenabler
|
||||
{
|
||||
public:
|
||||
explicit fpsignalenabler(unsigned fpexceptions);
|
||||
class fpexception_e : public pexception
|
||||
{
|
||||
public:
|
||||
explicit fpexception_e(const pstring &text);
|
||||
};
|
||||
|
||||
COPYASSIGNMOVE(fpsignalenabler, delete)
|
||||
static constexpr unsigned FP_INEXACT = 0x0001;
|
||||
static constexpr unsigned FP_DIVBYZERO = 0x0002;
|
||||
static constexpr unsigned FP_UNDERFLOW = 0x0004;
|
||||
static constexpr unsigned FP_OVERFLOW = 0x0008;
|
||||
static constexpr unsigned FP_INVALID = 0x00010;
|
||||
static constexpr unsigned FP_ALL = 0x0001f;
|
||||
|
||||
~fpsignalenabler();
|
||||
/*
|
||||
* Catch SIGFPE on linux for debugging purposes.
|
||||
*/
|
||||
|
||||
/* is the functionality supported ? */
|
||||
static bool supported();
|
||||
/* returns last global enable state */
|
||||
static bool global_enable(bool enable);
|
||||
class fpsignalenabler
|
||||
{
|
||||
public:
|
||||
explicit fpsignalenabler(unsigned fpexceptions);
|
||||
|
||||
private:
|
||||
int m_last_enabled;
|
||||
COPYASSIGNMOVE(fpsignalenabler, delete)
|
||||
|
||||
static bool m_enable;
|
||||
};
|
||||
~fpsignalenabler();
|
||||
|
||||
/* is the functionality supported ? */
|
||||
static bool supported();
|
||||
/* returns last global enable state */
|
||||
static bool global_enable(bool enable);
|
||||
|
||||
private:
|
||||
int m_last_enabled;
|
||||
|
||||
static bool m_enable;
|
||||
};
|
||||
|
||||
|
||||
} // namespace plib
|
||||
|
@ -11,9 +11,11 @@
|
||||
#include <algorithm>
|
||||
#include <cstdarg>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <locale>
|
||||
#include <array>
|
||||
|
||||
namespace plib {
|
||||
|
||||
@ -23,7 +25,7 @@ pfmt &pfmt::format_element(const char *l, const unsigned cfmt_spec, ...)
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||
va_start(ap, cfmt_spec);
|
||||
pstring fmt("%");
|
||||
char buf[2048]; // FIXME
|
||||
std::array<char, 2048> buf;
|
||||
std::size_t sl;
|
||||
|
||||
m_arg++;
|
||||
@ -81,9 +83,9 @@ pfmt &pfmt::format_element(const char *l, const unsigned cfmt_spec, ...)
|
||||
}
|
||||
else
|
||||
fmt += cfmt_spec;
|
||||
vsprintf(buf, fmt.c_str(), ap);
|
||||
std::vsnprintf(buf.data(), buf.size(), fmt.c_str(), ap);
|
||||
if (p != pstring::npos)
|
||||
m_str = m_str.substr(0, p) + pstring(buf) + m_str.substr(p + sl);
|
||||
m_str = m_str.substr(0, p) + pstring(buf.data()) + m_str.substr(p + sl);
|
||||
va_end(ap);
|
||||
return *this;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public:
|
||||
iter_t& operator=(const iter_t &rhs) { iter_t t(rhs); std::swap(*this, t); return *this; }
|
||||
iter_t& operator=(iter_t &&rhs) noexcept { std::swap(*this, rhs); return *this; }
|
||||
iter_t& operator++() noexcept {p = p->next();return *this;}
|
||||
iter_t operator++(int) noexcept {iter_t tmp(*this); operator++(); return tmp;}
|
||||
iter_t operator++(int) noexcept {const iter_t tmp(*this); operator++(); return tmp;}
|
||||
|
||||
~iter_t() = default;
|
||||
|
||||
|
@ -23,6 +23,22 @@
|
||||
|
||||
namespace plib {
|
||||
|
||||
template <typename P, typename T>
|
||||
struct pool_deleter
|
||||
{
|
||||
constexpr pool_deleter() noexcept = default;
|
||||
|
||||
template<typename PU, typename U, typename = typename
|
||||
std::enable_if<std::is_convertible< U*, T*>::value>::type>
|
||||
pool_deleter(const pool_deleter<PU, U>&) noexcept { }
|
||||
|
||||
void operator()(T *p) const
|
||||
{
|
||||
p->~T();
|
||||
P::free(p);
|
||||
}
|
||||
};
|
||||
|
||||
//============================================================
|
||||
// Memory pool
|
||||
//============================================================
|
||||
@ -56,8 +72,9 @@ namespace plib {
|
||||
struct info
|
||||
{
|
||||
info(block *b, std::size_t p) : m_block(b), m_pos(p) { }
|
||||
info(const info &) = default;
|
||||
info(info &&) = default;
|
||||
~info() = default;
|
||||
COPYASSIGNMOVE(info, default)
|
||||
|
||||
block * m_block;
|
||||
std::size_t m_pos;
|
||||
};
|
||||
@ -143,11 +160,11 @@ namespace plib {
|
||||
{
|
||||
auto it = sinfo().find(ptr);
|
||||
if (it == sinfo().end())
|
||||
printf("pointer not found\n");
|
||||
plib::terminate("mempool::free - pointer not found\n");
|
||||
info i = it->second;
|
||||
block *b = i.m_block;
|
||||
if (b->m_num_alloc == 0)
|
||||
throw plib::pexception("mempool::free - double free was called\n");
|
||||
plib::terminate("mempool::free - double free was called\n");
|
||||
else
|
||||
{
|
||||
//b->m_free = m_min_alloc;
|
||||
@ -159,23 +176,7 @@ namespace plib {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct pool_deleter
|
||||
{
|
||||
constexpr pool_deleter() noexcept = default;
|
||||
|
||||
template<typename U, typename = typename
|
||||
std::enable_if<std::is_convertible< U*, T*>::value>::type>
|
||||
pool_deleter(const pool_deleter<U>&) noexcept { }
|
||||
|
||||
void operator()(T *p) const
|
||||
{
|
||||
p->~T();
|
||||
mempool::free(p);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using poolptr = plib::owned_ptr<T, pool_deleter<T>>;
|
||||
using poolptr = plib::owned_ptr<T, pool_deleter<mempool, T>>;
|
||||
|
||||
template<typename T, typename... Args>
|
||||
poolptr<T> make_poolptr(Args&&... args)
|
||||
@ -204,9 +205,7 @@ namespace plib {
|
||||
|
||||
COPYASSIGNMOVE(mempool_default, delete)
|
||||
|
||||
~mempool_default()
|
||||
{
|
||||
}
|
||||
~mempool_default() = default;
|
||||
|
||||
void *alloc(size_t size)
|
||||
{
|
||||
@ -222,7 +221,7 @@ namespace plib {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
using poolptr = plib::owned_ptr<T>;
|
||||
using poolptr = plib::owned_ptr<T, pool_deleter<mempool_default, T>>;
|
||||
|
||||
template<typename T, typename... Args>
|
||||
poolptr<T> make_poolptr(Args&&... args)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* define a model param on core device
|
||||
*/
|
||||
/* Format: external name,netlist device,model */
|
||||
static const pstring s_lib_map =
|
||||
static const char * s_lib_map =
|
||||
"SN74LS00D, TTL_7400_DIP, 74LSXX\n"
|
||||
"SN74LS04D, TTL_7404_DIP, 74LSXX\n"
|
||||
"SN74ALS08D, TTL_7408_DIP, 74ALSXX\n"
|
||||
|
Loading…
Reference in New Issue
Block a user