Make bfd_byte an int8_t, flagword a uint32_t
[binutils-gdb.git] / bfd / bfd-in.h
index 8c4c838f3f8b90606194b18731237c671869964d..eb6ee9cf816feda94d5b63fa833b88afea855e6d 100644 (file)
@@ -1,6 +1,6 @@
 /* Main header file for the bfd library -- portable access to object files.
 
-   Copyright (C) 1990-2022 Free Software Foundation, Inc.
+   Copyright (C) 1990-2023 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
 
@@ -69,17 +69,12 @@ extern "C" {
 /* The word size of the default bfd target.  */
 #define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
 
-#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
-
 #include <inttypes.h>
 
 #if BFD_ARCH_SIZE >= 64
 #define BFD64
 #endif
 
-/* Declaring a type wide enough to hold a host long and a host pointer.  */
-typedef @BFD_HOSTPTR_T@ bfd_hostptr_t;
-
 /* Forward declaration.  */
 typedef struct bfd bfd;
 
@@ -104,44 +99,26 @@ typedef struct bfd bfd;
 
 #ifdef BFD64
 
-typedef uint64_t bfd_vma;
-typedef int64_t bfd_signed_vma;
-typedef uint64_t bfd_size_type;
-typedef uint64_t symvalue;
-
-#if BFD_HOST_64BIT_LONG
-#define BFD_VMA_FMT "l"
-#elif defined (__MSVCRT__)
-#define BFD_VMA_FMT "I64"
-#else
-#define BFD_VMA_FMT "ll"
-#endif
-
-#ifndef fprintf_vma
-#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
-#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
-#endif
-
-#else /* not BFD64  */
-
 /* Represent a target address.  Also used as a generic unsigned type
    which is guaranteed to be big enough to hold any arithmetic types
    we need to deal with.  */
-typedef unsigned long bfd_vma;
+typedef uint64_t bfd_vma;
 
 /* A generic signed type which is guaranteed to be big enough to hold any
    arithmetic types we need to deal with.  Can be assumed to be compatible
    with bfd_vma in the same way that signed and unsigned ints are compatible
    (as parameters, in assignment, etc).  */
-typedef long bfd_signed_vma;
+typedef int64_t bfd_signed_vma;
 
-typedef unsigned long symvalue;
-typedef unsigned long bfd_size_type;
+typedef uint64_t bfd_size_type;
+typedef uint64_t symvalue;
 
-/* Print a bfd_vma x on stream s.  */
-#define BFD_VMA_FMT "l"
-#define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x)
-#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x)
+#else /* not BFD64  */
+
+typedef uint32_t bfd_vma;
+typedef int32_t bfd_signed_vma;
+typedef uint32_t bfd_size_type;
+typedef uint32_t symvalue;
 
 #endif /* not BFD64  */
 
@@ -156,11 +133,10 @@ typedef @bfd_ufile_ptr@ ufile_ptr;
 extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
 extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
 
-#define printf_vma(x) fprintf_vma(stdout,x)
 #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
 
-typedef unsigned int flagword; /* 32 bits of flags */
-typedef unsigned char bfd_byte;
+typedef uint32_t flagword;     /* 32 bits of flags */
+typedef uint8_t bfd_byte;
 \f
 /* File formats.  */
 
@@ -359,16 +335,6 @@ extern void bfd_hash_traverse
    this size.  */
 extern unsigned long bfd_hash_set_default_size (unsigned long);
 
-/* Types of compressed DWARF debug sections.  We currently support
-   zlib.  */
-enum compressed_debug_section_type
-{
-  COMPRESS_DEBUG_NONE = 0,
-  COMPRESS_DEBUG = 1 << 0,
-  COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1,
-  COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2
-};
-
 /* This structure is used to keep track of stabs in sections
    information while linking.  */
 
@@ -399,10 +365,10 @@ extern int bfd_stat (bfd *, struct stat *);
 /* Deprecated old routines.  */
 #if __GNUC__
 #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \
-  (_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__),        \
+  (_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __func__),    \
    bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
 #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)                          \
-  (_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \
+  (_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __func__),   \
    bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
 #else
 #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)                           \