tests: Use integer widths rather than maximum values for strfuncs check

The maximum values can expand to something containing `__extension__` on
some platforms (like msys2-clang64), and the preprocessor can’t
understand that.

So, use the type widths rather than their maximum values instead. This
is equivalent, but definitely won’t expand to `__extension__`.

Should hopefully fix the following compiler error on msys2-clang64:
```
../glib/tests/strfuncs.c:667:5: error: function-like macro '__extension__' is not defined
  667 | #if G_MAXSIZE > G_MAXUINT
      |     ^
glib/glibconfig.h:89:19: note: expanded from macro 'G_MAXSIZE'
   89 | #define G_MAXSIZE       G_MAXUINT64
      |                         ^
../glib/gtypes.h:107:21: note: expanded from macro 'G_MAXUINT64'
  107 | #define G_MAXUINT64     G_GUINT64_CONSTANT(0xffffffffffffffff)
      |                         ^
glib/glibconfig.h:70:34: note: expanded from macro 'G_GUINT64_CONSTANT'
   70 | #define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
      |                                  ^
../glib/gmacros.h:62:26: note: expanded from macro 'G_GNUC_EXTENSION'
   62 | #define G_GNUC_EXTENSION __extension__
      |                          ^
1 error generated.
```

(as seen in https://gitlab.gnome.org/GNOME/glib/-/jobs/5608465)

Co-authored by: Luca Bacci <luca.bacci982@gmail.com>
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall
2025-09-30 16:08:04 +01:00
parent c9a0bc1b25
commit 648141d8ff

View File

@@ -664,7 +664,7 @@ test_strconcat (void)
static void
test_strjoinv_overflow (void)
{
#if G_MAXSIZE > G_MAXUINT
#if GLIB_SIZEOF_SIZE_T > (UINT_WIDTH / 8)
g_test_skip ("Overflow joining strings requires G_MAXSIZE <= G_MAXUINT.");
#else
if (!g_test_undefined ())