[PATCH] Backport g(s)size -> g(u)intptr atomics in builtin glib for gcc14 and clang15

Dan Fuhry dan at fuhry.com
Fri May 3 15:45:13 UTC 2024


Hello -
I've discovered that pkg-config 0.29.2 doesn't build on clang 15 and up and
gcc 14 and up, due to -Wint-conversion now defaulting to being an error in
both compilers. The old version of glib 2.36 bundled with pkg-config uses
gssize/gssize as the return type of the g_atomic_pointer_* functions, which
newer versions of gcc and clang complain (rightly) is not portable (as
these are aliased to long and ulong, respectively).

This was previously addressed in glib upstream commit c762d511 [1] by Alex
Richardson on Dec 14, 2022. The attached patch backports Alex's change to
glib 2.36 bundled with pkg-config, and also switches to the newer
__atomic_* intrinsics from commit 2eb37622 [2] (Philip Withnall).

This patch has been tested on clang 17 and only clang 17.

[1]
https://gitlab.gnome.org/GNOME/glib/-/commit/c762d511346d3cb84cea3557a246ccf8873b4a1c
[2]
https://gitlab.gnome.org/GNOME/glib/-/commit/2eb37622418a5c9f31a9d728a99bc621d3157ab0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pkg-config/attachments/20240503/7e621a18/attachment.htm>
-------------- next part --------------
-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEE9JEexHiYp1UO2nxv3NXE58C5SpkFAmY1BcQACgkQ3NXE58C5
SpnK+wf9FbjJw9E1isKvQHPU6DUhNS6E6VmbHoacYX+UnbXaCIbpDH/p4UbRT7rm
F3eJ2Biw8lu3/H9aHrNExhxlOEsQpk0eJIVInucMltzqJF64O/9sb9USF3jP+Io5
f680bV+YS3pNrZ7zN6mRJ10cJlga2s8/4fvZnApdu/d5Mw9t27ot0zPctkNzpTYZ
FeyrRzyucj5Q260sDM81lwjIhXwU4RXlFMGUCF9x4mU9r+i0DjNKd912nv7+45kz
8Qm+v3h+QDzzEff3elnr9UdV4DPfmF3f+vyrhiWrK4fa5ZC8MKjzLiExD2C7mprw
ALtAiIfQuhWqmpBsUr2ijxSmDaLQVA==
=YVeN
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pkg-config-builtin-glib-int-conversion.patch
Type: text/x-patch
Size: 5814 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/pkg-config/attachments/20240503/7e621a18/attachment.bin>


More information about the pkg-config mailing list