Browse Source

Remove C++11 feature checks

christophe 1 month ago
parent
commit
07bc4e11b3

+ 16 - 20
glm/detail/qualifier.hpp

@@ -89,23 +89,21 @@ namespace detail
 		} type;
 	};
 
-#	if GLM_HAS_ALIGNOF
-		template<length_t L, typename T>
-		struct storage<L, T, true>
-		{
-			typedef struct alignas(L * sizeof(T)) type {
-				T data[L];
-			} type;
-		};
+	template<length_t L, typename T>
+	struct storage<L, T, true>
+	{
+		typedef struct alignas(L * sizeof(T)) type {
+			T data[L];
+		} type;
+	};
 
-		template<typename T>
-		struct storage<3, T, true>
-		{
-			typedef struct alignas(4 * sizeof(T)) type {
-				T data[4];
-			} type;
-		};
-#	endif
+	template<typename T>
+	struct storage<3, T, true>
+	{
+		typedef struct alignas(4 * sizeof(T)) type {
+			T data[4];
+		} type;
+	};
 
 #	if GLM_ARCH & GLM_ARCH_SSE2_BIT
 	template<>
@@ -235,12 +233,11 @@ namespace detail
 	{
 		typedef glm_u32vec4 type;
 	};
-
+/* TODO: Duplicate ?
 	template<>
 	struct storage<3, unsigned int, true> : public storage<4, unsigned int, true>
 	{};
 
-#	if GLM_HAS_ALIGNOF
 	template<>
 	struct storage<3, double, true>
 	{
@@ -248,8 +245,7 @@ namespace detail
 			double data[4];
 		} type;
 	};
-#	endif//GLM_HAS_ALIGNOF
-
+*/
 #	endif
 
 	enum genTypeEnum

+ 2 - 62
glm/detail/setup.hpp

@@ -244,19 +244,6 @@
 		((GLM_COMPILER & GLM_COMPILER_HIP))))
 #endif
 
-// N2341 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf
-#if GLM_COMPILER & GLM_COMPILER_CLANG
-#	define GLM_HAS_ALIGNOF __has_feature(cxx_alignas)
-#elif GLM_LANG & GLM_LANG_CXX11_FLAG
-#	define GLM_HAS_ALIGNOF 1
-#else
-#	define GLM_HAS_ALIGNOF ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
-		((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)) || \
-		((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)) || \
-		((GLM_COMPILER & GLM_COMPILER_CUDA)) || \
-		((GLM_COMPILER & GLM_COMPILER_HIP))))
-#endif
-
 // N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf
 // N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html
 #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) // Compiler SIMD intrinsics don't support constexpr...
@@ -307,18 +294,6 @@
 #	define GLM_NODISCARD
 #endif
 
-//
-#if GLM_LANG & GLM_LANG_CXX11_FLAG
-#	define GLM_HAS_ASSIGNABLE 1
-#else
-#	define GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
-		((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \
-		((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))))
-#endif
-
-//
-#define GLM_HAS_TRIVIAL_QUERIES 0
-
 //
 #if GLM_LANG & GLM_LANG_CXX11_FLAG
 #	define GLM_HAS_MAKE_SIGNED 1
@@ -384,21 +359,6 @@
 #	define GLM_HAS_OPENMP 0
 #endif
 
-///////////////////////////////////////////////////////////////////////////////////
-// nullptr
-
-#if GLM_LANG & GLM_LANG_CXX0X_FLAG
-#	define GLM_CONFIG_NULLPTR GLM_ENABLE
-#else
-#	define GLM_CONFIG_NULLPTR GLM_DISABLE
-#endif
-
-#if GLM_CONFIG_NULLPTR == GLM_ENABLE
-#	define GLM_NULLPTR nullptr
-#else
-#	define GLM_NULLPTR 0
-#endif
-
 ///////////////////////////////////////////////////////////////////////////////////
 // Qualifiers
 
@@ -798,7 +758,7 @@ namespace detail
 ///////////////////////////////////////////////////////////////////////////////////
 // Use SIMD instruction sets
 
