]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Make _AC_C_C99_TEST_MAIN more robust with -Werror
authorVincent Lefevre <vincent@vinc17.net>
Thu, 7 Aug 2025 15:22:25 +0000 (17:22 +0200)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 7 Aug 2025 16:10:03 +0000 (09:10 -0700)
The current code fails with gcc r16-2729-g0d276cd378e and
  -Werror=discarded-qualifiers -Werror=write-strings
(the -Werror=write-strings is useful to check compatibility of
user code with C++, and the -Werror=discarded-qualifiers is an
upgrade of a default warning to an error). Since this is a test
for C99, we may assume that const is supported by the compiler,
and adding const makes the code more robust in this context.

Copyright-paperwork-exempt: yes

lib/autoconf/c.m4

index 12c9a5c51bd41054c4f4dbea71588fdb2b662dea..da367790394fe5a78b67a4d786f2e1da9c510c1a 100644 (file)
@@ -1316,7 +1316,7 @@ ac_c_conftest_c99_main='
   // Check restrict.
   if (test_restrict ("String literal") == 0)
     success = true;
-  char *restrict newvar = "Another string";
+  const char *restrict newvar = "Another string";
 
   // Check varargs.
   success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234);