changeset 13572:1835fbef9ef4

stdbool: avoid spurious failure with modern xlc * m4/stdbool.m4 (AC_HEADER_STDBOOL): Resync with autoconf.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 24 Aug 2010 14:36:27 -0700
parents 4a5fe69b5039
children e036e928c3d8
files ChangeLog m4/stdbool.m4
diffstat 2 files changed, 10 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+	stdbool: avoid spurious failure with modern xlc
+	* m4/stdbool.m4 (AC_HEADER_STDBOOL): Resync with autoconf.
+
 2010-08-24  Bruno Haible  <bruno@clisp.org>
 
 	getloadavg: simplify code
--- a/m4/stdbool.m4
+++ b/m4/stdbool.m4
@@ -35,7 +35,7 @@
 
 # This version of the macro is needed in autoconf <= 2.67.  Autoconf has
 # it built in since 2.60, but we want the tweaks from the 2.68 version
-# to avoid rejecting clang due to relying on extensions.
+# to avoid rejecting xlc and clang due to relying on extensions.
 
 AC_DEFUN([AC_HEADER_STDBOOL],
   [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
@@ -68,32 +68,17 @@
           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)];
           char i[sizeof s.t];
           enum { j = false, k = true, l = false * true, m = true * 256 };
+          /* The following fails for
+             HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
           _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];
-          #ifdef __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 run-time
-              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
-              our stdbool.h substitute should suffice.  We also test
-              in test-stdbool.c to ensure nothing else messes up.  */
-           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
@@ -102,6 +87,7 @@
           _Bool *pq = &q;
         ],
         [
+          bool e = &s;
           *pq |= q;
           *pq |= ! q;
           /* Refer to every declared value, to avoid compiler optimizations.  */