[Bf-blender-cvs] [e7082fbdb0e] master: Cleanup: replace BLI_assert(0 && "text") with BLI_assert_msg

Campbell Barton noreply at git.blender.org
Wed Jul 21 12:44:50 CEST 2021


Commit: e7082fbdb0eab8f8ba435ee6f3c065f0f57966b3
Author: Campbell Barton
Date:   Wed Jul 21 20:39:51 2021 +1000
Branches: master
https://developer.blender.org/rBe7082fbdb0eab8f8ba435ee6f3c065f0f57966b3

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

===================================================================

M	source/blender/blenkernel/intern/unit.c
M	source/blender/depsgraph/intern/eval/deg_eval.cc
M	source/blender/draw/engines/eevee/eevee_subsurface.c
M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/intern/draw_manager_data.c
M	source/blender/editors/interface/interface_ops.c
M	source/blender/editors/render/render_preview.c
M	source/blender/gpu/intern/gpu_batch.cc
M	source/blender/gpu/intern/gpu_codegen.c
M	source/blender/gpu/opengl/gl_shader_interface.cc
M	source/blender/makesrna/intern/rna_collection.c
M	source/blender/makesrna/intern/rna_rna.c

===================================================================

diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index d9f02ce4c75..4581d410444 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -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;
 }
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 915b9fedcec..ad88cf656ad 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -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();
diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c
index b7bcd127859..48c24d138e6 100644
--- a/source/blender/draw/engines/eevee/eevee_subsurface.c
+++ b/source/blender/draw/engines/eevee/eevee_subsurface.c
@@ -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;
   }
 
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 6f5e041fa79..28af1fbf79a 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -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);
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index 0a0e1ba9ac3..16a58f9fba2 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -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(
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 376a41ff9bb..3ab49b8773b 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -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");
     }
   }
 
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 29fcd516001..d64cb9beb24 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -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;
 }
 
diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc
index 9dc24c59e22..677777132e6 100644
--- a/source/blender/gpu/intern/gpu_batch.cc
+++ b/source/blender/gpu/intern/gpu_batch.cc
@@ -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;
 }
 
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index d12cecd129e..bb1ebc0e85d 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -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 "";
   }
 }
diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc
index 9cf072b2e8a..9900a4e0766 100644
--- a/source/blender/gpu/opengl/gl_shader_interface.cc
+++ b/source/blender/gpu/opengl/gl_shader_interface.cc
@@ -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. */
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c
index 752c9495e50..608a8e51b09 100644
--- a/source/blender/makesrna/intern/rna_collection.c
+++ b/source/blender/makesrna/intern/rna_collection.c
@@ -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;
   }
 
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 6008ef40b60..42bdc7442f4 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -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

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list