Cleanup: use new BLI_assert_unreachable macro

This commit is contained in:
2021-03-24 12:38:08 +11:00
parent 3ea1779365
commit 3f47df577d
28 changed files with 55 additions and 53 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -70,7 +70,8 @@
break; \
} \
default: \
BLI_assert(0); \
BLI_assert_unreachable(); \
break; \
} \
((void)0)

View File

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

View File

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