aboutsummaryrefslogtreecommitdiff
path: root/bfd/section.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-03-31 10:30:54 +1030
committerAlan Modra <amodra@gmail.com>2021-03-31 10:49:23 +1030
commit0a1b45a20eaa98d4d9026dc1fd17e79e741183af (patch)
tree059b2b296b4d60784a82cd6a52dae47dcac4d66a /bfd/section.c
parentfaa7a26040c617a6d29f601998b99a1da882c672 (diff)
downloadbinutils-0a1b45a20eaa98d4d9026dc1fd17e79e741183af.zip
binutils-0a1b45a20eaa98d4d9026dc1fd17e79e741183af.tar.gz
binutils-0a1b45a20eaa98d4d9026dc1fd17e79e741183af.tar.bz2
Use bool in bfd
* sysdep.h: POISON_BFD_BOOLEAN: Define. * aix5ppc-core.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aoutx.h, * arc-got.h, * archive.c, * archive64.c, * archures.c, * bfd-in.h, * bfd.c, * bfdwin.c, * binary.c, * cache.c, * coff-alpha.c, * coff-arm.c, * coff-arm.h, * coff-bfd.c, * coff-bfd.h, * coff-go32.c, * coff-i386.c, * coff-ia64.c, * coff-mcore.c, * coff-mips.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic30.c, * coff-tic4x.c, * coff-tic54x.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * corefile.c, * cpu-aarch64.c, * cpu-aarch64.h, * cpu-alpha.c, * cpu-arc.c, * cpu-arm.c, * cpu-arm.h, * cpu-avr.c, * cpu-bfin.c, * cpu-bpf.c, * cpu-cr16.c, * cpu-cris.c, * cpu-crx.c, * cpu-csky.c, * cpu-d10v.c, * cpu-d30v.c, * cpu-dlx.c, * cpu-epiphany.c, * cpu-fr30.c, * cpu-frv.c, * cpu-ft32.c, * cpu-h8300.c, * cpu-hppa.c, * cpu-i386.c, * cpu-ia64.c, * cpu-iamcu.c, * cpu-ip2k.c, * cpu-iq2000.c, * cpu-k1om.c, * cpu-l1om.c, * cpu-lm32.c, * cpu-m10200.c, * cpu-m10300.c, * cpu-m32c.c, * cpu-m32r.c, * cpu-m68hc11.c, * cpu-m68hc12.c, * cpu-m68k.c, * cpu-m9s12x.c, * cpu-m9s12xg.c, * cpu-mcore.c, * cpu-mep.c, * cpu-metag.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-mmix.c, * cpu-moxie.c, * cpu-msp430.c, * cpu-mt.c, * cpu-nds32.c, * cpu-nfp.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-pdp11.c, * cpu-pj.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-riscv.c, * cpu-rl78.c, * cpu-rs6000.c, * cpu-rx.c, * cpu-s12z.c, * cpu-s390.c, * cpu-score.c, * cpu-sh.c, * cpu-sparc.c, * cpu-spu.c, * cpu-tic30.c, * cpu-tic4x.c, * cpu-tic54x.c, * cpu-tic6x.c, * cpu-tilegx.c, * cpu-tilepro.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-vax.c, * cpu-visium.c, * cpu-wasm32.c, * cpu-xc16x.c, * cpu-xgate.c, * cpu-xstormy16.c, * cpu-xtensa.c, * cpu-z80.c, * cpu-z8k.c, * dwarf1.c, * dwarf2.c, * ecoff-bfd.h, * ecoff.c, * ecofflink.c, * elf-attrs.c, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-nacl.c, * elf-nacl.h, * elf-properties.c, * elf-s390-common.c, * elf-s390.h, * elf-strtab.c, * elf-vxworks.c, * elf-vxworks.h, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-arm.h, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-bfin.h, * elf32-cr16.c, * elf32-cr16.h, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-csky.h, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-gen.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-hppa.h, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m68k.h, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-metag.h, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-nios2.h, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s12z.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-relocs.h, * elf32-sh.c, * elf32-sparc.c, * elf32-spu.c, * elf32-spu.h, * elf32-tic6x.c, * elf32-tic6x.h, * elf32-tilegx.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-v850.h, * elf32-vax.c, * elf32-visium.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf32-z80.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-gen.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-nfp.c, * elf64-ppc.c, * elf64-ppc.h, * elf64-s390.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-x86-64.c, * elfcode.h, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-mips.h, * elfxx-riscv.c, * elfxx-riscv.h, * elfxx-sparc.c, * elfxx-sparc.h, * elfxx-target.h, * elfxx-tilegx.c, * elfxx-tilegx.h, * elfxx-x86.c, * elfxx-x86.h, * format.c, * genlink.h, * hash.c, * i386aout.c, * i386lynx.c, * i386msdos.c, * ihex.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libecoff.h, * libpei.h, * libxcoff.h, * linker.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mmo.c, * netbsd.h, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-sh.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pei-arm.c, * pei-i386.c, * pei-ia64.c, * pei-mcore.c, * pei-sh.c, * pei-x86_64.c, * peicode.h, * plugin.c, * plugin.h, * ppcboot.c, * reloc.c, * reloc16.c, * rs6000-core.c, * section.c, * simple.c, * som.c, * som.h, * srec.c, * stabs.c, * syms.c, * targets.c, * tekhex.c, * verilog.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * vms.h, * wasm-module.c, * xcofflink.c, * xcofflink.h, * xsym.c, * xsym.h: Replace bfd_boolean with bool, FALSE with false, and TRUE with true throughout. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
Diffstat (limited to 'bfd/section.c')
-rw-r--r--bfd/section.c124
1 files changed, 61 insertions, 63 deletions
diff --git a/bfd/section.c b/bfd/section.c
index 059b6fa..a353488 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -609,7 +609,7 @@ CODE_FRAGMENT
.{
. return sec->userdata;
.}
-.static inline bfd_boolean
+.static inline bool
.bfd_is_com_section (const asection *sec)
.{
. return (sec->flags & SEC_IS_COMMON) != 0;
@@ -619,33 +619,33 @@ CODE_FRAGMENT
. because not all callers use the return value. A macro implementation
. would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
. compilers will complain about comma expressions that have no effect. *}
-.static inline bfd_boolean
+.static inline bool
.bfd_set_section_userdata (asection *sec, void *val)
.{
. sec->userdata = val;
-. return TRUE;
+. return true;
.}
.
-.static inline bfd_boolean
+.static inline bool
.bfd_set_section_vma (asection *sec, bfd_vma val)
.{
. sec->vma = sec->lma = val;
-. sec->user_set_vma = TRUE;
-. return TRUE;
+. sec->user_set_vma = true;
+. return true;
.}
.
-.static inline bfd_boolean
+.static inline bool
.bfd_set_section_lma (asection *sec, bfd_vma val)
.{
. sec->lma = val;
-. return TRUE;
+. return true;
.}
.
-.static inline bfd_boolean
+.static inline bool
.bfd_set_section_alignment (asection *sec, unsigned int val)
.{
. sec->alignment_power = val;
-. return TRUE;
+. return true;
.}
.
.{* These sections are global, and are managed by BFD. The application
@@ -667,25 +667,25 @@ CODE_FRAGMENT
.{* Pointer to the indirect section. *}
.#define bfd_ind_section_ptr (&_bfd_std_section[3])
.
-.static inline bfd_boolean
+.static inline bool
.bfd_is_und_section (const asection *sec)
.{
. return sec == bfd_und_section_ptr;
.}
.
-.static inline bfd_boolean
+.static inline bool
.bfd_is_abs_section (const asection *sec)
.{
. return sec == bfd_abs_section_ptr;
.}
.
-.static inline bfd_boolean
+.static inline bool
.bfd_is_ind_section (const asection *sec)
.{
. return sec == bfd_ind_section_ptr;
.}
.
-.static inline bfd_boolean
+.static inline bool
.bfd_is_const_section (const asection *sec)
.{
. return (sec >= _bfd_std_section
@@ -694,7 +694,7 @@ CODE_FRAGMENT
.}
.
.{* Return TRUE if input section SEC has been discarded. *}
-.static inline bfd_boolean
+.static inline bool
.discarded_section (const asection *sec)
.{
. return (!bfd_is_abs_section (sec)
@@ -812,12 +812,12 @@ bfd_section_hash_newfunc (struct bfd_hash_entry *entry,
is useful for things like relocs which are relative to the base
of a section. */
-bfd_boolean
+bool
_bfd_generic_new_section_hook (bfd *abfd, asection *newsect)
{
newsect->symbol = bfd_make_empty_symbol (abfd);
if (newsect->symbol == NULL)
- return FALSE;
+ return false;
newsect->symbol->name = newsect->name;
newsect->symbol->value = 0;
@@ -825,7 +825,7 @@ _bfd_generic_new_section_hook (bfd *abfd, asection *newsect)
newsect->symbol->flags = BSF_SECTION_SYM;
newsect->symbol_ptr_ptr = &newsect->symbol;
- return TRUE;
+ return true;
}
unsigned int _bfd_section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */
@@ -898,7 +898,7 @@ bfd_get_section_by_name (bfd *abfd, const char *name)
{
struct section_hash_entry *sh;
- sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE);
+ sh = section_hash_lookup (&abfd->section_htab, name, false, false);
if (sh != NULL)
return &sh->section;
@@ -982,7 +982,7 @@ SYNOPSIS
asection *bfd_get_section_by_name_if
(bfd *abfd,
const char *name,
- bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
+ bool (*func) (bfd *abfd, asection *sect, void *obj),
void *obj);
DESCRIPTION
@@ -1000,15 +1000,13 @@ DESCRIPTION
asection *
bfd_get_section_by_name_if (bfd *abfd, const char *name,
- bfd_boolean (*operation) (bfd *,
- asection *,
- void *),
+ bool (*operation) (bfd *, asection *, void *),
void *user_storage)
{
struct section_hash_entry *sh;
unsigned long hash;
- sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE);
+ sh = section_hash_lookup (&abfd->section_htab, name, false, false);
if (sh == NULL)
return NULL;
@@ -1061,7 +1059,7 @@ bfd_get_unique_section_name (bfd *abfd, const char *templat, int *count)
abort ();
sprintf (sname + len, ".%d", num++);
}
- while (section_hash_lookup (&abfd->section_htab, sname, FALSE, FALSE));
+ while (section_hash_lookup (&abfd->section_htab, sname, false, false));
if (count != NULL)
*count = num;
@@ -1116,7 +1114,7 @@ bfd_make_section_old_way (bfd *abfd, const char *name)
{
struct section_hash_entry *sh;
- sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
+ sh = section_hash_lookup (&abfd->section_htab, name, true, false);
if (sh == NULL)
return NULL;
@@ -1171,7 +1169,7 @@ bfd_make_section_anyway_with_flags (bfd *abfd, const char *name,
return NULL;
}
- sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
+ sh = section_hash_lookup (&abfd->section_htab, name, true, false);
if (sh == NULL)
return NULL;
@@ -1256,7 +1254,7 @@ bfd_make_section_with_flags (bfd *abfd, const char *name,
|| strcmp (name, BFD_IND_SECTION_NAME) == 0)
return NULL;
- sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
+ sh = section_hash_lookup (&abfd->section_htab, name, true, false);
if (sh == NULL)
return NULL;
@@ -1297,7 +1295,7 @@ FUNCTION
bfd_set_section_flags
SYNOPSIS
- bfd_boolean bfd_set_section_flags (asection *sec, flagword flags);
+ bool bfd_set_section_flags (asection *sec, flagword flags);
DESCRIPTION
Set the attributes of the section @var{sec} to the value @var{flags}.
@@ -1311,11 +1309,11 @@ DESCRIPTION
*/
-bfd_boolean
+bool
bfd_set_section_flags (asection *section, flagword flags)
{
section->flags = flags;
- return TRUE;
+ return true;
}
/*
@@ -1389,7 +1387,7 @@ FUNCTION
SYNOPSIS
asection *bfd_sections_find_if
(bfd *abfd,
- bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
+ bool (*operation) (bfd *abfd, asection *sect, void *obj),
void *obj);
DESCRIPTION
@@ -1405,7 +1403,7 @@ DESCRIPTION
asection *
bfd_sections_find_if (bfd *abfd,
- bfd_boolean (*operation) (bfd *, asection *, void *),
+ bool (*operation) (bfd *, asection *, void *),
void *user_storage)
{
asection *sect;
@@ -1422,7 +1420,7 @@ FUNCTION
bfd_set_section_size
SYNOPSIS
- bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val);
+ bool bfd_set_section_size (asection *sec, bfd_size_type val);
DESCRIPTION
Set @var{sec} to the size @var{val}. If the operation is
@@ -1434,7 +1432,7 @@ DESCRIPTION
*/
-bfd_boolean
+bool
bfd_set_section_size (asection *sec, bfd_size_type val)
{
/* Once you've started writing to any section you cannot create or change
@@ -1443,11 +1441,11 @@ bfd_set_section_size (asection *sec, bfd_size_type val)
if (sec->owner == NULL || sec->owner->output_has_begun)
{
bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
+ return false;
}
sec->size = val;
- return TRUE;
+ return true;
}
/*
@@ -1455,7 +1453,7 @@ FUNCTION
bfd_set_section_contents
SYNOPSIS
- bfd_boolean bfd_set_section_contents
+ bool bfd_set_section_contents
(bfd *abfd, asection *section, const void *data,
file_ptr offset, bfd_size_type count);
@@ -1481,7 +1479,7 @@ DESCRIPTION
*/
-bfd_boolean
+bool
bfd_set_section_contents (bfd *abfd,
sec_ptr section,
const void *location,
@@ -1493,7 +1491,7 @@ bfd_set_section_contents (bfd *abfd,
if (!(bfd_section_flags (section) & SEC_HAS_CONTENTS))
{
bfd_set_error (bfd_error_no_contents);
- return FALSE;
+ return false;
}
sz = section->size;
@@ -1502,13 +1500,13 @@ bfd_set_section_contents (bfd *abfd,
|| count != (size_t) count)
{
bfd_set_error (bfd_error_bad_value);
- return FALSE;
+ return false;
}
if (!bfd_write_p (abfd))
{
bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
+ return false;
}
/* Record a copy of the data in memory if desired. */
@@ -1519,11 +1517,11 @@ bfd_set_section_contents (bfd *abfd,
if (BFD_SEND (abfd, _bfd_set_section_contents,
(abfd, section, location, offset, count)))
{
- abfd->output_has_begun = TRUE;
- return TRUE;
+ abfd->output_has_begun = true;
+ return true;
}
- return FALSE;
+ return false;
}
/*
@@ -1531,7 +1529,7 @@ FUNCTION
bfd_get_section_contents
SYNOPSIS
- bfd_boolean bfd_get_section_contents
+ bool bfd_get_section_contents
(bfd *abfd, asection *section, void *location, file_ptr offset,
bfd_size_type count);
@@ -1548,7 +1546,7 @@ DESCRIPTION
<<FALSE>>.
*/
-bfd_boolean
+bool
bfd_get_section_contents (bfd *abfd,
sec_ptr section,
void *location,
@@ -1560,7 +1558,7 @@ bfd_get_section_contents (bfd *abfd,
if (section->flags & SEC_CONSTRUCTOR)
{
memset (location, 0, (size_t) count);
- return TRUE;
+ return true;
}
if (abfd->direction != write_direction && section->rawsize != 0)
@@ -1572,17 +1570,17 @@ bfd_get_section_contents (bfd *abfd,
|| count != (size_t) count)
{
bfd_set_error (bfd_error_bad_value);
- return FALSE;
+ return false;
}
if (count == 0)
/* Don't bother. */
- return TRUE;
+ return true;
if ((section->flags & SEC_HAS_CONTENTS) == 0)
{
memset (location, 0, (size_t) count);
- return TRUE;
+ return true;
}
if ((section->flags & SEC_IN_MEMORY) != 0)
@@ -1594,11 +1592,11 @@ bfd_get_section_contents (bfd *abfd,
error code. */
section->flags &= ~ SEC_IN_MEMORY;
bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
+ return false;
}
memmove (location, section->contents + offset, (size_t) count);
- return TRUE;
+ return true;
}
return BFD_SEND (abfd, _bfd_get_section_contents,
@@ -1610,7 +1608,7 @@ FUNCTION
bfd_malloc_and_get_section
SYNOPSIS
- bfd_boolean bfd_malloc_and_get_section
+ bool bfd_malloc_and_get_section
(bfd *abfd, asection *section, bfd_byte **buf);
DESCRIPTION
@@ -1618,7 +1616,7 @@ DESCRIPTION
into a buffer, *@var{buf}, malloc'd by this function.
*/
-bfd_boolean
+bool
bfd_malloc_and_get_section (bfd *abfd, sec_ptr sec, bfd_byte **buf)
{
*buf = NULL;
@@ -1629,7 +1627,7 @@ FUNCTION
bfd_copy_private_section_data
SYNOPSIS
- bfd_boolean bfd_copy_private_section_data
+ bool bfd_copy_private_section_data
(bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
DESCRIPTION
@@ -1651,17 +1649,17 @@ FUNCTION
bfd_generic_is_group_section
SYNOPSIS
- bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
+ bool bfd_generic_is_group_section (bfd *, const asection *sec);
DESCRIPTION
Returns TRUE if @var{sec} is a member of a group.
*/
-bfd_boolean
+bool
bfd_generic_is_group_section (bfd *abfd ATTRIBUTE_UNUSED,
const asection *sec ATTRIBUTE_UNUSED)
{
- return FALSE;
+ return false;
}
/*
@@ -1687,20 +1685,20 @@ FUNCTION
bfd_generic_discard_group
SYNOPSIS
- bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
+ bool bfd_generic_discard_group (bfd *abfd, asection *group);
DESCRIPTION
Remove all members of @var{group} from the output.
*/
-bfd_boolean
+bool
bfd_generic_discard_group (bfd *abfd ATTRIBUTE_UNUSED,
asection *group ATTRIBUTE_UNUSED)
{
- return TRUE;
+ return true;
}
-bfd_boolean
+bool
_bfd_nowrite_set_section_contents (bfd *abfd,
sec_ptr section ATTRIBUTE_UNUSED,
const void *location ATTRIBUTE_UNUSED,