[Bf-blender-cvs] [3612ce55796] master: Cleanup: name macros w/ matching BEGIN/END

Campbell Barton noreply at git.blender.org
Fri Nov 30 05:22:42 CET 2018


Commit: 3612ce55796427a67ba070df165b46698b2d9ace
Author: Campbell Barton
Date:   Fri Nov 30 15:22:01 2018 +1100
Branches: master
https://developer.blender.org/rB3612ce55796427a67ba070df165b46698b2d9ace

Cleanup: name macros w/ matching BEGIN/END

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

M	source/blender/blenkernel/BKE_node.h
M	source/blender/blenkernel/intern/depsgraph.c
M	source/blender/blenkernel/intern/library_remap.c
M	source/blender/blenkernel/intern/node.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_250.c
M	source/blender/blenloader/intern/versioning_260.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/object/object_relations.c
M	source/blender/editors/space_node/node_draw.c
M	source/blender/editors/space_node/node_edit.c

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

diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 09860972802..852285492d2 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -37,7 +37,7 @@
 
 #include "DNA_listBase.h"
 
-/* for FOREACH_NODETREE */
+/* for FOREACH_NODETREE_BEGIN */
 #include "DNA_lamp_types.h"
 #include "DNA_material_types.h"
 #include "DNA_node_types.h"
@@ -643,17 +643,17 @@ void BKE_node_tree_unlink_id(ID *id, struct bNodeTree *ntree);
  * Examples:
  *
  * \code{.c}
- * FOREACH_NODETREE(bmain, nodetree, id) {
+ * FOREACH_NODETREE_BEGIN(bmain, nodetree, id) {
  *     if (id == nodetree)
  *         printf("This is a linkable node tree");
- * } FOREACH_NODETREE_END
+ * } FOREACH_NODETREE_END;
  *
