This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA] Move cpplib to the toplevel
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: Roman Zippel <zippel at linux-m68k dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Zack Weinberg <zack at codesourcery dot com>
- Date: Sat, 29 May 2004 08:37:03 +0200
- Subject: Re: [RFA] Move cpplib to the toplevel
- References: <40ACA8D2.8010502@gnu.org> <40B7C665.7090102@linux-m68k.org>
The ACX_HEADER_STDBOOL macro is wrong and broke the m68k-linux
bootstrap. This test doesn't check the size of bool and this results in
different sizes of bool in libcpp and (stage2) gcc if gcc is
bootstrapped with gcc 2.95.
Please either use AC_HEADER_STDBOOL or take a copy from a recent autoconf.
It seems that even Autoconf's AC_HEADER_STDBOOL cannot help here. They
do not test for sizeof (bool) being 1.
Please test the attached definition of ACX_HEADER_STDBOOL.
Paolo
AC_DEFUN([ACX_HEADER_STDBOOL],
[AC_CACHE_CHECK([for working stdbool.h],
acx_cv_header_stdbool_h,
[AC_TRY_COMPILE([#include <stdbool.h>
#ifndef bool
# error bool is not defined
#endif
#ifndef false
# error false is not defined
#endif
#if false
# error false is not 0
#endif
#ifndef true
# error true is not defined
#endif
#if true != 1
# error true is not 1
#endif
#ifndef __bool_true_false_are_defined
# error __bool_true_false_are_defined is not defined
#endif
struct s { _Bool s: 1; _Bool t; } s;
char a[true == 1 ? 1 : -1];
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;
char f[(_Bool) -0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool) == 1 ? 1 : -1];
char i[sizeof s.t];
],[return !a + !b + !c + !d + !e + !f + !g + !h + !i;],
[acx_cv_header_stdbool_h=yes],
[acx_cv_header_stdbool_h=no])])
if test $ac_cv_header_stdbool_h = yes; then
AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
fi
AC_CACHE_CHECK(for built-in _Bool, acx_cv_c__bool,
[AC_TRY_COMPILE(,
[_Bool foo;],
acx_cv_c__bool=yes, acx_cv_c__bool=no)
])
if test $acx_cv_c__bool = yes; then
AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
fi])# ACX_HEADER_STDBOOL