[Bf-blender-cvs] [5e1c729] master: Cleanup: use function attrs for BMesh inline funcs

Campbell Barton noreply at git.blender.org
Sat May 2 08:27:49 CEST 2015


Commit: 5e1c729882c242be56730f45f5828c0238b8c818
Author: Campbell Barton
Date:   Fri May 1 19:16:58 2015 +1000
Branches: master
https://developer.blender.org/rB5e1c729882c242be56730f45f5828c0238b8c818

Cleanup: use function attrs for BMesh inline funcs

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

M	source/blender/bmesh/intern/bmesh_inline.h
M	source/blender/bmesh/intern/bmesh_iterators_inline.h
M	source/blender/bmesh/intern/bmesh_operator_api_inline.h
M	source/blender/bmesh/intern/bmesh_queries_inline.h
M	source/blender/bmesh/intern/bmesh_structure_inline.h

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

diff --git a/source/blender/bmesh/intern/bmesh_inline.h b/source/blender/bmesh/intern/bmesh_inline.h
index 96b2cd3..4b55060 100644
--- a/source/blender/bmesh/intern/bmesh_inline.h
+++ b/source/blender/bmesh/intern/bmesh_inline.h
@@ -39,11 +39,13 @@
 #define BM_elem_flag_merge(    ele_a, ele_b)    _bm_elem_flag_merge    (&(ele_a)->head, &(ele_b)->head)
 #define BM_elem_flag_merge_into(ele, ele_a, ele_b)_bm_elem_flag_merge_into (&(ele)->head, &(ele_a)->head, &(ele_b)->head)
 
+ATTR_WARN_UNUSED_RESULT
 BLI_INLINE char _bm_elem_flag_test(const BMHeader *head, const char hflag)
 {
 	return head->hflag & hflag;
 }
 
+ATTR_WARN_UNUSED_RESULT
 BLI_INLINE bool _bm_elem_flag_test_bool(const BMHeader *head, const char hflag)
 {
 	return (head->hflag & hflag) != 0;
@@ -116,6 +118,7 @@ BLI_INLINE void _bm_elem_index_set(BMHeader *head, const int index)
 	head->index = index;
 }
 
+ATTR_WARN_UNUSED_RESULT
 BLI_INLINE int _bm_elem_index_get(const BMHeader *head)
 {
 	return head->index;
diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h
index d3e18b9..e684400 100644
--- a/source/blender/bmesh/intern/bmesh_iterators_inline.h
+++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h
@@ -37,6 +37,7 @@
  *
  * Calls an iterators step function to return the next element.
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE void *BM_iter_step(BMIter *iter)
 {
 	return iter->step(iter);
@@ -50,6 +51,7 @@ BLI_INLINE void *BM_iter_step(BMIter *iter)
  * it with the appropriate function pointers based
  * upon its type.
  */
+ATTR_NONNULL(1)
 BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data)
 {
 	/* int argtype; */
@@ -169,6 +171,7 @@ BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *da
  * to return the first element of the iterator.
  *
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *data)
 {
 	if (LIKELY(BM_iter_init(iter, bm, itype, data))) {
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
index 99fe665..4f995e0 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api_inline.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
@@ -38,37 +38,44 @@
  * ghash or a mapping slot to do it. */
 
 /* flags 15 and 16 (1 << 14 and 1 << 15) are reserved for bmesh api use */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2)
 BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, BMFlagLayer *oflags, const short oflag)
 {
 	return oflags[bm->stackdepth - 1].f & oflag;
 }
 
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2)
 BLI_INLINE bool _bmo_elem_flag_test_bool(BMesh *bm, BMFlagLayer *oflags, const short oflag)
 {
 	return (oflags[bm->stackdepth - 1].f & oflag) != 0;
 }
 
+ATTR_NONNULL(1, 2)
 BLI_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
 {
 	oflags[bm->stackdepth - 1].f |= oflag;
 }
 
+ATTR_NONNULL(1, 2)
 BLI_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
 {
 	oflags[bm->stackdepth - 1].f &= (short)~oflag;
 }
 
