From d45913a06f533285d66d3b10132d0b70dc872782 Mon Sep 17 00:00:00 2001 From: Dave Anglin Date: Fri, 25 Oct 2002 02:45:54 +0000 Subject: [PATCH] * aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to unsigned int. (NAME(aout,final_link)): Cast enum used in assignment. (aout_link_write_symbols): Cast enums in comparisons, int values to boolean, enums in assignments to int. (aout_link_input_section_std): Cast rel->r_index to unsigned int. (aout_link_input_section_ext): Likewise. Cast enums used in comparisons with unsigned ints. (aout_link_reloc_link_order): Cast enum to int in assignment. * archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr calls to char *. * bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in assignment. * bfd-in2.h (bfd_set_section_vma): Likewise. * bfd.c (bfd_record_phdr): Cast enums in assignments. * binary.c (bfd_alloc): Cast enum to long. * coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean. * dwarf2.c (read_abbrevs): Add casts to enum types. (read_attribute_value): Likewise. (arange_add): Cast result of bfd_zalloc call. (comp_unit_contains_address): Return true and false. (comp_unit_find_nearest_line): Cast return to boolean. * format.c (bfd_check_format_matches, bfd_set_format): Likewise. * gen-aout.c: define macro '_' if not defined. * libbfd.c (bfd_realloc): Cast malloc and realloc to PTR. (bfd_bwrite): Cast bfd_realloc to bfd_byte *. (bfd_write_bigendian_4byte_int): Cast return to boolean. (bfd_seek): Cast bfd_realloc to bfd_byte *. (bfd_generic_is_local_label_name): Cast return to boolean. * libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'. * linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to struct bfd_hash_entry *. (_bfd_generic_link_hash_newfunc): likewise. (_bfd_generic_final_link): Cast enum to unsigned int. * merge.c (sec_merge_emit): Cast return to boolean. (merge_strings): Add casts to const unsigned char *. * reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int. (bfd_generic_get_relocated_section_content): Cast enum to unsigned int. * section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result to struct bfd_hash_entry *. (bfd_set_section_content): Add cast to PTR in comparison. * simple.c (simple_dummy_warning, simple_dummy_undefined_symbol, simple_dummy_reloc_overflow, simple_dummy_reloc_dangerous, simple_dummy_unattached_reloc, bfd_simple_get_relocated_section_contents): Add K&R declarations and function definitions. * srec.c (S3Forced): Initialize to false. (srec_get_symtab): Cast return value from bfd_alloc to asymbol *. * stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons. (_bfd_discard_section_stabs): Likewise. Also cast return to boolean. * syms.c (bfd_is_undefined_symclass): Cast return to boolean. (_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in comparisons. --- bfd/ChangeLog | 57 ++++++++++++++++++++++++++++++++ bfd/aoutx.h | 88 +++++++++++++++++++++++++------------------------- bfd/archive.c | 6 ++-- bfd/bfd-in.h | 2 +- bfd/bfd-in2.h | 2 +- bfd/bfd.c | 8 ++--- bfd/binary.c | 2 +- bfd/dwarf2.c | 22 +++++++------ bfd/format.c | 4 +-- bfd/gen-aout.c | 4 +++ bfd/libbfd.c | 12 +++---- bfd/libcoff.h | 2 +- bfd/linker.c | 9 +++--- bfd/merge.c | 6 ++-- bfd/reloc.c | 4 +-- bfd/section.c | 5 +-- bfd/srec.c | 4 +-- bfd/stabs.c | 20 ++++++------ bfd/syms.c | 10 +++--- 19 files changed, 167 insertions(+), 100 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index af84d2f1ee6..07288b81513 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,60 @@ +2002-10-24 John David Anglin + + * aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to + unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to + unsigned int. + (NAME(aout,final_link)): Cast enum used in assignment. + (aout_link_write_symbols): Cast enums in comparisons, int values to + boolean, enums in assignments to int. + (aout_link_input_section_std): Cast rel->r_index to unsigned int. + (aout_link_input_section_ext): Likewise. Cast enums used in comparisons + with unsigned ints. + (aout_link_reloc_link_order): Cast enum to int in assignment. + * archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr + calls to char *. + * bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in + assignment. + * bfd-in2.h (bfd_set_section_vma): Likewise. + * bfd.c (bfd_record_phdr): Cast enums in assignments. + * binary.c (bfd_alloc): Cast enum to long. + * coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean. + * dwarf2.c (read_abbrevs): Add casts to enum types. + (read_attribute_value): Likewise. + (arange_add): Cast result of bfd_zalloc call. + (comp_unit_contains_address): Return true and false. + (comp_unit_find_nearest_line): Cast return to boolean. + * format.c (bfd_check_format_matches, bfd_set_format): Likewise. + * gen-aout.c: define macro '_' if not defined. + * libbfd.c (bfd_realloc): Cast malloc and realloc to PTR. + (bfd_bwrite): Cast bfd_realloc to bfd_byte *. + (bfd_write_bigendian_4byte_int): Cast return to boolean. + (bfd_seek): Cast bfd_realloc to bfd_byte *. + (bfd_generic_is_local_label_name): Cast return to boolean. + * libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'. + * linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to + struct bfd_hash_entry *. + (_bfd_generic_link_hash_newfunc): likewise. + (_bfd_generic_final_link): Cast enum to unsigned int. + * merge.c (sec_merge_emit): Cast return to boolean. + (merge_strings): Add casts to const unsigned char *. + * reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int. + (bfd_generic_get_relocated_section_content): Cast enum to unsigned int. + * section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result to + struct bfd_hash_entry *. + (bfd_set_section_content): Add cast to PTR in comparison. + * simple.c (simple_dummy_warning, simple_dummy_undefined_symbol, + simple_dummy_reloc_overflow, simple_dummy_reloc_dangerous, + simple_dummy_unattached_reloc, + bfd_simple_get_relocated_section_contents): Add K&R declarations and + function definitions. + * srec.c (S3Forced): Initialize to false. + (srec_get_symtab): Cast return value from bfd_alloc to asymbol *. + * stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons. + (_bfd_discard_section_stabs): Likewise. Also cast return to boolean. + * syms.c (bfd_is_undefined_symclass): Cast return to boolean. + (_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in + comparisons. + 2002-10-23 Jakub Jelinek * elf64-alpha.c (elf64_alpha_check_relocs): Only put maybe_dynamic diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 7fa334ab48f..107772dfc32 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -2261,8 +2261,8 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) /* Now the fun stuff. */ if (bfd_header_big_endian (abfd)) { - r_index = ((bytes->r_index[0] << 16) - | (bytes->r_index[1] << 8) + r_index = (((unsigned int) bytes->r_index[0] << 16) + | ((unsigned int) bytes->r_index[1] << 8) | bytes->r_index[2]); r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) @@ -2270,8 +2270,8 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) } else { - r_index = ((bytes->r_index[2] << 16) - | (bytes->r_index[1] << 8) + r_index = (((unsigned int) bytes->r_index[2] << 16) + | ((unsigned int) bytes->r_index[1] << 8) | bytes->r_index[0]); r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) @@ -2283,9 +2283,9 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) /* Base relative relocs are always against the symbol table, regardless of the setting of r_extern. r_extern just reflects whether the symbol the reloc is against is local or global. */ - if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + if (r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) r_extern = 1; if (r_extern && r_index > symcount) @@ -2320,8 +2320,8 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) /* Now the fun stuff. */ if (bfd_header_big_endian (abfd)) { - r_index = ((bytes->r_index[0] << 16) - | (bytes->r_index[1] << 8) + r_index = (((unsigned int) bytes->r_index[0] << 16) + | ((unsigned int) bytes->r_index[1] << 8) | bytes->r_index[2]); r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); @@ -2333,8 +2333,8 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) } else { - r_index = ((bytes->r_index[2] << 16) - | (bytes->r_index[1] << 8) + r_index = (((unsigned int) bytes->r_index[2] << 16) + | ((unsigned int) bytes->r_index[1] << 8) | bytes->r_index[0]); r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); @@ -3891,7 +3891,7 @@ NAME(aout,final_link) (abfd, info, callback) for (p = o->link_order_head; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order) - p->u.indirect.section->linker_mark = true; + p->u.indirect.section->linker_mark = (unsigned int) true; } } @@ -4440,7 +4440,7 @@ aout_link_write_symbols (finfo, input_bfd) characters in the symbol names, not including the file numbers in types (the first number after an open parenthesis). */ - if (type == N_BINCL) + if (type == (int) N_BINCL) { struct external_nlist *incl_sym; int nest; @@ -4454,13 +4454,13 @@ aout_link_write_symbols (finfo, input_bfd) int incl_type; incl_type = H_GET_8 (input_bfd, incl_sym->e_type); - if (incl_type == N_EINCL) + if (incl_type == (int) N_EINCL) { if (nest == 0) break; --nest; } - else if (incl_type == N_BINCL) + else if (incl_type == (int) N_BINCL) ++nest; else if (nest == 0) { @@ -4485,7 +4485,7 @@ aout_link_write_symbols (finfo, input_bfd) /* If we have already included a header file with the same value, then replace this one with an N_EXCL symbol. */ - copy = ! finfo->info->keep_memory; + copy = (boolean) (! finfo->info->keep_memory); incl_entry = aout_link_includes_lookup (&finfo->includes, name, true, copy); if (incl_entry == NULL) @@ -4513,7 +4513,7 @@ aout_link_write_symbols (finfo, input_bfd) /* This is a duplicate header file. We must change it to be an N_EXCL entry, and mark all the included symbols to prevent outputting them. */ - type = N_EXCL; + type = (int) N_EXCL; nest = 0; for (incl_sym = sym + 1, incl_map = symbol_map + 1; @@ -4523,7 +4523,7 @@ aout_link_write_symbols (finfo, input_bfd) int incl_type; incl_type = H_GET_8 (input_bfd, incl_sym->e_type); - if (incl_type == N_EINCL) + if (incl_type == (int) N_EINCL) { if (nest == 0) { @@ -4532,7 +4532,7 @@ aout_link_write_symbols (finfo, input_bfd) } --nest; } - else if (incl_type == N_BINCL) + else if (incl_type == (int) N_BINCL) ++nest; else if (nest == 0) *incl_map = -1; @@ -4887,8 +4887,8 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, if (bfd_header_big_endian (input_bfd)) { - r_index = ((rel->r_index[0] << 16) - | (rel->r_index[1] << 8) + r_index = (((unsigned int) rel->r_index[0] << 16) + | ((unsigned int) rel->r_index[1] << 8) | rel->r_index[2]); r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); @@ -4900,8 +4900,8 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, } else { - r_index = ((rel->r_index[2] << 16) - | (rel->r_index[1] << 8) + r_index = (((unsigned int) rel->r_index[2] << 16) + | ((unsigned int) rel->r_index[1] << 8) | rel->r_index[0]); r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); @@ -5223,8 +5223,8 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, if (bfd_header_big_endian (input_bfd)) { - r_index = ((rel->r_index[0] << 16) - | (rel->r_index[1] << 8) + r_index = (((unsigned int) rel->r_index[0] << 16) + | ((unsigned int) rel->r_index[1] << 8) | rel->r_index[2]); r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) @@ -5232,8 +5232,8 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, } else { - r_index = ((rel->r_index[2] << 16) - | (rel->r_index[1] << 8) + r_index = (((unsigned int) rel->r_index[2] << 16) + | ((unsigned int) rel->r_index[1] << 8) | rel->r_index[0]); r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) @@ -5249,16 +5249,16 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, /* We are generating a relocateable output file, and must modify the reloc accordingly. */ if (r_extern - || r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + || r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) { /* If we know the symbol this relocation is against, convert it into a relocation against a section. This is what the native linker does. */ - if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + if (r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) h = NULL; else h = sym_hashes[r_index]; @@ -5426,9 +5426,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, relocation = 0; } } - else if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + else if (r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) { struct external_nlist *sym; int type; @@ -5510,9 +5510,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, to skip this reloc. */ if (hundef && ! finfo->info->shared - && r_type != RELOC_BASE10 - && r_type != RELOC_BASE13 - && r_type != RELOC_BASE22) + && r_type != (unsigned int) RELOC_BASE10 + && r_type != (unsigned int) RELOC_BASE13 + && r_type != (unsigned int) RELOC_BASE22) { const char *name; @@ -5526,7 +5526,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, return false; } - if (r_type != RELOC_SPARC_REV32) + if (r_type != (unsigned int) RELOC_SPARC_REV32) r = MY_final_link_relocate (howto_table_ext + r_type, input_bfd, input_section, contents, r_addr, relocation, @@ -5555,9 +5555,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, if (h != NULL) name = h->root.root.string; else if (r_extern - || r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + || r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); else @@ -5673,7 +5673,7 @@ aout_link_reloc_link_order (finfo, o, p) int r_relative; int r_length; - r_pcrel = howto->pc_relative; + r_pcrel = (int) howto->pc_relative; r_baserel = (howto->type & 8) != 0; r_jmptable = (howto->type & 16) != 0; r_relative = (howto->type & 32) != 0; diff --git a/bfd/archive.c b/bfd/archive.c index c2b1dda0a51..bfbd6de116c 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -436,12 +436,12 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) spaces, so only look for ' ' if we don't find '/'. */ char *e; - e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd)); + e = (char *) memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd)); if (e == NULL) { - e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd)); + e = (char *) memchr (hdr.ar_name, '/', ar_maxnamelen (abfd)); if (e == NULL) - e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd)); + e = (char *) memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd)); } if (e != NULL) diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 5741f641d8e..f41e3fbf69d 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -345,7 +345,7 @@ typedef struct sec *sec_ptr; #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) -#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (boolean)true), true) +#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)true), true) #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true) #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true) diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 2b00e86dc6a..018a0fd292c 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -351,7 +351,7 @@ typedef struct sec *sec_ptr; #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) -#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (boolean)true), true) +#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)true), true) #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true) #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true) diff --git a/bfd/bfd.c b/bfd/bfd.c index bfcb95a69ab..bf451621657 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -1294,10 +1294,10 @@ bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at, m->p_type = type; m->p_flags = flags; m->p_paddr = at; - m->p_flags_valid = flags_valid; - m->p_paddr_valid = at_valid; - m->includes_filehdr = includes_filehdr; - m->includes_phdrs = includes_phdrs; + m->p_flags_valid = (unsigned int) flags_valid; + m->p_paddr_valid = (unsigned int) at_valid; + m->includes_filehdr = (unsigned int) includes_filehdr; + m->includes_phdrs = (unsigned int) includes_phdrs; m->count = count; if (count > 0) memcpy (m->sections, secs, count * sizeof (asection *)); diff --git a/bfd/binary.c b/bfd/binary.c index fc972b22d13..7bddabf5fa8 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -185,7 +185,7 @@ binary_get_symtab (abfd, alocation) syms = (asymbol *) bfd_alloc (abfd, amt); if (syms == NULL) - return false; + return (long) false; /* Start symbol. */ syms[0].the_bfd = abfd; diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index c03737f614d..063982662bc 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -578,7 +578,8 @@ read_abbrevs (abfd, offset, stash) /* Read in abbrev header. */ cur_abbrev->number = abbrev_number; - cur_abbrev->tag = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); + cur_abbrev->tag = (enum dwarf_tag) + read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr); abbrev_ptr += 1; @@ -601,8 +602,10 @@ read_abbrevs (abfd, offset, stash) return 0; } - cur_abbrev->attrs[cur_abbrev->num_attrs].name = abbrev_name; - cur_abbrev->attrs[cur_abbrev->num_attrs++].form = abbrev_form; + cur_abbrev->attrs[cur_abbrev->num_attrs].name + = (enum dwarf_attribute) abbrev_name; + cur_abbrev->attrs[cur_abbrev->num_attrs++].form + = (enum dwarf_form) abbrev_form; abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); @@ -646,7 +649,7 @@ read_attribute_value (attr, form, unit, info_ptr) struct dwarf_block *blk; bfd_size_type amt; - attr->form = form; + attr->form = (enum dwarf_form) form; switch (form) { @@ -977,7 +980,8 @@ arange_add (unit, low_pc, high_pc) } /* Need to allocate a new arange and insert it into the arange list. */ - arange = bfd_zalloc (unit->abfd, (bfd_size_type) sizeof (*arange)); + arange = (struct arange *) + bfd_zalloc (unit->abfd, (bfd_size_type) sizeof (*arange)); arange->low = low_pc; arange->high = high_pc; @@ -1733,18 +1737,18 @@ comp_unit_contains_address (unit, addr) struct arange *arange; if (unit->error) - return 0; + return false; arange = &unit->arange; do { if (addr >= arange->low && addr < arange->high) - return 1; + return true; arange = arange->next; } while (arange); - return 0; + return false; } /* If UNIT contains ADDR, set the output parameters to the values for @@ -1802,7 +1806,7 @@ comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr, line_p = lookup_address_in_line_info_table (unit->line_table, addr, function, filename_ptr, linenumber_ptr); - return line_p || func_p; + return (boolean) (line_p || func_p); } /* Locate a section in a BFD containing debugging info. The search starts diff --git a/bfd/format.c b/bfd/format.c index 1efa9e24547..ef6b46edfb8 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -132,7 +132,7 @@ bfd_check_format_matches (abfd, format, matching) } if (abfd->format != bfd_unknown) - return abfd->format == format; + return (boolean) (abfd->format == format); /* Since the target type was defaulted, check them all in the hope that one will be uniquely recognized. */ @@ -355,7 +355,7 @@ bfd_set_format (abfd, format) } if (abfd->format != bfd_unknown) - return abfd->format == format; + return (boolean) (abfd->format == format); /* Presume the answer is yes. */ abfd->format = format; diff --git a/bfd/gen-aout.c b/bfd/gen-aout.c index 1bba14adb5b..b6720e87dc9 100644 --- a/bfd/gen-aout.c +++ b/bfd/gen-aout.c @@ -21,6 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "/usr/include/a.out.h" #include +#ifndef _ +#define _(X) X +#endif + int main (argc, argv) int argc; char** argv; diff --git a/bfd/libbfd.c b/bfd/libbfd.c index 29170a0d561..f21abbcd6ce 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -186,9 +186,9 @@ bfd_realloc (ptr, size) } if (ptr == NULL) - ret = malloc ((size_t) size); + ret = (PTR) malloc ((size_t) size); else - ret = realloc (ptr, (size_t) size); + ret = (PTR) realloc (ptr, (size_t) size); if (ret == NULL && (size_t) size != 0) bfd_set_error (bfd_error_no_memory); @@ -562,7 +562,7 @@ bfd_bwrite (ptr, size, abfd) newsize = (bim->size + 127) & ~(bfd_size_type) 127; if (newsize > oldsize) { - bim->buffer = bfd_realloc (bim->buffer, newsize); + bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer, newsize); if (bim->buffer == 0) { bim->size = 0; @@ -608,7 +608,7 @@ bfd_write_bigendian_4byte_int (abfd, i) { bfd_byte buffer[4]; bfd_putb32 ((bfd_vma) i, buffer); - return bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4; + return (boolean) (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4); } bfd_vma @@ -706,7 +706,7 @@ bfd_seek (abfd, position, direction) newsize = (bim->size + 127) & ~(bfd_size_type) 127; if (newsize > oldsize) { - bim->buffer = bfd_realloc (bim->buffer, newsize); + bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer, newsize); if (bim->buffer == 0) { bim->size = 0; @@ -1414,7 +1414,7 @@ bfd_generic_is_local_label_name (abfd, name) { char locals_prefix = (bfd_get_symbol_leading_char (abfd) == '_') ? 'L' : '.'; - return (name[0] == locals_prefix); + return (boolean) (name[0] == locals_prefix); } /* Can be used from / for bfd_merge_private_bfd_data to check that diff --git a/bfd/libcoff.h b/bfd/libcoff.h index 88b09098296..ea9c5700b1f 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -784,7 +784,7 @@ typedef struct struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); - boolean (*_bfd_coff_adjust_symndx)\ + boolean (*_bfd_coff_adjust_symndx) PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, struct internal_reloc *, boolean *)); diff --git a/bfd/linker.c b/bfd/linker.c index e44ac6c6c9d..a5ded1f5883 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -449,7 +449,8 @@ _bfd_link_hash_newfunc (entry, table, string) subclass. */ if (entry == NULL) { - entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)); + entry = (struct bfd_hash_entry *) + bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)); if (entry == NULL) return entry; } @@ -645,8 +646,8 @@ _bfd_generic_link_hash_newfunc (entry, table, string) subclass. */ if (entry == NULL) { - entry = bfd_hash_allocate (table, - sizeof (struct generic_link_hash_entry)); + entry = (struct bfd_hash_entry *) + bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry)); if (entry == NULL) return entry; } @@ -2019,7 +2020,7 @@ _bfd_generic_final_link (abfd, info) for (o = abfd->sections; o != NULL; o = o->next) for (p = o->link_order_head; p != NULL; p = p->next) if (p->type == bfd_indirect_link_order) - p->u.indirect.section->linker_mark = true; + p->u.indirect.section->linker_mark = (unsigned int) true; /* Build the output symbol table. */ for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) diff --git a/bfd/merge.c b/bfd/merge.c index ce61207251f..9dc2e708344 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -353,7 +353,7 @@ sec_merge_emit (abfd, entry) if (alignment_power) free (pad); - return entry == NULL || entry->secinfo != secinfo; + return (boolean) (entry == NULL || entry->secinfo != secinfo); } /* This function is called for each input file from the add_symbols @@ -667,7 +667,7 @@ merge_strings (sinfo) break; if (e->len > 4 * e->u.entsize) { - s = e->root.string + e->len - e->u.entsize; + s = (const unsigned char *) (e->root.string + e->len - e->u.entsize); hash = 0; for (i = 0; i < 4 * e->u.entsize; i++) { @@ -690,7 +690,7 @@ merge_strings (sinfo) else *p = (PTR) e; } - s = e->root.string + e->len - e->u.entsize; + s = (const unsigned char *) (e->root.string + e->len - e->u.entsize); hash = 0; for (i = 0; i < e->u.entsize; i++) { diff --git a/bfd/reloc.c b/bfd/reloc.c index 23e49342c87..b13f6722c1a 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -3701,7 +3701,7 @@ const char * bfd_get_reloc_code_name (code) bfd_reloc_code_real_type code; { - if (code > BFD_RELOC_UNUSED) + if ((int) code > (int) BFD_RELOC_UNUSED) return 0; return bfd_reloc_code_real_names[(int)code]; } @@ -3829,7 +3829,7 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, /* We're not relaxing the section, so just copy the size info. */ input_section->_cooked_size = input_section->_raw_size; - input_section->reloc_done = true; + input_section->reloc_done = (unsigned int) true; reloc_count = bfd_canonicalize_reloc (input_bfd, input_section, diff --git a/bfd/section.c b/bfd/section.c index 51b21c70fbb..b5871e9bbfa 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -643,7 +643,8 @@ bfd_section_hash_newfunc (entry, table, string) subclass. */ if (entry == NULL) { - entry = bfd_hash_allocate (table, sizeof (struct section_hash_entry)); + entry = (struct bfd_hash_entry *) + bfd_hash_allocate (table, sizeof (struct section_hash_entry)); if (entry == NULL) return entry; } @@ -1186,7 +1187,7 @@ bfd_set_section_contents (abfd, section, location, offset, count) /* Record a copy of the data in memory if desired. */ if (section->contents - && location != section->contents + offset) + && location != (PTR) (section->contents + offset)) memcpy (section->contents + offset, location, (size_t) count); if (BFD_SEND (abfd, _bfd_set_section_contents, diff --git a/bfd/srec.c b/bfd/srec.c index 129b2ba4bb5..6c29fa16881 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -181,7 +181,7 @@ unsigned int Chunk = DEFAULT_CHUNK; /* The type of srec output (free or forced to S3). This variable can be modified by objcopy's --srec-forceS3 parameter. */ -boolean S3Forced = 0; +boolean S3Forced = false; /* When writing an S-record file, the S-records can not be output as they are seen. This structure is used to hold them in memory. */ @@ -1203,7 +1203,7 @@ srec_get_symtab (abfd, alocation) csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol)); if (csymbols == NULL && symcount != 0) - return false; + return (long) false; abfd->tdata.srec_data->csymbols = csymbols; for (s = abfd->tdata.srec_data->symbols, c = csymbols; diff --git a/bfd/stabs.c b/bfd/stabs.c index e225d9cd60d..0cb37412983 100644 --- a/bfd/stabs.c +++ b/bfd/stabs.c @@ -331,7 +331,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) symbol, ignoring nesting, adding up all the characters in the symbol names, not including the file numbers in types (the first number after an open parenthesis). */ - if (type == N_BINCL) + if (type == (int) N_BINCL) { bfd_vma val; int nest; @@ -351,13 +351,13 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) incl_type = incl_sym[TYPEOFF]; if (incl_type == 0) break; - else if (incl_type == N_EINCL) + else if (incl_type == (int) N_EINCL) { if (nest == 0) break; --nest; } - else if (incl_type == N_BINCL) + else if (incl_type == (int) N_BINCL) ++nest; else if (nest == 0) { @@ -400,7 +400,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) goto error_return; ne->offset = sym - stabbuf; ne->val = val; - ne->type = N_BINCL; + ne->type = (int) N_BINCL; ne->next = secinfo->excls; secinfo->excls = ne; @@ -422,7 +422,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) /* We have seen this header file before. Tell the final pass to change the type to N_EXCL. */ - ne->type = N_EXCL; + ne->type = (int) N_EXCL; /* Mark the skipped symbols. */ @@ -435,7 +435,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) incl_type = incl_sym[TYPEOFF]; - if (incl_type == N_EINCL) + if (incl_type == (int) N_EINCL) { if (nest == 0) { @@ -445,7 +445,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) } --nest; } - else if (incl_type == N_BINCL) + else if (incl_type == (int) N_BINCL) ++nest; else if (nest == 0) { @@ -597,7 +597,7 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, type = sym[TYPEOFF]; - if (type == N_FUN) + if (type == (int) N_FUN) { int strx = bfd_get_32 (abfd, sym + STRDXOFF); @@ -624,7 +624,7 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, else if (deleting == -1) { /* Outside of a function. Check for deleted variables. */ - if (type == N_STSYM || type == N_LCSYM) + if (type == (int) N_STSYM || type == (int) N_LCSYM) if ((*reloc_symbol_deleted_p) (sym + VALOFF - stabbuf, cookie)) { *pstridx = -1; @@ -674,7 +674,7 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, BFD_ASSERT (offset != 0); } - return (skip > 0); + return (boolean) (skip > 0); error_return: if (stabbuf != NULL) diff --git a/bfd/syms.c b/bfd/syms.c index 6eea2d807df..b135726c334 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -713,7 +713,7 @@ boolean bfd_is_undefined_symclass (symclass) int symclass; { - return symclass == 'U' || symclass == 'w' || symclass == 'v'; + return (boolean) (symclass == 'U' || symclass == 'w' || symclass == 'v'); } /* @@ -1070,7 +1070,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, saw_fun = 1; for (stab = info->stabs; stab < info->stabs + stabsize; stab += STABSIZE) { - if (stab[TYPEOFF] == N_SO) + if (stab[TYPEOFF] == (bfd_byte) N_SO) { /* N_SO with null name indicates EOF */ if (bfd_get_32 (abfd, stab + STRDXOFF) == 0) @@ -1084,12 +1084,12 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, /* two N_SO's in a row is a filename and directory. Skip */ if (stab + STABSIZE < info->stabs + stabsize - && *(stab + STABSIZE + TYPEOFF) == N_SO) + && *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO) { stab += STABSIZE; } } - else if (stab[TYPEOFF] == N_FUN) + else if (stab[TYPEOFF] == (bfd_byte) N_FUN) { saw_fun = 1; ++info->indextablesize; @@ -1158,7 +1158,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, { last_stab = stab; if (stab + STABSIZE >= info->stabs + stabsize - || *(stab + STABSIZE + TYPEOFF) != N_SO) + || *(stab + STABSIZE + TYPEOFF) != (bfd_byte) N_SO) { directory_name = NULL; } -- 2.30.2