This is the mail archive of the binutils@sourceware.org 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]

Include bfd_stdint.h in bfd.h


This patch adds bfd_stdint.h to bfd.h, so that BFD can use size_t
where appropriate in function parameters and return values.  I also
tidy a few other cases where headers are included twice.

bfd/
	* Makefile.am (bfdinclude_HEADERS): Add bfd_stdint.h.
	(BFD_H_DEPS): Add include/diagnostics.h.
	(LOCAL_H_DEPS): Add bfd_stdint.h.
	* bfd-in.h: Include bfd_stdint.h.
	* arc-plt.h: Don't include stdint.h.
	* coff-rs6000.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* elfxx-riscv.c: Likewise.
	* cache.c: Don't include bfd_stdint.h.
	* elf32-arm.c: Likewise.
	* elf32-avr.c: Likewise.
	* elf32-nds32.c: Likewise.
	* elf32-rl78.c: Likewise.
	* elf32-rx.c: Likewise.
	* elf32-wasm32.c: Likewise.
	* elf64-nfp.c: Likewise.
	* elflink.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfnn-ia64.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* elfxx-x86.h: Likewise.
	* wasm-module.c: Likewise, and don't include sysdep.h twice.
	* elf-nacl.h: Don't include bfd.h.
	* mach-o.h: Likewise.
	* elfxx-aarch64.c: Include bfd.h and elf-bfd.h.
	* elfxx-aarch64.h: Don't include bfd.h, elf-bfd.h or stdint.h.
	* mach-o-aarch64.c: Include mach-o.h later.
	* mach-o-arm.c: Likewise.
	* mach-o-i386.c: Likewise.
	* mach-o-x86-64.c: Likewise.
	* mach-o.c: Likewise.
	* sysdep.h: Don't include ansidecl.h or sys/stat.h.
	* Makefile.in: Regenerate.
	* bfd-in2.h: Regenerate.
opcodes/
	* arm-dis.c: Include bfd.h.
	* aarch64-opc.c: Include bfd_stdint.h rather than stdint.h.
	* csky-dis.c: Likewise.
	* nds32-asm.c: Likewise.
	* riscv-dis.c: Likewise.
	* s12z-dis.c: Likewise.
	* wasm32-dis.c: Likewise.

diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 2626ceb0a5..3d60628262 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -33,7 +33,7 @@ bfdlibdir = @bfdlibdir@
 bfdincludedir = @bfdincludedir@
 bfdlib_LTLIBRARIES = libbfd.la
 bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
-		     $(INCDIR)/bfdlink.h $(INCDIR)/diagnostics.h
+		     bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
 else !INSTALL_LIBBFD
 # Empty these so that the respective installation directories will not be created.
 bfdlibdir =
@@ -873,8 +873,8 @@ pex64igen.c: peXXigen.c
 	$(SED) -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new
 	mv -f pex64igen.new pex64igen.c
 
-BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
-LOCAL_H_DEPS= libbfd.h sysdep.h config.h
+BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/diagnostics.h
+LOCAL_H_DEPS= libbfd.h sysdep.h config.h bfd_stdint.h
 $(BFD32_LIBS) \
  $(BFD64_LIBS) \
  $(ALL_MACHINES) \
diff --git a/bfd/arc-plt.h b/bfd/arc-plt.h
index 2f4ba8604b..994b4882e9 100644
--- a/bfd/arc-plt.h
+++ b/bfd/arc-plt.h
@@ -22,8 +22,6 @@
 #ifndef ARC_PLT_H
 #define ARC_PLT_H
 
