From cce6ca8c883eda572c60e2bdabf6155e0583f08b Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 18 Jun 2024 12:58:51 +0100 Subject: [PATCH] tests: Improve 4GB file loading test to work on i386 This should test the limits of loading 4GB files on i386 platforms, such as the Hurd CI runner. On such platforms, `sizeof(size_t) == 4`. This should fix the compiler warning from https://gitlab.gnome.org/GNOME/glib/-/jobs/3989442: ``` ../gio/tests/file.c:2931:51: error: left shift count >= width of type [-Werror=shift-count-overflow] 2931 | static const gsize testfile_4gb_size = ((gsize) 1 << 32) + (1 << 16); /* 4GB + a bit */ | ^~ cc1: all warnings being treated as errors ``` Signed-off-by: Philip Withnall --- gio/tests/file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gio/tests/file.c b/gio/tests/file.c index 405d295f9..2967406fb 100644 --- a/gio/tests/file.c +++ b/gio/tests/file.c @@ -2928,7 +2928,12 @@ test_load_bytes_async (void) g_main_loop_unref (data.main_loop); } +#if GLIB_SIZEOF_SIZE_T > 4 static const gsize testfile_4gb_size = ((gsize) 1 << 32) + (1 << 16); /* 4GB + a bit */ +#else +/* Have to make do with something smaller on 32-bit platforms */ +static const gsize testfile_4gb_size = G_MAXSIZE; +#endif /* @filename will be modified as per g_mkstemp() */ static gboolean