-#if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)
+#if (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)
 #	define GLM_CONFIG_SIMD GLM_ENABLE
 #else
 #	define GLM_CONFIG_SIMD GLM_DISABLE
@@ -834,7 +794,7 @@ namespace detail
 #	define GLM_FORCE_ALIGNED_GENTYPES
 #endif
 
-#if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (defined(GLM_FORCE_ALIGNED_GENTYPES) || (GLM_CONFIG_SIMD == GLM_ENABLE))
+#if (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (defined(GLM_FORCE_ALIGNED_GENTYPES) || (GLM_CONFIG_SIMD == GLM_ENABLE))
 #	define GLM_CONFIG_ALIGNED_GENTYPES GLM_ENABLE
 #else
 #	define GLM_CONFIG_ALIGNED_GENTYPES GLM_DISABLE
@@ -942,26 +902,6 @@ namespace detail
 #		pragma message("GLM: C++ 17 with extensions")
 #	elif (GLM_LANG & GLM_LANG_CXX17_FLAG)
 #		pragma message("GLM: C++ 17")
-#	elif (GLM_LANG & GLM_LANG_CXX14_FLAG) && (GLM_LANG & GLM_LANG_EXT)
-#		pragma message("GLM: C++ 14 with extensions")
-#	elif (GLM_LANG & GLM_LANG_CXX14_FLAG)
-#		pragma message("GLM: C++ 14")
-#	elif (GLM_LANG & GLM_LANG_CXX11_FLAG) && (GLM_LANG & GLM_LANG_EXT)
-#		pragma message("GLM: C++ 11 with extensions")
-#	elif (GLM_LANG & GLM_LANG_CXX11_FLAG)
-#		pragma message("GLM: C++ 11")
-#	elif (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_LANG & GLM_LANG_EXT)
-#		pragma message("GLM: C++ 0x with extensions")
-#	elif (GLM_LANG & GLM_LANG_CXX0X_FLAG)
-#		pragma message("GLM: C++ 0x")
-#	elif (GLM_LANG & GLM_LANG_CXX03_FLAG) && (GLM_LANG & GLM_LANG_EXT)
-#		pragma message("GLM: C++ 03 with extensions")
-#	elif (GLM_LANG & GLM_LANG_CXX03_FLAG)
-#		pragma message("GLM: C++ 03")
-#	elif (GLM_LANG & GLM_LANG_CXX98_FLAG) && (GLM_LANG & GLM_LANG_EXT)
-#		pragma message("GLM: C++ 98 with extensions")
-#	elif (GLM_LANG & GLM_LANG_CXX98_FLAG)
-#		pragma message("GLM: C++ 98")
 #	else
 #		pragma message("GLM: C++ language undetected")
 #	endif//GLM_LANG

+ 2 - 2
test/core/core_force_intrinsics.cpp

@@ -21,7 +21,7 @@ static int test_vec4_ctor()
 		Error += glm::all(glm::equal(A, B)) ? 0 : 1;
 	}
 
-#	if GLM_HAS_TRIVIAL_QUERIES
+	{
 	//	Error += std::is_trivially_default_constructible<glm::vec4>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::vec4>::value ? 0 : 1;
 		Error += std::is_trivially_copyable<glm::vec4>::value ? 0 : 1;
@@ -30,7 +30,7 @@ static int test_vec4_ctor()
 		Error += std::is_trivially_copyable<glm::uvec4>::value ? 0 : 1;
 
 		Error += std::is_copy_constructible<glm::vec4>::value ? 0 : 1;
-#	endif
+	}
 
 #if GLM_HAS_INITIALIZER_LISTS
 	{

+ 2 - 2
test/core/core_force_pure.cpp

@@ -22,7 +22,7 @@ static int test_vec4_ctor()
 		Error += glm::all(glm::equal(A, B)) ? 0 : 1;
 	}
 
