[Bf-blender-cvs] [6192695a946] master: Cleanup: Allow using C++ features in BMesh header functions

Hans Goudey noreply at git.blender.org
Mon Nov 14 15:01:32 CET 2022


Commit: 6192695a9469fd34dfe938b8cf55a3e9bdc37819
Author: Hans Goudey
Date:   Sun Nov 13 23:08:53 2022 -0600
Branches: master
https://developer.blender.org/rB6192695a9469fd34dfe938b8cf55a3e9bdc37819

Cleanup: Allow using C++ features in BMesh header functions

Generally the `extern "C" {` brackets shouldn't be added around other
headers since it causes problems when using C++ features in them.
Follow that convention for the "bmesh.h" header.

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

M	source/blender/bmesh/bmesh.h
M	source/blender/bmesh/bmesh_class.h
M	source/blender/bmesh/intern/bmesh_callback_generic.h
M	source/blender/bmesh/intern/bmesh_construct.h
M	source/blender/bmesh/intern/bmesh_core.h
M	source/blender/bmesh/intern/bmesh_delete.h
M	source/blender/bmesh/intern/bmesh_edgeloop.h
M	source/blender/bmesh/intern/bmesh_error.h
M	source/blender/bmesh/intern/bmesh_interp.h
M	source/blender/bmesh/intern/bmesh_iterators.h
M	source/blender/bmesh/intern/bmesh_log.h
M	source/blender/bmesh/intern/bmesh_marking.h
M	source/blender/bmesh/intern/bmesh_mesh.h
M	source/blender/bmesh/intern/bmesh_mesh_convert.h
M	source/blender/bmesh/intern/bmesh_mesh_debug.h
M	source/blender/bmesh/intern/bmesh_mesh_duplicate.h
M	source/blender/bmesh/intern/bmesh_mesh_normals.h
M	source/blender/bmesh/intern/bmesh_mesh_partial_update.h
M	source/blender/bmesh/intern/bmesh_mesh_tessellate.h
M	source/blender/bmesh/intern/bmesh_mesh_validate.h
M	source/blender/bmesh/intern/bmesh_mods.h
M	source/blender/bmesh/intern/bmesh_operators.h
M	source/blender/bmesh/intern/bmesh_polygon.h
M	source/blender/bmesh/intern/bmesh_polygon_edgenet.h
M	source/blender/bmesh/intern/bmesh_query.h
M	source/blender/bmesh/intern/bmesh_query_uv.h
M	source/blender/bmesh/intern/bmesh_walkers.h

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

diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h
index 3956db0288a..e559944324f 100644
--- a/source/blender/bmesh/bmesh.h
+++ b/source/blender/bmesh/bmesh.h
@@ -179,10 +179,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include "bmesh_class.h"
 
 /* include the rest of the API */
