commit:     338780980540b326ee810f1a03e85b9ea446e17e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 05:27:59 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 05:28:12 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=33878098

dev-libs/libffi: fix tests w/ C23

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/libffi/files/libffi-3.4.6-c23-tests.patch | 38 ++++++++++++++++++++++
 dev-libs/libffi/libffi-3.4.6-r2.ebuild             |  1 +
 2 files changed, 39 insertions(+)

diff --git a/dev-libs/libffi/files/libffi-3.4.6-c23-tests.patch 
b/dev-libs/libffi/files/libffi-3.4.6-c23-tests.patch
new file mode 100644
index 000000000000..dc53b120cd90
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.6-c23-tests.patch
@@ -0,0 +1,38 @@
+https://github.com/libffi/libffi/commit/0859f8431242d5adff21420b9cab538d2af527b5
+
+From 0859f8431242d5adff21420b9cab538d2af527b5 Mon Sep 17 00:00:00 2001
+From: Joseph Myers <[email protected]>
+Date: Thu, 24 Oct 2024 18:26:58 +0000
+Subject: [PATCH] Fix testsuite for C23 `va_start` (#861)
+
+In the C23 revision of the C standard, `va_start` ignores its second
+argument, which is no longer required (previously the last named
+function parameter - which the compiler knows anyway, so it's
+redundant information).
+
+This has the consequence for the libffi testsuite, when making GCC
+default to `-std=gnu23`, of making two tests fail with warnings about
+an unused function argument (only passed to `va_start` and not
+otherwise used).  Fix those test failures by explicitly casting the
+argument to `void`.
+--- a/testsuite/libffi.call/va_struct2.c
++++ b/testsuite/libffi.call/va_struct2.c
+@@ -33,6 +33,7 @@ test_fn (int n, ...)
+   struct small_tag s2;
+   struct large_tag l;
+ 
++  (void) n;
+   va_start (ap, n);
+   s1 = va_arg (ap, struct small_tag);
+   l = va_arg (ap, struct large_tag);
+--- a/testsuite/libffi.call/va_struct3.c
++++ b/testsuite/libffi.call/va_struct3.c
+@@ -33,6 +33,7 @@ test_fn (int n, ...)
+   struct small_tag s2;
+   struct large_tag l;
+ 
++  (void) n;
+   va_start (ap, n);
+   s1 = va_arg (ap, struct small_tag);
+   l = va_arg (ap, struct large_tag);
+

diff --git a/dev-libs/libffi/libffi-3.4.6-r2.ebuild 
b/dev-libs/libffi/libffi-3.4.6-r2.ebuild
index 2235dc0d702f..61fa9d5ad843 100644
--- a/dev-libs/libffi/libffi-3.4.6-r2.ebuild
+++ b/dev-libs/libffi/libffi-3.4.6-r2.ebuild
@@ -44,6 +44,7 @@ PATCHES=(
        "${FILESDIR}"/${P}-asan.patch
        "${FILESDIR}"/${P}-tests.patch
        "${FILESDIR}"/${P}-regenerate-autotools.patch
+       "${FILESDIR}"/${P}-c23-tests.patch
 )
 
 src_prepare() {

Reply via email to