[Bf-blender-cvs] [93e4e1c] depsgraph_refactor: Build file changes to make use of the C++11 standard.
Lukas Tönne
noreply at git.blender.org
Sun Jun 8 12:46:52 CEST 2014
Commit: 93e4e1ce3434ea680c6ac69fab68303d09d0d11b
Author: Lukas Tönne
Date: Sun Jun 8 10:41:00 2014 +0200
https://developer.blender.org/rB93e4e1ce3434ea680c6ac69fab68303d09d0d11b
Build file changes to make use of the C++11 standard.
===================================================================
M CMakeLists.txt
M source/blender/blenlib/BLI_math_base.h
M source/blender/blenlib/BLI_utildefines.h
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7385182..adf8cad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2284,6 +2284,13 @@ if(WITH_GCC_MUDFLAP)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_ERROR_MUDFLAP -Wno-error=mudflap)
endif()
+# Enable C++11
+if(CMAKE_COMPILER_IS_GNUCC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+endif()
+
# Include warnings first, so its possible to disable them with user defined flags
# eg: -Wno-uninitialized
set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 54e9349..254175c 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -161,7 +161,7 @@ static const int NAN_INT = 0x7FC00000;
* incompatible types when assigning to type 'Foo' from type 'Bar'
* ... the compiler optimizes away the temp var */
#ifndef CHECK_TYPE
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__cplusplus)
#define CHECK_TYPE(var, type) { \
__typeof(var) *__tmp; \
__tmp = (type *)NULL; \
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index af192d1..e5c941a 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -49,7 +49,7 @@
#endif
/* min/max */
-#if defined(__GNUC__) || defined(__clang__)
+#if (defined(__GNUC__) || defined(__clang__)) && !defined(__cplusplus)
#define MIN2(a, b) __extension__ ({ \
typeof(a) a_ = (a); typeof(b) b_ = (b); \
@@ -135,7 +135,7 @@
/* Causes warning:
* incompatible types when assigning to type 'Foo' from type 'Bar'
* ... the compiler optimizes away the temp var */
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__cplusplus)
#define CHECK_TYPE(var, type) { \
__typeof(var) *__tmp; \
__tmp = (type *)NULL; \
@@ -276,7 +276,7 @@
/* some misc stuff.... */
/* avoid multiple access for supported compilers */
-#if defined(__GNUC__) || defined(__clang__)
+#if (defined(__GNUC__) || defined(__clang__)) && !defined(__cplusplus)
#define ABS(a) ({ \
typeof(a) a_ = (a); \
@@ -335,7 +335,7 @@
#define STACK_POP_PTR(stack) ((_##stack##_index) ? &((stack)[--(_##stack##_index)]) : NULL)
#define STACK_POP_ELSE(stack, r) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : r)
#define STACK_FREE(stack) ((void)stack)
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__cplusplus)
#define STACK_SWAP(stack_a, stack_b) { \
SWAP(typeof(stack_a), stack_a, stack_b); \
SWAP(unsigned int, _##stack_a##_index, _##stack_b##_index); \
More information about the Bf-blender-cvs
mailing list