@@ -215,7 +211,3 @@ extern "C" {
 #include "intern/bmesh_walkers.h"
 
 #include "intern/bmesh_inline.h"
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 9d5737a5b71..e837ec9eae2 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -11,6 +11,10 @@
 
 #include "BLI_assert.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* disable holes for now,
  * these are ifdef'd because they use more memory and can't be saved in DNA currently */
 // #define USE_BMESH_HOLES
@@ -655,3 +659,7 @@ typedef bool (*BMLoopPairFilterFunc)(const BMLoop *, const BMLoop *, void *user_
 #else
 #  define BM_OMP_LIMIT 10000
 #endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_callback_generic.h b/source/blender/bmesh/intern/bmesh_callback_generic.h
index 36dfc7d3d9f..2bd3c91ee28 100644
--- a/source/blender/bmesh/intern/bmesh_callback_generic.h
+++ b/source/blender/bmesh/intern/bmesh_callback_generic.h
@@ -6,6 +6,10 @@
  * \ingroup bmesh
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 bool BM_elem_cb_check_hflag_enabled(BMElem *, void *user_data);
 bool BM_elem_cb_check_hflag_disabled(BMElem *, void *user_data);
 bool BM_elem_cb_check_hflag_ex(BMElem *, void *user_data);
@@ -20,3 +24,7 @@ bool BM_elem_cb_check_elem_not_equal(BMElem *ele, void *user_data);
 
 #define BM_elem_cb_check_hflag_disabled_simple(type, hflag_n) \
   (bool (*)(type, void *)) BM_elem_cb_check_hflag_disabled, POINTER_FROM_UINT(hflag_n)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h
index 225e15c90e9..635198b9346 100644
--- a/source/blender/bmesh/intern/bmesh_construct.h
+++ b/source/blender/bmesh/intern/bmesh_construct.h
@@ -11,6 +11,10 @@
 struct BMAllocTemplate;
 struct Mesh;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Fill in a vertex array from an edge array.
  *
@@ -171,3 +175,7 @@ char BM_edge_flag_from_mflag(short mflag);
 /* ME -> BM */
 char BM_face_flag_to_mflag(BMFace *f);
 short BM_edge_flag_to_mflag(BMEdge *e);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h
index b1cf4929b7e..4df0463f134 100644
--- a/source/blender/bmesh/intern/bmesh_core.h
+++ b/source/blender/bmesh/intern/bmesh_core.h
@@ -6,6 +6,10 @@
  * \ingroup bmesh
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 BMFace *BM_face_copy(BMesh *bm_dst, BMesh *bm_src, BMFace *f, bool copy_verts, bool copy_edges);
 
 typedef enum eBMCreateFlag {
@@ -391,3 +395,7 @@ BMVert *bmesh_kernel_unglue_region_make_vert_multi(BMesh *bm, BMLoop **larr, int
  * isolated by calling #bmesh_kernel_edge_separate to segregate it radially.
  */
 BMVert *bmesh_kernel_unglue_region_make_vert_multi_isolated(BMesh *bm, BMLoop *l_sep);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_delete.h b/source/blender/bmesh/intern/bmesh_delete.h
index 7e2edc54224..afa94825a5c 100644
--- a/source/blender/bmesh/intern/bmesh_delete.h
+++ b/source/blender/bmesh/intern/bmesh_delete.h
@@ -6,6 +6,10 @@
  * \ingroup bmesh
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void BMO_mesh_delete_oflag_tagged(BMesh *bm, short oflag, char htype);
 void BM_mesh_delete_hflag_tagged(BMesh *bm, char hflag, char htype);
 
@@ -19,3 +23,7 @@ void BMO_mesh_delete_oflag_context(BMesh *bm, short oflag, int type);
  * not just the type being removed.
  */
 void BM_mesh_delete_hflag_context(BMesh *bm, char hflag, int type);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.h b/source/blender/bmesh/intern/bmesh_edgeloop.h
index 7e157c30a3d..cf9d010a53f 100644
--- a/source/blender/bmesh/intern/bmesh_edgeloop.h
+++ b/source/blender/bmesh/intern/bmesh_edgeloop.h
@@ -7,6 +7,10 @@
  * \ingroup bmesh
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct BMEdgeLoopStore;
 struct GSet;
 struct ListBase;
@@ -80,3 +84,7 @@ bool BM_edgeloop_overlap_check(struct BMEdgeLoopStore *el_store_a,
 #define BM_EDGELOOP_NEXT(el_store) \
   (CHECK_TYPE_INLINE(el_store, struct BMEdgeLoopStore *), \
    (struct BMEdgeLoopStore *)((LinkData *)el_store)->next)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h
index 41c9c02aae4..aa50e7b7e51 100644
--- a/source/blender/bmesh/intern/bmesh_error.h
+++ b/source/blender/bmesh/intern/bmesh_error.h
@@ -8,6 +8,10 @@
 
 #include "bmesh_operator_api.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*----------- bmop error system ----------*/
 
 /**
@@ -87,3 +91,7 @@ void BMO_error_clear(BMesh *bm);
                     _BMESH_DUMMY_ABORT(), \
                     NULL)) : \
                   NULL)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h
index 2cf9dffceec..21c99f00eab 100644
--- a/source/blender/bmesh/intern/bmesh_interp.h
+++ b/source/blender/bmesh/intern/bmesh_interp.h
@@ -9,6 +9,10 @@
 struct LinkNode;
 struct MemArena;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void BM_loop_interp_multires_ex(BMesh *bm,
                                 BMLoop *l_dst,
                                 const BMFace *f_src,
@@ -113,3 +117,7 @@ void BM_vert_loop_groups_data_layer_merge_weights(BMesh *bm,
                                                   struct LinkNode *groups,
                                                   int layer_n,
                                                   const float *loop_weights);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h
index 9132450d1f7..add08710eea 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.h
+++ b/source/blender/bmesh/intern/bmesh_iterators.h
@@ -20,6 +20,10 @@
 #include "BLI_compiler_attrs.h"
 #include "BLI_mempool.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* these iterator over all elements of a specific
  * type in the mesh.
  *
@@ -282,3 +286,7 @@ BMITER_CB_DEF(loop_of_face);
   (BM_ITER_CHECK_TYPE_DATA(data), BM_iter_new(iter, bm, itype, data))
 #define BM_iter_init(iter, bm, itype, data) \
   (BM_ITER_CHECK_TYPE_DATA(data), BM_iter_init(iter, bm, itype, data))
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_log.h b/source/blender/bmesh/intern/bmesh_log.h
index 8c9db9c66e7..329bb94e7b4 100644
--- a/source/blender/bmesh/intern/bmesh_log.h
+++ b/source/blender/bmesh/intern/bmesh_log.h
@@ -14,6 +14,10 @@ struct RangeTreeUInt;
 typedef struct BMLog BMLog;
 typedef struct BMLogEntry BMLogEntry;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Allocate, initialize, and assign a new BMLog.
  */
@@ -208,3 +212,7 @@ BMLogEntry *BM_log_current_entry(BMLog *log);
 struct RangeTreeUInt *BM_log_unused_ids(BMLog *log);
 
 void BM_log_print_entry(BMesh *bm, BMLogEntry *entry);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h
index 8bee9220aa2..0c1141032c1 100644
--- a/source/blender/bmesh/intern/bmesh_marking.h
+++ b/source/blender/bmesh/intern/bmesh_marking.h
@@ -6,6 +6,10 @@
  * \ingroup bmesh
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct BMEditSelection {
   struct BMEditSelection *next, *prev;
   BMElem *ele;
@@ -188,3 +192,7 @@ void BM_select_history_merge_from_targetmap(
   (bm)->selected = _bm_prev_selected; \
   } \
   (void)0
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index d766a26cf6e..d72ecfca338 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -8,6 +8,10 @@
 
 #include "bmesh_class.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct BMAllocTemplate;
 struct BMLoopNorEditDataArray;
 struct BMPartialUpdate;
@@ -204,3 +208,7 @@ void BM_mesh_vert_coords_apply(BMesh *bm, const float (*vert_coords)[3]);
 void BM_mesh_vert_coords_apply_with_mat4(BMesh *bm,
                                          const float (*vert_coords)[3],
                                          const float mat[4][4]);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.h b/source/blender/bmesh/intern/bmesh_mesh_convert.h
index 3f8e9e3dfef..5137df6d487 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.h
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.h
@@ -9,6 +9,10 @@
 
 #include "bmesh.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct CustomData_MeshMasks;
 struct Main;
 struct Mesh;
@@ -87,3 +91,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm,
                                struct Mesh *me,
                                const struct CustomData_MeshMasks *cd_mask_extra)
     ATTR_NONNULL(1, 2);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_mesh_debug.h b/source/blender/bmesh/intern/bmesh_mesh_debug.h
index dbbb22b8eac..7e8a6fdd60d 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_debug.h
+++ b/source/blender/bmesh/intern/bmesh_mesh_debug.h
@@ -10,7 +10,15 @@
 
 #include "bmesh.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef NDEBUG
 char *BM_mesh_debug_info(BMesh *bm) ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
 void BM_mesh_debug_print(BMesh *bm) ATTR_NONNULL(1);
 #endif /* NDEBUG */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_mesh_duplicate.h b/source/blender/bmesh/intern/bmesh_mesh_duplicate.h
index ba503b1cf5b..544f705e76d 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_duplicate.h
+++ b/source/blender/bmesh/intern/bmesh_mesh_duplicate.h
@@ -6,6 +6,10 @@
  * \ingroup bmesh
  */
 
+#ifdef _

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list