[Bf-blender-cvs] [a1fcee7] depsgraph_refactor: Depsgraph: Fix compilation error with C++11 disabled

Sergey Sharybin noreply at git.blender.org
Mon Feb 9 16:40:11 CET 2015


Commit: a1fcee79f509fb52f1d82b12957a26d2bbe84810
Author: Sergey Sharybin
Date:   Mon Feb 9 20:24:09 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rBa1fcee79f509fb52f1d82b12957a26d2bbe84810

Depsgraph: Fix compilation error with C++11 disabled

===================================================================

M	intern/cycles/util/util_types.h
M	source/blender/depsgraph/intern/depsgraph_build.cpp

===================================================================

diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h
index 19ee2e1..45fdd3c 100644
--- a/intern/cycles/util/util_types.h
+++ b/intern/cycles/util/util_types.h
@@ -485,14 +485,20 @@ enum InterpolationType {
  * incompatible types when assigning to type 'Foo' from type 'Bar'
  * ... the compiler optimizes away the temp var */
 #if defined(__GNUC__)
+#  if __cplusplus > 199711L
+#    define DECLTYPE(x) decltype(x)
+#  else
+#    define DECLTYPE(x) typeof(x)
+#  endif
+
 #define CHECK_TYPE(var, type)  {  \
-	decltype(var) *__tmp;         \
+	DECLTYPE(var) *__tmp;         \
 	__tmp = (type *)NULL;         \
 	(void)__tmp;                  \
 } (void)0
 
 #define CHECK_TYPE_PAIR(var_a, var_b)  {  \
-	decltype(var_a) *__tmp;               \
+	DECLTYPE(var_a) *__tmp;               \
 	__tmp = (typeof(var_b) *)NULL;        \
 	(void)__tmp;                          \
 } (void)0
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 33001ba..da3aef0 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -569,13 +569,15 @@ static void deg_graph_print_cycle_rel(const OperationDepsNode *to, const Operati
 	       rel->name.c_str());
 }
 
+/* TODO(sergey): Consider moving to proper location. */
+struct StackEntry {
+	OperationDepsNode *node;
+	StackEntry *from;
+	DepsRelation *via_relation;
+};
+
 static void deg_graph_detect_cycles(Depsgraph *graph)
 {
-	struct StackEntry {
-		OperationDepsNode *node;
-		StackEntry *from;
-		DepsRelation *via_relation;
-	};
 	/* Not is not visited at all during traversal. */
 	const int NODE_NOT_VISITED = 0;
 	/* Node has been visited during traversal and not in current stack. */




More information about the Bf-blender-cvs mailing list