diff options
author | Tom Tromey <tom@tromey.com> | 2023-07-30 10:26:07 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-08-03 07:39:15 -0600 |
commit | f559e52a8e79585e0b13156e949a7fd46060a714 (patch) | |
tree | 9ccc07385f1c6e11b233b4b711f8cbd37ddf8d45 /bfd | |
parent | f8c4789c7f4efa3726ec39256b9860e4df9f8177 (diff) | |
download | gdb-f559e52a8e79585e0b13156e949a7fd46060a714.zip gdb-f559e52a8e79585e0b13156e949a7fd46060a714.tar.gz gdb-f559e52a8e79585e0b13156e949a7fd46060a714.tar.bz2 |
Remove PEI_HEADERS define
I noticed a few files double-included libcoff.h, and digging deeper I
found that the PEI_HEADERS define is a sort of external include guard.
This patch adds include guards to the few files in include/coff that
were missing one, and then removes the PEI_HEADERS workaround and the
redundant includes.
I didn't see anything in these files that indicated that
double-inclusion would be useful, so it seems to me that this approach
is ok.
Tested by rebuilding with --enable-targets=all.
2023-08-02 Tom Tromey <tromey@adacore.com>
* pei-x86_64.c (PEI_HEADERS): Do not define.
* pei-loongarch64.c (PEI_HEADERS): Do not define.
* pei-aarch64.c (PEI_HEADERS): Do not define.
* pe-x86_64.c (PEI_HEADERS): Do not define.
* pe-aarch64.c (PEI_HEADERS): Do not define.
* libpei.h (_LIBPEI_H): Add include guard.
* coff-x86_64.c (PEI_HEADERS): Do not check.
* coff-loongarch64.c (PEI_HEADERS): Do not check.
* coff-aarch64.c (PEI_HEADERS): Do not check.
include/ChangeLog
2023-08-02 Tom Tromey <tromey@adacore.com>
* coff/x86_64.h (COFF_X86_64_H): Add include guard.
* coff/loongarch64.h (COFF_LOONGARCH64_H): Add include guard.
* coff/aarch64.h (COFF_AARCH64_H): Add include guard.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 12 | ||||
-rw-r--r-- | bfd/coff-aarch64.c | 7 | ||||
-rw-r--r-- | bfd/coff-loongarch64.c | 7 | ||||
-rw-r--r-- | bfd/coff-x86_64.c | 5 | ||||
-rw-r--r-- | bfd/libpei.h | 3 | ||||
-rw-r--r-- | bfd/pe-aarch64.c | 1 | ||||
-rw-r--r-- | bfd/pe-x86_64.c | 1 | ||||
-rw-r--r-- | bfd/pei-aarch64.c | 1 | ||||
-rw-r--r-- | bfd/pei-loongarch64.c | 1 | ||||
-rw-r--r-- | bfd/pei-x86_64.c | 4 |
10 files changed, 15 insertions, 27 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 56c858e..0087aed 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2023-08-02 Tom Tromey <tromey@adacore.com> + + * pei-x86_64.c (PEI_HEADERS): Do not define. + * pei-loongarch64.c (PEI_HEADERS): Do not define. + * pei-aarch64.c (PEI_HEADERS): Do not define. + * pe-x86_64.c (PEI_HEADERS): Do not define. + * pe-aarch64.c (PEI_HEADERS): Do not define. + * libpei.h (_LIBPEI_H): Add include guard. + * coff-x86_64.c (PEI_HEADERS): Do not check. + * coff-loongarch64.c (PEI_HEADERS): Do not check. + * coff-aarch64.c (PEI_HEADERS): Do not check. + 2023-07-24 Johannes Schauer Marin Rodrigues <josch@debian.org> * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): If inserting a diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c index 659cd4f..60e2313 100644 --- a/bfd/coff-aarch64.c +++ b/bfd/coff-aarch64.c @@ -23,10 +23,6 @@ #define COFF_WITH_peAArch64 #endif -/* Note we have to make sure not to include headers twice. - Not all headers are wrapped in #ifdef guards, so we define - PEI_HEADERS to prevent double including here. */ -#ifndef PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" @@ -35,9 +31,6 @@ #include "coff/pe.h" #include "libcoff.h" #include "libiberty.h" -#endif - -#include "libcoff.h" /* For these howto special functions, output_bfd == NULL => final link, or objdump -W and other calls to diff --git a/bfd/coff-loongarch64.c b/bfd/coff-loongarch64.c index 9136e06..8ae3f84 100644 --- a/bfd/coff-loongarch64.c +++ b/bfd/coff-loongarch64.c @@ -23,10 +23,6 @@ #define COFF_WITH_peLoongArch64 #endif -/* Note we have to make sure not to include headers twice. - Not all headers are wrapped in #ifdef guards, so we define - PEI_HEADERS to prevent double including here. */ -#ifndef PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" @@ -35,9 +31,6 @@ #include "coff/pe.h" #include "libcoff.h" #include "libiberty.h" -#endif - -#include "libcoff.h" /* The page size is a guess based on ELF. */ diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c index f5bd5a2..9a3f85c 100644 --- a/bfd/coff-x86_64.c +++ b/bfd/coff-x86_64.c @@ -20,10 +20,6 @@ Written by Kai Tietz, OneVision Software GmbH&CoKg. */ -/* Note we have to make sure not to include headers twice. - Not all headers are wrapped in #ifdef guards, so we define - PEI_HEADERS to prevent double including here. */ -#ifndef PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" @@ -31,7 +27,6 @@ #include "coff/internal.h" #include "libcoff.h" #include "libiberty.h" -#endif #define BADMAG(x) AMD64BADMAG(x) diff --git a/bfd/libpei.h b/bfd/libpei.h index eafb9cf..9837d46 100644 --- a/bfd/libpei.h +++ b/bfd/libpei.h @@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef _LIBPEI_H +#define _LIBPEI_H /* Most of this hacked by Steve Chamberlain, sac@cygnus.com @@ -445,3 +447,4 @@ bool _bfd_peAArch64_print_ce_compressed_pdata (bfd *, void *); bool _bfd_peLoongArch64_print_ce_compressed_pdata (bfd *, void *); bool _bfd_pep_print_ce_compressed_pdata (bfd *, void *); +#endif /* _LIBPEI_H */ diff --git a/bfd/pe-aarch64.c b/bfd/pe-aarch64.c index 9abc1cc..2d5a7e2 100644 --- a/bfd/pe-aarch64.c +++ b/bfd/pe-aarch64.c @@ -55,7 +55,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/pe-x86_64.c b/bfd/pe-x86_64.c index 04bf98e..b9c241e 100644 --- a/bfd/pe-x86_64.c +++ b/bfd/pe-x86_64.c @@ -20,7 +20,6 @@ Written by Kai Tietz, OneVision Software GmbH&CoKg. */ -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/pei-aarch64.c b/bfd/pei-aarch64.c index 3fa2ff8..2ec1254 100644 --- a/bfd/pei-aarch64.c +++ b/bfd/pei-aarch64.c @@ -56,7 +56,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/pei-loongarch64.c b/bfd/pei-loongarch64.c index 8940129..3b7751a 100644 --- a/bfd/pei-loongarch64.c +++ b/bfd/pei-loongarch64.c @@ -56,7 +56,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c index 4d2ba71..65bd83e 100644 --- a/bfd/pei-x86_64.c +++ b/bfd/pei-x86_64.c @@ -58,10 +58,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } -/* Note we have to make sure not to include headers twice. - Not all headers are wrapped in #ifdef guards, so we define - PEI_HEADERS to prevent double including in coff-x86_64.c */ -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" |