Thanks, I installed the attached patches.

That thing with malloc goes too far. 'char *p = malloc (...);' is a good idiom in C, and it's silly and even counterproductive to require a cast. I worked around the glitch by not using malloc.
From 45b38c225bcdeef919723c27e81aa5ec97c9a89e Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Thu, 7 Aug 2025 13:27:29 -0700
Subject: [PATCH 1/2] Port _AC_C_C99_TEST_GLOBALS to -Wc++-compat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Vincent Lefevre in:
https://lists.gnu.org/r/autoconf-patches/2025-08/msg00004.html
* lib/autoconf/c.m4 (_AC_C_C99_TEST_GLOBALS): and → aND.
---
 lib/autoconf/c.m4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index da367790..a36f56c7 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1214,7 +1214,8 @@ extern void free (void *);
 
 // Check varargs macros.  These examples are taken from C99 6.10.3.5.
 // dprintf is used instead of fprintf to avoid needing to declare
-// FILE and stderr.
+// FILE and stderr, and "aND" is used instead of "and" to work around
+// GCC bug 40564 which is irrelevant here.
 #define debug(...) dprintf (2, __VA_ARGS__)
 #define showlist(...) puts (#__VA_ARGS__)
 #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
@@ -1225,7 +1226,7 @@ test_varargs_macros (void)
   int y = 5678;
   debug ("Flag");
   debug ("X = %d\n", x);
-  showlist (The first, second, and third items.);
+  showlist (The first, second, aND third items.);
   report (x>y, "x is %d but y is %d", x, y);
 }
 
-- 
2.48.1

From 69ebe8fe97b62b678391df02518d67f9a79c2a19 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Thu, 7 Aug 2025 13:50:53 -0700
Subject: [PATCH 2/2] Port _AC_C_C99_TEST_MAIN to -Wc++-compat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Vincent Lefevre in:
https://lists.gnu.org/r/autoconf-patches/2025-08/msg00004.html
* lib/autoconf/c.m4 (_AC_C_C99_TEST_MAIN):
Don’t use malloc.
---
 lib/autoconf/c.m4 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index a36f56c7..689e506d 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1324,8 +1324,8 @@ ac_c_conftest_c99_main='
   test_varargs_macros ();
 
   // Check flexible array members.
-  struct incomplete_array *ia =
-    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+  static struct incomplete_array *volatile incomplete_array_pointer;
+  struct incomplete_array *ia = incomplete_array_pointer;
   ia->datasize = 10;
   for (int i = 0; i < ia->datasize; ++i)
     ia->data[i] = i * 1.234;
-- 
2.48.1

Reply via email to