-#include <stdint.h>
-
 /* Instructions appear in memory as a sequence of half-words (16 bit);
    individual half-words are represented on the target in target byte order.
    We use 'unsigned short' on the host to represent the PLT templates,
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 47b60bcfbf..5657d93b7e 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -34,6 +34,7 @@ extern "C" {
 
 #include "ansidecl.h"
 #include "symcat.h"
+#include "bfd_stdint.h"
 #include "diagnostics.h"
 #include <stdarg.h>
 #include <sys/stat.h>
diff --git a/bfd/cache.c b/bfd/cache.c
index faee6779f8..17c84cccda 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -44,7 +44,6 @@ SUBSECTION
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
-#include "bfd_stdint.h"
 
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index edff50daaa..65ae05cdcd 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -114,7 +114,6 @@ extern int rs6000coff_core_file_failing_signal (bfd *abfd);
 #define bfd_pe_print_pdata	NULL
 #endif
 
-#include <stdint.h>
 #include "coffcode.h"
 
 /* The main body of code is in coffcode.h.  */
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 928a23d4f8..6e52347624 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -278,7 +278,6 @@ extern int rs6000coff_core_file_failing_signal
 #define bfd_pe_print_pdata	NULL
 #endif
 
-#include <stdint.h>
 #include "coffcode.h"
 
 /* For XCOFF64, the effective width of symndx changes depending on
diff --git a/bfd/elf-nacl.h b/bfd/elf-nacl.h
index 8ca0618314..1b691a313b 100644
--- a/bfd/elf-nacl.h
+++ b/bfd/elf-nacl.h
@@ -16,8 +16,6 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "bfd.h"
-
 bfd_boolean nacl_modify_segment_map (bfd *, struct bfd_link_info *);
 bfd_boolean nacl_modify_program_headers (bfd *, struct bfd_link_info *);
 void nacl_final_write_processing (bfd *, bfd_boolean linker);
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 5adec5e473..9fda98edd8 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -22,7 +22,6 @@
 #include <limits.h>
 
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "libiberty.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 13e28d8a1e..527149c67b 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -25,7 +25,6 @@
 #include "elf-bfd.h"
 #include "elf/avr.h"
 #include "elf32-avr.h"
-#include "bfd_stdint.h"
 
 /* Enable debugging printout at stdout with this variable.  */
 static bfd_boolean debug_relax = FALSE;
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 184cf320f7..c7e15190cd 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -22,12 +22,10 @@
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "bfdlink.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "libiberty.h"
-#include "bfd_stdint.h"
 #include "elf/nds32.h"
 #include "opcode/nds32.h"
 #include "elf32-nds32.h"
diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c
index e072b1a96e..3a96f41343 100644
--- a/bfd/elf32-rl78.c
+++ b/bfd/elf32-rl78.c
@@ -20,7 +20,6 @@
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/rl78.h"
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index ddcf5e980f..68fac291b8 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -20,7 +20,6 @@
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/rx.h"
diff --git a/bfd/elf32-wasm32.c b/bfd/elf32-wasm32.c
index 9fc48de6d6..d4e54ca266 100644
--- a/bfd/elf32-wasm32.c
+++ b/bfd/elf32-wasm32.c
@@ -22,7 +22,6 @@
 #include "bfd.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
-#include "bfd_stdint.h"
 #include "libiberty.h"
 #include "elf/wasm32.h"
 
diff --git a/bfd/elf64-nfp.c b/bfd/elf64-nfp.c
index 3cdda3d36b..e043535723 100755
--- a/bfd/elf64-nfp.c
+++ b/bfd/elf64-nfp.c
@@ -24,7 +24,6 @@
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/nfp.h"
-#include "bfd_stdint.h"
 
 
 static bfd_reloc_status_type
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 8992a5016f..f5b411bd62 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -20,7 +20,6 @@
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "bfdlink.h"
 #include "libbfd.h"
 #define ARCH_SIZE 0
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 083f90b57d..8b5124b4c0 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -139,7 +139,6 @@
 #include "bfd.h"
 #include "libiberty.h"
 #include "libbfd.h"
-#include "bfd_stdint.h"
 #include "elf-bfd.h"
 #include "bfdlink.h"
 #include "objalloc.h"
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index e6551df204..56572d3d07 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -27,7 +27,6 @@
 #include "elf/ia64.h"
 #include "objalloc.h"
 #include "hashtab.h"