+ATTR_NONNULL(1, 2)
 BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val)
 {
 	if (val) oflags[bm->stackdepth - 1].f |= oflag;
 	else     oflags[bm->stackdepth - 1].f &= (short)~oflag;
 }
 
+ATTR_NONNULL(1, 2)
 BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag)
 {
 	oflags[bm->stackdepth - 1].f ^= oflag;
 }
 
+ATTR_NONNULL(1, 2)
 BLI_INLINE void BMO_slot_map_int_insert(
         BMOperator *op, BMOpSlot *slot,
         void *element, const int val)
@@ -78,6 +85,7 @@ BLI_INLINE void BMO_slot_map_int_insert(
 	BMO_slot_map_insert(op, slot, element, ((t.val = val), t.ptr));
 }
 
+ATTR_NONNULL(1, 2)
 BLI_INLINE void BMO_slot_map_bool_insert(
         BMOperator *op, BMOpSlot *slot,
         void *element, const bool val)
@@ -87,6 +95,7 @@ BLI_INLINE void BMO_slot_map_bool_insert(
 	BMO_slot_map_insert(op, slot, element, ((t.val = val), t.ptr));
 }
 
+ATTR_NONNULL(1, 2)
 BLI_INLINE void BMO_slot_map_float_insert(
         BMOperator *op, BMOpSlot *slot,
         void *element, const float val)
