Commit: cc5fefffe61c96646760af833d17bab580969d8e
Author: Campbell Barton
Date:   Mon Jan 16 14:05:49 2023 +1100
Branches: master
https://developer.blender.org/rBcc5fefffe61c96646760af833d17bab580969d8e

Cleanup: quiet array-bounds warning in GCC 12.2

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

M       source/blender/editors/armature/armature_edit.c

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

diff --git a/source/blender/editors/armature/armature_edit.c 
b/source/blender/editors/armature/armature_edit.c
index 3c0617a1dfc..2ec0ea57e71 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -388,18 +388,21 @@ static int armature_calc_roll_exec(bContext *C, 
wmOperator *op)
         ED_armature_ebone_to_mat3(ebone, mat);
         copy_v3_v3(vec, mat[2]);
       }
-      else { /* Axis */
-        BLI_assert(type <= 5);
+      else if (type < 6) { /* NOTE: always true, check to quiet GCC12.2 
`-Warray-bounds`. */
+        /* Axis */
         if (type < 3) {
           vec[type] = 1.0f;
         }
         else {
-          /* Use casting to quiet -Warray-bounds warning in gcc. */
-          vec[(int)type - 2] = -1.0f;
+          vec[type - 2] = -1.0f;
         }
         mul_m3_v3(imat, vec);
         normalize_v3(vec);
       }
+      else {
+        /* The previous block should handle all remaining cases. */
+        BLI_assert_unreachable();
+      }
 
       if (axis_flip) {
         negate_v3(vec);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to