From 78c1cd0fe4160d108faf6f8e6cc702cd9d322025 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 19 Dec 2010 15:27:30 +0100 Subject: [PATCH] stdbool: Relax test. * tests/test-stdbool.c (e): Don't require that casts from a variable's address to 'bool' work in static initializer, for compilers other than GCC. --- ChangeLog | 7 +++++++ tests/test-stdbool.c | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1bea88a523..204f98c494 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-12-19 Bruno Haible + + stdbool: Relax test. + * tests/test-stdbool.c (e): Don't require that casts from a variable's + address to 'bool' work in static initializer, for compilers other than + GCC. + 2010-12-19 Bruno Haible ftello: Add missing declaration on OSF/1 5.1. diff --git a/tests/test-stdbool.c b/tests/test-stdbool.c index 2103d8bab9..bb8d6f36f6 100644 --- a/tests/test-stdbool.c +++ b/tests/test-stdbool.c @@ -61,8 +61,13 @@ char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; #if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */ char d[(bool) 0.5 == true ? 1 : -1]; -# ifdef ADDRESS_CHECK_OKAY +# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ +/* C99 may plausibly be interpreted as not requiring support for a cast from + a variable's address to bool in a static initializer. So treat it like a + GCC extension. */ +# ifdef __GNUC__ bool e = &s; +# endif # endif char f[(_Bool) 0.0 == false ? 1 : -1]; #endif @@ -85,6 +90,13 @@ _Bool *pq = &q; int main () { +#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */ +# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ + /* A cast from a variable's address to bool is valid in expressions. */ + bool e1 = &s; +# endif +#endif + /* 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 -- 2.30.2