Skip to content

[glib] Backport g(s)size -> g(u)intptr atomics

gcc 14 and clang 15 disallow implicit integer-to-pointer conversion by default. This was done for safety reasons with archs that use 128bit pointers. Versions of glib prior to 2.80 used gsize/gssize as the return type of g_atomic_pointer_*, which would not be large enough to hold a pointer on 128bit archs as gsize/gssize are generally aliased to ulong/long.

This commit backports Alex Richardson's commit 1 which updates the return types, and additionally integrates Philip Withnall's commit 2 that migrates from __sync_fetch_* to __atomic_* intrinsics.

This patch allows pkg-config to be compiled using default CFLAGS on gcc 14 and later, and clang 15 and later.

Of course, this is all a bit silly, as pkg-config doesn't even use these features, and they could just be removed, but that might be more effort than backporting the patch. 😆

  1. https://gitlab.gnome.org/GNOME/glib/-/commit/c762d511346d3cb84cea3557a246ccf8873b4a1c

  2. https://gitlab.gnome.org/GNOME/glib/-/commit/2eb37622418a5c9f31a9d728a99bc621d3157ab0

Edited by Dan Fuhry

Merge request reports

Loading