From aa1c2ca808a267a5a3c372de5461c1f67f9a8869 Mon Sep 17 00:00:00 2001
From: Chih-Hung Hsieh <chh@google.com>
Date: Fri, 4 Sep 2015 12:04:11 -0700
Subject: [PATCH 1/4] Replace some K&R function definitions with ansi-C
 definitions.

Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 backends/ChangeLog      | 16 ++++++++++++++++
 backends/aarch64_init.c |  9 ++++-----
 backends/alpha_init.c   |  9 ++++-----
 backends/arm_init.c     |  9 ++++-----
 backends/i386_init.c    |  9 ++++-----
 backends/ia64_init.c    |  9 ++++-----
 backends/ppc64_init.c   |  9 ++++-----
 backends/ppc_init.c     |  9 ++++-----
 backends/s390_init.c    |  9 ++++-----
 backends/sh_init.c      |  9 ++++-----
 backends/sparc_init.c   |  9 ++++-----
 backends/tilegx_init.c  |  9 ++++-----
 backends/x86_64_init.c  |  9 ++++-----
 libasm/ChangeLog        |  7 +++++++
 libasm/asm_addint8.c    |  4 +---
 libasm/asm_adduint8.c   |  4 +---
 libasm/asm_begin.c      |  5 +----
 libdw/ChangeLog         |  6 ++++++
 libdw/dwarf_next_cfi.c  | 13 ++++++-------
 libdw/libdw_findcu.c    |  9 ++-------
 libebl/ChangeLog        |  6 ++++++
 libebl/eblopenbackend.c |  3 +--
 libebl/eblstother.c     |  4 +---
 23 files changed, 96 insertions(+), 89 deletions(-)

diff --git a/backends/ChangeLog b/backends/ChangeLog
index 4accedc..2059d86 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,19 @@
+2015-09-04  Chih-Hung Hsieh  <chh@google.com>
+
+	* aarch64_init.c (aarch64_init): Replace K&R function definition
+	with ansi-C definitions.
+	* alpha_init.c (alpha_init): Likewise.
+	* arm_init.c (arm_init): Likewise.
+	* i386_init.c (i386_init): Likewise.
+	* ia64_init.c (ia64_init): Likewise.
+	* ppc64_init.c (ppc64_init): Likewise.
+	* ppc_init.c (ppc_init): Likewise.
+	* s390_init.c (s390_init): Likewise.
+	* sh_init.c (sh_init): Likewise.
+	* sparc_init.c (sparc_init): Likewise.
+	* tilegx_init.c (tilegx_init): Likewise.
+	* x86_64_init.c (x86_64_init): Likewise.
+
 2015-09-03  Mark Wielaard  <mjw@redhat.com>
 
 	* sparc_regs.c (sparc_register_info): Use ebl->class not ebl->machine.
diff --git a/backends/aarch64_init.c b/backends/aarch64_init.c
index b0fd17a..6395f11 100644
--- a/backends/aarch64_init.c
+++ b/backends/aarch64_init.c
@@ -39,11 +39,10 @@
 
 
 const char *
