Browse Source

Fixed Clang and LLVM detections

Christophe Riccio 11 years ago
parent
commit
bddce172f7
5 changed files with 18 additions and 18 deletions
  1. 2 2
      glm/detail/_features.hpp
  2. 2 2
      glm/detail/func_common.inl
  3. 8 5
      glm/detail/setup.hpp
  4. 2 5
      glm/detail/type_int.hpp
  5. 4 4
      glm/gtc/packing.inl

+ 2 - 2
glm/detail/_features.hpp

@@ -280,7 +280,7 @@
 #		define GLM_CXX11_STATIC_ASSERT
 #	endif
 
-#elif(GLM_COMPILER & GLM_COMPILER_CLANG)
+#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
 #	if(__has_feature(cxx_exceptions))
 #		define GLM_CXX98_EXCEPTIONS
 #	endif
@@ -421,4 +421,4 @@
 #		define GLM_CXX11_VARIADIC_TEMPLATES
 #	endif
 
-#endif//(GLM_COMPILER & GLM_COMPILER_CLANG)
+#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))

+ 2 - 2
glm/detail/func_common.inl

@@ -539,7 +539,7 @@ namespace detail
 				return std::isnan(x);
 #			elif GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)
 				return _isnan(x) != 0;
-#			elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)
+#			elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
 #				if GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L
 					return _isnan(x) != 0;
 #				else
@@ -573,7 +573,7 @@ namespace detail
 				return std::isinf(x);
 #			elif(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC))
 				return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
-#			elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
+#			elif(GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)))
 #				if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L)
 					return _isinf(x) != 0;
 #				else

+ 8 - 5
glm/detail/setup.hpp

@@ -292,8 +292,10 @@
 #		pragma message("GLM: CUDA compiler detected")
 #	elif GLM_COMPILER & GLM_COMPILER_VC
 #		pragma message("GLM: Visual C++ compiler detected")
-#	elif GLM_COMPILER & GLM_COMPILER_CLANG
+#	elif GLM_COMPILER & GLM_COMPILER_APPLE_CLANG
 #		pragma message("GLM: Clang compiler detected")
+#	elif GLM_COMPILER & GLM_COMPILER_LLVM
+#		pragma message("GLM: LLVM compiler detected")
 #	elif GLM_COMPILER & GLM_COMPILER_INTEL
 #		pragma message("GLM: Intel Compiler detected")
 #	elif GLM_COMPILER & GLM_COMPILER_GCC
@@ -470,7 +472,8 @@
 	(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)))
+	((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)))
 
 // N2235
 #define GLM_HAS_CONSTEXPR ( \
@@ -579,7 +582,7 @@
 #	define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
 #elif defined(GLM_FORCE_SSE2)
 #	define GLM_ARCH (GLM_ARCH_SSE2)
-#elif (GLM_COMPILER & GLM_COMPILER_CLANG) || (GLM_COMPILER & GLM_COMPILER_GCC)
+#elif GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)
 #	if(__AVX2__)
 #		define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
 #	elif(__AVX__)
@@ -703,7 +706,7 @@
 #	elif GLM_COMPILER & GLM_COMPILER_GCC
 #		define GLM_INLINE inline __attribute__((__always_inline__))
 #		define GLM_NEVER_INLINE __attribute__((__noinline__))
-#	elif GLM_COMPILER & GLM_COMPILER_CLANG
+#	elif GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)
 #		define GLM_INLINE __attribute__((__always_inline__))
 #		define GLM_NEVER_INLINE __attribute__((__noinline__))
 #	else
@@ -742,7 +745,7 @@
 #	define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name
 #	define GLM_RESTRICT __declspec(restrict)
 #	define GLM_RESTRICT_VAR __restrict
-#elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_CUDA | GLM_COMPILER_INTEL)
+#elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_CUDA | GLM_COMPILER_INTEL)
 #	define GLM_DEPRECATED __attribute__((__deprecated__))
 #	define GLM_ALIGN(x) __attribute__((aligned(x)))
 #	define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))

+ 2 - 5
glm/detail/type_int.hpp

@@ -52,15 +52,12 @@ namespace detail
 #		if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available
 			typedef int64_t					sint64;
 			typedef uint64_t				uint64;
-#		elif(GLM_COMPILER & GLM_COMPILER_VC)
+#		elif GLM_COMPILER & GLM_COMPILER_VC
 			typedef signed __int64			sint64;
 			typedef unsigned __int64		uint64;
-#		elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC | GLM_COMPILER_CLANG))
+#		elif GLM_COMPILER & GLM_COMPILER_GCC
 			__extension__ typedef signed long long		sint64;
 			__extension__ typedef unsigned long long	uint64;
-#		elif(GLM_COMPILER & GLM_COMPILER_BC)
-			typedef Int64					sint64;
-			typedef Uint64					uint64;
 #		else//unknown compiler
 			typedef signed long	long		sint64;
 			typedef unsigned long long		uint64;

+ 4 - 4
glm/gtc/packing.inl

@@ -146,7 +146,7 @@ namespace detail
 		else if(glm::isinf(x))
 			return 0x1f << 6;
 
-#		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG)
+#		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
 			uint Pack = 0;
 			memcpy(&Pack, &x, sizeof(Pack));
 #		else	
@@ -167,7 +167,7 @@ namespace detail
 
 		uint Result = packed11ToFloat(x);
 
-#		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG)
+#		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
 			float Temp = 0;
 			memcpy(&Temp, &Result, sizeof(Temp));
 			return Temp;
@@ -185,7 +185,7 @@ namespace detail
 		else if(glm::isinf(x))
 			return 0x1f << 5;
 
-#		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG)
+#		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
 			uint Pack = 0;
 			memcpy(&Pack, &x, sizeof(Pack));
 #		else	
@@ -206,7 +206,7 @@ namespace detail
 
 		uint Result = packed10ToFloat(x);
 
-#		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG)
+#		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
 			float Temp = 0;
 			memcpy(&Temp, &Result, sizeof(Temp));
 			return Temp;