Cleanup: replace BLI_assert(0 && "text") with BLI_assert_msg

This commit is contained in:
Campbell Barton 2021-07-21 20:39:51 +10:00
parent ab101d444d
commit e7082fbdb0
Notes: blender-bot 2023-02-14 09:02:40 +01:00
Referenced by issue #90155, Cleanup: Use BLI_assert_msg when using BLI_assert(..&&"")
12 changed files with 34 additions and 34 deletions

View File

@ -1303,7 +1303,7 @@ const char *BKE_unit_identifier_get(const void *usys_pt, int index)
{
const bUnitDef *unit = ((const bUnitCollection *)usys_pt)->units + index;
if (unit->identifier == NULL) {
BLI_assert(false && "identifier for this unit is not specified yet");
BLI_assert_msg(0, "identifier for this unit is not specified yet");
}
return unit->identifier;
}

View File

@ -103,7 +103,7 @@ void evaluate_node(const DepsgraphEvalState *state, OperationNode *operation_nod
::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph *>(state->graph);
/* Sanity checks. */
BLI_assert(!operation_node->is_noop() && "NOOP nodes should not actually be scheduled");
BLI_assert_msg(!operation_node->is_noop(), "NOOP nodes should not actually be scheduled");
/* Perform operation. */
if (state->do_stats) {
const double start_time = PIL_check_seconds_timer();

View File

@ -192,7 +192,7 @@ void EEVEE_subsurface_add_pass(EEVEE_ViewLayerData *sldata,
gpumat, stl->effects->sss_sample_count, &sss_tex_profile);
if (!sss_profile) {
BLI_assert(0 && "SSS pass requested but no SSS data was found");
BLI_assert_msg(0, "SSS pass requested but no SSS data was found");
return;
}

View File

@ -2253,7 +2253,7 @@ static void draw_select_framebuffer_depth_only_setup(const int size[2])
/* Must run after all instance datas have been added. */
void DRW_render_instance_buffer_finish(void)
{
BLI_assert(!DST.buffer_finish_called && "DRW_render_instance_buffer_finish called twice!");
BLI_assert_msg(!DST.buffer_finish_called, "DRW_render_instance_buffer_finish called twice!");
DST.buffer_finish_called = true;
DRW_instance_buffer_finish(DST.idatalist);
drw_resource_buffer_finish(DST.vmempool);

View File

@ -453,7 +453,7 @@ void DRW_shgroup_vertex_buffer(DRWShadingGroup *shgroup,
{
int location = GPU_shader_get_ssbo(shgroup->shader, name);
if (location == -1) {
BLI_assert(false && "Unable to locate binding of shader storage buffer objects.");
BLI_assert_msg(0, "Unable to locate binding of shader storage buffer objects.");
return;
}
drw_shgroup_uniform_create_ex(

View File

@ -675,7 +675,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
PropertyRNA *src_prop;
RNA_id_pointer_create(id->override_library->reference, &id_refptr);
if (!RNA_path_resolve_property(&id_refptr, oprop->rna_path, &src, &src_prop)) {
BLI_assert(0 && "Failed to create matching source (linked data) RNA pointer");
BLI_assert_msg(0, "Failed to create matching source (linked data) RNA pointer");
}
}

View File

@ -359,7 +359,7 @@ static World *preview_get_world(Main *pr_main)
result = pr_main->worlds.first;
}
BLI_assert(result && "Preview file has no world.");
BLI_assert_msg(result, "Preview file has no world.");
return result;
}

View File

@ -184,7 +184,7 @@ int GPU_batch_instbuf_add_ex(GPUBatch *batch, GPUVertBuf *insts, bool own_vbo)
}
}
/* we only make it this far if there is no room for another GPUVertBuf */
BLI_assert(0 && "Not enough Instance VBO slot in batch");
BLI_assert_msg(0, "Not enough Instance VBO slot in batch");
return -1;
}
@ -207,7 +207,7 @@ int GPU_batch_vertbuf_add_ex(GPUBatch *batch, GPUVertBuf *verts, bool own_vbo)
}
}
/* we only make it this far if there is no room for another GPUVertBuf */
BLI_assert(0 && "Not enough VBO slot in batch");
BLI_assert_msg(0, "Not enough VBO slot in batch");
return -1;
}

View File

@ -657,7 +657,7 @@ static const char *attr_prefix_get(CustomDataType type)
case CD_AUTO_FROM_NAME:
return "a";
default:
BLI_assert(false && "GPUVertAttr Prefix type not found : This should not happen!");
BLI_assert_msg(0, "GPUVertAttr Prefix type not found : This should not happen!");
return "";
}
}

View File

@ -170,7 +170,7 @@ GLShaderInterface::GLShaderInterface(GLuint program)
program, GL_SHADER_STORAGE_BLOCK, GL_MAX_NAME_LENGTH, &max_ssbo_name_len);
}
BLI_assert(ubo_len <= 16 && "enabled_ubo_mask_ is uint16_t");
BLI_assert_msg(ubo_len <= 16, "enabled_ubo_mask_ is uint16_t");
/* Work around driver bug with Intel HD 4600 on Windows 7/8, where
* GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH does not work. */

View File

