[Bf-blender-cvs] [fb2ae6b8c5b] master: Cleanup: Use `switch` and `BLI_assert_unreachable()` more.

Bastien Montagne noreply at git.blender.org
Tue May 17 16:07:01 CEST 2022


Commit: fb2ae6b8c5bcab778f8b07c9d527abf5c3c36e0d
Author: Bastien Montagne
Date:   Tue May 17 15:12:12 2022 +0200
Branches: master
https://developer.blender.org/rBfb2ae6b8c5bcab778f8b07c9d527abf5c3c36e0d

Cleanup: Use `switch` and `BLI_assert_unreachable()` more.

Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.

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

M	source/blender/modifiers/intern/MOD_solidify.c
M	source/blender/modifiers/intern/MOD_weighted_normal.c
M	source/blender/modifiers/intern/MOD_weightvg_util.c

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

diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 48154a3670d..1f0aee7d689 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -75,7 +75,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
     case MOD_SOLIDIFY_MODE_NONMANIFOLD:
       return MOD_solidify_nonmanifold_modifyMesh(md, ctx, mesh);
     default:
-      BLI_assert(0);
+      BLI_assert_unreachable();
   }
   return mesh;
 }
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c
index 4c06a77e719..d436acb8ad5 100644
--- a/source/blender/modifiers/intern/MOD_weighted_normal.c
+++ b/source/blender/modifiers/intern/MOD_weighted_normal.c
@@ -326,7 +326,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
       }
       break;
     default:
-      BLI_assert(0);
+      BLI_assert_unreachable();
   }
 
   /* Validate computed weighted normals. */
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index acff66e74e4..65393370268 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -96,7 +96,7 @@ void weightvg_do_map(
         BLI_assert(do_invert);
         break;
       default:
-        BLI_assert(0);
+        BLI_assert_unreachable();
     }
 
     new_w[i] = do_invert ? 1.0f - fac : fac;



More information about the Bf-blender-cvs mailing list