-aarch64_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+aarch64_init (Elf *elf __attribute__ ((unused)),
+	      GElf_Half machine __attribute__ ((unused)),
+	      Ebl *eh,
+	      size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/alpha_init.c b/backends/alpha_init.c
index a3307d8..25c5b32 100644
--- a/backends/alpha_init.c
+++ b/backends/alpha_init.c
@@ -40,11 +40,10 @@
 
 
 const char *
-alpha_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+alpha_init (Elf *elf __attribute__ ((unused)),
+	    GElf_Half machine __attribute__ ((unused)),
+	    Ebl *eh,
+	    size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/arm_init.c b/backends/arm_init.c
index f3e5f0a..caadac6 100644
--- a/backends/arm_init.c
+++ b/backends/arm_init.c
@@ -40,11 +40,10 @@
 
 
 const char *
-arm_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+arm_init (Elf *elf __attribute__ ((unused)),
+	  GElf_Half machine __attribute__ ((unused)),
+	  Ebl *eh,
+	  size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/i386_init.c b/backends/i386_init.c
index 1e0b486..515d5ac 100644
--- a/backends/i386_init.c
+++ b/backends/i386_init.c
@@ -39,11 +39,10 @@
 #include "common-reloc.c"
 
 const char *
-i386_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+i386_init (Elf *elf __attribute__ ((unused)),
+	   GElf_Half machine __attribute__ ((unused)),
+	   Ebl *eh,
+	   size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/ia64_init.c b/backends/ia64_init.c
index 91da748..7241d7b 100644
--- a/backends/ia64_init.c
+++ b/backends/ia64_init.c
@@ -39,11 +39,10 @@
 #include "common-reloc.c"
 
 const char *
-ia64_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+ia64_init (Elf *elf __attribute__ ((unused)),
+	   GElf_Half machine __attribute__ ((unused)),
+	   Ebl *eh,
+	   size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c
index 56e1828..2ba8232 100644
--- a/backends/ppc64_init.c
+++ b/backends/ppc64_init.c
@@ -42,11 +42,10 @@
 
 
 const char *
-ppc64_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+ppc64_init (Elf *elf __attribute__ ((unused)),
+	    GElf_Half machine __attribute__ ((unused)),
+	    Ebl *eh,
+	    size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/ppc_init.c b/backends/ppc_init.c
index ad92765..c3e3ca3 100644
--- a/backends/ppc_init.c
+++ b/backends/ppc_init.c
@@ -40,11 +40,10 @@
 
 
 const char *
-ppc_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+ppc_init (Elf *elf __attribute__ ((unused)),
+	  GElf_Half machine __attribute__ ((unused)),
+	  Ebl *eh,
+	  size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/s390_init.c b/backends/s390_init.c
index 26b20b4..ba8df45 100644
--- a/backends/s390_init.c
+++ b/backends/s390_init.c
@@ -41,11 +41,10 @@ extern __typeof (s390_core_note) s390x_core_note;
 
 
 const char *
-s390_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+s390_init (Elf *elf __attribute__ ((unused)),
+	   GElf_Half machine __attribute__ ((unused)),
+	   Ebl *eh,
+	   size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/sh_init.c b/backends/sh_init.c
index 90ddcb2..5526aca 100644
--- a/backends/sh_init.c
+++ b/backends/sh_init.c
@@ -40,11 +40,10 @@
 
 
 const char *
-sh_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+sh_init (Elf *elf __attribute__ ((unused)),
+	 GElf_Half machine __attribute__ ((unused)),
+	 Ebl *eh,
+	 size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/sparc_init.c b/backends/sparc_init.c
index 7d22998..18d7349 100644
--- a/backends/sparc_init.c
+++ b/backends/sparc_init.c
@@ -40,11 +40,10 @@
 extern __typeof (EBLHOOK (core_note)) sparc64_core_note attribute_hidden;
 
 const char *
-sparc_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+sparc_init (Elf *elf __attribute__ ((unused)),
+	    GElf_Half machine __attribute__ ((unused)),
+	    Ebl *eh,
+	    size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/tilegx_init.c b/backends/tilegx_init.c
index 858798b..162ed36 100644
--- a/backends/tilegx_init.c
+++ b/backends/tilegx_init.c
@@ -38,11 +38,10 @@
 #include "common-reloc.c"
 
 const char *
-tilegx_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+tilegx_init (Elf *elf __attribute__ ((unused)),
+	     GElf_Half machine __attribute__ ((unused)),
+	     Ebl *eh,
+	     size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/backends/x86_64_init.c b/backends/x86_64_init.c
index 273eabb..cfd0158 100644
--- a/backends/x86_64_init.c
+++ b/backends/x86_64_init.c
@@ -42,11 +42,10 @@
 extern __typeof (EBLHOOK (core_note)) x32_core_note attribute_hidden;
 
 const char *
-x86_64_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+x86_64_init (Elf *elf __attribute__ ((unused)),
+	     GElf_Half machine __attribute__ ((unused)),
+	     Ebl *eh,
+	     size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
diff --git a/libasm/ChangeLog b/libasm/ChangeLog
index 9b25af9..91338d0 100644
--- a/libasm/ChangeLog
+++ b/libasm/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-04  Chih-Hung Hsieh  <chh@google.com>
+
+	* asm_addint8.c (FCT): Replace K&R function definition
+	with ansi-C definitions.
+	* asm_adduint8.c (UFCT): Likewise.
+	* asm_begin.c (asm_begin): Likewise.
+
 2014-12-18  Ulrich Drepper  <drepper@gmail.com>
 
 	* Makefile.am: Suppress output of textrel_check command.
diff --git a/libasm/asm_addint8.c b/libasm/asm_addint8.c
index ec05b8d..bb7d40f 100644
--- a/libasm/asm_addint8.c
+++ b/libasm/asm_addint8.c
@@ -51,9 +51,7 @@
 
 
 int
-FCT(SIZE) (asmscn, num)
-     AsmScn_t *asmscn;
-     TYPE(SIZE) num;
+FCT(SIZE) (AsmScn_t *asmscn, TYPE(SIZE) num)
 {
   if (asmscn == NULL)
     return -1;
diff --git a/libasm/asm_adduint8.c b/libasm/asm_adduint8.c
index 30641b8..18b67dd 100644
--- a/libasm/asm_adduint8.c
+++ b/libasm/asm_adduint8.c
@@ -48,9 +48,7 @@
 
 
 int
-UFCT(SIZE) (asmscn, num)
-     AsmScn_t *asmscn;
-     UTYPE(SIZE) num;
+UFCT(SIZE) (AsmScn_t *asmscn, UTYPE(SIZE) num)
 {
   return INTUSE(FCT(SIZE)) (asmscn, (TYPE(SIZE)) num);
 }
diff --git a/libasm/asm_begin.c b/libasm/asm_begin.c
index 48842d3..ff4d94c 100644
--- a/libasm/asm_begin.c
+++ b/libasm/asm_begin.c
@@ -127,10 +127,7 @@ prepare_binary_output (AsmCtx_t *result, Ebl *ebl)
 
 
 AsmCtx_t *
-asm_begin (fname, ebl, textp)
-     const char *fname;
-     Ebl *ebl;
-     bool textp;
+asm_begin (const char *fname, Ebl *ebl, bool textp)
 {
   if (fname == NULL && ! textp)
     return NULL;
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 315ad70..63910ba 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-04  Chih-Hung Hsieh  <chh@google.com>
+
+	* libdw_findcu.c (__libdw_intern_next_unit): Replace K&R function
+	definition with ansi-C definitions.
+	(__libdw_findcu): Likewise.
+
 2015-08-25  Mark Wielaard  <mjw@redhat.com>
 
 	* dwarf.h: Add DW_LANG_Haskell.
diff --git a/libdw/dwarf_next_cfi.c b/libdw/dwarf_next_cfi.c
index b5af49e..53fc369 100644
--- a/libdw/dwarf_next_cfi.c
+++ b/libdw/dwarf_next_cfi.c
@@ -37,13 +37,12 @@
 
 
 int
-dwarf_next_cfi (e_ident, data, eh_frame_p, off, next_off, entry)
-     const unsigned char e_ident[];
-     Elf_Data *data;
-     bool eh_frame_p;
-     Dwarf_Off off;
-     Dwarf_Off *next_off;
-     Dwarf_CFI_Entry *entry;
+dwarf_next_cfi (const unsigned char e_ident[],
+		Elf_Data *data,
+		bool eh_frame_p,
+		Dwarf_Off off,
+		Dwarf_Off *next_off,
+		Dwarf_CFI_Entry *entry)
 {
   /* Dummy struct for memory-access.h macros.  */
   BYTE_ORDER_DUMMY (dw, e_ident);
diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c
index d8da2e3..5c03843 100644
--- a/libdw/libdw_findcu.c
+++ b/libdw/libdw_findcu.c
@@ -63,9 +63,7 @@ findcu_cb (const void *arg1, const void *arg2)
 
 struct Dwarf_CU *
 internal_function
-__libdw_intern_next_unit (dbg, debug_types)
-     Dwarf *dbg;
-     bool debug_types;
+__libdw_intern_next_unit (Dwarf *dbg, bool debug_types)
 {
   Dwarf_Off *const offsetp
     = debug_types ? &dbg->next_tu_offset : &dbg->next_cu_offset;
@@ -135,10 +133,7 @@ __libdw_intern_next_unit (dbg, debug_types)
 }
 
 struct Dwarf_CU *
-__libdw_findcu (dbg, start, debug_types)
-     Dwarf *dbg;
-     Dwarf_Off start;
-     bool debug_types;
+__libdw_findcu (Dwarf *dbg, Dwarf_Off start, bool debug_types)
 {
   void **tree = debug_types ? &dbg->tu_tree : &dbg->cu_tree;
   Dwarf_Off *next_offset
diff --git a/libebl/ChangeLog b/libebl/ChangeLog
index 4305cf6..60ae566 100644
--- a/libebl/ChangeLog
+++ b/libebl/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-04  Chih-Hung Hsieh  <chh@google.com>
+
+	* eblopenbackend.c (ebl_openbackend_machine): Replace K&R function
+	definition with ansi-C definitions.
+	* eblstother.c (ebl_check_st_other_bits): Likewise.
+
 2015-06-12  Mark Wielaard  <mjw@redhat.com>
 
 	* eblcheckreloctargettype.c (ebl_check_reloc_target_type): Allow
diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
index 2766e7b..02b24d3 100644
--- a/libebl/eblopenbackend.c
+++ b/libebl/eblopenbackend.c
@@ -418,8 +418,7 @@ ebl_openbackend (elf)
 
 /* Find backend without underlying ELF file.  */
 Ebl *
-ebl_openbackend_machine (machine)
-     GElf_Half machine;
+ebl_openbackend_machine (GElf_Half machine)
 {
   return openbackend (NULL, NULL, machine);
 }
diff --git a/libebl/eblstother.c b/libebl/eblstother.c
index ccbf138..273f6fc 100644
--- a/libebl/eblstother.c
+++ b/libebl/eblstother.c
@@ -34,9 +34,7 @@
 
 
 bool
-ebl_check_st_other_bits (ebl, st_other)
-     Ebl *ebl;
-     unsigned char st_other;
+ebl_check_st_other_bits (Ebl *ebl, unsigned char st_other)
 {
   return ((st_other ^ GELF_ST_VISIBILITY (st_other)) == 0
 	  || ebl->check_st_other_bits (st_other ^ GELF_ST_VISIBILITY (st_other)));
-- 
1.8.3.1

