DynTopo: Enable BLI_linklist_stack type checking for clang-cl

and fix a few errors.
This commit is contained in:
Joseph Eagar 2021-05-24 11:40:05 -07:00
parent 995702da48
commit 3ca3098ed7
4 changed files with 34 additions and 31 deletions

View File

@ -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_))

View File

@ -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 */

View File

@ -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));
}
}

View File

@ -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",