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

@ -36,7 +36,7 @@ meta_calculate_drm_mode_refresh_rate (const drmModeModeInfo *drm_mode)
if (drm_mode->vscan > 1)
denominator *= drm_mode->vscan;
return numerator / denominator;
return (float) (numerator / denominator);
}
int64_t