[Bf-blender-cvs] [8435b4334d6] sculpt-dev: Fix gcc compile errors
Joseph Eagar
noreply at git.blender.org
Mon Oct 4 21:09:25 CEST 2021
Commit: 8435b4334d64aa6e0c032a5b44e4f36e3405662b
Author: Joseph Eagar
Date: Mon Oct 4 12:06:52 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB8435b4334d64aa6e0c032a5b44e4f36e3405662b
Fix gcc compile errors
===================================================================
M source/blender/blenlib/BLI_assert.h
M source/blender/blenlib/intern/smallhash.c
M source/blender/bmesh/bmesh_class.h
M source/blender/bmesh/intern/bmesh_log.c
M source/blender/bmesh/intern/bmesh_operator_api.h
M source/blender/editors/sculpt_paint/sculpt_undo.c
===================================================================
diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h
index 6019f0f3566..3061060bb7e 100644
--- a/source/blender/blenlib/BLI_assert.h
+++ b/source/blender/blenlib/BLI_assert.h
@@ -71,8 +71,8 @@ void _BLI_assert_unreachable_print(const char *file, const int line, const char
NULL)) : \
NULL)
#else
-# define BLI_assert(a) ((void)0)
-# define BLI_assert_msg(a, msg) ((void)0)
+# define BLI_assert(a) ((void*)0)
+# define BLI_assert_msg(a, msg) ((void*)0)
#endif
#if defined(__cplusplus)
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c
index 4f6db4f8fc6..a6d2e8906d1 100644
--- a/source/blender/blenlib/intern/smallhash.c
+++ b/source/blender/blenlib/intern/smallhash.c
@@ -17,6 +17,16 @@
* All rights reserved.
*/
+#ifdef __GNUC__
+/* I can't even *cast* signed ints in gcc's sign-conversion warning? gcc 10.3.0 -joeedh */
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
+#ifdef __GNUC__
+/* I can't even *cast* signed ints in gcc's sign-conversion warning? gcc 10.3.0 -joeedh */
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
/** \file
* \ingroup bli
*
@@ -110,7 +120,7 @@ extern const uint BLI_ghash_hash_sizes[];
int BLI_smallhash_memuse(SmallHash *sh)
{
- return (int)sh->nbuckets * sizeof(SmallHashEntry) + (int)sizeof(SmallHash);
+ return (int)sh->nbuckets * (int)sizeof(SmallHashEntry) + (int)sizeof(SmallHash);
}
#if 0
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 7088b93c47d..7aec1ea0721 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -26,6 +26,9 @@
*/
#include "BLI_assert.h"
+#include "BLI_compiler_compat.h"
+#include "BLI_compiler_typecheck.h"
+#include "BLI_utildefines.h"
/* disable holes for now,
* these are ifdef'd because they use more memory and can't be saved in DNA currently */
@@ -444,8 +447,7 @@ enum {
/* args for _Generic */
#define _BM_GENERIC_TYPE_ELEM_NONCONST \
- void *, BMVert *, BMEdge *, BMLoop *, BMFace *, BMVert_OFlag *, BMEdge_OFlag *, BMFace_OFlag *, \
- BMElem *, BMElemF *, BMHeader *
+ void *, BMVert *, BMEdge *, BMLoop *, BMFace *, BMElem *, BMElemF *, BMHeader *
#define _BM_GENERIC_TYPE_ELEM_CONST \
const void *, const BMVert *, const BMEdge *, const BMLoop *, const BMFace *, const BMElem *, \
@@ -460,22 +462,22 @@ enum {
CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST, _BM_GENERIC_TYPE_ELEM_CONST)
/* vert */
-#define _BM_GENERIC_TYPE_VERT_NONCONST BMVert *, BMVert_OFlag *
-#define _BM_GENERIC_TYPE_VERT_CONST const BMVert *, const BMVert_OFlag *
+#define _BM_GENERIC_TYPE_VERT_NONCONST BMVert *
+#define _BM_GENERIC_TYPE_VERT_CONST const BMVert *
#define BM_CHECK_TYPE_VERT_CONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_VERT_CONST)
#define BM_CHECK_TYPE_VERT_NONCONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST)
#define BM_CHECK_TYPE_VERT(ele) \
CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_VERT_NONCONST, _BM_GENERIC_TYPE_VERT_CONST)
/* edge */
-#define _BM_GENERIC_TYPE_EDGE_NONCONST BMEdge *, BMEdge_OFlag *
-#define _BM_GENERIC_TYPE_EDGE_CONST const BMEdge *, const BMEdge_OFlag *
+#define _BM_GENERIC_TYPE_EDGE_NONCONST BMEdge *
+#define _BM_GENERIC_TYPE_EDGE_CONST const BMEdge *
#define BM_CHECK_TYPE_EDGE_CONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_EDGE_CONST)
#define BM_CHECK_TYPE_EDGE_NONCONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST)
#define BM_CHECK_TYPE_EDGE(ele) \
CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_EDGE_NONCONST, _BM_GENERIC_TYPE_EDGE_CONST)
/* face */
-#define _BM_GENERIC_TYPE_FACE_NONCONST BMFace *, BMFace_OFlag *
-#define _BM_GENERIC_TYPE_FACE_CONST const BMFace *, const BMFace_OFlag *
+#define _BM_GENERIC_TYPE_FACE_NONCONST BMFace *
+#define _BM_GENERIC_TYPE_FACE_CONST const BMFace *
#define BM_CHECK_TYPE_FACE_CONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_FACE_CONST)
#define BM_CHECK_TYPE_FACE_NONCONST(ele) CHECK_TYPE_ANY(ele, _BM_GENERIC_TYPE_ELEM_NONCONST)
#define BM_CHECK_TYPE_FACE(ele) \
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index 28f64b81ff2..f265b8f2036 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -24,7 +24,7 @@
* Currently it supports the following types of changes:
*
* - Adding and removing vertices
- * - Adding and removing faces
+ * - Adding and removing facels
* - Moving vertices
* - Setting vertex paint-mask values
* - Setting vertex hflags
@@ -92,9 +92,19 @@ typedef struct myiter {
# define GHashIterator myiter
+#ifdef __GNUC__
+/* I can't even *cast* signed ints in gcc's sign-conversion warning? gcc 10.3.0 -joeedh */
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
+#ifdef __GNUC__
+/* I can't even *cast* signed ints in gcc's sign-conversion warning? gcc 10.3.0 -joeedh */
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
# define BLI_ghash_free(sh, a, b) free_smallhash(sh)
# define BLI_ghash_int_new_ex(a, b) new_smallhash()
-# define BLI_ghash_reserve(sh, n) smallhash_reserve(sh, n)
+# define BLI_ghash_reserve(sh, n) smallhash_reserve(sh, (unsigned int)(n))
# define BLI_ghash_new(a, b, c) new_smallhash()
# define BLI_ghash_insert(sh, key, val) BLI_smallhash_insert((sh), (uintptr_t)(key), (val))
# define BLI_ghash_remove(sh, key, a, b) BLI_smallhash_remove((sh), (uintptr_t)(key))
@@ -2796,11 +2806,11 @@ void BM_log_all_added(BMesh *bm, BMLog *log)
/* avoid unnecessary resizing on initialization */
if (BLI_ghash_len(log->current_entry->added_verts) == 0) {
- BLI_ghash_reserve(log->current_entry->added_verts, (uint)bm->totvert);
+ BLI_ghash_reserve(log->current_entry->added_verts, ((uint)bm->totvert));
}
if (BLI_ghash_len(log->current_entry->added_faces) == 0) {
- BLI_ghash_reserve(log->current_entry->added_faces, (uint)bm->totface);
+ BLI_ghash_reserve(log->current_entry->added_faces, ((uint)bm->totface));
}
/* Log all vertices as newly created */
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index 35427d3fa40..c6cd957fcb3 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -125,45 +125,45 @@ static BMFlagLayer *BMO_elem_flag_from_header(BMesh *bm, BMElem *ele)
typeof(e) _e = e; \
(BM_CHECK_TYPE_VERT(_e), \
(const BMFlagLayer*) BMO_elem_flag_from_header(bm, \
- BLI_assert(((const BMHeader *)_e)->htype == BM_VERT), \
- (BMElem*)_e)); \
+ (BLI_assert(((const BMHeader *)_e)->htype == BM_VERT), \
+ (BMElem*)_e))); \
})
#define _BMO_CAST_V(bm, e) ({\
typeof(e) _e = e; \
(BM_CHECK_TYPE_VERT_NONCONST(_e), \
BMO_elem_flag_from_header(bm, \
- BLI_assert(((const BMHeader *)_e)->htype == BM_VERT), \
- (BMElem*)_e)); \
+ (BLI_assert(((const BMHeader *)_e)->htype == BM_VERT), \
+ (BMElem*)_e))); \
})
#define _BMO_CAST_E_CONST(bm, e) ({\
typeof(e) _e = e; \
- (BM_CHECK_TYPE_VERT(_e), \
+ (BM_CHECK_TYPE_EDGE(_e), \
(const BMFlagLayer*) BMO_elem_flag_from_header(bm, \
- BLI_assert(((const BMHeader *)_e)->htype == BM_EDGE), \
- (BMElem*)_e)); \
+ (BLI_assert(((const BMHeader *)_e)->htype == BM_EDGE), \
+ (BMElem*)_e))); \
})
#define _BMO_CAST_E(bm, e) ({\
typeof(e) _e = e; \
- (BM_CHECK_TYPE_VERT_NONCONST(_e), \
+ (BM_CHECK_TYPE_EDGE_NONCONST(_e), \
BMO_elem_flag_from_header(bm, \
- BLI_assert(((const BMHeader *)_e)->htype == BM_EDGE), \
- (BMElem*)_e)); \
+ (BLI_assert(((const BMHeader *)_e)->htype == BM_EDGE), \
+ (BMElem*)_e))); \
})
#define _BMO_CAST_F_CONST(bm, e) ({\
typeof(e) _e = e; \
- (BM_CHECK_TYPE_VERT(_e), \
+ (BM_CHECK_TYPE_FACE(_e), \
(const BMFlagLayer*) BMO_elem_flag_from_header(bm, \
- BLI_assert(((const BMHeader *)_e)->htype == BM_FACE), \
- (BMElem*)_e)); \
+ (BLI_assert(((const BMHeader *)_e)->htype == BM_FACE), \
+ (BMElem*)_e))); \
})
#define _BMO_CAST_F(bm, e) ({\
typeof(e) _e = e; \
- (BM_CHECK_TYPE_VERT_NONCONST(_e), \
+ (BM_CHECK_TYPE_FACE_NONCONST(_e), \
BMO_elem_flag_from_header(bm, \
- BLI_assert(((const BMHeader *)_e)->htype == BM_FACE), \
- (BMElem*)_e)); \
+ (BLI_assert(((const BMHeader *)_e)->htype == BM_FACE), \
+ (BMElem*)_e))); \
})
/* clang-format on */
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 4c352fd24b1..601b871b73f 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1937,7 +1937,7 @@ bool SCULPT_ensure_dyntopo_node_undo(Object *ob,
}
if (!node) {
- return;
+ return false;
}
int n = BKE_pbvh_get_node_id(ss->pbvh, node);
More information about the Bf-blender-cvs
mailing list