This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Revised _Bool/stdbool.h patch


This patch is the latest revision of the thread started in

	http://gcc.gnu.org/ml/gcc-patches/2001-04/msg00256.html

It incorporates all comments and fixes one (final?) issue over the previous
revision

	http://gcc.gnu.org/ml/gcc-patches/2001-04/msg00607.html

Both HAVE__BOOL and HAVE_STDBOOL_H need to be AC_DEFINE'ed to 1 (as the
one-arg AC_DEFINE does), otherwise #if !HAVE_BOOL in system.h gets an
error.  This didn't show up with my original version since that one used
AC_DEFINE(HAVE__BOOL) and acconfig.h to provide the template instead of the
third arg to AC_DEFINE.

I've just finished the first phase (up to make compare) of a bootstrap on
alpha-dec-osf5.1 on a virginal current CVS tree (and a yet-unreleased adu
to avoid the need for the -oldas configury), so this seems to be safe.

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University

Email: ro@TechFak.Uni-Bielefeld.DE


Tue May 22 22:17:49 2001  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* aclocal.m4: Fixed typo.
 	(gcc_AC_HEADER_STDBOOL): Define.
	* configure.in: Use it.
 	(AC_CHECK_HEADERS): Remove stdbool.h
	* configure, config.in: Regenerate.
	
	* aclocal.m4 (gcc_AC_C__BOOL): Define.
	* configure.in: Use it.
	* configure, config.in: Regenerate.
	
Index: aclocal.m4
===================================================================
RCS file: /cvs/gcc/gcc/gcc/aclocal.m4,v
retrieving revision 1.40.4.1
diff -u -p -r1.40.4.1 aclocal.m4
--- aclocal.m4	2001/02/18 05:41:46	1.40.4.1
+++ aclocal.m4	2001/05/22 20:34:07
@@ -1,4 +1,17 @@
-Fdnl See whether we can include both string.h and strings.h.
+dnl See if stdbool.h properly defines bool and true/false.
+AC_DEFUN(gcc_AC_HEADER_STDBOOL,
+[AC_CACHE_CHECK([for working stdbool.h],
+  ac_cv_header_stdbool_h,
+[AC_TRY_COMPILE([#include <stdbool.h>],
+[bool foo = false;],
+ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
+if test $ac_cv_header_stdbool_h = yes; then
+  AC_DEFINE(HAVE_STDBOOL_H, 1,
+  [Define if you have a working <stdbool.h> header file.])
+fi
+])
+
+dnl See whether we can include both string.h and strings.h.
 AC_DEFUN(gcc_AC_HEADER_STRING,
 [AC_CACHE_CHECK([whether string.h and strings.h may both be included],
   gcc_cv_header_string,
@@ -194,6 +207,18 @@ gcc_cv_c_long_double=yes, gcc_cv_c_long_
 fi])
 if test $gcc_cv_c_long_double = yes; then
   AC_DEFINE(HAVE_LONG_DOUBLE)
+fi
+])
+
+dnl Check whether _Bool is built-in.
+AC_DEFUN(gcc_AC_C__BOOL,
+[AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
+[AC_TRY_COMPILE(,
+[_Bool foo;],
+gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
+])
+if test $gcc_cv_c__bool = yes; then
+  AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
 fi
 ])
 
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.483.2.17
diff -u -p -r1.483.2.17 configure.in
--- configure.in	2001/05/18 20:38:09	1.483.2.17
+++ configure.in	2001/05/22 20:34:17
@@ -347,6 +347,7 @@ AC_SUBST(NO_MINUS_C_MINUS_O)
 AC_SUBST(OUTPUT_OPTION)
 
 gcc_AC_C_LONG_DOUBLE
+gcc_AC_C__BOOL
 
 AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
 ac_cv_prog_cc_no_long_long,
@@ -434,12 +435,13 @@ gcc_AC_PROG_INSTALL
 
 AC_HEADER_STDC
 AC_HEADER_TIME
+gcc_AC_HEADER_STDBOOL
 gcc_AC_HEADER_STRING
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
 		 fcntl.h unistd.h stab.h sys/file.h sys/time.h \
 		 sys/resource.h sys/param.h sys/times.h sys/stat.h \
-		 direct.h malloc.h langinfo.h iconv.h stdbool.h)
+		 direct.h malloc.h langinfo.h iconv.h)
 
 # Check for thread headers.
 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]