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

@ -17,9 +17,12 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
/* Till https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3915 is fixed */
#pragma GCC diagnostic push
/* Till https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3915 is fixed */
#pragma GCC diagnostic ignored "-Wshadow"
/* Till https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4065 is fixed */
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#include "config.h"
@ -394,8 +397,8 @@ meta_screen_cast_stream_src_draw_cursor_into (MetaScreenCastStreamSrc *src,
texture_width = cogl_texture_get_width (cursor_texture);
texture_height = cogl_texture_get_height (cursor_texture);
width = texture_width * scale;
height = texture_height * scale;
width = (int) ceilf (texture_width * scale);
height = (int) ceilf (texture_height * scale);
if (texture_width == width &&
texture_height == height &&
@ -512,8 +515,8 @@ meta_screen_cast_stream_src_set_cursor_sprite_metadata (MetaScreenCastStreamSrc
texture_width = cogl_texture_get_width (cursor_texture);
texture_height = cogl_texture_get_height (cursor_texture);
bitmap_width = ceilf (texture_width * scale);
bitmap_height = ceilf (texture_height * scale);
bitmap_width = (int) ceilf (texture_width * scale);
bitmap_height = (int) ceilf (texture_height * scale);
spa_meta_bitmap->size.width = bitmap_width;
spa_meta_bitmap->size.height = bitmap_height;