From beecf70924105f744adce1f4bed1cf9f6b54228f Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 8 Jan 2024 13:33:26 +0100 Subject: [PATCH] Fix C compatibility issue in Meson probe Related to: --- mesa-meson-c99.patch | 42 ++++++++++++++++++++++++++++++++++++++++++ mesa.spec | 1 + 2 files changed, 43 insertions(+) create mode 100644 mesa-meson-c99.patch diff --git a/mesa-meson-c99.patch b/mesa-meson-c99.patch new file mode 100644 index 0000000..6cbb053 --- /dev/null +++ b/mesa-meson-c99.patch @@ -0,0 +1,42 @@ +meson: C type error in strtod_l/strtof_l probe + +Future compilers will fail compilation due to the C type error: + +…/testfile.c: In function 'main': +…/testfile.c:12:30: error: passing argument 2 of 'strtod_l' from incompatible pointer type + 12 | double d = strtod_l(s, end, loc); + | ^~~ + | | + | char * +/usr/include/stdlib.h:416:43: note: expected 'char ** restrict' but argument is of type 'char *' + 416 | char **__restrict __endptr, locale_t __loc) + | ~~~~~~~~~~~~~~~~~~^~~~~~~~ +…/testfile.c:13:29: error: passing argument 2 of 'strtof_l' from incompatible pointer type + 13 | float f = strtof_l(s, end, loc); + | ^~~ + | | + | char * +/usr/include/stdlib.h:420:42: note: expected 'char ** restrict' but argument is of type 'char *' + 420 | char **__restrict __endptr, locale_t __loc) + | ~~~~~~~~~~~~~~~~~~^~~~~~~~ + +This means that the probe no longer tests is objective and always +fails. + +Submitted upstream: + +diff --git a/meson.build b/meson.build +index 35cc5f1cd5fd9079..1a5d2ba492be0b31 100644 +--- a/meson.build ++++ b/meson.build +@@ -1425,8 +1425,8 @@ if cc.links(''' + locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL); + const char *s = "1.0"; + char *end; +- double d = strtod_l(s, end, loc); +- float f = strtof_l(s, end, loc); ++ double d = strtod_l(s, &end, loc); ++ float f = strtof_l(s, &end, loc); + freelocale(loc); + return 0; + }''', diff --git a/mesa.spec b/mesa.spec index 3cedbdc..ff4f7a9 100644 --- a/mesa.spec +++ b/mesa.spec @@ -77,6 +77,7 @@ Patch10: gnome-shell-glthread-disable.patch Patch11: 0001-intel-compiler-reemit-boolean-resolve-for-inverted-i.patch Patch12: 0001-intel-compiler-fix-release-build-unused-variable.patch Patch13: disable-zink-egl-fallback.patch +Patch14: mesa-meson-c99.patch BuildRequires: meson >= 1.2.0 BuildRequires: gcc