Cleaned up C++11 feature detections

This commit is contained in:
Christophe Riccio 2015-01-10 13:44:57 +01:00
parent 0ceb9e9394
commit fe0de059b8

View File

@ -496,113 +496,159 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Has of C++ features // Has of C++ features
#ifndef __has_include
# define __has_include(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef __has_feature
# define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef __has_extension
# define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
#endif
// http://clang.llvm.org/cxx_status.html // http://clang.llvm.org/cxx_status.html
// http://gcc.gnu.org/projects/cxx0x.html // http://gcc.gnu.org/projects/cxx0x.html
// http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
// N1720 #if GLM_PLATFORM != GLM_PLATFORM_ANDROID
#define GLM_HAS_CXX11_STL !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ((GLM_PLATFORM != GLM_PLATFORM_ANDROID) && (\ # define GLM_HAS_CXX11_STL 0
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \ #elif GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ # define GLM_HAS_CXX11_STL __has_include(<__config>)
__has_include(<__config>))) #else
# define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && \
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
// N1720 // N1720
#define GLM_HAS_STATIC_ASSERT !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ # define GLM_HAS_STATIC_ASSERT 1
__has_feature(cxx_static_assert)) #else
# define GLM_HAS_STATIC_ASSERT (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)))
#endif
// N1988 // N1988
#define GLM_HAS_EXTENDED_INTEGER_TYPE !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_LANG & GLM_LANG_CXX11_FLAG
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_EXTENDED_INTEGER_TYPE 1
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \ #else
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ # define GLM_HAS_EXTENDED_INTEGER_TYPE (\
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_LLVM) && (GLM_COMPILER >= GLM_COMPILER_LLVM30)) || \ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_APPLE_CLANG) && (GLM_COMPILER >= GLM_COMPILER_APPLE_CLANG40))) ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_LLVM) && (GLM_COMPILER >= GLM_COMPILER_LLVM30)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_APPLE_CLANG) && (GLM_COMPILER >= GLM_COMPILER_APPLE_CLANG40)))
#endif
// N2235 // N2235
#define GLM_HAS_CONSTEXPR !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_CONSTEXPR __has_feature(cxx_constexpr)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
__has_feature(cxx_constexpr)) # define GLM_HAS_CONSTEXPR 1
#else
# define GLM_HAS_CONSTEXPR (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015)))
#endif
// N2672 // N2672
#define GLM_HAS_INITIALIZER_LISTS !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \ # define GLM_HAS_INITIALIZER_LISTS 1
__has_feature(cxx_generalized_initializers)) #else
# define GLM_HAS_INITIALIZER_LISTS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
// N2544 Unrestricted unions // N2544 Unrestricted unions
#define GLM_HAS_UNRESTRICTED_UNIONS !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)
(GLM_LANG & GLM_LANG_CXXMS_FLAG) || \ #elif GLM_LANG & (GLM_LANG_CXX11_FLAG | GLM_LANG_CXXMS_FLAG)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ # define GLM_HAS_UNRESTRICTED_UNIONS 1
__has_feature(cxx_unrestricted_unions)) #else
# define GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)))
#endif
// N2346 // N2346
#define GLM_HAS_DEFAULTED_FUNCTIONS !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \ # define GLM_HAS_DEFAULTED_FUNCTIONS 1
__has_feature(cxx_defaulted_functions)) #else
# define GLM_HAS_DEFAULTED_FUNCTIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
// N2118 // N2118
#define GLM_HAS_RVALUE_REFERENCES !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ # define GLM_HAS_RVALUE_REFERENCES 1
__has_feature(cxx_rvalue_references)) #else
# define GLM_HAS_RVALUE_REFERENCES (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
#endif
// N2437 // N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
#define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \ # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \ #else
__has_feature(cxx_explicit_conversions)) # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
#define GLM_HAS_STL_ARRAY !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ // N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)) || \ # define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43))) #elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_TEMPLATE_ALIASES 1
#else
# define GLM_HAS_TEMPLATE_ALIASES (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC47)) || \
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12_1)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
#define GLM_HAS_TEMPLATE_ALIASES !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ // N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
__has_feature(cxx_alias_templates)) # define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for)
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_RANGE_FOR 1
#else
# define GLM_HAS_RANGE_FOR (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL13)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
#endif
#define GLM_HAS_RANGE_FOR !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ //
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ #if GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \ # define GLM_HAS_ASSIGNABLE 1
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ #else
__has_feature(cxx_range_for)) # define GLM_HAS_ASSIGNABLE (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
#endif
#define GLM_HAS_ASSIGNABLE !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ //
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ #define GLM_HAS_TRIVIAL_QUERIES ( \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
#define GLM_HAS_TRIVIAL_QUERIES !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#define GLM_HAS_MAKE_SIGNED !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ //
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ #if GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) # define GLM_HAS_MAKE_SIGNED 1
#else
# define GLM_HAS_MAKE_SIGNED (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
#define GLM_HAS_BITSCAN_WINDOWS ( \ //
(GLM_ARCH != GLM_ARCH_PURE) && \ #if GLM_ARCH == GLM_ARCH_PURE
(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && \ # define GLM_HAS_BITSCAN_WINDOWS 0
(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL))) #else
# define GLM_HAS_BITSCAN_WINDOWS (GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL))
#endif
// OpenMP // OpenMP
#ifdef _OPENMP #ifdef _OPENMP
@ -624,7 +670,7 @@
#endif #endif
// Not standard // Not standard
#define GLM_HAS_ANONYMOUS_UNION !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && (GLM_LANG & GLM_LANG_CXXMS_FLAG) #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Platform // Platform