Fix formatting

This commit is contained in:
Nick Clifton
2001-08-09 09:09:03 +00:00
parent 1c26dc27b5
commit 55ab10f0ee
3 changed files with 100 additions and 83 deletions

View File

@ -1,3 +1,8 @@
2001-08-09 Nick Clifton <nickc@cambridge.redhat.com>
* bfd.c: Fix formatting.
* bfd-in2.h: Regenerate.
2001-08-09 Nick Clifton <nickc@cambridge.redhat.com> 2001-08-09 Nick Clifton <nickc@cambridge.redhat.com>
* elf32-arc.c (R_ARC_B22_PCREL): Change 'partial_inplace' to * elf32-arc.c (R_ARC_B22_PCREL): Change 'partial_inplace' to

View File

@ -2958,7 +2958,7 @@ bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymb
struct _bfd struct _bfd
{ {
/* The filename the application opened the BFD with. */ /* The filename the application opened the BFD with. */
CONST char *filename; const char *filename;
/* A pointer to the target jump table. */ /* A pointer to the target jump table. */
const struct bfd_target *xvec; const struct bfd_target *xvec;
@ -3141,11 +3141,11 @@ bfd_get_error PARAMS ((void));
void void
bfd_set_error PARAMS ((bfd_error_type error_tag)); bfd_set_error PARAMS ((bfd_error_type error_tag));
CONST char * const char *
bfd_errmsg PARAMS ((bfd_error_type error_tag)); bfd_errmsg PARAMS ((bfd_error_type error_tag));
void void
bfd_perror PARAMS ((CONST char *message)); bfd_perror PARAMS ((const char *message));
typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
@ -3197,7 +3197,7 @@ void
bfd_set_gp_size PARAMS ((bfd *abfd, int i)); bfd_set_gp_size PARAMS ((bfd *abfd, int i));
bfd_vma bfd_vma
bfd_scan_vma PARAMS ((CONST char *string, CONST char **end, int base)); bfd_scan_vma PARAMS ((const char *string, const char **end, int base));
boolean boolean
bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));

170
bfd/bfd.c
View File

