Cleanup: use new BLI_assert_unreachable macro
This commit is contained in:
parent
3ea1779365
commit
3f47df577d
|
@ -664,7 +664,7 @@ bool BKE_appdir_folder_id_ex(const int folder_id,
|
|||
return false;
|
||||
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -719,7 +719,7 @@ const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char *su
|
|||
get_path_user_ex(path, sizeof(path), "scripts", subfolder, version, check_is_dir);
|
||||
break;
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1691,7 +1691,7 @@ void BKE_bone_parent_transform_calc_from_matrices(int bone_flag,
|
|||
break;
|
||||
|
||||
default:
|
||||
BLI_assert(false);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
/* If removing parent pose rotation: */
|
||||
|
@ -1723,7 +1723,7 @@ void BKE_bone_parent_transform_calc_from_matrices(int bone_flag,
|
|||
break;
|
||||
|
||||
default:
|
||||
BLI_assert(false);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1374,7 +1374,7 @@ void BKE_histogram_update_sample_line(Histogram *hist,
|
|||
rgba[3] = 1.0f;
|
||||
break;
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
||||
hist->data_luma[i] = IMB_colormanagement_get_luminance(rgba);
|
||||
|
@ -1476,7 +1476,7 @@ static void scopes_update_cb(void *__restrict userdata,
|
|||
rgba[3] = 1.0f;
|
||||
break;
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -936,7 +936,7 @@ static void update_velocities(FluidEffectorSettings *fes,
|
|||
}
|
||||
else {
|
||||
/* Should never reach this block. */
|
||||
BLI_assert(false);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -182,7 +182,7 @@ void BKE_main_free(Main *mainvar)
|
|||
BKE_id_free_ex(mainvar, id, free_flag, false);
|
||||
break;
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -148,7 +148,7 @@ bool BKE_mesh_wrapper_minmax(const Mesh *me, float min[3], float max[3])
|
|||
case ME_WRAPPER_TYPE_MDATA:
|
||||
return BKE_mesh_minmax(me, min, max);
|
||||
}
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ void BKE_mesh_wrapper_vert_coords_copy(const Mesh *me,
|
|||
return;
|
||||
}
|
||||
}
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
||||
void BKE_mesh_wrapper_vert_coords_copy_with_mat4(const Mesh *me,
|
||||
|
@ -226,7 +226,7 @@ void BKE_mesh_wrapper_vert_coords_copy_with_mat4(const Mesh *me,
|
|||
return;
|
||||
}
|
||||
}
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -243,7 +243,7 @@ int BKE_mesh_wrapper_vert_len(const Mesh *me)
|
|||
case ME_WRAPPER_TYPE_MDATA:
|
||||
return me->totvert;
|
||||
}
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ int BKE_mesh_wrapper_edge_len(const Mesh *me)
|
|||
case ME_WRAPPER_TYPE_MDATA:
|
||||
return me->totedge;
|
||||
}
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ int BKE_mesh_wrapper_loop_len(const Mesh *me)
|
|||
case ME_WRAPPER_TYPE_MDATA:
|
||||
return me->totloop;
|
||||
}
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ int BKE_mesh_wrapper_poly_len(const Mesh *me)
|
|||
case ME_WRAPPER_TYPE_MDATA:
|
||||
return me->totpoly;
|
||||
}
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1858,7 +1858,7 @@ bool BKE_object_data_is_in_editmode(const ID *id)
|
|||
case ID_AR:
|
||||
return ((const bArmature *)id)->edbo != NULL;
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1905,7 +1905,7 @@ char *BKE_object_data_editmode_flush_ptr_get(struct ID *id)
|
|||
return &arm->needs_flush_to_id;
|
||||
}
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -656,7 +656,7 @@ void BKE_paint_runtime_init(const ToolSettings *ts, Paint *paint)
|
|||
paint->runtime.ob_mode = OB_MODE_WEIGHT_GPENCIL;
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ void ED_editors_init(bContext *C)
|
|||
ED_object_wpaintmode_enter_ex(bmain, depsgraph, scene, ob);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -94,7 +94,7 @@ int ED_select_similar_compare_float(const float delta, const float thresh, const
|
|||
case SIM_CMP_LT:
|
||||
return ((delta - thresh) < FLT_EPSILON);
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ bool ED_select_similar_compare_float_tree(const KDTree_1d *tree,
|
|||
nearest_edge_length = FLT_MAX;
|
||||
break;
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ static BMLoop *bm_loop_find_other_fan_loop_with_visible_face(BMLoop *l_src,
|
|||
l_other = l_other->prev;
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
return l_other;
|
||||
|
@ -189,7 +189,7 @@ static BMLoop *bm_vert_step_fan_loop_uv(BMLoop *l, BMEdge **e_step, const int cd
|
|||
l_next = l;
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -2213,7 +2213,7 @@ static int uv_mouse_select_loop_generic_multi(bContext *C,
|
|||
flush = uv_select_edgering(sima, scene, obedit, &hit, extend);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
||||
if (ts->uv_flag & UV_SYNC_SELECTION) {
|
||||
|
|
|
@ -393,7 +393,7 @@ static ImBuf *thumb_create_ex(const char *file_path,
|
|||
img = IMB_thumb_load_font(file_path, tsize, tsize);
|
||||
break;
|
||||
default:
|
||||
BLI_assert(0); /* This should never happen */
|
||||
BLI_assert_unreachable(); /* This should never happen */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +738,7 @@ void IMB_thumb_path_unlock(const char *path)
|
|||
|
||||
if (thumb_locks.locked_paths) {
|
||||
if (!BLI_gset_remove(thumb_locks.locked_paths, key, MEM_freeN)) {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
BLI_condition_notify_all(&thumb_locks.cond);
|
||||
}
|
||||
|
|
|
@ -3984,7 +3984,7 @@ PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele)
|
|||
case BM_LOOP:
|
||||
return BPy_BMLoop_CreatePyObject(bm, (BMLoop *)ele);
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
PyErr_SetString(PyExc_SystemError, "internal error");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ static CustomData *bpy_bm_customdata_get(BMesh *bm, char htype)
|
|||
return &bm->ldata;
|
||||
}
|
||||
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -958,7 +958,7 @@ PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype)
|
|||
type = &BPy_BMLayerAccessLoop_Type;
|
||||
break;
|
||||
default: {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
type = NULL;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ static PyObject *py_imbuf_resize(Py_ImBuf *self, PyObject *args, PyObject *kw)
|
|||
IMB_scaleImBuf(self->ibuf, UNPACK2(size));
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ static PyObject *pygpu_matrix_stack_context_enter(BPyGPU_MatrixStackContext *sel
|
|||
self->level = GPU_matrix_stack_level_get_projection();
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ static PyObject *pygpu_matrix_stack_context_exit(BPyGPU_MatrixStackContext *self
|
|||
}
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
finally:
|
||||
Py_RETURN_NONE;
|
||||
|
|
|
@ -70,7 +70,8 @@
|
|||
break; \
|
||||
} \
|
||||
default: \
|
||||
BLI_assert(0); \
|
||||
BLI_assert_unreachable(); \
|
||||
break; \
|
||||
} \
|
||||
((void)0)
|
||||
|
||||
|
|
|
@ -1345,7 +1345,7 @@ BLI_bitmap *pyrna_set_to_enum_bitmap(const EnumPropertyItem *items,
|
|||
index = (int)ret_convert.as_unsigned;
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
BLI_assert(index < bitmap_size);
|
||||
|
@ -5550,7 +5550,7 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self,
|
|||
case PROP_POINTER:
|
||||
case PROP_COLLECTION:
|
||||
/* Should never happen. */
|
||||
BLI_assert(false);
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5595,7 +5595,7 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self,
|
|||
case PROP_POINTER:
|
||||
case PROP_COLLECTION:
|
||||
/* Should never happen. */
|
||||
BLI_assert(false);
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1049,7 +1049,8 @@ static void adjoint_matrix_n(float *mat_dst, const float *mat_src, const ushort
|
|||
break;
|
||||
}
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1159,7 +1160,7 @@ static void matrix_invert_safe_internal(const MatrixObject *self, float *r_mat)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -488,7 +488,7 @@ static Sequence *seq_dupli(const Scene *scene_src,
|
|||
}
|
||||
else {
|
||||
/* sequence type not handled in duplicate! Expect a crash now... */
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
||||
/* When using SEQ_DUPE_UNIQUE_NAME, it is mandatory to add new sequences in relevant container
|
||||
|
|
|
@ -324,7 +324,7 @@ bool wm_gizmogroup_is_visible_in_drawstep(const wmGizmoGroup *gzgroup,
|
|||
case WM_GIZMOMAP_DRAWSTEP_3D:
|
||||
return (gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D);
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,7 @@ static int gizmo_tweak_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
bool clear_modal = true;
|
||||
|
||||
if (gz == NULL) {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ static int gizmo_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
|
||||
if (!gz) {
|
||||
/* wm_handlers_do_intern shouldn't let this happen */
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
|
||||
}
|
||||
|
||||
|
|
|
@ -941,7 +941,7 @@ bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action)
|
|||
changed = wm_gizmomap_deselect_all(gzmap);
|
||||
break;
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ wmEvent *wm_event_add(wmWindow *win, const wmEvent *event_to_add)
|
|||
wmEvent *WM_event_add_simulate(wmWindow *win, const wmEvent *event_to_add)
|
||||
{
|
||||
if ((G.f & G_FLAG_EVENT_SIMULATE) == 0) {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
return NULL;
|
||||
}
|
||||
wmEvent *event = wm_event_add(win, event_to_add);
|
||||
|
@ -1037,7 +1037,7 @@ static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat,
|
|||
ED_area_type_hud_clear(wm, NULL);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2885,7 +2885,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
|
|||
}
|
||||
else {
|
||||
/* Unreachable (handle all types above). */
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
||||
if (action & WM_HANDLER_BREAK) {
|
||||
|
|
|
@ -2298,7 +2298,7 @@ static int operator_state_dispatch(bContext *C, wmOperator *op, OperatorDispatch
|
|||
return target.run(C, op);
|
||||
}
|
||||
}
|
||||
BLI_assert(false);
|
||||
BLI_assert_unreachable();
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
|
|
@ -750,7 +750,7 @@ static void lib_relocate_do_remap(Main *bmain,
|
|||
/* In some cases, new_id might become direct link, remove parent of library in this case. */
|
||||
if (new_id->lib->parent && (new_id->tag & LIB_TAG_INDIRECT) == 0) {
|
||||
if (do_reload) {
|
||||
BLI_assert(0); /* Should not happen in 'pure' reload case... */
|
||||
BLI_assert_unreachable(); /* Should not happen in 'pure' reload case... */
|
||||
}
|
||||
new_id->lib->parent = NULL;
|
||||
}
|
||||
|
|
|
@ -1229,7 +1229,7 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i
|
|||
id = (ID *)BKE_image_load_exists_ex(bmain, path, &exists);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
||||
if (!id) {
|
||||
|
@ -1248,7 +1248,7 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i
|
|||
BLI_path_rel(((Image *)id)->filepath, BKE_main_blendfile_path(bmain));
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1687,7 +1687,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *region, void *userdat
|
|||
UI_but_func_menu_search(but);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
||||
UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT);
|
||||
|
|
|
@ -2174,7 +2174,7 @@ void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect)
|
|||
screen_rect.ymin += height;
|
||||
break;
|
||||
default:
|
||||
BLI_assert(0);
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue