From: Paul Eggert Date: Tue, 24 Aug 2010 21:03:32 +0000 (-0700) Subject: AC_HEADER_STDBOOL: avoid spurious failure with modern xlc X-Git-Tag: v2.68~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9847652188d94dd8205725400f43dbe0153b0b5;p=thirdparty%2Fautoconf.git 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 --- diff --git a/ChangeLog b/ChangeLog index e82f811b..316b9635 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-08-24 Paul Eggert + + 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 AC_FUNC_GETLOADAVG: don't define SVR4 on cygwin diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4 index b97e09a9..1bc0febc 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. */