diff options
author | Kazu Hirata <kazu@codesourcery.com> | 2003-11-24 03:37:58 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@codesourcery.com> | 2003-11-24 03:37:58 +0000 |
commit | b1f1fa963c3c1e6deb8e8cf0651ce993e2b94a3c (patch) | |
tree | 322dacc8d73d100710a2691c119d9c1db35092a2 | |
parent | c765be85d5b6c0d20915c4c69c62f75d2d7fad49 (diff) | |
download | gdb-b1f1fa963c3c1e6deb8e8cf0651ce993e2b94a3c.zip gdb-b1f1fa963c3c1e6deb8e8cf0651ce993e2b94a3c.tar.gz gdb-b1f1fa963c3c1e6deb8e8cf0651ce993e2b94a3c.tar.bz2 |
* hash.c: Convert to ISO-C.
* hash.h: Likewise.
* input-file.c: Likewise.
* input-file.h: Likewise.
* input-scrub.c: Likewise.
* itbl-ops.c: Likewise.
* itbl-ops.h: Likewise.
-rw-r--r-- | gas/ChangeLog | 10 | ||||
-rw-r--r-- | gas/hash.c | 55 | ||||
-rw-r--r-- | gas/hash.h | 28 | ||||
-rw-r--r-- | gas/input-file.c | 29 | ||||
-rw-r--r-- | gas/input-file.h | 18 | ||||
-rw-r--r-- | gas/input-scrub.c | 53 | ||||
-rw-r--r-- | gas/itbl-ops.c | 32 | ||||
-rw-r--r-- | gas/itbl-ops.h | 33 |
8 files changed, 113 insertions, 145 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index bddeef1..70d4121 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,15 @@ 2003-11-23 Kazu Hirata <kazu@cs.umass.edu> + * hash.c: Convert to ISO-C. + * hash.h: Likewise. + * input-file.c: Likewise. + * input-file.h: Likewise. + * input-scrub.c: Likewise. + * itbl-ops.c: Likewise. + * itbl-ops.h: Likewise. + +2003-11-23 Kazu Hirata <kazu@cs.umass.edu> + * config/tc-h8300.c (Hmode): Make it global. (Smode): Likewise. (Nmode): Likewise. @@ -75,7 +75,7 @@ struct hash_control { /* Create a hash table. This return a control block. */ struct hash_control * -hash_new () +hash_new (void) { unsigned int size; struct hash_control *ret; @@ -105,8 +105,7 @@ hash_new () /* Delete a hash table, freeing all allocated memory. */ void -hash_die (table) - struct hash_control *table; +hash_die (struct hash_control *table) { obstack_free (&table->memory, 0); free (table); @@ -121,17 +120,14 @@ hash_die (table) Each time we look up a string, we move it to the start of the list for its hash code, to take advantage of referential locality. */ -static struct hash_entry *hash_lookup PARAMS ((struct hash_control *, - const char *, - struct hash_entry ***, - unsigned long *)); +static struct hash_entry *hash_lookup (struct hash_control *, + const char *, + struct hash_entry ***, + unsigned long *); static struct hash_entry * -hash_lookup (table, key, plist, phash) - struct hash_control *table; - const char *key; - struct hash_entry ***plist; - unsigned long *phash; +hash_lookup (struct hash_control *table, const char *key, + struct hash_entry ***plist, unsigned long *phash) { register unsigned long hash; unsigned int len; @@ -205,10 +201,7 @@ hash_lookup (table, key, plist, phash) hash table. */ const char * -hash_insert (table, key, value) - struct hash_control *table; - const char *key; - PTR value; +hash_insert (struct hash_control *table, const char *key, PTR value) { struct hash_entry *p; struct hash_entry **list; @@ -238,10 +231,7 @@ hash_insert (table, key, value) error. If an entry already exists, its value is replaced. */ const char * -hash_jam (table, key, value) - struct hash_control *table; - const char *key; - PTR value; +hash_jam (struct hash_control *table, const char *key, PTR value) { struct hash_entry *p; struct hash_entry **list; @@ -279,10 +269,7 @@ hash_jam (table, key, value) table, this does nothing and returns NULL. */ PTR -hash_replace (table, key, value) - struct hash_control *table; - const char *key; - PTR value; +hash_replace (struct hash_control *table, const char *key, PTR value) { struct hash_entry *p; PTR ret; @@ -306,9 +293,7 @@ hash_replace (table, key, value) if the entry is not found. */ PTR -hash_find (table, key) - struct hash_control *table; - const char *key; +hash_find (struct hash_control *table, const char *key) { struct hash_entry *p; @@ -323,9 +308,7 @@ hash_find (table, key) for that entry, or NULL if there is no such entry. */ PTR -hash_delete (table, key) - struct hash_control *table; - const char *key; +hash_delete (struct hash_control *table, const char *key) { struct hash_entry *p; struct hash_entry **list; @@ -354,9 +337,8 @@ hash_delete (table, key) hash table. */ void -hash_traverse (table, pfn) - struct hash_control *table; - void (*pfn) PARAMS ((const char *key, PTR value)); +hash_traverse (struct hash_control *table, + void (*pfn) (const char *key, PTR value)) { unsigned int i; @@ -373,10 +355,9 @@ hash_traverse (table, pfn) name of the hash table, used for printing a header. */ void -hash_print_statistics (f, name, table) - FILE *f ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; - struct hash_control *table ATTRIBUTE_UNUSED; +hash_print_statistics (FILE *f ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, + struct hash_control *table ATTRIBUTE_UNUSED) { #ifdef HASH_STATISTICS unsigned int i; @@ -25,54 +25,54 @@ struct hash_control; /* Create a hash table. This return a control block. */ -extern struct hash_control *hash_new PARAMS ((void)); +extern struct hash_control *hash_new (void); /* Delete a hash table, freeing all allocated memory. */ -extern void hash_die PARAMS ((struct hash_control *)); +extern void hash_die (struct hash_control *); /* Insert an entry into a hash table. This returns NULL on success. On error, it returns a printable string indicating the error. It is considered to be an error if the entry already exists in the hash table. */ -extern const char *hash_insert PARAMS ((struct hash_control *, - const char *key, PTR value)); +extern const char *hash_insert (struct hash_control *, + const char *key, PTR value); /* Insert or replace an entry in a hash table. This returns NULL on success. On error, it returns a printable string indicating the error. If an entry already exists, its value is replaced. */ -extern const char *hash_jam PARAMS ((struct hash_control *, - const char *key, PTR value)); +extern const char *hash_jam (struct hash_control *, + const char *key, PTR value); /* Replace an existing entry in a hash table. This returns the old value stored for the entry. If the entry is not found in the hash table, this does nothing and returns NULL. */ -extern PTR hash_replace PARAMS ((struct hash_control *, const char *key, - PTR value)); +extern PTR hash_replace (struct hash_control *, const char *key, + PTR value); /* Find an entry in a hash table, returning its value. Returns NULL if the entry is not found. */ -extern PTR hash_find PARAMS ((struct hash_control *, const char *key)); +extern PTR hash_find (struct hash_control *, const char *key); /* Delete an entry from a hash table. This returns the value stored for that entry, or NULL if there is no such entry. */ -extern PTR hash_delete PARAMS ((struct hash_control *, const char *key)); +extern PTR hash_delete (struct hash_control *, const char *key); /* Traverse a hash table. Call the function on every entry in the hash table. */ -extern void hash_traverse PARAMS ((struct hash_control *, - void (*pfn) (const char *key, PTR value))); +extern void hash_traverse (struct hash_control *, + void (*pfn) (const char *key, PTR value)); /* Print hash table statistics on the specified file. NAME is the name of the hash table, used for printing a header. */ -extern void hash_print_statistics PARAMS ((FILE *, const char *name, - struct hash_control *)); +extern void hash_print_statistics (FILE *, const char *name, + struct hash_control *); #endif /* HASH_H */ diff --git a/gas/input-file.c b/gas/input-file.c index 8e73615..5ada630 100644 --- a/gas/input-file.c +++ b/gas/input-file.c @@ -31,7 +31,7 @@ #include "input-file.h" #include "safe-ctype.h" -static int input_file_get PARAMS ((char *, int)); +static int input_file_get (char *, int); /* This variable is non-zero if the file currently being read should be preprocessed by app. It is zero if the file can be read straight in. */ @@ -62,25 +62,25 @@ struct saved_file /* These hooks accommodate most operating systems. */ void -input_file_begin () +input_file_begin (void) { f_in = (FILE *) 0; } void -input_file_end () +input_file_end (void) { } /* Return BUFFER_SIZE. */ unsigned int -input_file_buffer_size () +input_file_buffer_size (void) { return (BUFFER_SIZE); } int -input_file_is_open () +input_file_is_open (void) { return f_in != (FILE *) 0; } @@ -89,7 +89,7 @@ input_file_is_open () can be restored with input_file_pop (). */ char * -input_file_push () +input_file_push (void) { register struct saved_file *saved; @@ -108,8 +108,7 @@ input_file_push () } void -input_file_pop (arg) - char *arg; +input_file_pop (char *arg) { register struct saved_file *saved = (struct saved_file *) arg; @@ -125,9 +124,8 @@ input_file_pop (arg) } void -input_file_open (filename, pre) - char *filename; /* "" means use stdin. Must not be 0. */ - int pre; +input_file_open (char *filename, /* "" means use stdin. Must not be 0. */ + int pre) { int c; char buf[80]; @@ -205,7 +203,7 @@ input_file_open (filename, pre) /* Close input file. */ void -input_file_close () +input_file_close (void) { /* Don't close a null file pointer. */ if (f_in != NULL) @@ -217,9 +215,7 @@ input_file_close () /* This function is passed to do_scrub_chars. */ static int -input_file_get (buf, buflen) - char *buf; - int buflen; +input_file_get (char *buf, int buflen) { int size; @@ -235,8 +231,7 @@ input_file_get (buf, buflen) /* Read a buffer from the input file. */ char * -input_file_give_next_buffer (where) - char *where; /* Where to place 1st character of new buffer. */ +input_file_give_next_buffer (char *where /* Where to place 1st character of new buffer. */) { char *return_value; /* -> Last char of what we read, + 1. */ register int size; diff --git a/gas/input-file.h b/gas/input-file.h index 9934869..b686a0d 100644 --- a/gas/input-file.h +++ b/gas/input-file.h @@ -55,12 +55,12 @@ * about I/O errors. No I/O errors are fatal: an end-of-file may be faked. */ -char *input_file_give_next_buffer PARAMS ((char *where)); -char *input_file_push PARAMS ((void)); -unsigned int input_file_buffer_size PARAMS ((void)); -int input_file_is_open PARAMS ((void)); -void input_file_begin PARAMS ((void)); -void input_file_close PARAMS ((void)); -void input_file_end PARAMS ((void)); -void input_file_open PARAMS ((char *filename, int pre)); -void input_file_pop PARAMS ((char *arg)); +char *input_file_give_next_buffer (char *where); +char *input_file_push (void); +unsigned int input_file_buffer_size (void); +int input_file_is_open (void); +void input_file_begin (void); +void input_file_close (void); +void input_file_end (void); +void input_file_open (char *filename, int pre); +void input_file_pop (char *arg); diff --git a/gas/input-scrub.c b/gas/input-scrub.c index 84beaca..7a03965 100644 --- a/gas/input-scrub.c +++ b/gas/input-scrub.c @@ -121,9 +121,9 @@ struct input_save { char * saved_position; /* Caller's saved position in buf. */ }; -static struct input_save *input_scrub_push PARAMS ((char *saved_position)); -static char *input_scrub_pop PARAMS ((struct input_save *arg)); -static void as_1_char PARAMS ((unsigned int c, FILE * stream)); +static struct input_save *input_scrub_push (char *saved_position); +static char *input_scrub_pop (struct input_save *arg); +static void as_1_char (unsigned int c, FILE * stream); /* Saved information about the file that .include'd this one. When we hit EOF, we automatically pop to that file. */ @@ -135,8 +135,7 @@ static struct input_save *next_saved_file; area, which can be restored by passing it to input_scrub_pop(). */ static struct input_save * -input_scrub_push (saved_position) - char *saved_position; +input_scrub_push (char *saved_position) { register struct input_save *saved; @@ -171,8 +170,7 @@ input_scrub_push (saved_position) } static char * -input_scrub_pop (saved) - struct input_save *saved; +input_scrub_pop (struct input_save *saved) { char *saved_position; @@ -199,7 +197,7 @@ input_scrub_pop (saved) } void -input_scrub_begin () +input_scrub_begin (void) { know (strlen (BEFORE_STRING) == BEFORE_SIZE); know (strlen (AFTER_STRING) == AFTER_SIZE @@ -221,7 +219,7 @@ input_scrub_begin () } void -input_scrub_end () +input_scrub_end (void) { if (buffer_start) { @@ -235,8 +233,7 @@ input_scrub_end () Return start of caller's part of buffer. */ char * -input_scrub_new_file (filename) - char *filename; +input_scrub_new_file (char *filename) { input_file_open (filename, !flag_no_comments); physical_input_file = filename[0] ? filename : _("{standard input}"); @@ -251,9 +248,7 @@ input_scrub_new_file (filename) input_scrub_new_file. */ char * -input_scrub_include_file (filename, position) - char *filename; - char *position; +input_scrub_include_file (char *filename, char *position) { next_saved_file = input_scrub_push (position); return input_scrub_new_file (filename); @@ -263,10 +258,7 @@ input_scrub_include_file (filename, position) expanding a macro. */ void -input_scrub_include_sb (from, position, is_expansion) - sb *from; - char *position; - int is_expansion; +input_scrub_include_sb (sb *from, char *position, int is_expansion) { if (macro_nest > max_macro_nest) as_fatal (_("macros nested too deeply")); @@ -298,14 +290,13 @@ input_scrub_include_sb (from, position, is_expansion) } void -input_scrub_close () +input_scrub_close (void) { input_file_close (); } char * -input_scrub_next_buffer (bufp) - char **bufp; +input_scrub_next_buffer (char **bufp) { register char *limit; /*->just after last char of buffer. */ @@ -414,13 +405,13 @@ input_scrub_next_buffer (bufp) messages and so on. Return TRUE if we opened any file. */ int -seen_at_least_1_file () +seen_at_least_1_file (void) { return (physical_input_file != NULL); } void -bump_line_counters () +bump_line_counters (void) { if (sb_index < 0) { @@ -439,9 +430,8 @@ bump_line_counters () Returns nonzero if the filename actually changes. */ int -new_logical_line (fname, line_number) - char *fname; /* DON'T destroy it! We point to it! */ - int line_number; +new_logical_line (char *fname, /* DON'T destroy it! We point to it! */ + int line_number) { if (line_number >= 0) logical_input_line = line_number; @@ -464,9 +454,7 @@ new_logical_line (fname, line_number) up declarations like that, and it's easier to avoid it. */ void -as_where (namep, linep) - char **namep; - unsigned int *linep; +as_where (char **namep, unsigned int *linep) { if (logical_input_file != NULL && (linep == NULL || logical_input_line >= 0)) @@ -494,8 +482,7 @@ as_where (namep, linep) No free '\n' at end of line. */ void -as_howmuch (stream) - FILE *stream; /* Opened for write please. */ +as_howmuch (FILE *stream /* Opened for write please. */) { register char *p; /* Scan input line. */ @@ -511,9 +498,7 @@ as_howmuch (stream) } static void -as_1_char (c, stream) - unsigned int c; - FILE *stream; +as_1_char (unsigned int c, FILE *stream) { if (c > 127) { diff --git a/gas/itbl-ops.c b/gas/itbl-ops.c index 2d1ae45..089bff4 100644 --- a/gas/itbl-ops.c +++ b/gas/itbl-ops.c @@ -154,23 +154,21 @@ static struct itbl_entry *entries[e_nprocs][e_ntypes] = { }; /* local prototypes */ -static unsigned long build_opcode PARAMS ((struct itbl_entry *e)); -static e_type get_type PARAMS ((int yytype)); -static e_processor get_processor PARAMS ((int yyproc)); -static struct itbl_entry **get_entries PARAMS ((e_processor processor, - e_type type)); -static struct itbl_entry *find_entry_byname PARAMS ((e_processor processor, - e_type type, char *name)); -static struct itbl_entry *find_entry_byval PARAMS ((e_processor processor, - e_type type, unsigned long val, struct itbl_range *r)); -static struct itbl_entry *alloc_entry PARAMS ((e_processor processor, - e_type type, char *name, unsigned long value)); -static unsigned long apply_range PARAMS ((unsigned long value, - struct itbl_range r)); -static unsigned long extract_range PARAMS ((unsigned long value, - struct itbl_range r)); -static struct itbl_field *alloc_field PARAMS ((e_type type, int sbit, - int ebit, unsigned long flags)); +static unsigned long build_opcode (struct itbl_entry *e); +static e_type get_type (int yytype); +static e_processor get_processor (int yyproc); +static struct itbl_entry **get_entries (e_processor processor, + e_type type); +static struct itbl_entry *find_entry_byname (e_processor processor, + e_type type, char *name); +static struct itbl_entry *find_entry_byval (e_processor processor, + e_type type, unsigned long val, struct itbl_range *r); +static struct itbl_entry *alloc_entry (e_processor processor, + e_type type, char *name, unsigned long value); +static unsigned long apply_range (unsigned long value, struct itbl_range r); +static unsigned long extract_range (unsigned long value, struct itbl_range r); +static struct itbl_field *alloc_field (e_type type, int sbit, + int ebit, unsigned long flags); /*======================================================================*/ /* Interfaces to the parser */ diff --git a/gas/itbl-ops.h b/gas/itbl-ops.h index bcd68fe..4c98d72 100644 --- a/gas/itbl-ops.h +++ b/gas/itbl-ops.h @@ -86,24 +86,23 @@ extern int itbl_have_entries; /* These routines are visible to the main part of the assembler */ -int itbl_parse PARAMS ((char *insntbl)); -void itbl_init PARAMS ((void)); -char *itbl_get_field PARAMS ((char **s)); -unsigned long itbl_assemble PARAMS ((char *name, char *operands)); -int itbl_disassemble PARAMS ((char *str, unsigned long insn)); -int itbl_parse PARAMS ((char *tbl)); /* parses insn tbl */ -int itbl_get_reg_val PARAMS ((char *name, unsigned long *pval)); -int itbl_get_val PARAMS ((e_processor processor, e_type type, char *name, - unsigned long *pval)); -char *itbl_get_name PARAMS ((e_processor processor, e_type type, - unsigned long val)); +int itbl_parse (char *insntbl); +void itbl_init (void); +char *itbl_get_field (char **s); +unsigned long itbl_assemble (char *name, char *operands); +int itbl_disassemble (char *str, unsigned long insn); +int itbl_parse (char *tbl); /* parses insn tbl */ +int itbl_get_reg_val (char *name, unsigned long *pval); +int itbl_get_val (e_processor processor, e_type type, char *name, + unsigned long *pval); +char *itbl_get_name (e_processor processor, e_type type, unsigned long val); /* These routines are called by the table parser used to build the dynamic list of new processor instructions and registers. */ -struct itbl_entry *itbl_add_reg PARAMS ((int yyproc, int yytype, - char *regname, int regnum)); -struct itbl_entry *itbl_add_insn PARAMS ((int yyproc, char *name, - unsigned long value, int sbit, int ebit, unsigned long flags)); -struct itbl_field *itbl_add_operand PARAMS ((struct itbl_entry * e, int yytype, - int sbit, int ebit, unsigned long flags)); +struct itbl_entry *itbl_add_reg (int yyproc, int yytype, + char *regname, int regnum); +struct itbl_entry *itbl_add_insn (int yyproc, char *name, + unsigned long value, int sbit, int ebit, unsigned long flags); +struct itbl_field *itbl_add_operand (struct itbl_entry * e, int yytype, + int sbit, int ebit, unsigned long flags); |