-#include "bfd_stdint.h"
 #include "elfxx-ia64.h"
 
 #define ARCH_SIZE	NN
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index b8a541a9dd..e3b6ef6d5f 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -19,6 +19,8 @@
    see <http://www.gnu.org/licenses/>.  */
 
 #include "sysdep.h"
+#include "bfd.h"
+#include "elf-bfd.h"
 #include "elfxx-aarch64.h"
 #include <stdarg.h>
 #include <string.h>
diff --git a/bfd/elfxx-aarch64.h b/bfd/elfxx-aarch64.h
index 301af73e3e..0aa536a4bf 100644
--- a/bfd/elfxx-aarch64.h
+++ b/bfd/elfxx-aarch64.h
@@ -18,10 +18,6 @@
    along with this program; see the file COPYING3. If not,
    see <http://www.gnu.org/licenses/>.  */
 
-#include "bfd.h"
-#include "elf-bfd.h"
-#include "stdint.h"
-
 /* Take the PAGE component of an address or offset.  */
 #define PG(x)	     ((x) & ~ (bfd_vma) 0xfff)
 #define PG_OFFSET(x) ((x) &   (bfd_vma) 0xfff)
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 290dcd8e53..2c96f05da8 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -27,7 +27,6 @@
 #include "elf/ia64.h"
 #include "objalloc.h"
 #include "hashtab.h"
-#include "bfd_stdint.h"
 #include "elfxx-ia64.h"
 
 /* THE RULES for all the stuff the linker creates --
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index a88c7fa2e7..d92b2738f3 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -29,7 +29,6 @@
 #include "libiberty.h"
 #include "elfxx-riscv.h"
 #include "safe-ctype.h"
-#include <stdint.h>
 
 #define MINUS_ONE ((bfd_vma)0 - 1)
 
diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
index d153623d3e..2415987d32 100644
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -23,7 +23,6 @@
 #include "bfdlink.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
-#include "bfd_stdint.h"
 #include "hashtab.h"
 
 #define PLT_CIE_LENGTH		20
diff --git a/bfd/mach-o-aarch64.c b/bfd/mach-o-aarch64.c
index 7013d26da1..018ac2e12e 100644
--- a/bfd/mach-o-aarch64.c
+++ b/bfd/mach-o-aarch64.c
@@ -19,10 +19,10 @@
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "mach-o/arm64.h"
 
 #define bfd_mach_o_object_p bfd_mach_o_arm64_object_p
diff --git a/bfd/mach-o-arm.c b/bfd/mach-o-arm.c
index 738b2f1643..5182c97f8b 100644
--- a/bfd/mach-o-arm.c
+++ b/bfd/mach-o-arm.c
@@ -19,10 +19,10 @@
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "mach-o/arm.h"
 
 #define bfd_mach_o_object_p bfd_mach_o_arm_object_p
diff --git a/bfd/mach-o-i386.c b/bfd/mach-o-i386.c
index 4918e5e6da..db92e5d10a 100644
--- a/bfd/mach-o-i386.c
+++ b/bfd/mach-o-i386.c
@@ -19,10 +19,10 @@
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "mach-o/reloc.h"
 
 #define bfd_mach_o_object_p bfd_mach_o_i386_object_p
diff --git a/bfd/mach-o-x86-64.c b/bfd/mach-o-x86-64.c
index 9ee93a4ffb..153a85ceda 100644
--- a/bfd/mach-o-x86-64.c
+++ b/bfd/mach-o-x86-64.c
@@ -19,10 +19,10 @@
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "mach-o/x86-64.h"
 
 #define bfd_mach_o_object_p bfd_mach_o_x86_64_object_p
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 51217158ce..11e946c47d 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -19,10 +19,10 @@
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "aout/stab_gnu.h"
 #include "mach-o/reloc.h"
 #include "mach-o/external.h"
diff --git a/bfd/mach-o.h b/bfd/mach-o.h
index 61428d6a3a..97547a53de 100644
--- a/bfd/mach-o.h
+++ b/bfd/mach-o.h
@@ -21,7 +21,6 @@
 #ifndef _BFD_MACH_O_H_
 #define _BFD_MACH_O_H_
 
-#include "bfd.h"
 #include "mach-o/loader.h"
 #include "mach-o/external.h"
 
diff --git a/bfd/sysdep.h b/bfd/sysdep.h
index bc7dbcf6c3..7152d77be1 100644
--- a/bfd/sysdep.h
+++ b/bfd/sysdep.h
@@ -28,15 +28,12 @@
 
 #include "config.h"
 
-#include "ansidecl.h"
-
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
 #endif
 
 #include <stdio.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 
 #include <errno.h>
 #if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO))
diff --git a/bfd/wasm-module.c b/bfd/wasm-module.c
index 6806e0f81d..3deaf42bac 100644
--- a/bfd/wasm-module.c
+++ b/bfd/wasm-module.c
@@ -28,9 +28,7 @@
 #include "sysdep.h"
 #include "alloca-conf.h"
 #include "bfd.h"
-#include "sysdep.h"
 #include <limits.h>
-#include "bfd_stdint.h"
 #include "libiberty.h"
 #include "libbfd.h"
 #include "wasm-module.h"
diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c
index b047d2feab..72ff4d5448 100644
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -22,7 +22,7 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include <stdarg.h>
 #include <inttypes.h>
 
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 8e6a37b0c6..006197043d 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -32,6 +32,7 @@
 /* FIXME: This shouldn't be done here.  */
 #include "coff/internal.h"
 #include "libcoff.h"
