On 08/24/2010 01:25 PM, Ralf Wildenhues wrote: > the current git Autoconf AC_HEADER_STDBOOL test still provokes a > failure: > > configure:3108: checking for stdbool.h that conforms to C99 > configure:3193: cc -qlanglvl=extc89 -c -g conftest.c>&5 > "conftest.c", line 46.16: 1506-196 (W) Initialization between types "_Bool" > and "struct s*" is not allowed. > "conftest.c", line 74.23: 1506-221 (S) Initializer must be a valid constant > expression. > > with line 46 being > | bool e =&s; > > and line 74 being > | int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] ==&digs[4] ? 1 : 0);
The 2nd diagnostic is valid: xlc is clearly within its rights to reject that initializer. The first one is less clear: the C standard says that "&s" is a valid static initializer, but I suppose one could argue that there's an implicit conversion to bool that would clearly be invalid if one made it explicit and wrote "(bool) &s" there. I installed this: does it help? >From 592beca18058522a3cbedceff98633b306ca80c1 Mon Sep 17 00:00:00 2001 From: Paul Eggert <egg...@cs.ucla.edu> Date: Tue, 24 Aug 2010 14:03:32 -0700 Subject: [PATCH] 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 --- ChangeLog | 13 +++++++++++++ lib/autoconf/headers.m4 | 22 ++-------------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index e82f811..316b963 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-08-24 Paul Eggert <egg...@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 <ebl...@redhat.com> AC_FUNC_GETLOADAVG: don't define SVR4 on cygwin diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4 index b97e09a..1bc0feb 100644 --- a/lib/autoconf/headers.m4 +++ b/lib/autoconf/headers.m4 @@ -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. */ -- 1.7.2