Fix gcc compile errors

This commit is contained in:
Joseph Eagar 2021-10-04 12:06:52 -07:00
parent f8df47977c
commit 8435b4334d
6 changed files with 54 additions and 32 deletions

View File

@ -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)

View File

@ -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

View File

@ -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) \

View File

@ -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 */

View File

@ -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 */

View File

@ -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);