diff --git a/build_files/cmake/clang_array_check.py b/build_files/cmake/clang_array_check.py index fc85b5c454d..f29d3c75608 100644 --- a/build_files/cmake/clang_array_check.py +++ b/build_files/cmake/clang_array_check.py @@ -21,6 +21,7 @@ Invocation: # delay parsing functions until we need them USE_LAZY_INIT = True +USE_EXACT_COMPARE = False # ----------------------------------------------------------------------------- # predefined function/arg sizes, handy sometimes, but not complete... @@ -307,14 +308,24 @@ def file_check_arg_sizes(tu): # testing # size_def = 100 - if size < size_def and size != 1: - location = node.location - print("%s:%d:%d: argument %d is size %d, should be %d" % - (location.file, - location.line, - location.column, - i + 1, size, size_def - )) + if size != 1: + if USE_EXACT_COMPARE: + # is_err = (size != size_def) and (size != 4 and size_def != 3) + is_err = (size != size_def) + else: + is_err = (size < size_def) + + if is_err: + location = node.location + # if "math_color_inline.c" not in str(location.file): + if 1: + print("%s:%d:%d: argument %d is size %d, should be %d (from %s)" % + (location.file, + location.line, + location.column, + i + 1, size, size_def, + args[0] # always the same but useful when running threaded + )) # we dont really care what we are looking at, just scan entire file for # function calls. diff --git a/build_files/cmake/cmake_static_check_clang_array.py b/build_files/cmake/cmake_static_check_clang_array.py index 22b5d07c40c..17298599bdd 100644 --- a/build_files/cmake/cmake_static_check_clang_array.py +++ b/build_files/cmake/cmake_static_check_clang_array.py @@ -49,6 +49,10 @@ def main(): check_commands = [] for c, inc_dirs, defs in source_info: + + #~if "source/blender" not in c: + #~ continue + cmd = ([CHECKER_BIN] + CHECKER_ARGS + [c] + diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index f46f73c5350..bec9d5c4d1a 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -495,7 +495,10 @@ int bmesh_elem_check(void *element, const char htype) if (len != f->len) err |= (1 << 23); + break; } + default: + BLI_assert(0); } BMESH_ASSERT(err == 0); diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 988b03d3c9d..2c16bb3a9fe 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -291,7 +291,7 @@ void BM_mesh_normals_update(BMesh *bm, const bool skip_hidden) /* compute normalized direction vectors for each edge. directions will be * used below for calculating the weights of the face normals on the vertex * normals */ - edgevec = MEM_mallocN(sizeof(float) * 3 * bm->totedge, "BM normal computation array"); + edgevec = MEM_mallocN(sizeof(*edgevec) * bm->totedge, __func__); BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, index) { BM_elem_index_set(e, index); /* set_inline */ @@ -609,11 +609,16 @@ void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *fu */ int BM_mesh_elem_count(BMesh *bm, const char htype) { - if (htype == BM_VERT) return bm->totvert; - else if (htype == BM_EDGE) return bm->totedge; - else if (htype == BM_FACE) return bm->totface; - - return 0; + switch (htype) { + case BM_VERT: return bm->totvert; + case BM_EDGE: return bm->totedge; + case BM_FACE: return bm->totface; + default: + { + BLI_assert(0); + return 0; + } + } } /** diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 63444c5c17e..16e7e0fde4a 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -455,9 +455,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float BKE_object_where_is_calc(scene, obedit); - obedit->loc[0] += offset[0]; - obedit->loc[1] += offset[1]; - obedit->loc[2] += offset[2]; + add_v3_v3(obedit->loc, offset); cu = obedit->data; cu->vfont = BKE_vfont_builtin_get(); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 5a688d7daf3..48ef663592a 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -736,9 +736,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object BKE_get_constraint_target_matrix(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra); sub_v3_v3v3(vec, ob->obmat[3], cmat[3]); - ob->loc[0] = vec[0]; - ob->loc[1] = vec[1]; - ob->loc[2] = vec[2]; + copy_v3_v3(ob->loc, vec); } else if (pararm && ob->type == OB_MESH && par->type == OB_ARMATURE) { if (partype == PAR_ARMATURE_NAME)