From 25b942de742204fc63c4014311d47285ec87667d Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 5 Jun 2017 10:05:17 +0000 Subject: [PATCH] Visual Studio apparently still defines __cplusplus as 199711. git-svn-id: https://svn.eduke32.com/eduke32@6141 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/compat.h | 20 +++++++++++++------- source/build/include/print.h | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/source/build/include/compat.h b/source/build/include/compat.h index c21eb5281..aba4dd04f 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -31,6 +31,12 @@ # define __has_extension __has_feature // Compatibility with pre-3.0 compilers. #endif +#ifdef _MSC_VER +# define EDUKE32_MSVC_PREREQ(major) ((major) <= (_MSC_VER)) +#else +# define EDUKE32_MSVC_PREREQ(major) 0 +#endif + ////////// Language detection ////////// @@ -190,14 +196,14 @@ # define ASMSYM(x) x #endif -#if defined __cplusplus && (__cplusplus >= 201103L || __has_feature(cxx_constexpr)) +#if defined __cplusplus && (__cplusplus >= 201103L || __has_feature(cxx_constexpr) || EDUKE32_MSVC_PREREQ(1900)) # define HAVE_CONSTEXPR # define CONSTEXPR constexpr #else # define CONSTEXPR #endif -#if CXXSTD >= 2011 +#if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1700) # define FINAL final #else # define FINAL @@ -352,7 +358,7 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 || #include #ifdef __cplusplus -# if CXXSTD >= 2011 +# if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800) # include # endif #endif @@ -636,7 +642,7 @@ void eduke32_exit_return(int) ATTRIBUTE((noreturn)); #ifdef __cplusplus -# if CXXSTD >= 2011 +# if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800) using std::is_integral; # endif @@ -645,7 +651,7 @@ using std::enable_if_t; using std::conditional_t; using std::make_signed_t; using std::make_unsigned_t; -# elif CXXSTD >= 2011 +# elif CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800) template using enable_if_t = typename std::enable_if::type; template @@ -697,7 +703,7 @@ struct Dummy FINAL }; #endif -#if CXXSTD >= 2011 +#if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800) using native_t = typename integers_of_size::i; using unative_t = typename integers_of_size::u; #else @@ -944,7 +950,7 @@ CLAMP_DECL float fclamp2(float in, float min, float max) { return in >= max ? ma #ifdef __cplusplus -#if CXXSTD >= 2011 +#if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800) template struct DivResult { diff --git a/source/build/include/print.h b/source/build/include/print.h index 089ea887b..665600d7e 100644 --- a/source/build/include/print.h +++ b/source/build/include/print.h @@ -4,7 +4,7 @@ #ifndef print_h_ #define print_h_ -#if CXXSTD >= 2011 +#if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800) template struct binwrap