]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AC_C_CONST: don't reject gcc -Werror -Wall
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Sep 2011 06:16:06 +0000 (23:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Sep 2011 06:16:41 +0000 (23:16 -0700)
* lib/autoconf/c.m4 (AC_C_CONST): Don't reject gcc when it is used
with -Werror -Wall during configuring.  It's unwise to use GCC
that way, but apparently enough people do it nowadays that it's an
issue.  These days nobody uses the old compilers that the old
tests reject, so we can't test this fix against them, but it's
more important to work with modern GCC (even when misused) than to
work with no-longer-used compilers.  Problem reported by Shevek in
<http://lists.gnu.org/archive/html/bug-autoconf/2008-11/msg00007.html>
and raised again by Dan Kegel in
<http://lists.gnu.org/archive/html/bug-autoconf/2011-08/msg00020.html>.

ChangeLog
lib/autoconf/c.m4

index 6e36455c1008e0feac1eefc2ce3bcfd06a944447..1e17e609000b597383c228c593d19da4e04bf62c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-08-31  Paul Eggert  <eggert@cs.ucla.edu>
+
+       AC_C_CONST: don't reject gcc -Werror -Wall
+       * lib/autoconf/c.m4 (AC_C_CONST): Don't reject gcc when it is used
+       with -Werror -Wall during configuring.  It's unwise to use GCC
+       that way, but apparently enough people do it nowadays that it's an
+       issue.  These days nobody uses the old compilers that the old
+       tests reject, so we can't test this fix against them, but it's
+       more important to work with modern GCC (even when misused) than to
+       work with no-longer-used compilers.  Problem reported by Shevek in
+       <http://lists.gnu.org/archive/html/bug-autoconf/2008-11/msg00007.html>
+       and raised again by Dan Kegel in
+       <http://lists.gnu.org/archive/html/bug-autoconf/2011-08/msg00020.html>.
+
 2011-08-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        docs: other issues with parallel BSD make
index e4b807b6647a56833694d9fda32fa97ca6d17d81..88785d1e51c728235b470452ee6016a08a1da0af 100644 (file)
@@ -1660,11 +1660,11 @@ esac
 AC_DEFUN([AC_C_CONST],
 [AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
-[[/* FIXME: Include the comments suggested by Paul. */
+[[
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -1681,8 +1681,9 @@ AC_DEFUN([AC_C_CONST],
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -1698,10 +1699,10 @@ AC_DEFUN([AC_C_CONST],
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, 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 { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;