Mercurial > hg > octave-lyh > gnulib-hg
changeset 13944:b0e21b9566f9
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 19 Dec 2010 15:27:30 +0100 |
parents | 190accfb0919 |
children | 5690eb725721 |
files | ChangeLog tests/test-stdbool.c |
diffstat | 2 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-12-19 Bruno Haible <bruno@clisp.org> + + 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 <bruno@clisp.org> ftello: Add missing declaration on OSF/1 5.1.
--- a/tests/test-stdbool.c +++ b/tests/test-stdbool.c @@ -61,8 +61,13 @@ 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 @@ 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