[Bf-blender-cvs] [9e9cd77] master: Compiler warning: double-promotion

Campbell Barton noreply at git.blender.org
Sat Jan 31 15:18:11 CET 2015


Commit: 9e9cd77b8de68015a98659671272cc9d78710e69
Author: Campbell Barton
Date:   Sat Jan 31 17:23:30 2015 +1100
Branches: master
https://developer.blender.org/rB9e9cd77b8de68015a98659671272cc9d78710e69

Compiler warning: double-promotion

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

M	source/blender/blenkernel/intern/armature.c
M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenkernel/intern/curve.c
M	source/blender/blenkernel/intern/particle.c
M	source/blender/blenkernel/intern/particle_child.c
M	source/blender/blenkernel/intern/texture.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/bmesh/operators/bmo_dissolve.c
M	source/blender/bmesh/operators/bmo_extrude.c
M	source/blender/bmesh/operators/bmo_removedoubles.c
M	source/blender/bmesh/operators/bmo_similar.c
M	source/blender/bmesh/tools/bmesh_intersect.c
M	source/blender/editors/include/BIF_gl.h
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/interface/interface_style.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/interface/view2d.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/sculpt_paint/paint_stroke.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_sequencer/sequencer_preview.c
M	source/blender/editors/space_view3d/drawarmature.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/editors/space_view3d/view3d_ops.c
M	source/blender/editors/transform/transform_constraints.c
M	source/blender/editors/transform/transform_manipulator.c
M	source/blender/editors/uvedit/uvedit_parametrizer.c
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/modifiers/intern/MOD_array.c
M	source/blender/modifiers/intern/MOD_laplaciansmooth.c
M	source/blender/nodes/shader/nodes/node_shader_gamma.c
M	source/blender/physics/intern/implicit_blender.c
M	source/blender/render/intern/source/initrender.c
M	source/blender/render/intern/source/pixelshading.c
M	source/blender/render/intern/source/rayshade.c
M	source/blender/render/intern/source/render_texture.c
M	source/blender/render/intern/source/sunsky.c
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 7d04ab7..31695b0 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -2206,7 +2206,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
 							
 							float range = bulge_max - 1.0f;
 							float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
-							float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (0.5f * M_PI);
+							float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (float)M_PI_2;
 							
 							bulge = interpf(soft, hard, ikData->bulge_smooth);
 						}
@@ -2218,7 +2218,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
 							
 							float range = 1.0f - bulge_min;
 							float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
-							float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (0.5f * M_PI);
+							float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (float)M_PI_2;
 							
 							bulge = interpf(soft, hard, ikData->bulge_smooth);
 						}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index f591fe8..668b78a 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -2715,7 +2715,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
 				
 				float range = bulge_max - 1.0f;
 				float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
-				float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (0.5f * M_PI);
+				float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (float)M_PI_2;
 				
 				bulge = interpf(soft, hard, data->bulge_smooth);
 			}
@@ -2727,7 +2727,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
 				
 				float range = 1.0f - bulge_min;
 				float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
-				float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (0.5f * M_PI);
+				float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (float)M_PI_2;
 				
 				bulge = interpf(soft, hard, data->bulge_smooth);
 			}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 51330f2..e88a8ec 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1742,7 +1742,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp,
 
 			/* half a circle */
 			fp = dl->verts;
-			dangle = (0.5 * M_PI / (dnr - 1));
+			dangle = ((float)M_PI_2 / (dnr - 1));
 			angle = -(nr - 1) * dangle;
 
 			for (a = 0; a < nr; a++) {
@@ -1801,7 +1801,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp,
 			/* half a circle */
 			fp = dl->verts;
 			angle = 0.0;
-			dangle = (0.5 * M_PI / (dnr - 1));
+			dangle = ((float)M_PI_2 / (dnr - 1));
 
 			for (a = 0; a < nr; a++) {
 				fp[0] = 0.0;
@@ -1943,7 +1943,7 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2,
 
 	t02 = x1 * x2 + y1 * y2;
 	if (fabsf(t02) >= 1.0f)
-		t02 = 0.5 * M_PI;
+		t02 = M_PI_2;
 	else
 		t02 = (saacos(t02)) / 2.0f;
 
@@ -2476,7 +2476,7 @@ static void make_bevel_list_2D(BevList *bl)
 
 		/* first */
 		bevp = bl->bevpoints;
-		angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)(M_PI / 2.0f);
+		angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)M_PI_2;
 		bevp->sina = sinf(angle);
 		bevp->cosa = cosf(angle);
 		vec_to_quat(bevp->quat, bevp->dir, 5, 1);
@@ -2484,7 +2484,7 @@ static void make_bevel_list_2D(BevList *bl)
 		/* last */
 		bevp = bl->bevpoints;
 		bevp += (bl->nr - 1);
-		angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)(M_PI / 2.0f);
+		angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)M_PI_2;
 		bevp->sina = sinf(angle);
 		bevp->cosa = cosf(angle);
 		vec_to_quat(bevp->quat, bevp->dir, 5, 1);
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index b5004b9..b817b72 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -4059,8 +4059,8 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
 		normalize_v3(nor);
 
 		/* make sure that we get a proper side vector */
