Reviving
https://lists.gnu.org/archive/html/bug-autoconf/2008-11/msg00007.html
https://lists.gnu.org/archive/html/bug-autoconf/2008-11/msg00008.html

There is an argument for fixing AC_C_CONST: the way it breaks
caused strange errors building one package because its config.h
defined const to /**/.   Users shouldn't have to go digging around
to figure stuff like that out.  (Well, ok, any user who does
./configure CFLAGS="-Werror -Wall" is asking for it, and shouldn't
mind digging around, but still.)

Here's a patch that seems to do the trick, only very lightly tested.
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index e4b807b..0c01197 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1664,7 +1664,7 @@ AC_DEFUN([AC_C_CONST],
 #ifndef __cplusplus
   /* Ultrix mips cc rejects this.  */
   typedef int charset[2];
-  const charset cs;
+  static const charset cs;
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -1682,7 +1682,7 @@ AC_DEFUN([AC_C_CONST],
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
   { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+    char *t = 0;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -1701,7 +1701,7 @@ AC_DEFUN([AC_C_CONST],
   { /* AIX XL C 1.02.0.0 rejects this saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
     struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s *b=0; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;

Reply via email to