This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] get rid of K&R style args


From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>

Hi,

$subject, the new style is much shorter.

built crosses to one target per tc-*.c and regtested x86_64-linux-gnu, ok?

Trev

gas/ChangeLog:

2016-03-30  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* cgen.c: Modernize the way functions declare arguments.
	* config/tc-bfin.c: Likewise.
	* config/tc-pdp11.c: Likewise.
	* literal.c: Likewise.
	* read.c: Likewise.
	* stabs.c: Likewise.
---
 gas/cgen.c            | 79 ++++++++++++++-------------------------------------
 gas/config/tc-bfin.c  | 12 ++------
 gas/config/tc-pdp11.c |  4 +--
 gas/literal.c         |  6 +---
 gas/read.c            |  8 ++----
 gas/stabs.c           |  8 ++----
 6 files changed, 30 insertions(+), 87 deletions(-)

diff --git a/gas/cgen.c b/gas/cgen.c
index bf8611f..41eaa55 100644
--- a/gas/cgen.c
+++ b/gas/cgen.c
@@ -57,9 +57,7 @@ CGEN_CPU_DESC gas_cgen_cpu_desc;
    ??? Not currently used.  */
 
 void
-cgen_asm_record_register (name, number)
-     char *name;
-     int number;
+cgen_asm_record_register (char *name, int number)
 {
   /* Use symbol_create here instead of symbol_new so we don't try to
      output registers into the object file's symbol table.  */
@@ -102,10 +100,7 @@ gas_cgen_init_parse ()
 /* Queue a fixup.  */
 
 static void
-queue_fixup (opindex, opinfo, expP)
-     int           opindex;
-     int           opinfo;
-     expressionS * expP;
+queue_fixup (int opindex, int opinfo, expressionS *expP)
 {
   /* We need to generate a fixup for this expression.  */
   if (num_fixups >= GAS_CGEN_MAX_FIXUPS)
@@ -168,8 +163,7 @@ gas_cgen_initialize_saved_fixups_array ()
 }
 
 void
-gas_cgen_save_fixups (i)
-     int i;
+gas_cgen_save_fixups (int i)
 {
   if (i < 0 || i >= MAX_SAVED_FIXUP_CHAINS)
     {
@@ -184,8 +178,7 @@ gas_cgen_save_fixups (i)
 }
 
 void
-gas_cgen_restore_fixups (i)
-     int i;
+gas_cgen_restore_fixups (int i)
 {
   if (i < 0 || i >= MAX_SAVED_FIXUP_CHAINS)
     {
@@ -200,8 +193,7 @@ gas_cgen_restore_fixups (i)
 }
 
 void
-gas_cgen_swap_fixups (i)
-     int i;
+gas_cgen_swap_fixups (int i)
 {
   if (i < 0 || i >= MAX_SAVED_FIXUP_CHAINS)
     {
@@ -247,15 +239,9 @@ gas_cgen_swap_fixups (i)
    operand type.  We pick a BFD reloc type in md_apply_fix.  */
 
 fixS *
-gas_cgen_record_fixup (frag, where, insn, length, operand, opinfo, symbol, offset)
-     fragS *              frag;
-     int                  where;
-     const CGEN_INSN *    insn;
-     int                  length;
-     const CGEN_OPERAND * operand;
-     int                  opinfo;
-     symbolS *            symbol;
-     offsetT              offset;
+gas_cgen_record_fixup (fragS *frag, int where, const CGEN_INSN *insn,
+		       int length, const CGEN_OPERAND *operand, int opinfo,
+		       symbolS *symbol, offsetT offset)
 {
   fixS *fixP;
 
@@ -288,14 +274,9 @@ gas_cgen_record_fixup (frag, where, insn, length, operand, opinfo, symbol, offse
    operand type.  We pick a BFD reloc type in md_apply_fix.  */
 
 fixS *
-gas_cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp)
-     fragS *              frag;
-     int                  where;
-     const CGEN_INSN *    insn;
-     int                  length;
-     const CGEN_OPERAND * operand;
-     int                  opinfo;
-     expressionS *        exp;
+gas_cgen_record_fixup_exp (fragS *frag, int where, const CGEN_INSN *insn,
+			   int length, const CGEN_OPERAND *operand, int opinfo,
+			   expressionS *exp)
 {
   fixS *fixP;
 
@@ -344,19 +325,11 @@ static int expr_jmp_buf_p;
    The resulting value is stored in VALUEP.  */
 
 const char *
-gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP)
-
-#ifdef OBJ_COMPLEX_RELC
-     CGEN_CPU_DESC cd;
-#else
-     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
-#endif
-     enum cgen_parse_operand_type want;
-     const char **strP;
-     int opindex;
-     int opinfo;
-     enum cgen_parse_operand_result *resultP;
-     bfd_vma *valueP;
+gas_cgen_parse_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
+		       	enum cgen_parse_operand_type want, const char **strP,
+		       	int opindex, int opinfo,
+		       	enum cgen_parse_operand_result *resultP,
+		       	bfd_vma *valueP)
 {
 #ifdef __STDC__
   /* These are volatile to survive the setjmp.  */
@@ -525,8 +498,7 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP)
    ??? This could be done differently by adding code to `expression'.  */
 
 void
-gas_cgen_md_operand (expressionP)
-     expressionS *expressionP ATTRIBUTE_UNUSED;
+gas_cgen_md_operand (expressionS *expressionP ATTRIBUTE_UNUSED)
 {
   /* Don't longjmp if we're not called from within cgen_parse_operand().  */
   if (expr_jmp_buf_p)
@@ -541,12 +513,8 @@ gas_cgen_md_operand (expressionP)
    The "result" is stored in RESULT if non-NULL.  */
 
 void
-gas_cgen_finish_insn (insn, buf, length, relax_p, result)
-     const CGEN_INSN *insn;
-     CGEN_INSN_BYTES_PTR buf;
-     unsigned int length;
-     int relax_p;
-     finished_insnS *result;
+gas_cgen_finish_insn (const CGEN_INSN *insn, CGEN_INSN_BYTES_PTR buf,
+		      unsigned int length, int relax_p, finished_insnS *result)
 {
   int i;
   int relax_operand;
@@ -868,10 +836,7 @@ make_right_shifted_expr (expressionS * exp,
    should handle them all.  */
 
 void
-gas_cgen_md_apply_fix (fixP, valP, seg)
-     fixS *   fixP;
-     valueT * valP;
-     segT     seg ATTRIBUTE_UNUSED;
+gas_cgen_md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
 {
   char *where = fixP->fx_frag->fr_literal + fixP->fx_where;
   valueT value = * valP;
@@ -1042,9 +1007,7 @@ gas_cgen_pcrel_r_type (bfd_reloc_code_real_type r)
    FIXME: To what extent can we get all relevant targets to use this?  */
 
 arelent *
-gas_cgen_tc_gen_reloc (section, fixP)
-     asection * section ATTRIBUTE_UNUSED;
-     fixS *     fixP;
+gas_cgen_tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
 {
   bfd_reloc_code_real_type r_type = fixP->fx_r_type;
   arelent *reloc;
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index e14fbe1..be5c3f8 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -791,9 +791,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
 
 /* Round up a section size to the appropriate boundary.  */
 valueT
-md_section_align (segment, size)
-     segT segment;
-     valueT size;
+md_section_align (segT segment, valueT size)
 {
   int boundary = bfd_get_section_alignment (stdoutput, segment);
   return ((size + (1 << boundary) - 1) & -(1 << boundary));
@@ -811,9 +809,7 @@ md_atof (int type, char * litP, int * sizeP)
    then it is done here.  */
 
 arelent *
-tc_gen_reloc (seg, fixp)
-     asection *seg ATTRIBUTE_UNUSED;
-     fixS *fixp;
+tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
 {
   arelent *reloc;
 
@@ -844,9 +840,7 @@ tc_gen_reloc (seg, fixp)
     given a PC relative reloc.  */
 
 long
-md_pcrel_from_section (fixP, sec)
-     fixS *fixP;
-     segT sec;
+md_pcrel_from_section (fixS *fixP, segT sec)
 {
   if (fixP->fx_addsy != (symbolS *) NULL
       && (!S_IS_DEFINED (fixP->fx_addsy)
diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index f144754..d5cd906 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -279,9 +279,7 @@ md_apply_fix (fixS *fixP,
 }
 
 long
-md_chars_to_number (con, nbytes)
-     unsigned char con[];	/* Low order byte 1st.  */
-     int nbytes;		/* Number of bytes in the input.  */
+md_chars_to_number (unsigned char *con, int nbytes)
 {
   /* On a PDP-11, 0x1234 is stored as "\x12\x34", and
      0x12345678 is stored as "\x56\x78\x12\x34". It's
diff --git a/gas/literal.c b/gas/literal.c
index b177296..e2287c1 100644
--- a/gas/literal.c
+++ b/gas/literal.c
@@ -43,11 +43,7 @@
 #ifdef NEED_LITERAL_POOL
 
 valueT
-add_to_literal_pool (sym, addend, sec, size)
-     symbolS *sym;
-     valueT addend;
-     segT sec;
-     int size;
+add_to_literal_pool (symbolS *sym, valueT addend, segT sec, int size)
 {
   segT current_section = now_seg;
   int current_subsec = now_subseg;
diff --git a/gas/read.c b/gas/read.c
index a22c750..45023ca 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -4593,9 +4593,7 @@ emit_expr_fix (expressionS *exp, unsigned int nbytes, fragS *frag, char *p,
    BITFIELD_CONS_EXPRESSIONS.  */
 
 static void
-parse_bitfield_cons (exp, nbytes)
-     expressionS *exp;
-     unsigned int nbytes;
+parse_bitfield_cons (expressionS *exp, unsigned int nbytes)
 {
   unsigned int bits_available = BITS_PER_CHAR * nbytes;
   char *hold = input_line_pointer;
@@ -4780,9 +4778,7 @@ parse_mri_cons (expressionS *exp, unsigned int nbytes)
    To use this for a target, define REPEAT_CONS_EXPRESSIONS.  */
 
 static void
-parse_repeat_cons (exp, nbytes)
-     expressionS *exp;
-     unsigned int nbytes;
+parse_repeat_cons (expressionS *exp, unsigned int nbytes)
 {
   expressionS count;
   int i;
diff --git a/gas/stabs.c b/gas/stabs.c
index c489af0..9503ef7 100644
--- a/gas/stabs.c
+++ b/gas/stabs.c
@@ -134,10 +134,7 @@ get_stab_string_offset (const char *string, const char *stabstr_secname)
 
 /* Here instead of obj-aout.c because other formats use it too.  */
 void
-aout_process_stab (what, string, type, other, desc)
-     int what;
-     const char *string;
-     int type, other, desc;
+aout_process_stab (int what, const char *string, int type, int other, int desc)
 {
   /* Put the stab information in the symbol table.  */
   symbolS *symbol;
@@ -451,8 +448,7 @@ s_xstab (int what)
 /* Frob invented at RMS' request. Set the n_desc of a symbol.  */
 
 void
-s_desc (ignore)
-     int ignore ATTRIBUTE_UNUSED;
+s_desc (int ignore ATTRIBUTE_UNUSED)
 {
   char *name;
   char c;
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]