From ad9e24ad113a160d8d44dba0eb5cb02647a164e0 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 31 Mar 2021 10:19:10 +1030 Subject: Use stdbool.h With this in place we can retire bfd_boolean one project at a time. bfd/ * bfd-in.h: Include stdbool.h. (bfd_boolean): Define as bool * bfd-in2.h: Regenerate. --- bfd/ChangeLog | 6 ++++++ bfd/bfd-in.h | 22 +++++++++++----------- bfd/bfd-in2.h | 22 +++++++++++----------- 3 files changed, 28 insertions(+), 22 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 58ddab0..8b7e53e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 2021-03-31 Alan Modra + * bfd-in.h: Include stdbool.h. + (bfd_boolean): Define as bool + * bfd-in2.h: Regenerate. + +2021-03-31 Alan Modra + * .gitignore: Delete bfd_stdint.h entry. * Makefile.am (bfdinclude_HEADERS): Delete bfd_stdint.h. (BUILD_HFILES, LOCAL_H_DEPS): Likewise. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 46a0fcd..88f1e86 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -35,6 +35,7 @@ extern "C" { #include "ansidecl.h" #include "symcat.h" #include +#include #include "diagnostics.h" #include #include @@ -114,20 +115,19 @@ typedef BFD_HOSTPTR_T bfd_hostptr_t; /* Forward declaration. */ typedef struct bfd bfd; -/* Boolean type used in bfd. Too many systems define their own - versions of "boolean" for us to safely typedef a "boolean" of - our own. Using an enum for "bfd_boolean" has its own set of - problems, with strange looking casts required to avoid warnings - on some older compilers. Thus we just use an int. - +/* Boolean type used in bfd. General rule: Functions which are bfd_boolean return TRUE on success and FALSE on failure (unless they're a predicate). */ -typedef int bfd_boolean; -#undef FALSE -#undef TRUE -#define FALSE 0 -#define TRUE 1 +#ifdef POISON_BFD_BOOLEAN +# pragma GCC poison bfd_boolean FALSE TRUE +#else +# define bfd_boolean bool +# undef FALSE +# undef TRUE +# define FALSE 0 +# define TRUE 1 +#endif #ifdef BFD64 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 92af6ca..9fbde9d 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -42,6 +42,7 @@ extern "C" { #include "ansidecl.h" #include "symcat.h" #include +#include #include "diagnostics.h" #include #include @@ -121,20 +122,19 @@ typedef BFD_HOSTPTR_T bfd_hostptr_t; /* Forward declaration. */ typedef struct bfd bfd; -/* Boolean type used in bfd. Too many systems define their own - versions of "boolean" for us to safely typedef a "boolean" of - our own. Using an enum for "bfd_boolean" has its own set of - problems, with strange looking casts required to avoid warnings - on some older compilers. Thus we just use an int. - +/* Boolean type used in bfd. General rule: Functions which are bfd_boolean return TRUE on success and FALSE on failure (unless they're a predicate). */ -typedef int bfd_boolean; -#undef FALSE -#undef TRUE -#define FALSE 0 -#define TRUE 1 +#ifdef POISON_BFD_BOOLEAN +# pragma GCC poison bfd_boolean FALSE TRUE +#else +# define bfd_boolean bool +# undef FALSE +# undef TRUE +# define FALSE 0 +# define TRUE 1 +#endif #ifdef BFD64 -- cgit v1.1