+#include "bfd.h"
 #include "elf-bfd.h"
 #include "elf/internal.h"
 #include "elf/arm.h"
diff --git a/opcodes/csky-dis.c b/opcodes/csky-dis.c
index 9c3495f82d..f57b9da6bd 100644
--- a/opcodes/csky-dis.c
+++ b/opcodes/csky-dis.c
@@ -22,7 +22,7 @@
 #include "sysdep.h"
 #include "config.h"
 #include <stdio.h>
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include "disassemble.h"
 #include "elf-bfd.h"
 #include "opcode/csky.h"
diff --git a/opcodes/nds32-asm.c b/opcodes/nds32-asm.c
index f0dd3266f9..94f0af2008 100644
--- a/opcodes/nds32-asm.c
+++ b/opcodes/nds32-asm.c
@@ -22,7 +22,7 @@
 
 #include "sysdep.h"
 
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include <assert.h>
 
 #include "safe-ctype.h"
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index f1bbfdb1f1..ab7575a22b 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -28,7 +28,7 @@
 #include "elf-bfd.h"
 #include "elf/riscv.h"
 
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include <ctype.h>
 
 struct riscv_private_data
diff --git a/opcodes/s12z-dis.c b/opcodes/s12z-dis.c
index 719f172bcc..5d9307bb77 100644
--- a/opcodes/s12z-dis.c
+++ b/opcodes/s12z-dis.c
@@ -20,7 +20,7 @@
 
 #include "sysdep.h"
 #include <stdio.h>
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include <stdbool.h>
 #include <assert.h>
 
diff --git a/opcodes/wasm32-dis.c b/opcodes/wasm32-dis.c
index d6f1697542..9b5dea4a49 100644
--- a/opcodes/wasm32-dis.c
+++ b/opcodes/wasm32-dis.c
@@ -27,7 +27,7 @@
 #include "elf-bfd.h"
 #include "elf/internal.h"
 #include "elf/wasm32.h"
-#include <stdint.h>
+#include "bfd_stdint.h"
 
 /* Type names for blocks and signatures.  */
 #define BLOCK_TYPE_NONE              0x40

-- 
Alan Modra
Australia Development Lab, IBM


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