From b380514764cf857469bae61c11143a19f79a74c5 Mon Sep 17 00:00:00 2001 From: andreasnaive Date: Mon, 25 Mar 2019 23:13:40 +0100 Subject: Revert "conflict resolution (nw)" This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing changes made to 009cba4fb8102102168ef32870892438327f3705. --- src/lib/netlist/plib/pfmtlog.h | 50 ++++++++++-------------------------------- 1 file changed, 12 insertions(+), 38 deletions(-) (limited to 'src/lib/netlist/plib/pfmtlog.h') diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h index cb9b59c01ce..9b7a85d8d8d 100644 --- a/src/lib/netlist/plib/pfmtlog.h +++ b/src/lib/netlist/plib/pfmtlog.h @@ -9,7 +9,6 @@ #include "pstring.h" #include "ptypes.h" -#include "putil.h" #include @@ -35,6 +34,7 @@ struct ptype_traits_base template <> struct ptype_traits_base { + static unsigned int cast(bool &x) { return static_cast(x); } static unsigned int cast(const bool &x) { return static_cast(x); } static const bool is_signed = std::numeric_limits::is_signed; static const char *size_spec() { return ""; } @@ -136,6 +136,7 @@ struct ptype_traits : ptype_traits_base static char32_t fmt_spec() { return 'f'; } }; + template<> struct ptype_traits : ptype_traits_base { @@ -143,13 +144,6 @@ struct ptype_traits : ptype_traits_base static char32_t fmt_spec() { return 's'; } }; -template<> -struct ptype_traits : ptype_traits_base -{ - static const char *cast(const std::string &x) { return x.c_str(); } - static char32_t fmt_spec() { return 's'; } -}; - class pfmt { public: @@ -157,57 +151,44 @@ public: : m_str(fmt), m_arg(0) { } - COPYASSIGNMOVE(pfmt, default) - ~pfmt() noexcept = default; + pfmt(const pfmt &rhs) : m_str(rhs.m_str), m_arg(rhs.m_arg) { } + + ~pfmt() + { + } operator pstring() const { return m_str; } - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) pfmt & e(const double &x) {return format_element("", 'e', x); } - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) pfmt & g(const double &x) {return format_element("", 'g', x); } - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) pfmt & e(const float &x) {return format_element("", 'e', static_cast(x)); } - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) pfmt & g(const float &x) {return format_element("", 'g', static_cast(x)); } - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) pfmt &operator ()(const void *x) {return format_element("", 'p', x); } - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) pfmt &operator ()(const pstring &x) {return format_element("", 's', x.c_str() ); } template pfmt &operator ()(const T &x) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) return format_element(ptype_traits::size_spec(), ptype_traits::fmt_spec(), ptype_traits::cast(x)); } template pfmt &operator ()(const T *x) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) return format_element(ptype_traits::size_spec(), ptype_traits::fmt_spec(), ptype_traits::cast(x)); } - template - pfmt &operator()(X&& x, Y && y, Args&&... args) - { - return ((*this)(std::forward(x)))(std::forward(y), std::forward(args)...); - } - template pfmt &x(const T &x) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) return format_element(ptype_traits::size_spec(), 'x', x); } template pfmt &o(const T &x) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) return format_element(ptype_traits::size_spec(), 'o', x); } @@ -222,13 +203,11 @@ private: }; template -class pfmt_writer_t +class pfmt_writer_t : plib::nocopyassignmove { public: explicit pfmt_writer_t() : m_enabled(true) { } - COPYASSIGNMOVE(pfmt_writer_t, delete) - /* runtime enable */ template void log(const pstring & fmt, Args&&... args) const @@ -258,7 +237,7 @@ public: bool is_enabled() const { return m_enabled; } protected: - ~pfmt_writer_t() noexcept = default; + ~pfmt_writer_t() { } private: pfmt &xlog(pfmt &fmt) const { return fmt; } @@ -279,10 +258,7 @@ class plog_channel : public pfmt_writer_t, bui friend class pfmt_writer_t, build_enabled>; public: explicit plog_channel(T &b) : pfmt_writer_t(), m_base(b) { } - - COPYASSIGNMOVE(plog_channel, delete) - - ~plog_channel() noexcept = default; + ~plog_channel() { } protected: void vdowrite(const pstring &ls) const @@ -307,9 +283,7 @@ public: error(proxy), fatal(proxy) {} - - COPYASSIGNMOVE(plog_base, default) - virtual ~plog_base() noexcept = default; + virtual ~plog_base() {} plog_channel debug; plog_channel info; @@ -319,7 +293,7 @@ public: plog_channel fatal; }; -} // namespace plib +} template plib::pfmt& operator<<(plib::pfmt &p, T&& val) { return p(std::forward(val)); } -- cgit v1.2.3-70-g09d2