Compile with -Wfloat-conversion

This means we'll get warnings whenever a floating point value looses
precision, e.g. gets implicitly casted to an integer. It also warns when
implicitly casting double's to float's, which arguably is less of a
problem, but there are no warning for just float/double to int.

This would have caught
https://gitlab.gnome.org/GNOME/mutter/-/issues/3530.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3822>
This commit is contained in:
Jonas Ådahl
2024-06-18 10:23:00 +02:00
committed by Sebastian Wick
parent d5bc883712
commit 422ee4515d
157 changed files with 1313 additions and 1161 deletions

View File

@ -44,7 +44,7 @@ static const RefreshRateTestCase refresh_rate_test_cases[] = {
.vscan = 0,
.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
},
.expected_refresh_rate = 59.9375,
.expected_refresh_rate = 59.9375f,
},
/* "cvt 640 480" with htotal 0 */
@ -62,7 +62,7 @@ static const RefreshRateTestCase refresh_rate_test_cases[] = {
.vscan = 0,
.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
},
.expected_refresh_rate = 0.0,
.expected_refresh_rate = 0.0f,
},
/* "cvt 640 480" with vtotal 0 */
@ -80,7 +80,7 @@ static const RefreshRateTestCase refresh_rate_test_cases[] = {
.vscan = 0,
.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
},
.expected_refresh_rate = 0.0,
.expected_refresh_rate = 0.0f,
},
/* "cvt 320 240" with doubled clock and vscan 2 */
@ -98,7 +98,7 @@ static const RefreshRateTestCase refresh_rate_test_cases[] = {
.vscan = 2,
.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
},
.expected_refresh_rate = 59.8313,
.expected_refresh_rate = 59.8313f,
},
/* "cvt 15360 8640 180" */
@ -116,7 +116,7 @@ static const RefreshRateTestCase refresh_rate_test_cases[] = {
.vscan = 0,
.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
},
.expected_refresh_rate = 179.9939,
.expected_refresh_rate = 179.9939f,
},
};