- * FOREACH_NODETREE(bmain, nodetree, id) {
+ * FOREACH_NODETREE_BEGIN(bmain, nodetree, id) {
  *     if (nodetree->idname == "ShaderNodeTree")
  *         printf("This is a shader node tree);
  *     if (GS(id) == ID_MA)
  *         printf(" and it's owned by a material");
- * } FOREACH_NODETREE_END
+ * } FOREACH_NODETREE_END;
  * \endcode
  *
  * \{
@@ -674,7 +674,7 @@ void BKE_node_tree_iter_init(struct NodeTreeIterStore *ntreeiter, struct Main *b
 bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter,
                              struct bNodeTree **r_nodetree, struct ID **r_id);
 
-#define FOREACH_NODETREE(bmain, _nodetree, _id) \
+#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id) \
 { \
 	struct NodeTreeIterStore _nstore; \
 	bNodeTree *_nodetree; \
@@ -687,7 +687,7 @@ bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter,
 #define FOREACH_NODETREE_END \
 		} \
 	} \
-}
+} ((void)0)
 /** \} */
 
 /* -------------------------------------------------------------------- */
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 15d08f5a230..621cd6cf5c8 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -2792,7 +2792,7 @@ static void dag_id_flush_update(Main *bmain, Scene *sce, ID *id)
 		 * could be with the current depsgraph design/
 		 */
 		if (idtype == ID_IM) {
-			FOREACH_NODETREE(bmain, ntree, parent_id) {
+			FOREACH_NODETREE_BEGIN(bmain, ntree, parent_id) {
 				if (ntree->type == NTREE_SHADER) {
 					bNode *node;
 					for (node = ntree->nodes.first; node; node = node->next) {
@@ -2802,7 +2802,7 @@ static void dag_id_flush_update(Main *bmain, Scene *sce, ID *id)
 						}
 					}
 				}
-			} FOREACH_NODETREE_END
+			} FOREACH_NODETREE_END;
 		}
 
 		if (idtype == ID_MSK) {
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index f791d9a6591..604e7754352 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -406,10 +406,10 @@ static void libblock_remap_data_postprocess_nodetree_update(Main *bmain, ID *new
 	ntreeVerifyNodes(bmain, new_id);
 
 	/* Update node trees as necessary. */
-	FOREACH_NODETREE(bmain, ntree, id) {
+	FOREACH_NODETREE_BEGIN(bmain, ntree, id) {
 		/* make an update call for the tree */
 		ntreeUpdateTree(bmain, ntree);
-	} FOREACH_NODETREE_END
+	} FOREACH_NODETREE_END;
 }
 
 /**
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index b3f210dfba5..82f619da9c6 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -226,7 +226,7 @@ static void update_typeinfo(Main *bmain, const struct bContext *C, bNodeTreeType
 	if (!bmain)
 		return;
 
-	FOREACH_NODETREE(bmain, ntree, id) {
+	FOREACH_NODETREE_BEGIN(bmain, ntree, id) {
 		bNode *node;
 		bNodeSocket *sock;
 
@@ -257,7 +257,7 @@ static void update_typeinfo(Main *bmain, const struct bContext *C, bNodeTreeType
 			if (socktype && STREQ(sock->idname, socktype->idname))
 				node_socket_set_typeinfo(ntree, sock, unregister ? NULL : socktype);
 	}
-	FOREACH_NODETREE_END
+	FOREACH_NODETREE_END;
 }
 
 /* Try to initialize all typeinfo in a node tree.
@@ -2998,13 +2998,13 @@ static void ntree_validate_links(bNodeTree *ntree)
 
 void ntreeVerifyNodes(struct Main *main, struct ID *id)
 {
-	FOREACH_NODETREE(main, ntree, owner_id) {
+	FOREACH_NODETREE_BEGIN(main, ntree, owner_id) {
 		bNode *node;
 
 		for (node = ntree->nodes.first; node; node = node->next)
 			if (node->typeinfo->verifyfunc)
 				node->typeinfo->verifyfunc(ntree, node, id);
-	} FOREACH_NODETREE_END
+	} FOREACH_NODETREE_END;
 }
 
 void ntreeUpdateTree(Main *bmain, bNodeTree *ntree)
@@ -3770,7 +3770,7 @@ void free_nodesystem(void)
 
 
 /* -------------------------------------------------------------------- */
-/* NodeTree Iterator Helpers (FOREACH_NODETREE) */
+/* NodeTree Iterator Helpers (FOREACH_NODETREE_BEGIN) */
 
 void BKE_node_tree_iter_init(struct NodeTreeIterStore *ntreeiter, struct Main *bmain)
 {
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 9689ab173a8..3947ca157c0 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1940,13 +1940,13 @@ void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *sc
 	if (!use_new_eval && DAG_id_type_tagged(bmain, ID_NT)) {
 		float ctime = BKE_scene_frame_get(scene);
 
-		FOREACH_NODETREE(bmain, ntree, id)
+		FOREACH_NODETREE_BEGIN(bmain, ntree, id)
 		{
 			AnimData *adt = BKE_animdata_from_id(&ntree->id);
 			if (adt && (adt->recalc & ADT_RECALC_ANIM))
 				BKE_animsys_evaluate_animdata(scene, &ntree->id, adt, ctime, 0);
 		}
-		FOREACH_NODETREE_END
+		FOREACH_NODETREE_END;
 	}
 #endif
 
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index d689b871a64..ead3b324644 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2925,16 +2925,16 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 #endif
 
 	/* set node->typeinfo pointers */
-	FOREACH_NODETREE (main, ntree, id) {
+	FOREACH_NODETREE_BEGIN (main, ntree, id) {
 		ntreeSetTypes(NULL, ntree);
-	} FOREACH_NODETREE_END
+	} FOREACH_NODETREE_END;
 
 	/* verify static socket templates */
-	FOREACH_NODETREE (main, ntree, id) {
+	FOREACH_NODETREE_BEGIN (main, ntree, id) {
 		bNode *node;
 		for (node = ntree->nodes.first; node; node = node->next)
 			node_verify_socket_templates(ntree, node);
-	} FOREACH_NODETREE_END
+	} FOREACH_NODETREE_END;
 
 	{
 		bool has_old_groups = false;
@@ -2950,7 +2950,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 		}
 
 		if (has_old_groups) {
-			FOREACH_NODETREE (main, ntree, id) {
+			FOREACH_NODETREE_BEGIN (main, ntree, id) {
 				/* updates external links for all group nodes in a tree */
 				bNode *node;
 				for (node = ntree->nodes.first; node; node = node->next) {
@@ -2960,7 +2960,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 							lib_node_do_versions_group_indices(node);
 					}
 				}
-			} FOREACH_NODETREE_END
+			} FOREACH_NODETREE_END;
 		}
 
 		for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
@@ -2981,7 +2981,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 		 * so have to clean up all of them ...
 		 */
 
-		FOREACH_NODETREE(main, ntree, id) {
+		FOREACH_NODETREE_BEGIN(main, ntree, id) {
 			if (ntree->flag & NTREE_DO_VERSIONS_CUSTOMNODES_GROUP) {
 				bNode *input_node = NULL, *output_node = NULL;
 				int num_inputs = 0, num_outputs = 0;
@@ -3067,7 +3067,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 				ntree->flag &= ~(NTREE_DO_VERSIONS_CUSTOMNODES_GROUP | NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE);
 			}
 		}
-		FOREACH_NODETREE_END
+		FOREACH_NODETREE_END;
 	}
 
 	/* verify all group user nodes */
@@ -3077,10 +3077,10 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 
 	/* make update calls where necessary */
 	{
-		FOREACH_NODETREE(main, ntree, id) {
+		FOREACH_NODETREE_BEGIN(main, ntree, id) {
 			/* make an update call for the tree */
 			ntreeUpdateTree(main, ntree);
-		} FOREACH_NODETREE_END
+		} FOREACH_NODETREE_END;
 	}
 }
 
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index 28ab7b2842e..835acbc853d 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -2700,7 +2700,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 	if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 2)) {
 		{
 			/* Convert default socket values from bNodeStack */
-			FOREACH_NODETREE(bmain, ntree, id) {
+			FOREACH_NODETREE_BEGIN(bmain, ntree, id) {
 				bNode *node;
 				bNodeSocket *sock;
 
@@ -2717,8 +2717,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
 					do_versions_socket_default_value_259(sock);
 
 				ntree->update |= NTREE_UPDATE;
-			}
-			FOREACH_NODETREE_END
+			} FOREACH_NODETREE_END;
 		}
 
 		{
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c
index 35fcb11e5a5..f630dbe1aaf 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -688,7 +688,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
 	}
 
 	if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 2)) {
-		FOREACH_NODETREE(bmain, ntree, id) {
+		FOREACH_NODETREE_BEGIN(bmain, ntree, id) {
 			if (ntree->type == NTREE_SHADER) {
 				bNode *node;
 				for (node = ntree->nodes.first; node; node = node->next) {
@@ -702,7 +702,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
 					}
 				}
 			}
-		} FOREACH_NODETREE_END
+		} FOREACH_NODETREE_END;
 	}
 
 	if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 4)) {
@@ -1330,7 +1330,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
 	}
 
 	if (bmain->versionfile < 263 || (bmain->versionfile == 263 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list