diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index ab373665..a0c0536f 100644 --- a/glm/core/setup.hpp +++ b/glm/core/setup.hpp @@ -477,6 +477,43 @@ # endif//GLM_MODEL #endif//GLM_MESSAGE +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Has of C++ features + +#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://gcc.gnu.org/projects/cxx0x.html +// http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx + +// N1720 +#define GLM_HAS_STATIC_ASSERT ( \ + (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ + __has_feature(cxx_static_assert)) + +// N1988 +#define GLM_HAS_EXTENDED_INTEGER_TYPE ( \ + (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ + ((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_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG29))) + +// N2235 +#define GLM_HAS_CONSTEXPR ( \ + (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ + __has_feature(cxx_constexpr)) + +// Not standard +#define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG) + ///////////////// // Platform @@ -594,7 +631,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // Static assert -#if((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X) +#if GLM_HAS_STATIC_ASSERT # define GLM_STATIC_ASSERT(x, message) static_assert(x, message) #elif(defined(BOOST_STATIC_ASSERT)) # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x) @@ -648,7 +685,7 @@ #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)) # define GLM_MESSAGE_SWIZZLE_DISPLAYED -# if defined(GLM_SWIZZLE) +# if defined(GLM_SWIZZL)E # pragma message("GLM: Swizzling operators enabled") # else # pragma message("GLM: Swizzling operators disabled") @@ -664,32 +701,31 @@ # define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct # define GLM_RESTRICT __declspec(restrict) # define GLM_RESTRICT_VAR __restrict -# define GLM_CONSTEXPR #elif(GLM_COMPILER & GLM_COMPILER_INTEL) # define GLM_DEPRECATED # define GLM_ALIGN(x) __declspec(align(x)) # define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct # define GLM_RESTRICT # define GLM_RESTRICT_VAR __restrict -# define GLM_CONSTEXPR -#elif(((GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC)) && (GLM_COMPILER >= GLM_COMPILER_GCC34)) || (GLM_COMPILER & GLM_COMPILER_CLANG)) +#elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) # define GLM_DEPRECATED __attribute__((__deprecated__)) # define GLM_ALIGN(x) __attribute__((aligned(x))) # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) # define GLM_RESTRICT __restrict__ # define GLM_RESTRICT_VAR __restrict__ -# if((GLM_COMPILER >= GLM_COMPILER_GCC47) && ((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X)) -# define GLM_CONSTEXPR constexpr -# else -# define GLM_CONSTEXPR -# endif #else # define GLM_DEPRECATED # define GLM_ALIGN # define GLM_ALIGNED_STRUCT(x) # define GLM_RESTRICT # define GLM_RESTRICT_VAR -# define GLM_CONSTEXPR #endif//GLM_COMPILER +#if GLM_HAS_CONSTEXPR +# define GLM_CONSTEXPR constexpr +#else +# define GLM_CONSTEXPR +#endif + + #endif//GLM_SETUP_INCLUDED diff --git a/glm/core/type_int.hpp b/glm/core/type_int.hpp index 670ed442..2411ea29 100644 --- a/glm/core/type_int.hpp +++ b/glm/core/type_int.hpp @@ -31,14 +31,14 @@ #include "setup.hpp" -#if(((GLM_LANG & GLM_LANG_CXX11) == GLM_LANG_CXX11) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) +#if GLM_HAS_EXTENDED_INTEGER_TYPE # include #endif namespace glm{ namespace detail { -# if((GLM_LANG & GLM_LANG_CXX11) == GLM_LANG_CXX11) +# if GLM_HAS_EXTENDED_INTEGER_TYPE typedef std::int8_t int8; typedef std::int16_t int16; typedef std::int32_t int32; diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index 2fc69e62..f901646b 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -49,7 +49,7 @@ namespace detail ////////////////////////////////////// // Data -# if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE)) +# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) union { struct{ T x, y; }; diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index 1adb9108..41f1f696 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -49,7 +49,7 @@ namespace detail ////////////////////////////////////// // Data -# if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE)) +# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) union { struct{ T x, y, z; }; diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp index eb703fca..fb77be2f 100644 --- a/glm/core/type_vec4.hpp +++ b/glm/core/type_vec4.hpp @@ -49,7 +49,7 @@ namespace detail ////////////////////////////////////// // Data -# if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE)) +# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) union { struct { T r, g, b, a; }; diff --git a/test/external/gli/core/image2d.inl b/test/external/gli/core/image2d.inl index 6799b54b..3781be83 100644 --- a/test/external/gli/core/image2d.inl +++ b/test/external/gli/core/image2d.inl @@ -96,7 +96,7 @@ namespace gli }; return Desc[Format]; - }; + } inline image2D::size_type sizeBlock ( diff --git a/test/gtc/gtc_random.cpp b/test/gtc/gtc_random.cpp index f15aa4a5..3564f775 100644 --- a/test/gtc/gtc_random.cpp +++ b/test/gtc/gtc_random.cpp @@ -11,7 +11,7 @@ #include #include #include -#if((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X) +#if(GLM_LANG & GLM_LANG_CXX0X_FLAG) # include #endif @@ -139,7 +139,7 @@ int test_ballRand() return Error; } /* -#if((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X) +#if(GLM_LANG & GLM_LANG_CXX0X_FLAG) int test_grid() { int Error = 0; @@ -189,7 +189,7 @@ int main() Error += test_diskRand(); Error += test_ballRand(); /* -#if((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X) +#if(GLM_LANG & GLM_LANG_CXX0X_FLAG) Error += test_grid(); #endif */