From ff1e783f277ce5218d9a5a26c7a68cb8bad43e62 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Fri, 25 Mar 2005 11:50:53 +0000 Subject: [PATCH] * config/tc-mmix.c, config/tc-mmix.h: Convert to ISO C90. --- gas/ChangeLog | 4 + gas/config/tc-mmix.c | 188 +++++++++++++++---------------------------- gas/config/tc-mmix.h | 34 ++++---- 3 files changed, 86 insertions(+), 140 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 6e0c4885ff..cb2713a0dd 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2005-03-25 Hans-Peter Nilsson + + * config/tc-mmix.c, config/tc-mmix.h: Convert to ISO C90. + 2005-03-25 Hans-Peter Nilsson * config/tc-cris.h: Convert to ISO C90. diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index 600f02122c..f4a95f1634 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -47,27 +47,25 @@ enum mmix_fixup_action mmix_fixup_register_or_adjust_for_byte }; -static int get_spec_regno PARAMS ((char *)); -static int get_operands PARAMS ((int, char *, expressionS[])); -static int get_putget_operands - PARAMS ((struct mmix_opcode *, char *, expressionS[])); -static void s_prefix PARAMS ((int)); -static void s_greg PARAMS ((int)); -static void s_loc PARAMS ((int)); -static void s_bspec PARAMS ((int)); -static void s_espec PARAMS ((int)); -static void mmix_s_local PARAMS ((int)); -static void mmix_greg_internal PARAMS ((char *)); -static void mmix_set_geta_branch_offset PARAMS ((char *, offsetT value)); -static void mmix_set_jmp_offset PARAMS ((char *, offsetT)); -static void mmix_fill_nops PARAMS ((char *, int)); -static int cmp_greg_symbol_fixes PARAMS ((const PTR, const PTR)); -static int cmp_greg_val_greg_symbol_fixes - PARAMS ((const PTR p1, const PTR p2)); -static void mmix_handle_rest_of_empty_line PARAMS ((void)); -static void mmix_discard_rest_of_line PARAMS ((void)); -static void mmix_byte PARAMS ((void)); -static void mmix_cons PARAMS ((int)); +static int get_spec_regno (char *); +static int get_operands (int, char *, expressionS *); +static int get_putget_operands (struct mmix_opcode *, char *, expressionS *); +static void s_prefix (int); +static void s_greg (int); +static void s_loc (int); +static void s_bspec (int); +static void s_espec (int); +static void mmix_s_local (int); +static void mmix_greg_internal (char *); +static void mmix_set_geta_branch_offset (char *, offsetT); +static void mmix_set_jmp_offset (char *, offsetT); +static void mmix_fill_nops (char *, int); +static int cmp_greg_symbol_fixes (const void *, const void *); +static int cmp_greg_val_greg_symbol_fixes (const void *, const void *); +static void mmix_handle_rest_of_empty_line (void); +static void mmix_discard_rest_of_line (void); +static void mmix_byte (void); +static void mmix_cons (int); /* Continue the tradition of symbols.c; use control characters to enforce magic. These are used when replacing e.g. 8F and 8B so we can handle @@ -399,9 +397,7 @@ const char mmix_flt_chars[] = "rf"; /* Fill in the offset-related part of GETA or Bcc. */ static void -mmix_set_geta_branch_offset (opcodep, value) - char *opcodep; - offsetT value; +mmix_set_geta_branch_offset (char *opcodep, offsetT value) { if (value < 0) { @@ -416,9 +412,7 @@ mmix_set_geta_branch_offset (opcodep, value) /* Fill in the offset-related part of JMP. */ static void -mmix_set_jmp_offset (opcodep, value) - char *opcodep; - offsetT value; +mmix_set_jmp_offset (char *opcodep, offsetT value) { if (value < 0) { @@ -433,9 +427,7 @@ mmix_set_jmp_offset (opcodep, value) /* Fill in NOP:s for the expanded part of GETA/JMP/Bcc/PUSHJ. */ static void -mmix_fill_nops (opcodep, n) - char *opcodep; - int n; +mmix_fill_nops (char *opcodep, int n) { int i; @@ -446,9 +438,7 @@ mmix_fill_nops (opcodep, n) /* See macro md_parse_name in tc-mmix.h. */ int -mmix_current_location (fn, exp) - void (*fn) PARAMS ((expressionS *)); - expressionS *exp; +mmix_current_location (void (*fn) (expressionS *), expressionS *exp) { (*fn) (exp); @@ -459,10 +449,7 @@ mmix_current_location (fn, exp) General idea and code stolen from the tic80 port. */ static int -get_operands (max_operands, s, exp) - int max_operands; - char *s; - expressionS exp[]; +get_operands (int max_operands, char *s, expressionS *exp) { char *p = s; int numexp = 0; @@ -528,8 +515,7 @@ get_operands (max_operands, s, exp) one. NAME is a null-terminated string. */ static int -get_spec_regno (name) - char *name; +get_spec_regno (char *name) { int i; @@ -551,10 +537,8 @@ get_spec_regno (name) /* For GET and PUT, parse the register names "manually", so we don't use user labels. */ static int -get_putget_operands (insn, operands, exp) - struct mmix_opcode *insn; - char *operands; - expressionS exp[]; +get_putget_operands (struct mmix_opcode *insn, char *operands, + expressionS *exp) { expressionS *expp_reg; expressionS *expp_sreg; @@ -648,9 +632,7 @@ get_putget_operands (insn, operands, exp) /* Handle MMIX-specific option. */ int -md_parse_option (c, arg) - int c; - char *arg ATTRIBUTE_UNUSED; +md_parse_option (int c, char *arg ATTRIBUTE_UNUSED) { switch (c) { @@ -707,8 +689,7 @@ md_parse_option (c, arg) /* Display MMIX-specific help text. */ void -md_show_usage (stream) - FILE * stream; +md_show_usage (FILE * stream) { fprintf (stream, _(" MMIX-specific command line options:\n")); fprintf (stream, _("\ @@ -741,7 +722,7 @@ md_show_usage (stream) /* Step to end of line, but don't step over the end of the line. */ static void -mmix_discard_rest_of_line () +mmix_discard_rest_of_line (void) { while (*input_line_pointer && (! is_end_of_line[(unsigned char) *input_line_pointer] @@ -754,7 +735,7 @@ mmix_discard_rest_of_line () delimiter). */ static void -mmix_handle_rest_of_empty_line () +mmix_handle_rest_of_empty_line (void) { if (mmix_gnu_syntax) demand_empty_rest_of_line (); @@ -768,7 +749,7 @@ mmix_handle_rest_of_empty_line () /* Initialize GAS MMIX specifics. */ void -mmix_md_begin () +mmix_md_begin (void) { int i; const struct mmix_opcode *opcode; @@ -827,8 +808,7 @@ mmix_md_begin () /* Assemble one insn in STR. */ void -md_assemble (str) - char *str; +md_assemble (char *str) { char *operands = str; char modified_char = 0; @@ -1909,8 +1889,7 @@ md_assemble (str) tc_unrecognized_line too, through this function. */ int -mmix_assemble_return_nonzero (str) - char *str; +mmix_assemble_return_nonzero (char *str) { int last_error_count = had_errors (); char *s2 = str; @@ -1939,8 +1918,7 @@ mmix_assemble_return_nonzero (str) /* The PREFIX pseudo. */ static void -s_prefix (unused) - int unused ATTRIBUTE_UNUSED; +s_prefix (int unused ATTRIBUTE_UNUSED) { char *p; int c; @@ -1982,8 +1960,7 @@ s_prefix (unused) that. (It might be worth a rewrite for other reasons, though). */ char * -mmix_prefix_name (shortname) - char *shortname; +mmix_prefix_name (char *shortname) { if (*shortname == ':') return shortname + 1; @@ -2007,8 +1984,7 @@ mmix_prefix_name (shortname) be persistent, perhaps allocated on an obstack. */ static void -mmix_greg_internal (label) - char *label; +mmix_greg_internal (char *label) { expressionS *expP = &mmix_raw_gregs[n_of_raw_gregs].exp; @@ -2044,8 +2020,7 @@ mmix_greg_internal (label) /* The ".greg label,expr" worker. */ static void -s_greg (unused) - int unused ATTRIBUTE_UNUSED; +s_greg (int unused ATTRIBUTE_UNUSED) { char *p; char c; @@ -2074,8 +2049,7 @@ s_greg (unused) /* The "BSPEC expr" worker. */ static void -s_bspec (unused) - int unused ATTRIBUTE_UNUSED; +s_bspec (int unused ATTRIBUTE_UNUSED) { asection *expsec; asection *sec; @@ -2140,8 +2114,7 @@ s_bspec (unused) /* The "ESPEC" worker. */ static void -s_espec (unused) - int unused ATTRIBUTE_UNUSED; +s_espec (int unused ATTRIBUTE_UNUSED) { /* First, check that we *do* have a BSPEC in progress. */ if (! doing_bspec) @@ -2164,8 +2137,7 @@ s_espec (unused) Implementing this by means of contents in a section lost. */ static void -mmix_s_local (unused) - int unused ATTRIBUTE_UNUSED; +mmix_s_local (int unused ATTRIBUTE_UNUSED) { expressionS exp; @@ -2195,9 +2167,7 @@ mmix_s_local (unused) function may be called multiple times. */ int -md_estimate_size_before_relax (fragP, segment) - fragS *fragP; - segT segment; +md_estimate_size_before_relax (fragS *fragP, segT segment) { int length; @@ -2268,10 +2238,7 @@ md_estimate_size_before_relax (fragP, segment) OK. */ char * -md_atof (type, litP, sizeP) - int type; - char *litP; - int *sizeP; +md_atof (int type, char *litP, int *sizeP) { int prec; LITTLENUM_TYPE words[4]; @@ -2314,10 +2281,8 @@ md_atof (type, litP, sizeP) /* Convert variable-sized frags into one or more fixups. */ void -md_convert_frag (abfd, sec, fragP) - bfd *abfd ATTRIBUTE_UNUSED; - segT sec ATTRIBUTE_UNUSED; - fragS *fragP; +md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, + fragS *fragP) { /* Pointer to first byte in variable-sized part of the frag. */ char *var_partp; @@ -2448,10 +2413,7 @@ md_convert_frag (abfd, sec, fragP) Note that this function isn't called when linkrelax != 0. */ void -md_apply_fix3 (fixP, valP, segment) - fixS * fixP; - valueT * valP; - segT segment; +md_apply_fix3 (fixS *fixP, valueT *valP, segT segment) { char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; /* Note: use offsetT because it is signed, valueT is unsigned. */ @@ -2625,9 +2587,7 @@ md_apply_fix3 (fixP, valP, segment) definitions. */ static int -cmp_greg_val_greg_symbol_fixes (p1, p2) - const PTR p1; - const PTR p2; +cmp_greg_val_greg_symbol_fixes (const void *p1, const void *p2) { offsetT val1 = *(offsetT *) p1; offsetT val2 = ((struct mmix_symbol_greg_fixes *) p2)->offs; @@ -2644,9 +2604,7 @@ cmp_greg_val_greg_symbol_fixes (p1, p2) /* Generate a machine-dependent relocation. */ arelent * -tc_gen_reloc (section, fixP) - asection *section ATTRIBUTE_UNUSED; - fixS *fixP; +tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) { bfd_signed_vma val = fixP->fx_offset @@ -2940,7 +2898,7 @@ tc_gen_reloc (section, fixP) ugly labels_without_colons etc. */ void -mmix_handle_mmixal () +mmix_handle_mmixal (void) { char *s0 = input_line_pointer; char *s; @@ -3251,8 +3209,7 @@ mmix_handle_mmixal () We fill in the label as an expression. */ void -mmix_fb_label (expP) - expressionS *expP; +mmix_fb_label (expressionS *expP) { symbolS *sym; char *fb_internal_name; @@ -3301,8 +3258,7 @@ mmix_fb_label (expP) relaxing. */ int -mmix_force_relocation (fixP) - fixS *fixP; +mmix_force_relocation (fixS *fixP) { if (fixP->fx_r_type == BFD_RELOC_MMIX_LOCAL || fixP->fx_r_type == BFD_RELOC_MMIX_BASE_PLUS_OFFSET) @@ -3325,9 +3281,7 @@ mmix_force_relocation (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) @@ -3345,7 +3299,7 @@ md_pcrel_from_section (fixP, sec) register section. */ void -mmix_adjust_symtab () +mmix_adjust_symtab (void) { symbolS *sym; symbolS *regsec = section_symbol (reg_section); @@ -3375,7 +3329,7 @@ mmix_adjust_symtab () thought at the time I first wrote this. */ int -mmix_label_without_colon_this_line () +mmix_label_without_colon_this_line (void) { int retval = label_without_colon_this_line; @@ -3391,10 +3345,7 @@ mmix_label_without_colon_this_line () join with. */ long -mmix_md_relax_frag (seg, fragP, stretch) - segT seg; - fragS *fragP; - long stretch; +mmix_md_relax_frag (segT seg, fragS *fragP, long stretch) { switch (fragP->fr_subtype) { @@ -3520,7 +3471,7 @@ mmix_md_relax_frag (seg, fragP, stretch) /* Various things we punt until all input is seen. */ void -mmix_md_end () +mmix_md_end (void) { fragS *fragP; symbolS *mainsym; @@ -3695,9 +3646,7 @@ mmix_md_end () /* qsort function for mmix_symbol_gregs. */ static int -cmp_greg_symbol_fixes (parg, qarg) - const PTR parg; - const PTR qarg; +cmp_greg_symbol_fixes (const void *parg, const void *qarg) { const struct mmix_symbol_greg_fixes *p = (const struct mmix_symbol_greg_fixes *) parg; @@ -3714,7 +3663,7 @@ cmp_greg_symbol_fixes (parg, qarg) as an ELF section. */ void -mmix_frob_file () +mmix_frob_file (void) { int i; struct mmix_symbol_gregs *all_greg_symbols[MAX_GREGS]; @@ -3822,9 +3771,7 @@ mmix_frob_file () If the name isn't a built-in name and parsed into *EXPP, return zero. */ int -mmix_parse_predefined_name (name, expP) - char *name; - expressionS *expP; +mmix_parse_predefined_name (char *name, expressionS *expP) { char *canon_name; char *handler_charp; @@ -3933,7 +3880,7 @@ mmix_parse_predefined_name (name, expP) section. */ void -mmix_md_elf_section_change_hook () +mmix_md_elf_section_change_hook (void) { if (doing_bspec) as_bad (_("section change from within a BSPEC/ESPEC pair is not supported")); @@ -3946,8 +3893,7 @@ mmix_md_elf_section_change_hook () section too. */ static void -s_loc (ignore) - int ignore ATTRIBUTE_UNUSED; +s_loc (int ignore ATTRIBUTE_UNUSED) { segT section; expressionS exp; @@ -4076,7 +4022,7 @@ s_loc (ignore) by comma. */ static void -mmix_byte () +mmix_byte (void) { unsigned int c; char *start; @@ -4166,8 +4112,7 @@ mmix_byte () lenient than mmix_byte but FIXME: they should eventually merge. */ static void -mmix_cons (nbytes) - int nbytes; +mmix_cons (int nbytes) { expressionS exp; char *start; @@ -4296,11 +4241,8 @@ mmix_cons (nbytes) Arguably this is a GCC bug. */ void -mmix_md_do_align (n, fill, len, max) - int n; - char *fill ATTRIBUTE_UNUSED; - int len ATTRIBUTE_UNUSED; - int max ATTRIBUTE_UNUSED; +mmix_md_do_align (int n, char *fill ATTRIBUTE_UNUSED, + int len ATTRIBUTE_UNUSED, int max ATTRIBUTE_UNUSED) { last_alignment = n; want_unaligned = n == 0; diff --git a/gas/config/tc-mmix.h b/gas/config/tc-mmix.h index c6d222f1fd..33003a349e 100644 --- a/gas/config/tc-mmix.h +++ b/gas/config/tc-mmix.h @@ -1,5 +1,5 @@ /* tc-mmix.h -- Header file for tc-mmix.c. - Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Written by Hans-Peter Nilsson (hp@bitrange.com). This file is part of GAS, the GNU Assembler. @@ -41,25 +41,25 @@ extern const char mmix_flt_chars[]; /* "@" is a synonym for ".". */ #define LEX_AT (LEX_BEGIN_NAME) -extern int mmix_label_without_colon_this_line PARAMS ((void)); +extern int mmix_label_without_colon_this_line (void); #define LABELS_WITHOUT_COLONS mmix_label_without_colon_this_line () extern int mmix_next_semicolon_is_eoln; #define TC_EOL_IN_INSN(p) (*(p) == ';' && ! mmix_next_semicolon_is_eoln) /* This is one direction we can get mmixal compatibility. */ -extern void mmix_handle_mmixal PARAMS ((void)); +extern void mmix_handle_mmixal (void); #define md_start_line_hook mmix_handle_mmixal -extern void mmix_md_begin PARAMS ((void)); +extern void mmix_md_begin (void); #define md_begin mmix_md_begin -extern void mmix_md_end PARAMS ((void)); +extern void mmix_md_end (void); #define md_end mmix_md_end extern int mmix_current_location \ - PARAMS ((void (*fn) (expressionS *), expressionS *)); -extern int mmix_parse_predefined_name PARAMS ((char *, expressionS *)); + (void (*fn) (expressionS *), expressionS *); +extern int mmix_parse_predefined_name (char *, expressionS *); extern char *mmix_current_prefix; @@ -78,7 +78,7 @@ extern int mmix_gnu_syntax; : ((name[0] == ':' || ISUPPER (name[0])) \ && mmix_parse_predefined_name (name, exp)))) -extern char *mmix_prefix_name PARAMS ((char *)); +extern char *mmix_prefix_name (char *); /* We implement when *creating* a symbol, we also need to strip a ':' or prepend a prefix. */ @@ -87,7 +87,7 @@ extern char *mmix_prefix_name PARAMS ((char *)); #define md_undefined_symbol(x) NULL -extern void mmix_fb_label PARAMS ((expressionS *)); +extern void mmix_fb_label (expressionS *); /* Since integer_constant is local to expr.c, we have to make this a macro. FIXME: Do it cleaner. */ @@ -110,7 +110,7 @@ extern void mmix_fb_label PARAMS ((expressionS *)); /* Gas dislikes the 2ADD, 8ADD etc. insns, so we have to assemble them in the error-recovery loop. Hopefully there are no significant differences. Also, space on a line isn't gracefully handled. */ -extern int mmix_assemble_return_nonzero PARAMS ((char *)); +extern int mmix_assemble_return_nonzero (char *); #define tc_unrecognized_line(c) \ ((c) == ' ' \ || (((c) == '1' || (c) == '2' || (c) == '4' || (c) == '8') \ @@ -124,7 +124,7 @@ extern const struct relax_type mmix_relax_table[]; #define TC_GENERIC_RELAX_TABLE mmix_relax_table /* We use the relax table for everything except the GREG frags and PUSHJ. */ -extern long mmix_md_relax_frag PARAMS ((segT, fragS *, long)); +extern long mmix_md_relax_frag (segT, fragS *, long); #define md_relax_frag mmix_md_relax_frag #define tc_fix_adjustable(FIX) \ @@ -136,7 +136,7 @@ extern long mmix_md_relax_frag PARAMS ((segT, fragS *, long)); /* Adjust symbols which are registers. */ #define tc_adjust_symtab() mmix_adjust_symtab () -extern void mmix_adjust_symtab PARAMS ((void)); +extern void mmix_adjust_symtab (void); /* Here's where we make all symbols global, when so requested. We must avoid doing that for expression symbols or section symbols, @@ -170,11 +170,11 @@ extern int mmix_globalize_symbols; /* When relaxing, we need to emit various relocs we otherwise wouldn't. */ #define TC_FORCE_RELOCATION(fix) mmix_force_relocation (fix) -extern int mmix_force_relocation PARAMS ((struct fix *)); +extern int mmix_force_relocation (struct fix *); /* Call md_pcrel_from_section(), not md_pcrel_from(). */ #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC) -extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); +extern long md_pcrel_from_section (struct fix *, segT); #define md_section_align(seg, size) (size) @@ -192,7 +192,7 @@ extern fragS *mmix_opcode_frag; all symbols have been evaluated and all frags mapped, and when the fixups are done and relocs are output. Similarly for each unknown symbol. */ -extern void mmix_frob_file PARAMS ((void)); +extern void mmix_frob_file (void); #define tc_frob_file_before_fix mmix_frob_file /* Used by mmix_frob_file. Hangs on section symbols and unknown symbols. */ @@ -210,10 +210,10 @@ struct mmix_segment_info_type }; #define TC_SEGMENT_INFO_TYPE struct mmix_segment_info_type -extern void mmix_md_elf_section_change_hook PARAMS ((void)); +extern void mmix_md_elf_section_change_hook (void); #define md_elf_section_change_hook mmix_md_elf_section_change_hook -extern void mmix_md_do_align PARAMS ((int, char *, int, int)); +extern void mmix_md_do_align (int, char *, int, int); #define md_do_align(n, fill, len, max, label) \ mmix_md_do_align (n, fill, len, max)