From 3f47df577d05478a324b6eca80df0a33c838fab8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 24 Mar 2021 12:38:08 +1100 Subject: Cleanup: use new BLI_assert_unreachable macro --- source/blender/python/bmesh/bmesh_py_types.c | 2 +- source/blender/python/bmesh/bmesh_py_types_customdata.c | 4 ++-- source/blender/python/generic/imbuf_py_api.c | 2 +- source/blender/python/gpu/gpu_py_matrix.c | 4 ++-- source/blender/python/gpu/gpu_py_vertex_buffer.c | 3 ++- source/blender/python/intern/bpy_rna.c | 6 +++--- source/blender/python/mathutils/mathutils_Matrix.c | 5 +++-- 7 files changed, 14 insertions(+), 12 deletions(-) (limited to 'source/blender/python') diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 5fca6f4cec6..563a76ac824 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -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; } diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index 471a311c411..78c43d18609 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -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; } diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c index 5b4a4fd237e..97a66bc23c0 100644 --- a/source/blender/python/generic/imbuf_py_api.c +++ b/source/blender/python/generic/imbuf_py_api.c @@ -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; } diff --git a/source/blender/python/gpu/gpu_py_matrix.c b/source/blender/python/gpu/gpu_py_matrix.c index df7c82379b3..b00a13d5be8 100644 --- a/source/blender/python/gpu/gpu_py_matrix.c +++ b/source/blender/python/gpu/gpu_py_matrix.c @@ -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; diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.c b/source/blender/python/gpu/gpu_py_vertex_buffer.c index 111fa114c43..3c7038186b9 100644 --- a/source/blender/python/gpu/gpu_py_vertex_buffer.c +++ b/source/blender/python/gpu/gpu_py_vertex_buffer.c @@ -70,7 +70,8 @@ break; \ } \ default: \ - BLI_assert(0); \ + BLI_assert_unreachable(); \ + break; \ } \ ((void)0) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index fab73d0f3dc..49ac2662a31 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -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; } diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 016ba462030..161d2f41592 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -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(); } } -- cgit v1.2.3