From f7087c847a03a2bb4e9392e41eac4cb1ec37172c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 29 Aug 2021 12:18:17 +0300 Subject: [PATCH] Require C++11 for building In practice this has been a requirement for a while due to libsigc++. --- Build | 1 + source/core/noncopyable.h | 9 ------- source/debug/exceptiontrace.cpp | 6 ----- source/io/print.h | 46 --------------------------------- source/strings/format.h | 25 ------------------ 5 files changed, 1 insertion(+), 86 deletions(-) diff --git a/Build b/Build index 1321bb2..8108803 100644 --- a/Build +++ b/Build @@ -7,6 +7,7 @@ package "mspcore" build_info { threads true; + standard CXX "c++11"; }; if_arch "linux" { diff --git a/source/core/noncopyable.h b/source/core/noncopyable.h index b3dfca3..c948c57 100644 --- a/source/core/noncopyable.h +++ b/source/core/noncopyable.h @@ -5,20 +5,11 @@ namespace Msp { class NonCopyable { -#if __cplusplus >= 201103L protected: NonCopyable() = default; NonCopyable(const NonCopyable &) = delete; NonCopyable &operator=(const NonCopyable &) = delete; ~NonCopyable() = default; -#else -private: - NonCopyable(const NonCopyable &) { } - NonCopyable &operator=(const NonCopyable &) { } -protected: - NonCopyable() { } - ~NonCopyable() { } -#endif }; } // namespace Msp diff --git a/source/debug/exceptiontrace.cpp b/source/debug/exceptiontrace.cpp index fb72223..8ffc9c8 100644 --- a/source/debug/exceptiontrace.cpp +++ b/source/debug/exceptiontrace.cpp @@ -32,13 +32,7 @@ bool trace_enabled = false; Msp::Debug::Backtrace &get_thread_backtrace() { -#if __cplusplus>=201103L static thread_local Msp::Debug::Backtrace backtrace; -#elif defined(__GNUC__) - static __thread Msp::Debug::Backtrace backtrace; -#else - static Msp::Debug::Backtrace backtrace; -#endif return backtrace; } diff --git a/source/io/print.h b/source/io/print.h index 29da9f4..85fd539 100644 --- a/source/io/print.h +++ b/source/io/print.h @@ -15,65 +15,19 @@ completeness with the other print functions. inline unsigned print(Base &o, const std::string &f) { return o.write(f); } -#if __cplusplus>=201103L template inline unsigned print(Base &o, const std::string &f, Args... args) { return print(o, format(f, args...)); } -#else -template -inline unsigned print(Base &o, const std::string &f, A1 a1) -{ return print(o, format(f, a1)); } - -template -inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2) -{ return print(o, format(f, a1, a2)); } - -template -inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3) -{ return print(o, format(f, a1, a2, a3)); } - -template -inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4) -{ return print(o, format(f, a1, a2, a3, a4)); } - -template -inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ return print(o, format(f, a1, a2, a3, a4, a5)); } -#endif - /* The following functions print to console */ inline unsigned print(const std::string &f) { return print(cout, f); } -#if __cplusplus>=201103L template inline unsigned print(const std::string &f, Args... args) { return print(cout, f, args...); } -#else -template -inline unsigned print(const std::string &f, A1 a1) -{ return print(cout, f, a1); } - -template -inline unsigned print(const std::string &f, A1 a1, A2 a2) -{ return print(cout, f, a1, a2); } - -template -inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3) -{ return print(cout, f, a1, a2, a3); } - -template -inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4) -{ return print(cout, f, a1, a2, a3, a4); } - -template -inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ return print(cout, f, a1, a2, a3, a4, a5); } -#endif - } // namespace IO } // namespace Msp diff --git a/source/strings/format.h b/source/strings/format.h index ea5d5b0..49c40e9 100644 --- a/source/strings/format.h +++ b/source/strings/format.h @@ -31,13 +31,11 @@ public: return *this; } -#if __cplusplus>=201103L template Formatter &operator()(const T &a, const Tail &... tail) { return (*this)(a)(tail...); } -#endif /** Returns the result of the formatting operation. Will throw if not enough values have been fed to the formatter. */ @@ -57,35 +55,12 @@ private: inline Formatter format(const std::string &f) { return Formatter(f); } -#if __cplusplus >= 201103L template inline std::string format(const std::string &f, const Args &... args) { return Formatter(f)(args...).str(); } -#else -template -inline std::string format(const std::string &f, const A1 &a1) -{ return Formatter(f)(a1).str(); } - -template -inline std::string format(const std::string &f, const A1 &a1, const A2 &a2) -{ return Formatter(f)(a1)(a2).str(); } - -template -inline std::string format(const std::string &f, const A1 &a1, const A2 &a2, const A3 &a3) -{ return Formatter(f)(a1)(a2)(a3).str(); } - -template -inline std::string format(const std::string &f, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) -{ return Formatter(f)(a1)(a2)(a3)(a4).str(); } - -template -inline std::string format(const std::string &f, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) -{ return Formatter(f)(a1)(a2)(a3)(a4)(a5).str(); } -#endif - } // namespace Msp #endif -- 2.43.0