From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14209 invoked by alias); 31 May 2005 09:35:11 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 14098 invoked by uid 22791); 31 May 2005 09:34:50 -0000 Received: from lug-owl.de (HELO lug-owl.de) (195.71.106.12) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 31 May 2005 09:34:50 +0000 Received: by lug-owl.de (Postfix, from userid 1001) id 7E2E5F0067; Tue, 31 May 2005 11:34:43 +0200 (CEST) Date: Tue, 31 May 2005 09:41:00 -0000 From: Jan-Benedict Glaw To: binutils@sources.redhat.com Subject: [PATCH] C90fy elf32-vax.c Message-ID: <20050531093443.GS2417@lug-owl.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-Operating-System: Linux mail 2.6.11.10lug-owl X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll User-Agent: Mutt/1.5.9i X-SW-Source: 2005-05/txt/msg00758.txt.bz2 Hi! This is a first patch to shift code away from K&R style. Basically removal of PARAMS() and dropping casts in front of NULL. Regtested targeted for vax-linux, hosted on i686-linux, no new regressions. (Though I need to fix two that showed up earlier this month: the 'dot' and 'purge' tests fail for gas/macro, but that's not yet a real problem.) 2005-05-30 Jan-Benedict Glaw bfd/ * elf32-vax.c (rtype_to_howto): Remove PARAMS. (reloc_type_lookup): Dito. (elf_vax_discard_copies): Dito. (elf_vax_instantiate_got_entries): Dito. (elf_vax_link_hash_traverse): Dito. (elf_vax_link_hash_newfunc): Dito. (elf_vax_link_hash_table_create): Dito. (elf32_vax_set_private_flags): Dito. (elf32_vax_merge_private_bfd_data): Dito. (elf32_vax_print_private_bfd_data): Dito. (elf_vax_check_relocs): Dito. (elf_vax_gc_mark_hook): Dito. (elf_vax_gc_sweep_hook): Dito. (elf_vax_size_dynamic_sections): Dito. (elf_vax_discard_copies): Dito. (elf_vax_instantiate_got_entries): Dito. (elf_vax_relocate_section): Dito. (elf_vax_finish_dynamic_symbol): Dito. (elf_vax_finish_dynamic_sections): Dito. (elf_vax_hash_table): Break-up of line isn't needed. (elf_vax_check_relocs): Remove leading whitespace (elf_vax_relocate_section): Remove redundant whitespace (elf_vax_link_hash_newfunc): Don't cast NULL. (elf_vax_link_hash_table_create): Dito. diff -Nurp src-binutils-fresh/bfd/elf32-vax.c src-binutils-hacked/bfd/elf32= -vax.c --- src-binutils-fresh/bfd/elf32-vax.c 2005-05-05 22:54:46.000000000 +0200 +++ src-binutils-hacked/bfd/elf32-vax.c 2005-05-30 18:31:45.000000000 +0200 @@ -26,42 +26,37 @@ #include "elf-bfd.h" #include "elf/vax.h" =20 -static reloc_howto_type *reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void rtype_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static struct bfd_hash_entry *elf_vax_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)= ); -static struct bfd_link_hash_table *elf_vax_link_hash_table_create - PARAMS ((bfd *)); -static bfd_boolean elf_vax_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static asection *elf_vax_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static bfd_boolean elf_vax_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static bfd_boolean elf_vax_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static bfd_boolean elf_vax_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf_vax_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static bfd_boolean elf_vax_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); -static bfd_boolean elf_vax_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); - -static bfd_boolean elf32_vax_set_private_flags - PARAMS ((bfd *, flagword)); -static bfd_boolean elf32_vax_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); -static bfd_boolean elf32_vax_print_private_bfd_data - PARAMS ((bfd *, PTR)); +static reloc_howto_type *reloc_type_lookup (bfd *, bfd_reloc_code_real_typ= e); +static void rtype_to_howto (bfd *, arelent *, Elf_Internal_Rela *); +static struct bfd_hash_entry *elf_vax_link_hash_newfunc (struct bfd_hash_e= ntry *, + struct bfd_hash_table *, + const char *); +static struct bfd_link_hash_table *elf_vax_link_hash_table_create (bfd *); +static bfd_boolean elf_vax_check_relocs (bfd *, struct bfd_link_info *, + asection *, const Elf_Internal_Rela *); +static asection *elf_vax_gc_mark_hook (asection *, struct bfd_link_info *, + Elf_Internal_Rela *, + struct elf_link_hash_entry *, + Elf_Internal_Sym *); +static bfd_boolean elf_vax_gc_sweep_hook (bfd *, struct bfd_link_info *, + asection *, + const Elf_Internal_Rela *); +static bfd_boolean elf_vax_adjust_dynamic_symbol (struct bfd_link_info *, + struct elf_link_hash_entry *); +static bfd_boolean elf_vax_size_dynamic_sections (bfd *, struct bfd_link_i= nfo *); +static bfd_boolean elf_vax_relocate_section (bfd *, struct bfd_link_info *, + bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, + Elf_Internal_Sym *, asection **); +static bfd_boolean elf_vax_finish_dynamic_symbol (bfd *, struct bfd_link_i= nfo *, + struct elf_link_hash_entry *, + Elf_Internal_Sym *); +static bfd_boolean elf_vax_finish_dynamic_sections (bfd *, + struct bfd_link_info *); + +static bfd_boolean elf32_vax_set_private_flags (bfd *, flagword); +static bfd_boolean elf32_vax_merge_private_bfd_data (bfd *, bfd *); +static bfd_boolean elf32_vax_print_private_bfd_data (bfd *, PTR); =20 static reloc_howto_type howto_table[] =3D { HOWTO (R_VAX_NONE, /* type */ @@ -290,10 +285,8 @@ static reloc_howto_type howto_table[] =3D=20 }; =20 static void -rtype_to_howto (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + Elf_Internal_Rela *dst) { BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_VAX_max); cache_ptr->howto =3D &howto_table[ELF32_R_TYPE(dst->r_info)]; @@ -325,9 +318,7 @@ static const struct }; =20 static reloc_howto_type * -reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type co= de) { unsigned int i; for (i =3D 0; i < sizeof (reloc_map) / sizeof (reloc_map[0]); i++) @@ -414,52 +405,50 @@ struct elf_vax_link_hash_table =20 /* Declare this now that the above structures are defined. */ =20 -static bfd_boolean elf_vax_discard_copies - PARAMS ((struct elf_vax_link_hash_entry *, PTR)); +static bfd_boolean elf_vax_discard_copies (struct elf_vax_link_hash_entry = *, + PTR); =20 /* Declare this now that the above structures are defined. */ =20 -static bfd_boolean elf_vax_instantiate_got_entries - PARAMS ((struct elf_link_hash_entry *, PTR)); +static bfd_boolean elf_vax_instantiate_got_entries (struct elf_link_hash_e= ntry *, + PTR); =20 /* Traverse an VAX ELF linker hash table. */ =20 #define elf_vax_link_hash_traverse(table, func, info) \ (elf_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func),= \ + (bfd_boolean (*) (struct elf_link_hash_entry *, PTR)) (func), \ (info))) =20 /* Get the VAX ELF linker hash table from a link_info structure. */ =20 -#define elf_vax_hash_table(p) \ - ((struct elf_vax_link_hash_table *) (p)->hash) +#define elf_vax_hash_table(p) ((struct elf_vax_link_hash_table *) (p)->has= h) =20 /* Create an entry in an VAX ELF linker hash table. */ =20 static struct bfd_hash_entry * -elf_vax_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +elf_vax_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { struct elf_vax_link_hash_entry *ret =3D (struct elf_vax_link_hash_entry *) entry; =20 /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret =3D=3D (struct elf_vax_link_hash_entry *) NULL) + if (ret =3D=3D NULL) ret =3D ((struct elf_vax_link_hash_entry *) bfd_hash_allocate (table, sizeof (struct elf_vax_link_hash_entry))); - if (ret =3D=3D (struct elf_vax_link_hash_entry *) NULL) + if (ret =3D=3D NULL) return (struct bfd_hash_entry *) ret; =20 /* Call the allocation method of the superclass. */ ret =3D ((struct elf_vax_link_hash_entry *) _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - if (ret !=3D (struct elf_vax_link_hash_entry *) NULL) + if (ret !=3D NULL) { ret->pcrel_relocs_copied =3D NULL; } @@ -470,14 +459,13 @@ elf_vax_link_hash_newfunc (entry, table, /* Create an VAX ELF linker hash table. */ =20 static struct bfd_link_hash_table * -elf_vax_link_hash_table_create (abfd) - bfd *abfd; +elf_vax_link_hash_table_create (bfd *abfd) { struct elf_vax_link_hash_table *ret; bfd_size_type amt =3D sizeof (struct elf_vax_link_hash_table); =20 - ret =3D (struct elf_vax_link_hash_table *) bfd_malloc (amt); - if (ret =3D=3D (struct elf_vax_link_hash_table *) NULL) + ret =3D bfd_malloc (amt); + if (ret =3D=3D NULL) return NULL; =20 if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, @@ -492,9 +480,7 @@ elf_vax_link_hash_table_create (abfd) =20 /* Keep vax-specific flags in the ELF header */ static bfd_boolean -elf32_vax_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; +elf32_vax_set_private_flags (bfd *abfd, flagword flags) { elf_elfheader (abfd)->e_flags =3D flags; elf_flags_init (abfd) =3D TRUE; @@ -504,9 +490,7 @@ elf32_vax_set_private_flags (abfd, flags /* Merge backend specific data from an object file to the output object file when linking. */ static bfd_boolean -elf32_vax_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +elf32_vax_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { flagword out_flags; flagword in_flags; @@ -529,9 +513,7 @@ elf32_vax_merge_private_bfd_data (ibfd,=20 =20 /* Display the flags field */ static bfd_boolean -elf32_vax_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; +elf32_vax_print_private_bfd_data (bfd *abfd, PTR ptr) { FILE *file =3D (FILE *) ptr; =20 @@ -563,11 +545,8 @@ elf32_vax_print_private_bfd_data (abfd,=20 table. */ =20 static bfd_boolean -elf_vax_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, + const Elf_Internal_Rela *relocs) { bfd *dynobj; Elf_Internal_Shdr *symtab_hdr; @@ -786,8 +765,8 @@ elf_vax_check_relocs (abfd, info, sec, r which means that h is really a pointer to an elf_vax_link_hash_entry. */ if ((ELF32_R_TYPE (rel->r_info) =3D=3D R_VAX_PC8 - || ELF32_R_TYPE (rel->r_info) =3D=3D R_VAX_PC16 - || ELF32_R_TYPE (rel->r_info) =3D=3D R_VAX_PC32) + || ELF32_R_TYPE (rel->r_info) =3D=3D R_VAX_PC16 + || ELF32_R_TYPE (rel->r_info) =3D=3D R_VAX_PC32) && info->symbolic) { struct elf_vax_link_hash_entry *eh; @@ -843,12 +822,11 @@ elf_vax_check_relocs (abfd, info, sec, r relocation. */ =20 static asection * -elf_vax_gc_mark_hook (sec, info, rel, h, sym) - asection *sec; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; +elf_vax_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { if (h !=3D NULL) { @@ -882,11 +860,8 @@ elf_vax_gc_mark_hook (sec, info, rel, h, /* Update the got entry reference counts for the section being removed. */ =20 static bfd_boolean -elf_vax_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +elf_vax_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, asection *se= c, + const Elf_Internal_Rela *relocs) { Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; @@ -1128,9 +1103,7 @@ elf_vax_adjust_dynamic_symbol (info, h) /* Set the sizes of the dynamic sections. */ =20 static bfd_boolean -elf_vax_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) { bfd *dynobj; asection *s; @@ -1177,7 +1150,7 @@ elf_vax_size_dynamic_sections (output_bf if (info->shared && info->symbolic) elf_vax_link_hash_traverse (elf_vax_hash_table (info), elf_vax_discard_copies, - (PTR) NULL); + NULL); =20 /* If this is a -Bsymbolic shared link or a static link, we need to discard all the got entries we've recorded. Otherwise, we need to @@ -1334,9 +1307,8 @@ elf_vax_size_dynamic_sections (output_bf routine, but we won't fill them in in the relocate_section routine. */ =20 static bfd_boolean -elf_vax_discard_copies (h, ignore) - struct elf_vax_link_hash_entry *h; - PTR ignore ATTRIBUTE_UNUSED; +elf_vax_discard_copies (struct elf_vax_link_hash_entry *h, + PTR ignore ATTRIBUTE_UNUSED) { struct elf_vax_pcrel_relocs_copied *s; =20 @@ -1361,9 +1333,7 @@ elf_vax_discard_copies (h, ignore) will be reserved for the symbol. */ =20 static bfd_boolean -elf_vax_instantiate_got_entries (h, infoptr) - struct elf_link_hash_entry *h; - PTR infoptr; +elf_vax_instantiate_got_entries (struct elf_link_hash_entry *h, PTR infopt= r) { struct bfd_link_info *info =3D (struct bfd_link_info *) infoptr; bfd *dynobj; @@ -1409,16 +1379,14 @@ elf_vax_instantiate_got_entries (h, info /* Relocate an VAX ELF section. */ =20 static bfd_boolean -elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; +elf_vax_relocate_section (bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) { bfd *dynobj; Elf_Internal_Shdr *symtab_hdr; @@ -1487,7 +1455,7 @@ elf_vax_relocate_section (output_bfd, in r_symndx, symtab_hdr, sym_hashes, h, sec, relocation, unresolved_reloc, warned); -=09=20=20=20 + if ((h->root.type =3D=3D bfd_link_hash_defined || h->root.type =3D=3D bfd_link_hash_defweak) && ((r_type =3D=3D R_VAX_PLT32 @@ -1842,11 +1810,9 @@ elf_vax_relocate_section (output_bfd, in dynamic sections here. */ =20 static bfd_boolean -elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym) - bfd *output_bfd; - struct bfd_link_info *info; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; +elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { bfd *dynobj; =20 @@ -1997,9 +1963,7 @@ elf_vax_finish_dynamic_symbol (output_bf /* Finish up the dynamic sections. */ =20 static bfd_boolean -elf_vax_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *in= fo) { bfd *dynobj; asection *sgot; --=20 Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 = _ O _ "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg = _ _ O fuer einen Freien Staat voll Freier B=C3=BCrger" | im Internet! | im Ira= k! O O O ret =3D do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA)= );