diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libffi/files/libffi-3.4.6-c23-tests.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libffi/files/libffi-3.4.6-c23-tests.patch new file mode 100644 index 0000000000..dc53b120cd --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/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 +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/sdk_container/src/third_party/portage-stable/dev-libs/libffi/libffi-3.4.6-r2.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/libffi/libffi-3.4.6-r2.ebuild index 2235dc0d70..61fa9d5ad8 100644 --- a/sdk_container/src/third_party/portage-stable/dev-libs/libffi/libffi-3.4.6-r2.ebuild +++ b/sdk_container/src/third_party/portage-stable/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() {