]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AC_HEADER_STDBOOL: avoid spurious failure with modern xlc
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 24 Aug 2010 21:03:32 +0000 (14:03 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 24 Aug 2010 21:04:16 +0000 (14:04 -0700)
* lib/autoconf/headers.m4 (AC_HEADER_STDBOOL): Move the "bool e =
&s;" test into the main program, as C99 might plausibly be
interpreted as not requiring support for this construction in
static initializers.  Remove the "#if defined __xlc__" stuff, as
the bug is not present in recent xlc implementations, and they
reject the test for other (valid) reasons.  People using ancient
xlc versions, if any, are suggested to update to fixed versions.
Reported by Ralf Wildenhues in the thread starting at:
http://lists.gnu.org/archive/html/bug-autoconf/2010-08/msg00103.html

ChangeLog
lib/autoconf/headers.m4

index e82f811bb5cb6871455be4539ed75ea5892eafb8..316b96352ac3e34661b2b9b87caae3247fd2766e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-08-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       AC_HEADER_STDBOOL: avoid spurious failure with modern xlc
+       * lib/autoconf/headers.m4 (AC_HEADER_STDBOOL): Move the "bool e =
+       &s;" test into the main program, as C99 might plausibly be
+       interpreted as not requiring support for this construction in
+       static initializers.  Remove the "#if defined __xlc__" stuff, as
+       the bug is not present in recent xlc implementations, and they
+       reject the test for other (valid) reasons.  People using ancient
+       xlc versions, if any, are suggested to update to fixed versions.
+       Reported by Ralf Wildenhues in the thread starting at:
+       http://lists.gnu.org/archive/html/bug-autoconf/2010-08/msg00103.html
+
 2010-08-24  Eric Blake  <eblake@redhat.com>
 
        AC_FUNC_GETLOADAVG: don't define SVR4 on cygwin
index b97e09a90a70e196ea6ff60d9f07dcc0754b1a2a..1bc0febca73afcfce5c0375156c735b4ead46e59 100644 (file)
@@ -628,7 +628,7 @@ AC_DEFUN([AC_HEADER_STDBOOL],
        char b[false == 0 ? 1 : -1];
        char c[__bool_true_false_are_defined == 1 ? 1 : -1];
        char d[(bool) 0.5 == true ? 1 : -1];
-       bool e = &s;
+       /* See body of main program for 'e'.  */
        char f[(_Bool) 0.0 == false ? 1 : -1];
        char g[true];
        char h[sizeof (_Bool)];
@@ -639,25 +639,6 @@ AC_DEFUN([AC_HEADER_STDBOOL],
        _Bool n[m];
        char o[sizeof n == m * sizeof n[0] ? 1 : -1];
        char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-#      if defined __xlc__
-        /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
-           reported by James Lemley on 2005-10-05; see
-           http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-           This test is not quite right, since xlc is allowed to
-           reject this program, as the initializer for xlcbug is
-           not one of the forms that C requires support for.
-           However, doing the test right would require a runtime
-           test, and that would make cross-compilation harder.
-           Let us hope that IBM fixes the xlc bug, and also adds
-           support for this kind of constant expression.  In the
-           meantime, this test will reject xlc, which is OK, since
-           the gnulib stdbool.h substitute should suffice.  Gnulib
-           also tests this case in test-stdbool.c, to detect more
-           quickly whether someone messes up the test in the
-           future.  */
-        char digs[] = "0123456789";
-        int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : 0);
-#      endif
        /* Catch a bug in an HP-UX C compiler.  See
           http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
           http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
@@ -666,6 +647,7 @@ AC_DEFUN([AC_HEADER_STDBOOL],
        _Bool *pq = &q;
       ]],
       [[
+       bool e = &s;
        *pq |= q;
        *pq |= ! q;
        /* Refer to every declared value, to avoid compiler optimizations.  */