@@ -102,6 +111,7 @@ BLI_INLINE void BMO_slot_map_float_insert(
  * do NOT use these for non-operator-api-allocated memory! instead
  * use BMO_slot_map_data_get and BMO_slot_map_insert, which copies the data. */
 
+ATTR_NONNULL(1, 2)
 BLI_INLINE void BMO_slot_map_ptr_insert(
         BMOperator *op, BMOpSlot *slot,
         const void *element, void *val)
@@ -110,6 +120,7 @@ BLI_INLINE void BMO_slot_map_ptr_insert(
 	BMO_slot_map_insert(op, slot, element, val);
 }
 
+ATTR_NONNULL(1, 2)
 BLI_INLINE void BMO_slot_map_elem_insert(
         BMOperator *op, BMOpSlot *slot,
         const void *element, void *val)
@@ -120,6 +131,7 @@ BLI_INLINE void BMO_slot_map_elem_insert(
 
 
 /* no values */
+ATTR_NONNULL(1, 2)
 BLI_INLINE void BMO_slot_map_empty_insert(
         BMOperator *op, BMOpSlot *slot,
         const void *element)
@@ -128,18 +140,21 @@ BLI_INLINE void BMO_slot_map_empty_insert(
 	BMO_slot_map_insert(op, slot, element, NULL);
 }
 
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE bool BMO_slot_map_contains(BMOpSlot *slot, const void *element)
 {
 	BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
 	return BLI_ghash_haskey(slot->data.ghash, element);
 }
 
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE void **BMO_slot_map_data_get(BMOpSlot *slot, const void *element)
 {
 
 	return BLI_ghash_lookup_p(slot->data.ghash, element);
 }
 
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE float BMO_slot_map_float_get(BMOpSlot *slot, const void *element)
 {
 	void **data;
@@ -154,6 +169,7 @@ BLI_INLINE float BMO_slot_map_float_get(BMOpSlot *slot, const void *element)
 	}
 }
 
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE int BMO_slot_map_int_get(BMOpSlot *slot, const void *element)
 {
 	void **data;
@@ -168,6 +184,7 @@ BLI_INLINE int BMO_slot_map_int_get(BMOpSlot *slot, const void *element)
 	}
 }
 
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE bool BMO_slot_map_bool_get(BMOpSlot *slot, const void *element)
 {
 	void **data;
@@ -182,6 +199,7 @@ BLI_INLINE bool BMO_slot_map_bool_get(BMOpSlot *slot, const void *element)
 	}
 }
 
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE void *BMO_slot_map_ptr_get(BMOpSlot *slot, const void *element)
 {
 	void **val = BMO_slot_map_data_get(slot, element);
@@ -191,6 +209,7 @@ BLI_INLINE void *BMO_slot_map_ptr_get(BMOpSlot *slot, const void *element)
 	return NULL;
 }
 
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE void *BMO_slot_map_elem_get(BMOpSlot *slot, const void *element)
 {
 	void **val = (void **) BMO_slot_map_data_get(slot, element);
diff --git a/source/blender/bmesh/intern/bmesh_queries_inline.h b/source/blender/bmesh/intern/bmesh_queries_inline.h
index 1ca56be..430ba10 100644
--- a/source/blender/bmesh/intern/bmesh_queries_inline.h
+++ b/source/blender/bmesh/intern/bmesh_queries_inline.h
@@ -30,6 +30,7 @@
  * Returns whether or not a given vertex is
  * is part of a given edge.
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE bool BM_vert_in_edge(const BMEdge *e, const BMVert *v)
 {
 	return (ELEM(v, e->v1, e->v2));
@@ -38,6 +39,7 @@ BLI_INLINE bool BM_vert_in_edge(const BMEdge *e, const BMVert *v)
 /**
  * Returns whether or not a given edge is part of a given loop.
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2)
 BLI_INLINE bool BM_edge_in_loop(const BMEdge *e, const BMLoop *l)
 {
 	return (l->e == e || l->prev->e == e);
@@ -47,6 +49,7 @@ BLI_INLINE bool BM_edge_in_loop(const BMEdge *e, const BMLoop *l)
  * Returns whether or not two vertices are in
  * a given edge
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3)
 BLI_INLINE bool BM_verts_in_edge(const BMVert *v1, const BMVert *v2, const BMEdge *e)
 {
 	return ((e->v1 == v1 && e->v2 == v2) ||
@@ -57,6 +60,7 @@ BLI_INLINE bool BM_verts_in_edge(const BMVert *v1, const BMVert *v2, const BMEdg
  * Given a edge and one of its vertices, returns
  * the other vertex.
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2)
 BLI_INLINE BMVert *BM_edge_other_vert(BMEdge *e, const BMVert *v)
 {
 	if (e->v1 == v) {
@@ -72,6 +76,7 @@ BLI_INLINE BMVert *BM_edge_other_vert(BMEdge *e, const BMVert *v)
  * Tests whether or not the edge is part of a wire.
  * (ie: has no faces attached to it)
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE bool BM_edge_is_wire(const BMEdge *e)
 {
 	return (e->l == NULL);
@@ -83,6 +88,7 @@ BLI_INLINE bool BM_edge_is_wire(const BMEdge *e)
  */
 
 #if 1 /* fast path for checking manifold */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e)
 {
 	const BMLoop *l = e->l;
@@ -100,6 +106,7 @@ BLI_INLINE int BM_edge_is_manifold(BMEdge *e)
  * Tests that the edge is manifold and
  * that both its faces point the same way.
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE bool BM_edge_is_contiguous(const BMEdge *e)
 {
 	const BMLoop *l = e->l;
@@ -115,6 +122,7 @@ BLI_INLINE bool BM_edge_is_contiguous(const BMEdge *e)
  */
 
 #if 1 /* fast path for checking boundary */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e)
 {
 	const BMLoop *l = e->l;
@@ -130,6 +138,7 @@ BLI_INLINE int BM_edge_is_boundary(BMEdge *e)
 /**
  * Tests whether one loop is next to another within the same face.
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2)
 BLI_INLINE bool BM_loop_is_adjacent(const BMLoop *l_a, const BMLoop *l_b)
 {
 	BLI_assert(l_a->f == l_b->f);
@@ -140,6 +149,7 @@ BLI_INLINE bool BM_loop_is_adjacent(const BMLoop *l_a, const BMLoop *l_b)
 /**
  * Check if we have a single wire edge user.
  */
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 BLI_INLINE bool BM_vert_is_wire_endpoint(const BMVert *v)
 {
 	const BMEdge *e = v->e;
diff --git a/source/blender/bmesh/intern/bmesh_structure_inline.h b/source/blender/bmesh/intern/bmesh_structure_inline.h
index 5b7e890..6429219 100644
--- a/source/blender/bmesh/intern/bmesh_structure_inline.h
+++ b/source/blender/bmesh/intern/bmesh_structure_inline.h
@@ -27,6 +27,7 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list