@ -37,7 +37,7 @@ CODE_FRAGMENT
.struct _bfd .struct _bfd
.{ .{
. {* The filename the application opened the BFD with. *} . {* The filename the application opened the BFD with. *}
. CONST char *filename; . const char *filename;
. .
. {* A pointer to the target jump table. *} . {* A pointer to the target jump table. *}
. const struct bfd_target *xvec; . const struct bfd_target *xvec;
@ -269,27 +269,28 @@ CODE_FRAGMENT
static bfd_error_type bfd_error = bfd_error_no_error; static bfd_error_type bfd_error = bfd_error_no_error;
CONST char *CONST bfd_errmsgs[] = { const char *const bfd_errmsgs[] =
N_("No error"), {
N_("System call error"), N_("No error"),
N_("Invalid bfd target"), N_("System call error"),
N_("File in wrong format"), N_("Invalid bfd target"),
N_("Invalid operation"), N_("File in wrong format"),
N_("Memory exhausted"), N_("Invalid operation"),
N_("No symbols"), N_("Memory exhausted"),
N_("Archive has no index; run ranlib to add one"), N_("No symbols"),
N_("No more archived files"), N_("Archive has no index; run ranlib to add one"),
N_("Malformed archive"), N_("No more archived files"),
N_("File format not recognized"), N_("Malformed archive"),
N_("File format is ambiguous"), N_("File format not recognized"),
N_("Section has no contents"), N_("File format is ambiguous"),
N_("Nonrepresentable section on output"), N_("Section has no contents"),
N_("Symbol needs debug section which does not exist"), N_("Nonrepresentable section on output"),
N_("Bad value"), N_("Symbol needs debug section which does not exist"),
N_("File truncated"), N_("Bad value"),
N_("File too big"), N_("File truncated"),
N_("#<Invalid error code>") N_("File too big"),
}; N_("#<Invalid error code>")
};
/* /*
FUNCTION FUNCTION
@ -331,14 +332,14 @@ FUNCTION
bfd_errmsg bfd_errmsg
SYNOPSIS SYNOPSIS
CONST char *bfd_errmsg (bfd_error_type error_tag); const char *bfd_errmsg (bfd_error_type error_tag);
DESCRIPTION DESCRIPTION
Return a string describing the error @var{error_tag}, or Return a string describing the error @var{error_tag}, or
the system error if @var{error_tag} is <<bfd_error_system_call>>. the system error if @var{error_tag} is <<bfd_error_system_call>>.
*/ */
CONST char * const char *
bfd_errmsg (error_tag) bfd_errmsg (error_tag)
bfd_error_type error_tag; bfd_error_type error_tag;
{ {
@ -348,8 +349,8 @@ bfd_errmsg (error_tag)
if (error_tag == bfd_error_system_call) if (error_tag == bfd_error_system_call)
return xstrerror (errno); return xstrerror (errno);
if ((((int)error_tag <(int) bfd_error_no_error) || if ((((int) error_tag < (int) bfd_error_no_error) ||
((int)error_tag > (int)bfd_error_invalid_error_code))) ((int) error_tag > (int) bfd_error_invalid_error_code)))
error_tag = bfd_error_invalid_error_code;/* sanity check */ error_tag = bfd_error_invalid_error_code;/* sanity check */
return _(bfd_errmsgs [(int)error_tag]); return _(bfd_errmsgs [(int)error_tag]);
@ -360,7 +361,7 @@ FUNCTION
bfd_perror bfd_perror
SYNOPSIS SYNOPSIS
void bfd_perror (CONST char *message); void bfd_perror (const char *message);
DESCRIPTION DESCRIPTION
Print to the standard error stream a string describing the Print to the standard error stream a string describing the
@ -372,16 +373,18 @@ DESCRIPTION
void void
bfd_perror (message) bfd_perror (message)
CONST char *message; const char *message;
{ {
if (bfd_get_error () == bfd_error_system_call) if (bfd_get_error () == bfd_error_system_call)
perror((char *)message); /* must be system error then... */ /* Must be a system error then. */
else { perror ((char *)message);
if (message == NULL || *message == '\0') else
fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ())); {
else if (message == NULL || *message == '\0')
fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ())); fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
} else
fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ()));
}
} }
/* /*
@ -550,10 +553,11 @@ bfd_get_reloc_upper_bound (abfd, asect)
bfd *abfd; bfd *abfd;
sec_ptr asect; sec_ptr asect;
{ {
if (abfd->format != bfd_object) { if (abfd->format != bfd_object)
bfd_set_error (bfd_error_invalid_operation); {
return -1; bfd_set_error (bfd_error_invalid_operation);
} return -1;
}
return BFD_SEND (abfd, _get_reloc_upper_bound, (abfd, asect)); return BFD_SEND (abfd, _get_reloc_upper_bound, (abfd, asect));
} }
@ -589,10 +593,12 @@ bfd_canonicalize_reloc (abfd, asect, location, symbols)
arelent **location; arelent **location;
asymbol **symbols; asymbol **symbols;
{ {
if (abfd->format != bfd_object) { if (abfd->format != bfd_object)
bfd_set_error (bfd_error_invalid_operation); {
return -1; bfd_set_error (bfd_error_invalid_operation);
} return -1;
}
return BFD_SEND (abfd, _bfd_canonicalize_reloc, return BFD_SEND (abfd, _bfd_canonicalize_reloc,
(abfd, asect, location, symbols)); (abfd, asect, location, symbols));
} }
@ -648,23 +654,26 @@ bfd_set_file_flags (abfd, flags)
bfd *abfd; bfd *abfd;
flagword flags; flagword flags;
{ {
if (abfd->format != bfd_object) { if (abfd->format != bfd_object)
bfd_set_error (bfd_error_wrong_format); {
return false; bfd_set_error (bfd_error_wrong_format);
} return false;
}
if (bfd_read_p (abfd)) { if (bfd_read_p (abfd))
bfd_set_error (bfd_error_invalid_operation); {
return false; bfd_set_error (bfd_error_invalid_operation);
} return false;
}
bfd_get_file_flags (abfd) = flags; bfd_get_file_flags (abfd) = flags;
if ((flags & bfd_applicable_file_flags (abfd)) != flags) { if ((flags & bfd_applicable_file_flags (abfd)) != flags)
bfd_set_error (bfd_error_invalid_operation); {
return false; bfd_set_error (bfd_error_invalid_operation);
} return false;
}
return true; return true;
} }
void void
@ -786,9 +795,9 @@ RETURNS
*/ */
boolean boolean
bfd_set_start_address(abfd, vma) bfd_set_start_address (abfd, vma)
bfd *abfd; bfd *abfd;
bfd_vma vma; bfd_vma vma;
{ {
abfd->start_address = vma; abfd->start_address = vma;
return true; return true;
@ -869,7 +878,7 @@ bfd_get_size (abfd)
return ((struct bfd_in_memory *) abfd->iostream)->size; return ((struct bfd_in_memory *) abfd->iostream)->size;
fp = bfd_cache_lookup (abfd); fp = bfd_cache_lookup (abfd);
if (0 != fstat (fileno (fp), &buf)) if (0 != fstat (fileno (fp), & buf))
return 0; return 0;
return buf.st_size; return buf.st_size;
@ -920,9 +929,10 @@ bfd_set_gp_size (abfd, i)
bfd *abfd; bfd *abfd;
int i; int i;
{ {
/* Don't try to set GP size on an archive or core file! */ /* Don't try to set GP size on an archive or core file! */
if (abfd->format != bfd_object) if (abfd->format != bfd_object)
return; return;
if (abfd->xvec->flavour == bfd_target_ecoff_flavour) if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
ecoff_data (abfd)->gp_size = i; ecoff_data (abfd)->gp_size = i;
else if (abfd->xvec->flavour == bfd_target_elf_flavour) else if (abfd->xvec->flavour == bfd_target_elf_flavour)
@ -937,13 +947,14 @@ bfd_vma
_bfd_get_gp_value (abfd) _bfd_get_gp_value (abfd)
bfd *abfd; bfd *abfd;
{ {
if (abfd->format == bfd_object) if (abfd->format != bfd_object)
{ return 0;
if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
return ecoff_data (abfd)->gp; if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
else if (abfd->xvec->flavour == bfd_target_elf_flavour) return ecoff_data (abfd)->gp;
return elf_gp (abfd); else if (abfd->xvec->flavour == bfd_target_elf_flavour)
} return elf_gp (abfd);
return 0; return 0;
} }
@ -956,6 +967,7 @@ _bfd_set_gp_value (abfd, v)
{ {
if (abfd->format != bfd_object) if (abfd->format != bfd_object)
return; return;
if (abfd->xvec->flavour == bfd_target_ecoff_flavour) if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
ecoff_data (abfd)->gp = v; ecoff_data (abfd)->gp = v;
else if (abfd->xvec->flavour == bfd_target_elf_flavour) else if (abfd->xvec->flavour == bfd_target_elf_flavour)
@ -967,7 +979,7 @@ FUNCTION
bfd_scan_vma bfd_scan_vma
SYNOPSIS SYNOPSIS
bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base); bfd_vma bfd_scan_vma(const char *string, const char **end, int base);
DESCRIPTION DESCRIPTION
Convert, like <<strtoul>>, a numerical expression Convert, like <<strtoul>>, a numerical expression
@ -984,8 +996,8 @@ DESCRIPTION
bfd_vma bfd_vma
bfd_scan_vma (string, end, base) bfd_scan_vma (string, end, base)
CONST char *string; const char *string;
CONST char **end; const char **end;
int base; int base;
{ {
bfd_vma value; bfd_vma value;
@ -1005,17 +1017,18 @@ bfd_scan_vma (string, end, base)
{ {
if ((string[1] == 'x') || (string[1] == 'X')) if ((string[1] == 'x') || (string[1] == 'X'))
base = 16; base = 16;
/* XXX should we also allow "0b" or "0B" to set base to 2? */ /* XXX should we also allow "0b" or "0B" to set base to 2? */
else else
base = 8; base = 8;
} }
else else
base = 10; base = 10;
} }
if ((base == 16) && if ((base == 16) &&
(string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X'))) (string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X')))
string += 2; string += 2;
/* XXX should we also skip over "0b" or "0B" if base is 2? */ /* XXX should we also skip over "0b" or "0B" if base is 2? */
/* Speed could be improved with a table like hex_value[] in gas. */ /* Speed could be improved with a table like hex_value[] in gas. */
#define HEX_VALUE(c) \ #define HEX_VALUE(c) \
@ -1025,13 +1038,11 @@ bfd_scan_vma (string, end, base)
: (10 + c - (islower ((unsigned char) c) ? 'a' : 'A'))) \ : (10 + c - (islower ((unsigned char) c) ? 'a' : 'A'))) \
: 42) : 42)
for (value = 0; (digit = HEX_VALUE(*string)) < base; string++) for (value = 0; (digit = HEX_VALUE (* string)) < base; string ++)
{ value = value * base + digit;
value = value * base + digit;
}
if (end) if (end)
*end = string; * end = string;
return value; return value;
} }
@ -1194,11 +1205,12 @@ bfd_get_relocated_section_contents (abfd, link_info, link_order, data,
if (link_order->type == bfd_indirect_link_order) if (link_order->type == bfd_indirect_link_order)
{ {
abfd2 = link_order->u.indirect.section->owner; abfd2 = link_order->u.indirect.section->owner;
if (abfd2 == 0) if (abfd2 == NULL)
abfd2 = abfd; abfd2 = abfd;
} }
else else
abfd2 = abfd; abfd2 = abfd;
fn = abfd2->xvec->_bfd_get_relocated_section_contents; fn = abfd2->xvec->_bfd_get_relocated_section_contents;
return (*fn) (abfd, link_info, link_order, data, relocateable, symbols); return (*fn) (abfd, link_info, link_order, data, relocateable, symbols);