Visual Studio apparently still defines __cplusplus as 199711.

git-svn-id: https://svn.eduke32.com/eduke32@6141 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-06-05 10:05:17 +00:00
parent f781f21ccd
commit 25b942de74
2 changed files with 14 additions and 8 deletions

View file

@ -31,6 +31,12 @@
# define __has_extension __has_feature // Compatibility with pre-3.0 compilers. # define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
#endif #endif
#ifdef _MSC_VER
# define EDUKE32_MSVC_PREREQ(major) ((major) <= (_MSC_VER))
#else
# define EDUKE32_MSVC_PREREQ(major) 0
#endif
////////// Language detection ////////// ////////// Language detection //////////
@ -190,14 +196,14 @@
# define ASMSYM(x) x # define ASMSYM(x) x
#endif #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 HAVE_CONSTEXPR
# define CONSTEXPR constexpr # define CONSTEXPR constexpr
#else #else
# define CONSTEXPR # define CONSTEXPR
#endif #endif
#if CXXSTD >= 2011 #if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1700)
# define FINAL final # define FINAL final
#else #else
# define FINAL # define FINAL
@ -352,7 +358,7 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 ||
#include <assert.h> #include <assert.h>
#ifdef __cplusplus #ifdef __cplusplus
# if CXXSTD >= 2011 # if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800)
# include <type_traits> # include <type_traits>
# endif # endif
#endif #endif
@ -636,7 +642,7 @@ void eduke32_exit_return(int) ATTRIBUTE((noreturn));
#ifdef __cplusplus #ifdef __cplusplus
# if CXXSTD >= 2011 # if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800)
using std::is_integral; using std::is_integral;
# endif # endif
@ -645,7 +651,7 @@ using std::enable_if_t;
using std::conditional_t; using std::conditional_t;
using std::make_signed_t; using std::make_signed_t;
using std::make_unsigned_t; using std::make_unsigned_t;
# elif CXXSTD >= 2011 # elif CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800)
template <bool B, class T = void> template <bool B, class T = void>
using enable_if_t = typename std::enable_if<B, T>::type; using enable_if_t = typename std::enable_if<B, T>::type;
template<bool B, class T, class F> template<bool B, class T, class F>
@ -697,7 +703,7 @@ struct Dummy FINAL
}; };
#endif #endif
#if CXXSTD >= 2011 #if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800)
using native_t = typename integers_of_size<sizeof(size_t)>::i; using native_t = typename integers_of_size<sizeof(size_t)>::i;
using unative_t = typename integers_of_size<sizeof(size_t)>::u; using unative_t = typename integers_of_size<sizeof(size_t)>::u;
#else #else
@ -944,7 +950,7 @@ CLAMP_DECL float fclamp2(float in, float min, float max) { return in >= max ? ma
#ifdef __cplusplus #ifdef __cplusplus
#if CXXSTD >= 2011 #if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800)
template <typename T> template <typename T>
struct DivResult struct DivResult
{ {

View file

@ -4,7 +4,7 @@
#ifndef print_h_ #ifndef print_h_
#define print_h_ #define print_h_
#if CXXSTD >= 2011 #if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800)
template <typename T> template <typename T>
struct binwrap struct binwrap