From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: binutils@sources.redhat.com
Subject: K&R patch for binutils bfd directory
Date: Thu, 24 Oct 2002 16:00:00 -0000 [thread overview]
Message-ID: <200210242300.g9ON0I9s027161@hiauly1.hia.nrc.ca> (raw)
This may be a losing battle but here is the K&R patch for the bfd directory.
I am sure that the addition of simple.c breaks building with the HP bundled
compiler. There are a few changes that may fix real bugs (aoutx.h).
Tested on vax-dec-ultrix4.3.
Ok?
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2002-10-24 John David Anglin <dave@hiauly1.hia.nrc.ca>
* 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.
Index: aoutx.h
===================================================================
RCS file: /cvs/src/src/bfd/aoutx.h,v
retrieving revision 1.35
diff -u -3 -p -r1.35 aoutx.h
--- aoutx.h 2 Sep 2002 05:58:55 -0000 1.35
+++ aoutx.h 24 Oct 2002 19:57:17 -0000
@@ -2261,8 +2261,8 @@ NAME(aout,swap_ext_reloc_in) (abfd, byte
/* 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, byte
}
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, byte
/* 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, byte
/* 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, byte
}
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, callb
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_bf
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_bf
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_bf
/* 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_bf
/* 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_bf
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_bf
}
--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, inpu
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, inpu
}
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, inpu
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, inpu
}
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, inpu
/* 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, inpu
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, inpu
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, inpu
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, inpu
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;
Index: archive.c
===================================================================
RCS file: /cvs/src/src/bfd/archive.c,v
retrieving revision 1.25
diff -u -3 -p -r1.25 archive.c
--- archive.c 21 Oct 2002 01:58:48 -0000 1.25
+++ archive.c 24 Oct 2002 19:57:19 -0000
@@ -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)
Index: bfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in.h,v
retrieving revision 1.52
diff -u -3 -p -r1.52 bfd-in.h
--- bfd-in.h 14 Oct 2002 12:06:03 -0000 1.52
+++ bfd-in.h 24 Oct 2002 19:57:20 -0000
@@ -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)
Index: bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.177
diff -u -3 -p -r1.177 bfd-in2.h
--- bfd-in2.h 14 Oct 2002 12:06:03 -0000 1.177
+++ bfd-in2.h 24 Oct 2002 19:57:24 -0000
@@ -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)
Index: bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.38
diff -u -3 -p -r1.38 bfd.c
--- bfd.c 14 Oct 2002 12:06:03 -0000 1.38
+++ bfd.c 24 Oct 2002 19:57:26 -0000
@@ -1294,10 +1294,10 @@ bfd_record_phdr (abfd, type, flags_valid
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 *));
Index: binary.c
===================================================================
RCS file: /cvs/src/src/bfd/binary.c,v
retrieving revision 1.15
diff -u -3 -p -r1.15 binary.c
--- binary.c 5 Jun 2002 03:43:09 -0000 1.15
+++ binary.c 24 Oct 2002 19:57:26 -0000
@@ -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;
Index: coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.34
diff -u -3 -p -r1.34 coffgen.c
--- coffgen.c 30 Jul 2002 05:49:24 -0000 1.34
+++ coffgen.c 24 Oct 2002 19:57:33 -0000
@@ -2196,7 +2196,7 @@ _bfd_coff_is_local_label_name (abfd, nam
bfd *abfd ATTRIBUTE_UNUSED;
const char *name;
{
- return name[0] == '.' && name[1] == 'L';
+ return (boolean) (name[0] == '.' && name[1] == 'L');
}
/* Provided a BFD, a section and an offset (in bytes, not octets) into the
Index: dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.36
diff -u -3 -p -r1.36 dwarf2.c
--- dwarf2.c 24 Sep 2002 07:11:16 -0000 1.36
+++ dwarf2.c 24 Oct 2002 19:57:35 -0000
@@ -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,
struct dwarf_block *blk;
bfd_size_type amt;
- attr->form = form;
+ attr->form = (enum dwarf_form) form;
switch (form)
{
@@ -908,7 +911,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;
@@ -1645,18 +1649,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
@@ -1714,7 +1718,7 @@ comp_unit_find_nearest_line (unit, addr,
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
Index: format.c
===================================================================
RCS file: /cvs/src/src/bfd/format.c,v
retrieving revision 1.8
diff -u -3 -p -r1.8 format.c
--- format.c 25 Jun 2002 06:21:54 -0000 1.8
+++ format.c 24 Oct 2002 19:57:36 -0000
@@ -132,7 +132,7 @@ bfd_check_format_matches (abfd, format,
}
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;
Index: gen-aout.c
===================================================================
RCS file: /cvs/src/src/bfd/gen-aout.c,v
retrieving revision 1.3
diff -u -3 -p -r1.3 gen-aout.c
--- gen-aout.c 2 Oct 2001 05:58:41 -0000 1.3
+++ gen-aout.c 24 Oct 2002 19:57:36 -0000
@@ -21,6 +21,10 @@ Foundation, Inc., 59 Temple Place - Suit
#include "/usr/include/a.out.h"
#include <stdio.h>
+#ifndef _
+#define _(X) X
+#endif
+
int
main (argc, argv)
int argc; char** argv;
Index: libbfd.c
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.c,v
retrieving revision 1.23
diff -u -3 -p -r1.23 libbfd.c
--- libbfd.c 25 Jun 2002 06:21:54 -0000 1.23
+++ libbfd.c 24 Oct 2002 19:57:37 -0000
@@ -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, n
{
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
Index: libcoff.h
===================================================================
RCS file: /cvs/src/src/bfd/libcoff.h,v
retrieving revision 1.27
diff -u -3 -p -r1.27 libcoff.h
--- libcoff.h 9 Aug 2002 15:38:22 -0000 1.27
+++ libcoff.h 24 Oct 2002 19:57:38 -0000
@@ -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 *));
Index: linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.26
diff -u -3 -p -r1.26 linker.c
--- linker.c 11 Oct 2002 08:33:11 -0000 1.26
+++ linker.c 24 Oct 2002 19:57:52 -0000
@@ -449,7 +449,8 @@ _bfd_link_hash_newfunc (entry, table, st
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, t
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)
Index: merge.c
===================================================================
RCS file: /cvs/src/src/bfd/merge.c,v
retrieving revision 1.13
diff -u -3 -p -r1.13 merge.c
--- merge.c 9 Jul 2002 23:47:22 -0000 1.13
+++ merge.c 24 Oct 2002 19:57:54 -0000
@@ -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++)
{
Index: reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.68
diff -u -3 -p -r1.68 reloc.c
--- reloc.c 11 Oct 2002 14:32:03 -0000 1.68
+++ reloc.c 24 Oct 2002 19:57:58 -0000
@@ -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_conten
/* 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,
Index: section.c
===================================================================
RCS file: /cvs/src/src/bfd/section.c,v
retrieving revision 1.50
diff -u -3 -p -r1.50 section.c
--- section.c 4 Jul 2002 14:40:25 -0000 1.50
+++ section.c 24 Oct 2002 19:57:59 -0000
@@ -643,7 +643,8 @@ bfd_section_hash_newfunc (entry, table,
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,
/* 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,
Index: simple.c
===================================================================
RCS file: /cvs/src/src/bfd/simple.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 simple.c
--- simple.c 11 Oct 2002 13:53:33 -0000 1.1
+++ simple.c 24 Oct 2002 19:58:00 -0000
@@ -24,56 +24,93 @@
#include "libbfd.h"
#include "bfdlink.h"
+static boolean simple_dummy_warning
+ PARAMS ((struct bfd_link_info * ATTRIBUTE_UNUSED,
+ const char * ATTRIBUTE_UNUSED, const char * ATTRIBUTE_UNUSED,
+ bfd * ATTRIBUTE_UNUSED, asection * ATTRIBUTE_UNUSED,
+ bfd_vma ATTRIBUTE_UNUSED));
+
+static boolean simple_dummy_undefined_symbol
+ PARAMS ((struct bfd_link_info * ATTRIBUTE_UNUSED,
+ const char * ATTRIBUTE_UNUSED, bfd * ATTRIBUTE_UNUSED,
+ asection * ATTRIBUTE_UNUSED, bfd_vma ATTRIBUTE_UNUSED,
+ boolean ATTRIBUTE_UNUSED));
+
+static boolean simple_dummy_reloc_overflow
+ PARAMS ((struct bfd_link_info * ATTRIBUTE_UNUSED,
+ const char * ATTRIBUTE_UNUSED, const char * ATTRIBUTE_UNUSED,
+ bfd_vma ATTRIBUTE_UNUSED, bfd * ATTRIBUTE_UNUSED,
+ asection * ATTRIBUTE_UNUSED, bfd_vma ATTRIBUTE_UNUSED));
+
+static boolean simple_dummy_reloc_dangerous
+ PARAMS ((struct bfd_link_info * ATTRIBUTE_UNUSED,
+ const char * ATTRIBUTE_UNUSED, bfd * ATTRIBUTE_UNUSED,
+ asection * ATTRIBUTE_UNUSED, bfd_vma ATTRIBUTE_UNUSED));
+
+static boolean simple_dummy_unattached_reloc
+ PARAMS ((struct bfd_link_info * ATTRIBUTE_UNUSED,
+ const char * ATTRIBUTE_UNUSED, bfd * ATTRIBUTE_UNUSED,
+ asection * ATTRIBUTE_UNUSED, bfd_vma ATTRIBUTE_UNUSED));
+
+bfd_byte * bfd_simple_get_relocated_section_contents
+ PARAMS ((bfd *, asection *, bfd_byte *));
+
static boolean
-simple_dummy_warning (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *warning ATTRIBUTE_UNUSED,
- const char *symbol ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED)
+simple_dummy_warning (link_info, warning, symbol, abfd, section, address)
+ struct bfd_link_info *link_info;
+ const char *warning;
+ const char *symbol;
+ bfd *abfd;
+ asection *section;
+ bfd_vma address;
{
return true;
}
static boolean
-simple_dummy_undefined_symbol (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED,
- boolean fatal ATTRIBUTE_UNUSED)
+simple_dummy_undefined_symbol (link_info, name, abfd, section, address, fatal)
+ struct bfd_link_info *link_info;
+ const char *name;
+ bfd *abfd;
+ asection *section;
+ bfd_vma address;
+ boolean fatal;
{
return true;
}
static boolean
-simple_dummy_reloc_overflow (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED,
- const char *reloc_name ATTRIBUTE_UNUSED,
- bfd_vma addend ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED)
+simple_dummy_reloc_overflow (link_info, name, reloc_name, addend, abfd,
+ section, address)
+ struct bfd_link_info *link_info;
+ const char *name;
+ const char *reloc_name;
+ bfd_vma addend;
+ bfd *abfd;
+ asection *section;
+ bfd_vma address;
{
return true;
}
static boolean
-simple_dummy_reloc_dangerous (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *message ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED)
+simple_dummy_reloc_dangerous (link_info, message, abfd, section, address)
+ struct bfd_link_info *link_info;
+ const char *message;
+ bfd *abfd;
+ asection *section;
+ bfd_vma address;
{
return true;
}
static boolean
-simple_dummy_unattached_reloc (struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED,
- bfd *abfd ATTRIBUTE_UNUSED,
- asection *section ATTRIBUTE_UNUSED,
- bfd_vma address ATTRIBUTE_UNUSED)
+simple_dummy_unattached_reloc (link_info, name, abfd, section, address)
+ struct bfd_link_info *link_info;
+ const char *name;
+ bfd *abfd;
+ asection *section;
+ bfd_vma address;
{
return true;
}
@@ -99,8 +136,10 @@ DESCRIPTION
*/
bfd_byte *
-bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec,
- bfd_byte *outbuf)
+bfd_simple_get_relocated_section_contents (abfd, sec, outbuf)
+ bfd *abfd;
+ asection *sec;
+ bfd_byte *outbuf;
{
struct bfd_link_info link_info;
struct bfd_link_order link_order;
Index: srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.21
diff -u -3 -p -r1.21 srec.c
--- srec.c 30 Jul 2002 05:49:24 -0000 1.21
+++ srec.c 24 Oct 2002 19:58:00 -0000
@@ -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;
Index: stabs.c
===================================================================
RCS file: /cvs/src/src/bfd/stabs.c,v
retrieving revision 1.10
diff -u -3 -p -r1.10 stabs.c
--- stabs.c 6 Jun 2002 09:24:56 -0000 1.10
+++ stabs.c 24 Oct 2002 19:58:01 -0000
@@ -331,7 +331,7 @@ _bfd_link_section_stabs (abfd, psinfo, s
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, s
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, s
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, s
/* 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, s
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, s
}
--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, stabse
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, stabse
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, stabse
BFD_ASSERT (offset != 0);
}
- return (skip > 0);
+ return (boolean) (skip > 0);
error_return:
if (stabbuf != NULL)
Index: syms.c
===================================================================
RCS file: /cvs/src/src/bfd/syms.c,v
retrieving revision 1.25
diff -u -3 -p -r1.25 syms.c
--- syms.c 22 Aug 2002 16:12:00 -0000 1.25
+++ syms.c 24 Oct 2002 19:58:05 -0000
@@ -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 (abf
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 (abf
/* 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 (abf
{
last_stab = stab;
if (stab + STABSIZE >= info->stabs + stabsize
- || *(stab + STABSIZE + TYPEOFF) != N_SO)
+ || *(stab + STABSIZE + TYPEOFF) != (bfd_byte) N_SO)
{
directory_name = NULL;
}
next reply other threads:[~2002-10-24 23:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-24 16:00 John David Anglin [this message]
2002-10-24 16:20 ` Andrew Cagney
2002-10-25 7:32 ` `true' and `false'; Was: " Andrew Cagney
2002-10-24 19:12 ` Alan Modra
2002-10-24 19:35 ` John David Anglin
[not found] <no.id>
2002-10-24 19:42 ` John David Anglin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200210242300.g9ON0I9s027161@hiauly1.hia.nrc.ca \
--to=dave@hiauly1.hia.nrc.ca \
--cc=binutils@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).