Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Nov 2000 03:50:24 -0500 (EST)
From:      Donald.J.Maddox@cae88-102-101.sc.rr.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/22936: <stdbool.h> broken, needs repair
Message-ID:  <200011180850.eAI8oOt50089@cae88-102-101.sc.rr.com>

next in thread | raw e-mail | index | archive | help

>Number:         22936
>Category:       misc
>Synopsis:       /usr/include/stdbool.h defines _bool twice when included by gcc.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 18 01:00:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Donald J. Maddox
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD cae88-102-101.sc.rr.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Wed Nov 15 00:22:26 EST 2000 root@cae88-102-101.sc.rr.com:/usr/src/sys/compile/RHIANNON i386

>Description:
	The header file <stdbool.h> contains a defective
conditional that breaks several ports.  Any code that includes
<stdbool.h> will break if compiled by gcc...  Example:

#include <stdbool.h>

int main()
{
	return(0);
}

$ cc test.c
In file included from test.c:1:
/usr/include/stdbool.h:51: conflicting types for `_Bool'
/usr/include/stdbool.h:38: previous declaration of `_Bool'

>How-To-Repeat:
	See above :)
>Fix:

--- /usr/src/include/stdbool.h	Sat Sep 16 03:28:44 2000
+++ stdbool.h.new	Sat Nov 18 03:23:55 2000
@@ -31,11 +31,15 @@
 #ifndef	_STDBOOL_H_
 #define	_STDBOOL_H_	
 
+#if __STDC_VERSION__ < 199901L
+typedef int	_Bool;		/* not built into pre-C99 compilers */
+#else
 /* `_Bool' type must promote to `int' or `unsigned int' */
 typedef enum {
 	false = 0,
 	true = 1
 } _Bool;
+#endif
 
 /* And those constants must also be available as macros */
 #define	false	false
@@ -46,9 +50,5 @@
 
 /* Inform that everything is fine */
 #define __bool_true_false_are_defined 1
-
-#if __STDC_VERSION__ < 199901L
-typedef int	_Bool;		/* not built into pre-C99 compilers */
-#endif
 
 #endif /* _STDBOOL_H_ */

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011180850.eAI8oOt50089>