#include "ansidecl.h"
#include "symcat.h"
#include <stdint.h>
+#include <stdbool.h>
#include "diagnostics.h"
#include <stdarg.h>
#include <string.h>
typedef BFD_HOST_U_64_BIT bfd_uint64_t;
#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if BFD_HOST_64BIT_LONG
-# define BFD_PRI64 "l"
-# elif defined (__MSVCRT__)
-# define BFD_PRI64 "I64"
-# else
-# define BFD_PRI64 "ll"
-# endif
-# undef PRId64
-# define PRId64 BFD_PRI64 "d"
-# undef PRIu64
-# define PRIu64 BFD_PRI64 "u"
-# undef PRIx64
-# define PRIx64 BFD_PRI64 "x"
-#endif
+#include <inttypes.h>
#if BFD_ARCH_SIZE >= 64
#define BFD64
/* 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
+#else
+# define bfd_boolean bool
+# undef FALSE
+# undef TRUE
+# define FALSE 0
+# define TRUE 1
+#endif
#ifdef BFD64
};
/* Initialize a hash table. */
-extern bfd_boolean bfd_hash_table_init
+extern bool bfd_hash_table_init
(struct bfd_hash_table *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
unsigned int);
/* Initialize a hash table specifying a size. */
-extern bfd_boolean bfd_hash_table_init_n
+extern bool bfd_hash_table_init_n
(struct bfd_hash_table *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
COPY argument must be TRUE if this routine should copy the string
into newly allocated memory when adding an entry. */
extern struct bfd_hash_entry *bfd_hash_lookup
- (struct bfd_hash_table *, const char *, bfd_boolean create,
- bfd_boolean copy);
+ (struct bfd_hash_table *, const char *, bool create, bool copy);
/* Insert an entry in a hash table. */
extern struct bfd_hash_entry *bfd_hash_insert
INFO argument is passed to the function. */
extern void bfd_hash_traverse
(struct bfd_hash_table *,
- bfd_boolean (*) (struct bfd_hash_entry *, void *),
+ bool (*) (struct bfd_hash_entry *, void *),
void *info);
/* Allows the default size of a hash table to be configured. New hash
#endif
extern void _bfd_warn_deprecated (const char *, const char *, int, const char *);
-extern bfd_boolean bfd_cache_close
+extern bool bfd_cache_close
(bfd *abfd);
/* NB: This declaration should match the autogenerated one in libbfd.h. */
-extern bfd_boolean bfd_cache_close_all (void);
+extern bool bfd_cache_close_all (void);
-extern bfd_boolean bfd_record_phdr
- (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
- bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
+extern bool bfd_record_phdr
+ (bfd *, unsigned long, bool, flagword, bool, bfd_vma,
+ bool, bool, unsigned int, struct bfd_section **);
/* Byte swapping routines. */
/* Byte swapping routines which take size and endiannes as arguments. */
-bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
-void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
+bfd_uint64_t bfd_get_bits (const void *, int, bool);
+void bfd_put_bits (bfd_uint64_t, void *, int, bool);
/* mmap hacks */
(bfd_window *);
extern void bfd_free_window
(bfd_window *);
-extern bfd_boolean bfd_get_file_window
- (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
+extern bool bfd_get_file_window
+ (bfd *, file_ptr, bfd_size_type, bfd_window *, bool);
\f
/* Externally visible ELF routines. */
/* Return TRUE if the start of STR matches PREFIX, FALSE otherwise. */
-static inline bfd_boolean
+static inline bool
startswith (const char *str, const char *prefix)
{
return strncmp (str, prefix, strlen (prefix)) == 0;