-		if (fabsf(dot_v3v3(nor, vec)) > 0.999999) {
-			if (fabsf(dot_v3v3(nor, xvec)) > 0.999999) {
+		if (fabsf(dot_v3v3(nor, vec)) > 0.999999f) {
+			if (fabsf(dot_v3v3(nor, xvec)) > 0.999999f) {
 				nor[0] = 0.0f;
 				nor[1] = 1.0f;
 				nor[2] = 0.0f;
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c
index df03f39..24fba60 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -138,14 +138,15 @@ static void do_kink_spiral_deform(ParticleKey *state, const float dir[3], const
 		 * and goes up to the Golden Spiral for 1.0
 		 * http://en.wikipedia.org/wiki/Golden_spiral
 		 */
-		const float b = shape * (1.0f + sqrtf(5.0f)) / M_PI * 0.25f;
+		const float b = shape * (1.0f + sqrtf(5.0f)) / (float)M_PI * 0.25f;
 		/* angle of the spiral against the curve (rotated opposite to make a smooth transition) */
-		const float start_angle = (b != 0.0f ? atanf(1.0f / b) : -M_PI*0.5f) + (b > 0.0f ? -M_PI*0.5f : M_PI*0.5f);
+		const float start_angle = ((b != 0.0f) ? atanf(1.0f / b) :
+		                           (float)-M_PI_2) + (b > 0.0f ? -(float)M_PI_2 : (float)M_PI_2);
 		
 		float spiral_axis[3], rot[3][3];
 		float vec[3];
 		
-		float theta = freq * time * 2.0f*M_PI;
+		float theta = freq * time * 2.0f * (float)M_PI;
 		float radius = amplitude * expf(b * theta);
 		
 		/* a bit more intuitive than using negative frequency for this */
@@ -269,7 +270,7 @@ static void do_kink_spiral(ParticleThreadContext *ctx, ParticleTexture *ptex, co
 			normalize_v3(kink);
 			
 			if (kink_axis_random > 0.0f) {
-				float a = kink_axis_random * (psys_frand(ctx->sim.psys, 7112 + seed) * 2.0f - 1.0f) * M_PI;
+				float a = kink_axis_random * (psys_frand(ctx->sim.psys, 7112 + seed) * 2.0f - 1.0f) * (float)M_PI;
 				float rot[3][3];
 				
 				axis_angle_normalized_to_mat3(rot, dir, a);
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index c7d7ae1..6c4cbcf 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -760,7 +760,7 @@ void default_mtex(MTex *mtex)
 	mtex->fieldfac = 1.0f;
 	mtex->normapspace = MTEX_NSPACE_TANGENT;
 	mtex->brush_map_mode = MTEX_MAP_MODE_TILED;
-	mtex->random_angle = 2.0f * M_PI;
+	mtex->random_angle = 2.0f * (float)M_PI;
 	mtex->brush_angle_mode = 0;
 }
 
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 652a452..6f33cab 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -451,8 +451,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 				br->mtex.brush_angle_mode |= MTEX_ANGLE_RANDOM;
 				br->mask_mtex.brush_angle_mode |= MTEX_ANGLE_RANDOM;
 			}
-			br->mtex.random_angle = 2.0f * M_PI;
-			br->mask_mtex.random_angle = 2.0f * M_PI;
+			br->mtex.random_angle = 2.0 * M_PI;
+			br->mask_mtex.random_angle = 2.0 * M_PI;
 		}
 
 #undef BRUSH_RAKE
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 8cd9ee1..ecb4136 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -475,7 +475,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
 {
 	BMOpSlot *einput = BMO_slot_get(op->slots_in, "edges");
 	BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
-	const float angle_max = (float)M_PI / 2.0f;
+	const float angle_max = M_PI_2;
 	const float angle_limit = min_ff(angle_max, BMO_slot_float_get(op->slots_in, "angle_limit"));
 	const bool do_dissolve_boundaries = BMO_slot_bool_get(op->slots_in, "use_dissolve_boundaries");
 	const BMO_Delimit delimit = BMO_slot_int_get(op->slots_in, "delimit");
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 88b53b6..aa92c30 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -608,10 +608,10 @@ static void calc_solidify_normals(BMesh *bm)
 		}
 		else {
 			/* only one face attached to that edge */
-			/* an edge without another attached- the weight on this is
-			 * undefined, M_PI / 2 is 90d in radians and that seems good enough */
+			/* an edge without another attached- the weight on this is undefined,
+			 * M_PI_2 is 90d in radians and that seems good enough */
 			copy_v3_v3(edge_normal, f1->no);
-			mul_v3_fl(edge_normal, M_PI / 2);
+			mul_v3_fl(edge_normal, M_PI_2);
 		}
 
 		add_v3_v3(e->v1->no, edge_normal);
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index 9c8b9ca..871bee6 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -529,7 +529,7 @@ static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op,
 
 	const float dist  = BMO_slot_float_get(op->slots_in, "dist");
 	const float dist_sq = dist * dist;
-	const float dist3 = (M_SQRT3 + 0.00005f) * dist;   /* Just above sqrt(3) */
+	const float dist3 = ((float)M_SQRT3 + 0.00005f) * dist;   /* Just above sqrt(3) */
 
 	/* Test whether keep_verts arg exists and is non-empty */
 	if (BMO_slot_exists(op->slots_in, "keep_verts")) {
diff --git a/source/blender/bmesh/operators/bmo_similar.c b/source/blender/bmesh/operators/bmo_similar.c
index 02462e3..5f84389 100644
--- a/source/blender/bmesh/operators/bmo_similar.c
+++ b/source/blender/bmesh/operators/bmo_similar.c
@@ -412,10 +412,10 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
 						/* compute the angle between the two edges */
 						angle = angle_normalized_v3v3(e_ext[i].dir, e_ext[indices[idx]].dir);
 
-						if (an

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list