@ -170,7 +170,7 @@ static bool rna_Collection_objects_override_apply(Main *bmain,
Collection *coll_dst = (Collection *)ptr_dst->owner_id;
if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
// BLI_assert(0 && "invalid source or destination object.");
// BLI_assert_msg(0, "invalid source or destination object.");
return false;
}
@ -185,7 +185,7 @@ static bool rna_Collection_objects_override_apply(Main *bmain,
&coll_dst->gobject, ob_dst, offsetof(CollectionObject, ob));
if (cob_dst == NULL) {
BLI_assert(0 && "Could not find destination object in destination collection!");
BLI_assert_msg(0, "Could not find destination object in destination collection!");
return false;
}
@ -288,7 +288,7 @@ static bool rna_Collection_children_override_apply(Main *bmain,
&coll_dst->children, subcoll_dst, offsetof(CollectionChild, collection));
if (collchild_dst == NULL) {
BLI_assert(0 && "Could not find destination sub-collection in destination collection!");
BLI_assert_msg(0, "Could not find destination sub-collection in destination collection!");
return false;
}

View File

@ -2089,7 +2089,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
switch (RNA_property_type(prop_local)) {
case PROP_BOOLEAN:
/* TODO: support boolean ops? Really doubt this would ever be useful though. */
BLI_assert(0 && "Boolean properties support no override diff operation");
BLI_assert_msg(0, "Boolean properties support no override diff operation");
break;
case PROP_INT: {
int prop_min, prop_max;
@ -2143,7 +2143,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
break;
}
default:
BLI_assert(0 && "Unsupported RNA override diff operation on integer");
BLI_assert_msg(0, "Unsupported RNA override diff operation on integer");
break;
}
@ -2175,7 +2175,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
break;
}
default:
BLI_assert(0 && "Unsupported RNA override diff operation on integer");
BLI_assert_msg(0, "Unsupported RNA override diff operation on integer");
break;
}
}
@ -2256,7 +2256,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
break;
}
default:
BLI_assert(0 && "Unsupported RNA override diff operation on float");
BLI_assert_msg(0, "Unsupported RNA override diff operation on float");
break;
}
@ -2299,7 +2299,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
break;
}
default:
BLI_assert(0 && "Unsupported RNA override diff operation on float");
BLI_assert_msg(0, "Unsupported RNA override diff operation on float");
break;
}
}
@ -2307,17 +2307,17 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
}
case PROP_ENUM:
/* TODO: support add/sub, for bitflags? */
BLI_assert(0 && "Enum properties support no override diff operation");
BLI_assert_msg(0, "Enum properties support no override diff operation");
break;
case PROP_POINTER:
BLI_assert(0 && "Pointer properties support no override diff operation");
BLI_assert_msg(0, "Pointer properties support no override diff operation");
break;
case PROP_STRING:
BLI_assert(0 && "String properties support no override diff operation");
BLI_assert_msg(0, "String properties support no override diff operation");
break;
case PROP_COLLECTION:
/* XXX TODO: support this of course... */
BLI_assert(0 && "Collection properties support no override diff operation");
BLI_assert_msg(0, "Collection properties support no override diff operation");
break;
default:
break;
@ -2364,7 +2364,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
RNA_property_boolean_set_array(ptr_dst, prop_dst, array_a);
break;
default:
BLI_assert(0 && "Unsupported RNA override operation on boolean");
BLI_assert_msg(0, "Unsupported RNA override operation on boolean");
return false;
}
@ -2380,7 +2380,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
RNA_PROPERTY_SET_SINGLE(boolean, ptr_dst, prop_dst, index, value);
break;
default:
BLI_assert(0 && "Unsupported RNA override operation on boolean");
BLI_assert_msg(0, "Unsupported RNA override operation on boolean");
return false;
}
}
@ -2421,7 +2421,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
}
break;
default:
BLI_assert(0 && "Unsupported RNA override operation on integer");
BLI_assert_msg(0, "Unsupported RNA override operation on integer");
return false;
}
@ -2459,7 +2459,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
storage_value);
break;
default:
BLI_assert(0 && "Unsupported RNA override operation on integer");
BLI_assert_msg(0, "Unsupported RNA override operation on integer");
return false;
}
}
@ -2506,7 +2506,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
}
break;
default:
BLI_assert(0 && "Unsupported RNA override operation on float");
BLI_assert_msg(0, "Unsupported RNA override operation on float");
return false;
}
@ -2552,7 +2552,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
storage_value);
break;
default:
BLI_assert(0 && "Unsupported RNA override operation on float");
BLI_assert_msg(0, "Unsupported RNA override operation on float");
return false;
}
}
@ -2566,7 +2566,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
break;
/* TODO: support add/sub, for bitflags? */
default:
BLI_assert(0 && "Unsupported RNA override operation on enum");
BLI_assert_msg(0, "Unsupported RNA override operation on enum");
return false;
}
return true;
@ -2579,7 +2579,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
RNA_property_pointer_set(ptr_dst, prop_dst, value, NULL);
break;
default:
BLI_assert(0 && "Unsupported RNA override operation on pointer");
BLI_assert_msg(0, "Unsupported RNA override operation on pointer");
return false;
}
return true;
@ -2593,7 +2593,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
RNA_property_string_set(ptr_dst, prop_dst, value);
break;
default:
BLI_assert(0 && "Unsupported RNA override operation on string");
BLI_assert_msg(0, "Unsupported RNA override operation on string");
return false;
}
@ -2609,7 +2609,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
const bool is_dst_idprop = (prop_dst->magic != RNA_MAGIC) ||
(prop_dst->flag & PROP_IDPROPERTY) != 0;
if (!(is_src_idprop && is_dst_idprop)) {
BLI_assert(0 && "You need to define a specific override apply callback for collections");
BLI_assert_msg(0, "You need to define a specific override apply callback for collections");
return false;
}
@ -2668,7 +2668,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
return RNA_property_collection_move(ptr_dst, prop_dst, item_index_added, item_index_dst);
}
default:
BLI_assert(0 && "Unsupported RNA override operation on collection");
BLI_assert_msg(0, "Unsupported RNA override operation on collection");
return false;
}
}