Browse Source

Define MAYBE macros for explicit and constexpr

- So we can wrap less code in macros
Jesse Talavera-Greenberg 10 years ago
parent
commit
6d1ddc8980
1 changed files with 21 additions and 13 deletions
  1. 21 13
      glm/detail/setup.hpp

+ 21 - 13
glm/detail/setup.hpp

@@ -8,14 +8,14 @@
 /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 /// copies of the Software, and to permit persons to whom the Software is
 /// copies of the Software, and to permit persons to whom the Software is
 /// furnished to do so, subject to the following conditions:
 /// furnished to do so, subject to the following conditions:
-/// 
+///
 /// The above copyright notice and this permission notice shall be included in
 /// The above copyright notice and this permission notice shall be included in
 /// all copies or substantial portions of the Software.
 /// all copies or substantial portions of the Software.
-/// 
+///
 /// Restrictions:
 /// Restrictions:
 ///		By making use of the Software for military purposes, you choose to make
 ///		By making use of the Software for military purposes, you choose to make
 ///		a Bunny unhappy.
 ///		a Bunny unhappy.
-/// 
+///
 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -117,7 +117,7 @@
 // Compiler
 // Compiler
 
 
 // User defines: GLM_FORCE_COMPILER_UNKNOWN
 // User defines: GLM_FORCE_COMPILER_UNKNOWN
-// TODO ? __llvm__ 
+// TODO ? __llvm__
 
 
 #define GLM_COMPILER_UNKNOWN		0x00000000
 #define GLM_COMPILER_UNKNOWN		0x00000000
 
 
@@ -210,7 +210,7 @@
 // CUDA
 // CUDA
 #elif defined(__CUDACC__)
 #elif defined(__CUDACC__)
 #	if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
 #	if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
-#		include <cuda.h>  // make sure version is defined since nvcc does not define it itself! 
+#		include <cuda.h>  // make sure version is defined since nvcc does not define it itself!
 #	endif
 #	endif
 #	if CUDA_VERSION < 3000
 #	if CUDA_VERSION < 3000
 #		error "GLM requires CUDA 3.0 or higher"
 #		error "GLM requires CUDA 3.0 or higher"
@@ -284,7 +284,7 @@
 #		endif
 #		endif
 #	endif
 #	endif
 
 
-// G++ 
+// G++
 #elif defined(__GNUC__) || defined(__MINGW32__)
 #elif defined(__GNUC__) || defined(__MINGW32__)
 #	if (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
 #	if (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
 #		define GLM_COMPILER (GLM_COMPILER_GCC42)
 #		define GLM_COMPILER (GLM_COMPILER_GCC42)
@@ -669,7 +669,7 @@
 		((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
 		((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
 #endif
 #endif
 
 
-// 
+//
 #if GLM_LANG & GLM_LANG_CXX11_FLAG
 #if GLM_LANG & GLM_LANG_CXX11_FLAG
 #	define GLM_HAS_ASSIGNABLE 1
 #	define GLM_HAS_ASSIGNABLE 1
 #else
 #else
@@ -677,10 +677,10 @@
 		((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
 		((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
 #endif
 #endif
 
 
-// 
+//
 #define GLM_HAS_TRIVIAL_QUERIES 0
 #define GLM_HAS_TRIVIAL_QUERIES 0
 
 
-// 
+//
 #if GLM_LANG & GLM_LANG_CXX11_FLAG
 #if GLM_LANG & GLM_LANG_CXX11_FLAG
 #	define GLM_HAS_MAKE_SIGNED 1
 #	define GLM_HAS_MAKE_SIGNED 1
 #else
 #else
@@ -688,7 +688,7 @@
 		((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
 		((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
 #endif
 #endif
 
 
-// 
+//
 #if GLM_ARCH == GLM_ARCH_PURE
 #if GLM_ARCH == GLM_ARCH_PURE
 #	define GLM_HAS_BITSCAN_WINDOWS 0
 #	define GLM_HAS_BITSCAN_WINDOWS 0
 #else
 #else
@@ -697,7 +697,7 @@
 #endif
 #endif
 
 
 // OpenMP
 // OpenMP
-#ifdef _OPENMP 
+#ifdef _OPENMP
 #	if GLM_COMPILER & GLM_COMPILER_GCC
 #	if GLM_COMPILER & GLM_COMPILER_GCC
 #		if GLM_COMPILER >= GLM_COMPILER_GCC47
 #		if GLM_COMPILER >= GLM_COMPILER_GCC47
 #			define GLM_HAS_OPENMP 31
 #			define GLM_HAS_OPENMP 31
@@ -719,7 +719,7 @@
 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
 #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
 
 
 ///////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////
-// Platform 
+// Platform
 
 
 // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
 // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
 
 
@@ -769,7 +769,7 @@
 #		define GLM_ARCH (GLM_ARCH_PURE)
 #		define GLM_ARCH (GLM_ARCH_PURE)
 #	endif
 #	endif
 #elif (GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))
 #elif (GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))
-#	if defined(__AVX2__) 
+#	if defined(__AVX2__)
 #		define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
 #		define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
 #	elif defined(__AVX__)
 #	elif defined(__AVX__)
 #		define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
 #		define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
@@ -925,8 +925,16 @@
 
 
 #if GLM_HAS_CONSTEXPR
 #if GLM_HAS_CONSTEXPR
 #	define GLM_CONSTEXPR constexpr
 #	define GLM_CONSTEXPR constexpr
+# define GLM_CONSTEXPR_MAYBE constexpr
 #else
 #else
 #	define GLM_CONSTEXPR
 #	define GLM_CONSTEXPR
+# define GLM_CONSTEXPR_MAYBE const
+#endif
+
+#ifdef GLM_FORCE_EXPLICIT_CTOR
+# define GLM_EXPLICIT_CTOR_MAYBE explicit
+#else
+# define GLM_EXPLICIT_CTOR_MAYBE
 #endif
 #endif
 
 
 ///////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////