Fix testsuite for C23 `va_start` (#861)
authorJoseph Myers <jsm@polyomino.org.uk>
Thu, 24 Oct 2024 18:26:58 +0000 (18:26 +0000)
committerGitHub <noreply@github.com>
Thu, 24 Oct 2024 18:26:58 +0000 (14:26 -0400)
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`.

testsuite/libffi.call/va_struct2.c
testsuite/libffi.call/va_struct3.c

index a8daff3bf6084c025fc260514d25ac902d661206..a034087077516d32bc2625167f200f3ddc612f74 100644 (file)
@@ -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);
index d3bd280966a713a633be27cbffaa031b1ae07a36..5a52c9f23e268084a25cfc630c5b18a011a3d496 100644 (file)
@@ -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);