[Bf-blender-cvs] [3ca3098ed79] temp_bmesh_multires: DynTopo: Enable BLI_linklist_stack type checking for clang-cl and fix a few errors.
Joseph Eagar
noreply at git.blender.org
Mon May 24 20:40:50 CEST 2021
Commit: 3ca3098ed7941bc0c8a9c1bd0fc0ab2ba3ff3f4d
Author: Joseph Eagar
Date: Mon May 24 11:40:05 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB3ca3098ed7941bc0c8a9c1bd0fc0ab2ba3ff3f4d
DynTopo: Enable BLI_linklist_stack type checking for clang-cl
and fix a few errors.
===================================================================
M source/blender/blenlib/BLI_linklist_stack.h
M source/blender/blenlib/BLI_strict_flags.h
M source/blender/editors/sculpt_paint/sculpt_expand.c
M source/blender/editors/sculpt_paint/sculpt_geodesic.c
===================================================================
diff --git a/source/blender/blenlib/BLI_linklist_stack.h b/source/blender/blenlib/BLI_linklist_stack.h
index be98304e6b5..9af98172b78 100644
--- a/source/blender/blenlib/BLI_linklist_stack.h
+++ b/source/blender/blenlib/BLI_linklist_stack.h
@@ -52,7 +52,7 @@
#define BLI_LINKSTACK_SIZE(var) BLI_mempool_len(var##_pool_)
/* check for typeof() */
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
# define BLI_LINKSTACK_PUSH(var, ptr) \
(CHECK_TYPE_INLINE(ptr, typeof(var##_type_)), \
BLI_linklist_prepend_pool(&(var), ptr, var##_pool_))
diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h
index efe89dffa97..142782c6d86 100644
--- a/source/blender/blenlib/BLI_strict_flags.h
+++ b/source/blender/blenlib/BLI_strict_flags.h
@@ -45,6 +45,8 @@
#endif
#ifdef _MSC_VER
+/* While regular clang defines __GNUC__ and is handled by the code above, clang-cl does not and
+ * needs to be handled separately. */
# ifdef __clang__
# pragma clang diagnostic error "-Wsign-conversion"
# pragma clang diagnostic error "-Wsign-compare"
@@ -52,6 +54,7 @@
# pragma clang diagnostic error "-Wimplicit-int-conversion"
# pragma clang diagnostic error "-Wimplicit-int"
# pragma clang diagnostic error "-Wshadow"
+/* Normal MSVC */
# else
# pragma warning(error : 4018) /* signed/unsigned mismatch */
# pragma warning(error : 4244) /* conversion from 'type1' to 'type2', possible loss of data */
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 39d251ca44d..c7ad2bb20bd 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -2071,7 +2071,7 @@ static void sculpt_expand_delete_face_set_id_bmesh(int *r_face_sets,
SculptFaceRef fref = BKE_pbvh_table_index_to_face(ss->pbvh, i);
if (r_face_sets[i] == delete_id) {
- BLI_LINKSTACK_PUSH(queue, POINTER_FROM_INT(fref.i));
+ BLI_LINKSTACK_PUSH(queue, (BMFace *)(fref.i));
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_geodesic.c b/source/blender/editors/sculpt_paint/sculpt_geodesic.c
index 9f5a1435c96..f560f717d5e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_geodesic.c
+++ b/source/blender/editors/sculpt_paint/sculpt_geodesic.c
@@ -175,42 +175,42 @@ static float fast_geodesic_distance_propagate_across_triangle(
xintercept =
-(0.5 * (dist2 * dist2 - v2lensqr - (dist1 * dist1)) *
- fabsf((double)(((v2lensqr - (v2z * v2z)) * v0z - (2 * v0y * v2y * v2z)) * v0z +
- (v2lensqr - (v2y * v2y)) * (v0y * v0y) -
- ((2 * (v0y * v2y + v0z * v2z) * v2x -
- ((v2y * v2y + v2z * v2z) * v0x)) *
- v0x))) -
+ fabsf((float)(((v2lensqr - (v2z * v2z)) * v0z - (2 * v0y * v2y * v2z)) * v0z +
+ (v2lensqr - (v2y * v2y)) * (v0y * v0y) -
+ ((2 * (v0y * v2y + v0z * v2z) * v2x -
+ ((v2y * v2y + v2z * v2z) * v0x)) *
+ v0x))) -
((v0y * v2y + v0z * v2z + v0x * v2x) * the_hh_sqrt * v2len)) /
((fabsf(
- (double)(((v2lensqr - (v2z * v2z)) * v0z - (2 * v0y * v2y * v2z)) * v0z +
- (v2lensqr - (v2y * v2y)) * (v0y * v0y) -
- ((2 * (v0y * v2y + v0z * v2z) * v2x - ((v2y * v2y + v2z * v2z) * v0x)) *
- v0x))) +
+ (float)(((v2lensqr - (v2z * v2z)) * v0z - (2 * v0y * v2y * v2z)) * v0z +
+ (v2lensqr - (v2y * v2y)) * (v0y * v0y) -
+ ((2 * (v0y * v2y + v0z * v2z) * v2x - ((v2y * v2y + v2z * v2z) * v0x)) *
+ v0x))) +
the_hh_sqrt * v2len) *
v2len);
if (xintercept >= 0.0 && xintercept <= v2len) {
float result =
- (0.5 * sqrt((double)((2.0 * (v0y * v2y + v0z * v2z + v0x * v2x) - (dist1 * dist1) +
- (dist2 + v2len) * (dist2 - v2len)) *
- (2.0 * (v0y * v2y + v0z * v2z + v0x * v2x) -
- (dist1 * dist1) + (dist2 + v2len) * (dist2 - v2len)) +
- 4.0 * ((fabsf((double)(((v2lensqr - (v2z * v2z)) * v0z -
- (2 * v0y * v2y * v2z)) *
- v0z +
- (v2lensqr - (v2y * v2y)) * (v0y * v0y) -
- ((2 * (v0y * v2y + v0z * v2z) * v2x -
- ((v2y * v2y + v2z * v2z) * v0x)) *
- v0x))) +
- the_hh_sqrt * v2len) *
- (fabsf((double)(((v2lensqr - (v2z * v2z)) * v0z -
- (2 * v0y * v2y * v2z)) *
- v0z +
- (v2lensqr - (v2y * v2y)) * (v0y * v0y) -
- ((2 * (v0y * v2y + v0z * v2z) * v2x -
- ((v2y * v2y + v2z * v2z) * v0x)) *
- v0x))) +
- the_hh_sqrt * v2len))))) /
+ (0.5 * sqrt((float)((2.0 * (v0y * v2y + v0z * v2z + v0x * v2x) - (dist1 * dist1) +
+ (dist2 + v2len) * (dist2 - v2len)) *
+ (2.0 * (v0y * v2y + v0z * v2z + v0x * v2x) -
+ (dist1 * dist1) + (dist2 + v2len) * (dist2 - v2len)) +
+ 4.0 * ((fabsf((float)(((v2lensqr - (v2z * v2z)) * v0z -
+ (2 * v0y * v2y * v2z)) *
+ v0z +
+ (v2lensqr - (v2y * v2y)) * (v0y * v0y) -
+ ((2 * (v0y * v2y + v0z * v2z) * v2x -
+ ((v2y * v2y + v2z * v2z) * v0x)) *
+ v0x))) +
+ the_hh_sqrt * v2len) *
+ (fabsf((float)(((v2lensqr - (v2z * v2z)) * v0z -
+ (2 * v0y * v2y * v2z)) *
+ v0z +
+ (v2lensqr - (v2y * v2y)) * (v0y * v0y) -
+ ((2 * (v0y * v2y + v0z * v2z) * v2x -
+ ((v2y * v2y + v2z * v2z) * v0x)) *
+ v0x))) +
+ the_hh_sqrt * v2len))))) /
v2len;
/*
printf("%.7f : %.7f\n",
More information about the Bf-blender-cvs
mailing list