From f5179f7ec8483f3975cf584dc939c99d8d42954b Mon Sep 17 00:00:00 2001 From: couriersud Date: Wed, 25 May 2016 14:52:40 +0200 Subject: [PATCH] Make netlist compile with c++11, use own implementation of make_unique to avoid c++14. (nw) --- src/lib/netlist/devices/nld_log.h | 2 +- src/lib/netlist/plib/palloc.h | 7 +++++++ src/lib/netlist/plib/pstate.cpp | 4 ++-- src/lib/netlist/tools/nl_convert.cpp | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/netlist/devices/nld_log.h b/src/lib/netlist/devices/nld_log.h index 1565cadecf1..c2e05784913 100644 --- a/src/lib/netlist/devices/nld_log.h +++ b/src/lib/netlist/devices/nld_log.h @@ -42,7 +42,7 @@ NETLIB_OBJECT(log) enregister("I", m_I); pstring filename = pfmt("{1}.log")(this->name()); - m_strm = std::make_unique(filename); + m_strm = pmake_unique(filename); } NETLIB_DESTRUCTOR(log); NETLIB_UPDATEI(); diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h index a4e046125d5..bc0b18a2ff8 100644 --- a/src/lib/netlist/plib/palloc.h +++ b/src/lib/netlist/plib/palloc.h @@ -10,6 +10,8 @@ #include #include +#include +#include #include "pconfig.h" #include "pstring.h" @@ -121,6 +123,11 @@ inline void pfree_array_t(T *p) #endif +template +std::unique_ptr pmake_unique(Args&&... args) { + return std::unique_ptr(new T(std::forward(args)...)); +} + class pmempool { private: diff --git a/src/lib/netlist/plib/pstate.cpp b/src/lib/netlist/plib/pstate.cpp index aa5d7b7bae2..095c8c812be 100644 --- a/src/lib/netlist/plib/pstate.cpp +++ b/src/lib/netlist/plib/pstate.cpp @@ -36,7 +36,7 @@ ATTR_COLD void pstate_manager_t::save_state_ptr(const pstring &stname, const pst "DT_FLOAT" }; - auto p = std::make_unique(stname, dt, owner, size, count, ptr, is_ptr); + auto p = pmake_unique(stname, dt, owner, size, count, ptr, is_ptr); m_save.push_back(std::move(p)); } @@ -70,7 +70,7 @@ template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, { //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state); pstate_callback_t *state_p = &state; - auto p = std::make_unique(stname, owner, state_p); + auto p = pmake_unique(stname, owner, state_p); m_save.push_back(std::move(p)); state.register_state(*this, stname); } diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp index ad10f15bd6b..052bd246e5e 100644 --- a/src/lib/netlist/tools/nl_convert.cpp +++ b/src/lib/netlist/tools/nl_convert.cpp @@ -38,7 +38,7 @@ static pvector_t bubble(const pvector_t &sl) void nl_convert_base_t::add_pin_alias(const pstring &devname, const pstring &name, const pstring &alias) { pstring pname = devname + "." + name; - m_pins.add(pname, std::make_unique(pname, devname + "." + alias)); + m_pins.add(pname, pmake_unique(pname, devname + "." + alias)); } void nl_convert_base_t::add_ext_alias(const pstring &alias)