This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: More stdbool tweaking


Sorry for taking so long to get to this.

Including <stdbool.h> where it is available seems to cause more problems
than it solves.  Basically, some versions of <curses.h> drag in <stdbool.h>
which conflicts with BFD's bool; others conflict with <stdbool.h>.  The only
way I found to get this right was to require consumers of "bfd.h" to include
<curses.h> beforehand.  I'll do the patch to GDB to make this happen
separately.

If no one has an objection, I'll commit this tonight or tomorrow (since it
fixes build failures).

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


2002-02-07  Daniel Jacobowitz  <drow@mvista.com>

	* bfd-in.h: Update <stdbool.h> check to only see if <stdbool.h> has
	been included, not drag it in.
	* bfd-in2.h: Regenerate.

Index: bfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in.h,v
retrieving revision 1.41
diff -u -p -r1.41 bfd-in.h
--- bfd-in.h	2002/01/31 04:42:30	1.41
+++ bfd-in.h	2002/02/07 17:37:23
@@ -89,12 +89,13 @@ typedef struct _bfd bfd;
 /* It gets worse if the host also defines a true/false enum... -sts */
 /* And even worse if your compiler has built-in boolean types... -law */
 /* And even worse if your compiler provides a stdbool.h that conflicts
-   with these definitions... gcc 2.95 and later do.  -drow */
+   with these definitions... gcc 2.95 and later do.  If so, it must
+   be included first.  -drow */
 #if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
 #define TRUE_FALSE_ALREADY_DEFINED
 #else
-#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
-#include <stdbool.h>
+#if defined (__bool_true_false_are_defined)
+/* We have <stdbool.h>.  */
 #define TRUE_FALSE_ALREADY_DEFINED
 #endif
 #endif
Index: bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.142
diff -u -p -r1.142 bfd-in2.h
--- bfd-in2.h	2002/02/05 03:35:14	1.142
+++ bfd-in2.h	2002/02/07 17:37:23
@@ -95,12 +95,13 @@ typedef struct _bfd bfd;
 /* It gets worse if the host also defines a true/false enum... -sts */
 /* And even worse if your compiler has built-in boolean types... -law */
 /* And even worse if your compiler provides a stdbool.h that conflicts
-   with these definitions... gcc 2.95 and later do.  -drow */
+   with these definitions... gcc 2.95 and later do.  If so, it must
+   be included first.  -drow */
 #if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
 #define TRUE_FALSE_ALREADY_DEFINED
 #else
-#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
-#include <stdbool.h>
+#if defined (__bool_true_false_are_defined)
+/* We have <stdbool.h>.  */
 #define TRUE_FALSE_ALREADY_DEFINED
 #endif
 #endif


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