From 8becb29fad074908efdeaec34af768096cd139c2 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Mon, 19 Mar 2018 00:09:33 +1100 Subject: [PATCH] Removed C++14 feature macros --- src/config.hpp | 34 +--------------------------------- src/config_attribute_value.hpp | 20 -------------------- src/formatter.hpp | 24 +++++++++--------------- src/global.hpp | 12 +----------- 4 files changed, 11 insertions(+), 79 deletions(-) diff --git a/src/config.hpp b/src/config.hpp index bb35022e26f0..b1e9c5b13e59 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -49,27 +49,6 @@ #include "config_attribute_value.hpp" #include "exceptions.hpp" -#ifdef HAVE_CXX14 -# ifdef __clang__ // Check this first, because clang also defines __GNUC__ -# ifdef __apple_build_version__ // Apple clang -# if (__clang_major__ == 5 && __clang_minor__ >= 1) || __clang_major__ > 5 // Apple clang 5.1+ -# define USE_HETEROGENOUS_LOOKUPS -# endif -# else // Non-Apple clang -# if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 // clang 3.4+ -# define USE_HETEROGENOUS_LOOKUPS -# endif -# endif -# elif defined(__GNUC__) && __GNUC__ >= 5 // GCC 5.0+ -# define USE_HETEROGENOUS_LOOKUPS -# endif -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1900 // MSVC 2015 -# define USE_HETEROGENOUS_LOOKUPS -#endif - -#ifdef USE_HETEROGENOUS_LOOKUPS #if BOOST_VERSION > 106100 #include using config_key_type = boost::string_view; @@ -77,9 +56,6 @@ using config_key_type = boost::string_view; #include using config_key_type = boost::string_ref; #endif -#else -using config_key_type = const std::string &; -#endif class config; class enum_tag; @@ -141,11 +117,7 @@ class config { return this != &invalid; } typedef std::vector> child_list; - typedef std::map -#endif - > child_map; + typedef std::map> child_map; struct const_child_iterator; @@ -249,9 +221,7 @@ class config typedef std::map< std::string , attribute_value -#ifdef USE_HETEROGENOUS_LOOKUPS , std::less<> -#endif > attribute_map; typedef attribute_map::value_type attribute; struct const_attribute_iterator; @@ -405,7 +375,6 @@ class config */ const attribute_value& operator[](config_key_type key) const; -#ifdef USE_HETEROGENOUS_LOOKUPS /** * Returns a reference to the attribute with the given @a key. * Creates it if it does not exist. @@ -423,7 +392,6 @@ class config { return operator[](config_key_type(key)); } -#endif /** * Returns a reference to the attribute with the given @a key. diff --git a/src/config_attribute_value.hpp b/src/config_attribute_value.hpp index 741929513980..1aff629f7046 100644 --- a/src/config_attribute_value.hpp +++ b/src/config_attribute_value.hpp @@ -47,26 +47,6 @@ #include "tstring.hpp" -#ifdef HAVE_CXX14 -# ifdef __clang__ // Check this first, because clang also defines __GNUC__ -# ifdef __apple_build_version__ // Apple clang -# if (__clang_major__ == 5 && __clang_minor__ >= 1) || __clang_major__ > 5 // Apple clang 5.1+ -# define USE_HETEROGENOUS_LOOKUPS -# endif -# else // Non-Apple clang -# if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 // clang 3.4+ -# define USE_HETEROGENOUS_LOOKUPS -# endif -# endif -# elif defined(__GNUC__) && __GNUC__ >= 5 // GCC 5.0+ -# define USE_HETEROGENOUS_LOOKUPS -# endif -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1900 // MSVC 2015 -# define USE_HETEROGENOUS_LOOKUPS -#endif - class enum_tag; /** diff --git a/src/formatter.hpp b/src/formatter.hpp index 1e949e25a231..af9cec6c6ba3 100644 --- a/src/formatter.hpp +++ b/src/formatter.hpp @@ -38,38 +38,32 @@ class formatter { public: - formatter() : - stream_() + formatter() + : stream_() { } template - formatter& operator<<(const T & o) -#if HAVE_REF_QUALIFIERS - & -#endif + formatter& operator<<(const T& o) & { stream_ << o; return *this; } -#if HAVE_REF_QUALIFIERS - template - formatter && operator<<(const T & o) && { + template + formatter&& operator<<(const T& o) && + { stream_ << o; return std::move(*this); } -#endif - std::string str() const { + std::string str() const + { return stream_.str(); } // Implicit x-value conversion to string - operator std::string() const -#if HAVE_REF_QUALIFIERS - && -#endif + operator std::string() const && { return stream_.str(); } diff --git a/src/global.hpp b/src/global.hpp index b580cd6b8c39..eb4e36a5a2c4 100644 --- a/src/global.hpp +++ b/src/global.hpp @@ -33,20 +33,15 @@ #define UNUSED(x) ((void)(x)) /* to avoid warnings */ -// To allow using some optional C++14 and C++17 features -#if __cplusplus >= 201402L -#define HAVE_CXX14 +// To allow using some optional C++17 features #if __cplusplus >= 201703L #define HAVE_CXX17 #endif -#endif // Some C++11 features are not available on all supported platforms #if defined(_MSC_VER) // MSVC supports these starting in MSVC 2015 #if _MSC_VER >= 1900 -#define HAVE_REF_QUALIFIERS 1 -#define HAVE_INHERITING_CTORS 1 #else #endif // MSVC supports these starting in 2017? @@ -67,9 +62,6 @@ #if defined(__clang__) #include // To ensure standard library version macros are defined -// Clang has convenient feature detection macros \o/ -#define HAVE_REF_QUALIFIERS __has_feature(cxx_reference_qualified_functions) -#define HAVE_INHERITING_CTORS __has_feature(cxx_inheriting_constructors) // All supported versions of clang have these #define FALLTHROUGH [[clang::fallthrough]] // Use GCC-style attribute because the __has_cpp_attribute feature-checking macro doesn't exist in clang 3.5 @@ -79,8 +71,6 @@ #if defined(__GNUC__) && !defined(__clang__) // GCC supports these from 4.8 up -#define HAVE_REF_QUALIFIERS 1 -#define HAVE_INHERITING_CTORS 1 // Deprecated is supported from 4.9 up #if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)