-#	if GLM_HAS_TRIVIAL_QUERIES
+	{
 	//	Error += std::is_trivially_default_constructible<glm::vec4>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::vec4>::value ? 0 : 1;
 		Error += std::is_trivially_copyable<glm::vec4>::value ? 0 : 1;
@@ -31,7 +31,7 @@ static int test_vec4_ctor()
 		Error += std::is_trivially_copyable<glm::uvec4>::value ? 0 : 1;
 
 		Error += std::is_copy_constructible<glm::vec4>::value ? 0 : 1;
-#	endif
+	}
 
 #if GLM_HAS_INITIALIZER_LISTS
 	{

+ 0 - 2
test/core/core_type_mat4x4.cpp

@@ -71,13 +71,11 @@ static int test_ctr()
 {
 	int Error = 0;
 
-#if GLM_HAS_TRIVIAL_QUERIES
 	//Error += std::is_trivially_default_constructible<glm::mat4>::value ? 0 : 1;
 	//Error += std::is_trivially_copy_assignable<glm::mat4>::value ? 0 : 1;
 	Error += std::is_trivially_copyable<glm::mat4>::value ? 0 : 1;
 	//Error += std::is_copy_constructible<glm::mat4>::value ? 0 : 1;
 	//Error += std::has_trivial_copy_constructor<glm::mat4>::value ? 0 : 1;
-#endif
 
 #if GLM_HAS_INITIALIZER_LISTS
 	glm::mat4 const m0(

+ 3 - 3
test/core/core_type_vec1.cpp

@@ -50,7 +50,7 @@ static int test_ctor()
 {
 	int Error = 0;
 
-#	if GLM_HAS_TRIVIAL_QUERIES
+	{
 	//	Error += std::is_trivially_default_constructible<glm::vec1>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::vec1>::value ? 0 : 1;
 		Error += std::is_trivially_copyable<glm::vec1>::value ? 0 : 1;
@@ -59,8 +59,8 @@ static int test_ctor()
 		Error += std::is_trivially_copyable<glm::uvec1>::value ? 0 : 1;
 
 		Error += std::is_copy_constructible<glm::vec1>::value ? 0 : 1;
-#	endif
-
+	}
+	
 /*
 #if GLM_HAS_INITIALIZER_LISTS
 	{

+ 3 - 5
test/core/core_type_vec2.cpp

@@ -6,9 +6,7 @@
 #include <glm/vector_relational.hpp>
 #include <glm/vec2.hpp>
 #include <vector>
-#if GLM_HAS_TRIVIAL_QUERIES
-#	include <type_traits>
-#endif
+#include <type_traits>
 
 #if GLM_COMPILER & GLM_COMPILER_CLANG
 #	pragma clang diagnostic push
@@ -229,7 +227,7 @@ static int test_ctor()
 		Error += A == B ? 0 : 1;
 	}
 
-#	if GLM_HAS_TRIVIAL_QUERIES
+	{
 	//	Error += std::is_trivially_default_constructible<glm::vec2>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::vec2>::value ? 0 : 1;
 		Error += std::is_trivially_copyable<glm::vec2>::value ? 0 : 1;
@@ -238,7 +236,7 @@ static int test_ctor()
 		Error += std::is_trivially_copyable<glm::uvec2>::value ? 0 : 1;
 
 		Error += std::is_copy_constructible<glm::vec2>::value ? 0 : 1;
-#	endif
+	}
 
 #if GLM_HAS_INITIALIZER_LISTS
 	{

+ 3 - 3
test/core/core_type_vec3.cpp

@@ -27,7 +27,7 @@ static int test_vec3_ctor()
 {
 	int Error = 0;
 
-#	if GLM_HAS_TRIVIAL_QUERIES
+	{
 	//	Error += std::is_trivially_default_constructible<glm::vec3>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::vec3>::value ? 0 : 1;
 		Error += std::is_trivially_copyable<glm::vec3>::value ? 0 : 1;
@@ -36,8 +36,8 @@ static int test_vec3_ctor()
 		Error += std::is_trivially_copyable<glm::uvec3>::value ? 0 : 1;
 
 		Error += std::is_copy_constructible<glm::vec3>::value ? 0 : 1;
-#	endif
-
+	}
+	
 #	if GLM_HAS_INITIALIZER_LISTS
 	{
 		glm::vec3 a{ 0, 1, 2 };

+ 3 - 3
test/core/core_type_vec4.cpp

@@ -56,7 +56,7 @@ static int test_vec4_ctor()
 		Error += glm::all(glm::equal(A, B)) ? 0 : 1;
 	}
 
-#	if GLM_HAS_TRIVIAL_QUERIES
+	{
 	//	Error += std::is_trivially_default_constructible<glm::vec4>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::vec4>::value ? 0 : 1;
 		Error += std::is_trivially_copyable<glm::vec4>::value ? 0 : 1;
@@ -65,8 +65,8 @@ static int test_vec4_ctor()
 		Error += std::is_trivially_copyable<glm::uvec4>::value ? 0 : 1;
 
 		Error += std::is_copy_constructible<glm::vec4>::value ? 0 : 1;
-#	endif
-
+	}
+	
 #if GLM_HAS_INITIALIZER_LISTS
 	{
 		glm::vec4 a{ 0, 1, 2, 3 };

+ 7 - 7
test/ext/ext_quaternion_type.cpp

@@ -11,18 +11,18 @@ static int test_ctr()
 {
 	int Error(0);
 
-#	if GLM_HAS_TRIVIAL_QUERIES
+	{
 	//	Error += std::is_trivially_default_constructible<glm::quat>::value ? 0 : 1;
 	//	Error += std::is_trivially_default_constructible<glm::dquat>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::quat>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::dquat>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::quat>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::dquat>::value ? 0 : 1;
-
-	Error += std::is_copy_constructible<glm::quat>::value ? 0 : 1;
-	Error += std::is_copy_constructible<glm::dquat>::value ? 0 : 1;
-#	endif
+		Error += std::is_trivially_copyable<glm::quat>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::dquat>::value ? 0 : 1;
 
+		Error += std::is_copy_constructible<glm::quat>::value ? 0 : 1;
+		Error += std::is_copy_constructible<glm::dquat>::value ? 0 : 1;
+	}
+	
 #	if GLM_HAS_INITIALIZER_LISTS
 	{
 		glm::quat A{0, 1, 2, 3};

+ 2 - 3
test/ext/ext_vec1.cpp

@@ -48,7 +48,7 @@ static int test_vec1_ctor()
 {
 	int Error = 0;
 
-#	if GLM_HAS_TRIVIAL_QUERIES
+	{
 	//	Error += std::is_trivially_default_constructible<glm::vec1>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::vec1>::value ? 0 : 1;
 		Error += std::is_trivially_copyable<glm::vec1>::value ? 0 : 1;
@@ -57,8 +57,7 @@ static int test_vec1_ctor()
 		Error += std::is_trivially_copyable<glm::uvec1>::value ? 0 : 1;
 
 		Error += std::is_copy_constructible<glm::vec1>::value ? 0 : 1;
-#	endif
-
+	}
 
 	{
 		glm::ivec1 A = glm::vec1(2.0f);

+ 4 - 6
test/gtx/gtx_dual_quaternion.cpp

@@ -5,9 +5,7 @@
 #include <glm/gtc/epsilon.hpp>
 #include <glm/gtx/euler_angles.hpp>
 #include <glm/vector_relational.hpp>
-#if GLM_HAS_TRIVIAL_QUERIES
-#	include <type_traits>
-#endif
+#include <type_traits>
 
 static int myrand()
 {
@@ -161,7 +159,7 @@ static int test_dual_quat_ctr()
 {
 	int Error(0);
 
-#	if GLM_HAS_TRIVIAL_QUERIES
+	{
 	//	Error += std::is_trivially_default_constructible<glm::dualquat>::value ? 0 : 1;
 	//	Error += std::is_trivially_default_constructible<glm::ddualquat>::value ? 0 : 1;
 	//	Error += std::is_trivially_copy_assignable<glm::dualquat>::value ? 0 : 1;
@@ -171,8 +169,8 @@ static int test_dual_quat_ctr()
 
 		Error += std::is_copy_constructible<glm::dualquat>::value ? 0 : 1;
 		Error += std::is_copy_constructible<glm::ddualquat>::value ? 0 : 1;
-#	endif
-
+	}
+	
 	return Error;
 }