diff --git a/gas/ChangeLog b/gas/ChangeLog index 6232652f32..656867bfbb 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,8 +1,18 @@ 2000-11-06 Kazu Hirata - * input-file.c: Fix formatting. + * as.c: Fix formatting. + * dwarf2dbg.c: Likewise. + * input-file.c: Likewise. * input-file.h: Likewise. * input-scrub.c: Likewise. + * itbl-ops.c: Likewise. + * listing.c: Likewise. + * macro.h: Likewise. + * messages.c: Likewise. + * read.c: Likewise. + * subsegs.c: Likewise. + * subsegs.h: Likewise. + * write.c: Likewise. 2000-11-06 Nick Clifton diff --git a/gas/as.c b/gas/as.c index db183a3df4..48ab5c4963 100644 --- a/gas/as.c +++ b/gas/as.c @@ -497,7 +497,7 @@ parse_args (pargc, pargv) new_argv[new_argc++] = optarg; new_argv[new_argc] = NULL; break; - + case OPTION_TARGET_HELP: md_show_usage (stdout); exit (EXIT_SUCCESS); diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index bcf1c27e3b..b91ba5877c 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -782,15 +782,14 @@ dwarf2_generate_asm_lineno (size) { bfd_vma addr; static struct dwarf2_line_info debug_line; - + /* First update the notion of the current source line. */ - dwarf2_where (& debug_line); - + dwarf2_where (&debug_line); + /* We want the offset of the start of this instruction within the the current frag. */ addr = frag_now->fr_address + frag_now_fix () - size; - - /* And record the information. */ - dwarf2_gen_line_info (addr, & debug_line); -} + /* And record the information. */ + dwarf2_gen_line_info (addr, &debug_line); +} diff --git a/gas/itbl-ops.c b/gas/itbl-ops.c index 392db1946d..b7c3686829 100644 --- a/gas/itbl-ops.c +++ b/gas/itbl-ops.c @@ -114,43 +114,39 @@ int itbl_have_entries = 0; /*======================================================================*/ /* structures for keeping itbl format entries */ -struct itbl_range - { - int sbit; /* mask starting bit position */ - int ebit; /* mask ending bit position */ - }; +struct itbl_range { + int sbit; /* mask starting bit position */ + int ebit; /* mask ending bit position */ +}; -struct itbl_field - { - e_type type; /* dreg/creg/greg/immed/symb */ - struct itbl_range range; /* field's bitfield range within instruction */ - unsigned long flags; /* field flags */ - struct itbl_field *next; /* next field in list */ - }; +struct itbl_field { + e_type type; /* dreg/creg/greg/immed/symb */ + struct itbl_range range; /* field's bitfield range within instruction */ + unsigned long flags; /* field flags */ + struct itbl_field *next; /* next field in list */ +}; /* These structures define the instructions and registers for a processor. * If the type is an instruction, the structure defines the format of an * instruction where the fields are the list of operands. * The flags field below uses the same values as those defined in the * gnu assembler and are machine specific. */ -struct itbl_entry - { - e_processor processor; /* processor number */ - e_type type; /* dreg/creg/greg/insn */ - char *name; /* mnemionic name for insn/register */ - unsigned long value; /* opcode/instruction mask/register number */ - unsigned long flags; /* effects of the instruction */ - struct itbl_range range; /* bit range within instruction for value */ - struct itbl_field *fields; /* list of operand definitions (if any) */ - struct itbl_entry *next; /* next entry */ - }; +struct itbl_entry { + e_processor processor; /* processor number */ + e_type type; /* dreg/creg/greg/insn */ + char *name; /* mnemionic name for insn/register */ + unsigned long value; /* opcode/instruction mask/register number */ + unsigned long flags; /* effects of the instruction */ + struct itbl_range range; /* bit range within instruction for value */ + struct itbl_field *fields; /* list of operand definitions (if any) */ + struct itbl_entry *next; /* next entry */ +}; /* local data and structures */ static int itbl_num_opcodes = 0; /* Array of entries for each processor and entry type */ -static struct itbl_entry *entries[e_nprocs][e_ntypes] = -{ +static struct itbl_entry *entries[e_nprocs][e_ntypes] = { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, @@ -273,7 +269,8 @@ itbl_add_operand (struct itbl_entry *e, int yytype, int sbit, #include "symbols.h" static void append_insns_as_macros (void); -/* initialize for gas */ +/* Initialize for gas. */ + void itbl_init (void) { @@ -282,7 +279,7 @@ itbl_init (void) e_type type; if (!itbl_have_entries) - return; + return; /* Since register names don't have a prefix, put them in the symbol table so they can't be used as symbols. This simplifies argument parsing as @@ -297,7 +294,7 @@ itbl_init (void) for (e = *es; e; e = e->next) { symbol_table_insert (symbol_create (e->name, reg_section, - e->value, &zero_address_frag)); + e->value, &zero_address_frag)); } } append_insns_as_macros (); @@ -327,7 +324,7 @@ append_insns_as_macros (void) int n, id, size, new_size, new_num_opcodes; if (!itbl_have_entries) - return; + return; if (!itbl_num_opcodes) /* no new instructions to add! */ { @@ -603,7 +600,7 @@ itbl_disassemble (char *s, unsigned long insn) struct itbl_field *f; if (!ITBL_IS_INSN (insn)) - return 0; /* error*/ + return 0; /* error */ processor = get_processor (ITBL_DECODE_PNUM (insn)); /* find entry in list */ @@ -612,15 +609,15 @@ itbl_disassemble (char *s, unsigned long insn) return 0; /* opcode not in table; invalid instrustion */ strcpy (s, e->name); - /* parse insn's args (if any) */ + /* Parse insn's args (if any). */ for (f = e->fields; f; f = f->next) /* for each arg, ... */ { struct itbl_entry *r; unsigned long value; - if (f == e->fields) /* first operand is preceeded by tab */ + if (f == e->fields) /* First operand is preceeded by tab. */ strcat (s, "\t"); - else /* ','s separate following operands */ + else /* ','s separate following operands. */ strcat (s, ","); value = extract_range (insn, f->range); /* n should be in form $n or 0xhhh (are symbol names valid?? */ @@ -630,7 +627,7 @@ itbl_disassemble (char *s, unsigned long insn) case e_creg: case e_greg: /* Accept either a string name - * or '$' followed by the register number */ + or '$' followed by the register number. */ r = find_entry_byval (e->processor, f->type, value, &f->range); if (r) strcat (s, r->name); @@ -638,11 +635,9 @@ itbl_disassemble (char *s, unsigned long insn) sprintf (s, "%s$%lu", s, value); break; case e_addr: - /* use assembler's symbol table to find symbol */ - /* FIXME!! Do we need this? - * if so, what about relocs?? - */ - /* If not a symbol, fall thru to IMMED */ + /* Use assembler's symbol table to find symbol. */ + /* FIXME!! Do we need this? If so, what about relocs?? */ + /* If not a symbol, fall through to IMMED. */ case e_immed: sprintf (s, "%s0x%lx", s, value); break; @@ -650,7 +645,7 @@ itbl_disassemble (char *s, unsigned long insn) return 0; /* error; invalid field spec */ } } - return 1; /* done! */ + return 1; /* Done! */ } /*======================================================================*/ diff --git a/gas/listing.c b/gas/listing.c index 985522866a..7fdb67d772 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -119,20 +119,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif /* This structure remembers which .s were used. */ -typedef struct file_info_struct -{ +typedef struct file_info_struct { struct file_info_struct * next; char * filename; long pos; unsigned int linenum; int at_end; -} -file_info_type; +} file_info_type; /* This structure rememebrs which line from which file goes into which frag. */ -struct list_info_struct -{ +struct list_info_struct { /* Frag which this line of source is nearest to. */ fragS *frag; @@ -157,16 +154,15 @@ struct list_info_struct /* Pointer to any error message associated with this line. */ char *message; - enum - { - EDICT_NONE, - EDICT_SBTTL, - EDICT_TITLE, - EDICT_NOLIST, - EDICT_LIST, - EDICT_NOLIST_NEXT, - EDICT_EJECT - } edict; + enum { + EDICT_NONE, + EDICT_SBTTL, + EDICT_TITLE, + EDICT_NOLIST, + EDICT_LIST, + EDICT_NOLIST_NEXT, + EDICT_EJECT + } edict; char *edict_arg; /* Nonzero if this line is to be omitted because it contains @@ -194,7 +190,7 @@ static int paper_height = 60; extern int listing; /* File to output listings to. */ -static FILE * list_file; +static FILE *list_file; /* This static array is used to keep the text of data to be printed before the start of the line. */ @@ -209,7 +205,7 @@ static char *data_buffer; /* Prototypes. */ static void listing_message PARAMS ((const char *name, const char *message)); -static file_info_type * file_info PARAMS ((const char *file_name)); +static file_info_type *file_info PARAMS ((const char *file_name)); static void new_frag PARAMS ((void)); static char *buffer_line PARAMS ((file_info_type *file, char *line, unsigned int size)); diff --git a/gas/macro.h b/gas/macro.h index 7c30086d5f..030fc9131a 100644 --- a/gas/macro.h +++ b/gas/macro.h @@ -38,15 +38,13 @@ /* describe the formal arguments to a macro */ -typedef struct formal_struct - { - struct formal_struct *next; /* next formal in list */ - sb name; /* name of the formal */ - sb def; /* the default value */ - sb actual; /* the actual argument (changed on each expansion) */ - int index; /* the index of the formal 0..formal_count-1 */ - } -formal_entry; +typedef struct formal_struct { + struct formal_struct *next; /* next formal in list */ + sb name; /* name of the formal */ + sb def; /* the default value */ + sb actual; /* the actual argument (changed on each expansion) */ + int index; /* the index of the formal 0..formal_count-1 */ +} formal_entry; /* Other values found in the index field of a formal_entry. */ #define QUAL_INDEX (-1) @@ -55,14 +53,12 @@ formal_entry; /* describe the macro. */ -typedef struct macro_struct - { - sb sub; /* substitution text. */ - int formal_count; /* number of formal args. */ - formal_entry *formals; /* pointer to list of formal_structs */ - struct hash_control *formal_hash; /* hash table of formals. */ - } -macro_entry; +typedef struct macro_struct { + sb sub; /* substitution text. */ + int formal_count; /* number of formal args. */ + formal_entry *formals; /* pointer to list of formal_structs */ + struct hash_control *formal_hash; /* hash table of formals. */ +} macro_entry; /* Whether any macros have been defined. */ diff --git a/gas/messages.c b/gas/messages.c index 42f51341df..7af8de69f5 100644 --- a/gas/messages.c +++ b/gas/messages.c @@ -1,5 +1,5 @@ /* messages.c - error reporter - - Copyright (C) 1987, 91, 92, 93, 94, 95, 96, 97, 1998 + Copyright (C) 1987, 91, 92, 93, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -47,8 +47,7 @@ static void as_show_where PARAMS ((void)); static void as_warn_internal PARAMS ((char *, unsigned int, char *)); static void as_bad_internal PARAMS ((char *, unsigned int, char *)); -/* - * Despite the rest of the comments in this file, (FIXME-SOON), +/* Despite the rest of the comments in this file, (FIXME-SOON), * here is the current scheme for error messages etc: * * as_fatal() is used when gas is quite confused and @@ -105,7 +104,8 @@ identify (file) fprintf (stderr, _("Assembler messages:\n")); } -static int warning_count; /* Count of number of warnings issued */ +/* The number of warnings issued. */ +static int warning_count; int had_warnings () @@ -114,7 +114,7 @@ had_warnings () } /* Nonzero if we've hit a 'bad error', and should not write an obj file, - and exit with a nonzero error code */ + and exit with a nonzero error code. */ static int error_count; @@ -138,11 +138,7 @@ as_show_where () fprintf (stderr, "%s:%u: ", file, line); } -/* - * a s _ p e r r o r - * - * Like perror(3), but with more info. - */ +/* Like perror(3), but with more info. */ void as_perror (gripe, filename) @@ -165,18 +161,15 @@ as_perror (gripe, filename) #endif } -/* - * a s _ t s k t s k () - * - * Send to stderr a string as a warning, and locate warning - * in input file(s). - * Please only use this for when we have some recovery action. - * Please explain in string (which may have '\n's) what recovery was done. - */ +/* Send to stderr a string as a warning, and locate warning + in input file(s). + Please only use this for when we have some recovery action. + Please explain in string (which may have '\n's) what recovery was + done. */ #ifdef USE_STDARG void -as_tsktsk (const char *format,...) +as_tsktsk (const char *format, ...) { va_list args; @@ -185,7 +178,7 @@ as_tsktsk (const char *format,...) vfprintf (stderr, format, args); va_end (args); (void) putc ('\n', stderr); -} /* as_tsktsk() */ +} #else void as_tsktsk (format, va_alist) @@ -199,7 +192,7 @@ as_tsktsk (format, va_alist) vfprintf (stderr, format, args); va_end (args); (void) putc ('\n', stderr); -} /* as_tsktsk() */ +} #endif /* not NO_STDARG */ /* The common portion of as_warn and as_warn_where. */ @@ -226,18 +219,15 @@ as_warn_internal (file, line, buffer) #endif } -/* - * a s _ w a r n () - * - * Send to stderr a string as a warning, and locate warning - * in input file(s). - * Please only use this for when we have some recovery action. - * Please explain in string (which may have '\n's) what recovery was done. - */ +/* Send to stderr a string as a warning, and locate warning + in input file(s). + Please only use this for when we have some recovery action. + Please explain in string (which may have '\n's) what recovery was + done. */ #ifdef USE_STDARG void -as_warn (const char *format,...) +as_warn (const char *format, ...) { va_list args; char buffer[2000]; @@ -249,9 +239,8 @@ as_warn (const char *format,...) va_end (args); as_warn_internal ((char *) NULL, 0, buffer); } -} /* as_warn() */ +} #else -/*VARARGS1 */ void as_warn (format, va_alist) const char *format; @@ -267,16 +256,16 @@ as_warn (format, va_alist) va_end (args); as_warn_internal ((char *) NULL, 0, buffer); } -} /* as_warn() */ +} #endif /* not NO_STDARG */ -/* as_warn_where, like as_bad but the file name and line number are - passed in. Unfortunately, we have to repeat the function in order - to handle the varargs correctly and portably. */ +/* Like as_bad but the file name and line number are passed in. + Unfortunately, we have to repeat the function in order to handle + the varargs correctly and portably. */ #ifdef USE_STDARG void -as_warn_where (char *file, unsigned int line, const char *format,...) +as_warn_where (char *file, unsigned int line, const char *format, ...) { va_list args; char buffer[2000]; @@ -288,9 +277,8 @@ as_warn_where (char *file, unsigned int line, const char *format,...) va_end (args); as_warn_internal (file, line, buffer); } -} /* as_warn() */ +} #else -/*VARARGS1 */ void as_warn_where (file, line, format, va_alist) char *file; @@ -308,7 +296,7 @@ as_warn_where (file, line, format, va_alist) va_end (args); as_warn_internal (file, line, buffer); } -} /* as_warn() */ +} #endif /* not NO_STDARG */ /* The common portion of as_bad and as_bad_where. */ @@ -335,18 +323,15 @@ as_bad_internal (file, line, buffer) #endif } -/* - * a s _ b a d () - * - * Send to stderr a string as a warning, and locate warning in input file(s). - * Please us when there is no recovery, but we want to continue processing - * but not produce an object file. - * Please explain in string (which may have '\n's) what recovery was done. - */ +/* Send to stderr a string as a warning, and locate warning in input + file(s). Please us when there is no recovery, but we want to + continue processing but not produce an object file. + Please explain in string (which may have '\n's) what recovery was + done. */ #ifdef USE_STDARG void -as_bad (const char *format,...) +as_bad (const char *format, ...) { va_list args; char buffer[2000]; @@ -359,7 +344,6 @@ as_bad (const char *format,...) } #else -/*VARARGS1 */ void as_bad (format, va_alist) const char *format; @@ -376,13 +360,13 @@ as_bad (format, va_alist) } #endif /* not NO_STDARG */ -/* as_bad_where, like as_bad but the file name and line number are - passed in. Unfortunately, we have to repeat the function in order - to handle the varargs correctly and portably. */ +/* Like as_bad but the file name and line number are passed in. + Unfortunately, we have to repeat the function in order to handle + the varargs correctly and portably. */ #ifdef USE_STDARG void -as_bad_where (char *file, unsigned int line, const char *format,...) +as_bad_where (char *file, unsigned int line, const char *format, ...) { va_list args; char buffer[2000]; @@ -395,7 +379,6 @@ as_bad_where (char *file, unsigned int line, const char *format,...) } #else -/*VARARGS1 */ void as_bad_where (file, line, format, va_alist) char *file; @@ -414,18 +397,14 @@ as_bad_where (file, line, format, va_alist) } #endif /* not NO_STDARG */ -/* - * a s _ f a t a l () - * - * Send to stderr a string as a fatal message, and print location of error in - * input file(s). - * Please only use this for when we DON'T have some recovery action. - * It xexit()s with a warning status. - */ +/* Send to stderr a string as a fatal message, and print location of + error in input file(s). + Please only use this for when we DON'T have some recovery action. + It xexit()s with a warning status. */ #ifdef USE_STDARG void -as_fatal (const char *format,...) +as_fatal (const char *format, ...) { va_list args; @@ -436,9 +415,8 @@ as_fatal (const char *format,...) (void) putc ('\n', stderr); va_end (args); xexit (EXIT_FAILURE); -} /* as_fatal() */ +} #else -/*VARARGS1*/ void as_fatal (format, va_alist) char *format; @@ -453,13 +431,11 @@ as_fatal (format, va_alist) (void) putc ('\n', stderr); va_end (args); xexit (EXIT_FAILURE); -} /* as_fatal() */ +} #endif /* not NO_STDARG */ -/* - * as_assert: Indicate assertion failure. - * Arguments: Filename, line number, optional function name. - */ +/* Indicate assertion failure. + Arguments: Filename, line number, optional function name. */ void as_assert (file, line, fn) @@ -479,6 +455,7 @@ as_assert (file, line, fn) /* as_abort: Print a friendly message saying how totally hosed we are, and exit without producing a core file. */ + void as_abort (file, line, fn) const char *file, *fn; @@ -536,5 +513,3 @@ sprint_value (buf, val) #endif abort (); } - -/* end of messages.c */ diff --git a/gas/read.c b/gas/read.c index d776c0f63b..0afd1e5c69 100644 --- a/gas/read.c +++ b/gas/read.c @@ -119,8 +119,7 @@ die horribly; #endif /* Used by is_... macros. our ctype[]. */ -char lex_type[256] = -{ +char lex_type[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */ 0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */ @@ -141,8 +140,7 @@ char lex_type[256] = /* In: a character. Out: 1 if this character ends a line. */ -char is_end_of_line[256] = -{ +char is_end_of_line[256] = { #ifdef CR_EOL 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */ #else @@ -275,8 +273,7 @@ read_begin () static struct hash_control *po_hash; -static const pseudo_typeS potable[] = -{ +static const pseudo_typeS potable[] = { {"abort", s_abort, 0}, {"align", s_align_ptwo, 0}, {"ascii", stringer, 0}, @@ -610,10 +607,10 @@ read_a_source_file (name) symbol in the symbol table. */ if (!mri_line_macro #ifdef TC_START_LABEL_WITHOUT_COLON - && TC_START_LABEL_WITHOUT_COLON(c, - input_line_pointer) + && TC_START_LABEL_WITHOUT_COLON(c, + input_line_pointer) #endif - ) + ) line_label = colon (line_start); else line_label = symbol_create (line_start, @@ -659,13 +656,13 @@ read_a_source_file (name) int len; /* Find the end of the current expanded macro line. */ - for (s = input_line_pointer - 1; *s ; ++s) + for (s = input_line_pointer - 1; *s; ++s) if (is_end_of_line[(unsigned char) *s]) break; /* Copy it for safe keeping. Also give an indication of how much macro nesting is involved at this point. */ - len = s - (input_line_pointer-1); + len = s - (input_line_pointer - 1); copy = (char *) xmalloc (len + macro_nest + 2); memset (copy, '>', macro_nest); copy[macro_nest] = ' '; @@ -745,7 +742,7 @@ read_a_source_file (name) strncpy (original_case_string, s2, sizeof (original_case_string)); original_case_string[sizeof (original_case_string) - 1] = 0; - + while (*s2) { if (isupper ((unsigned char) *s2)) @@ -2094,7 +2091,7 @@ s_lcomm_internal (needs_align, bytes_p) if (align) frag_align (align, 0, 0); - /* Detach from old frag. */ + /* Detach from old frag. */ if (S_GET_SEGMENT (symbolP) == bss_seg) symbol_get_frag (symbolP)->fr_symbol = NULL; @@ -3819,7 +3816,8 @@ parse_bitfield_cons (exp, nbytes) break; } /* Won't fit. */ - hold = ++input_line_pointer; /* skip ':' */ + /* Skip ':'. */ + hold = ++input_line_pointer; (void) expression (exp); if (exp->X_op != O_constant) diff --git a/gas/subsegs.c b/gas/subsegs.c index 49a93af7ea..1d29bbaf2b 100644 --- a/gas/subsegs.c +++ b/gas/subsegs.c @@ -19,9 +19,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* - * Segments & sub-segments. - */ +/* Segments & sub-segments. */ #include "as.h" @@ -41,8 +39,7 @@ segment_info_type segment_info[SEG_MAXIMUM_ORDINAL]; frchainS *data0_frchainP, *bss0_frchainP; #endif /* MANY_SEGMENTS */ -char const *const seg_name[] = -{ +char const *const seg_name[] = { "absolute", #ifdef MANY_SEGMENTS "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", @@ -567,8 +564,7 @@ section_symbol (sec) /* Return whether the specified segment is thought to hold text. */ #ifndef BFD_ASSEMBLER -const char * const nontext_section_names[] = -{ +const char * const nontext_section_names[] = { ".eh_frame", ".gcc_except_table", #ifdef OBJ_COFF diff --git a/gas/subsegs.h b/gas/subsegs.h index a2ef4748a5..504b6df699 100644 --- a/gas/subsegs.h +++ b/gas/subsegs.h @@ -64,8 +64,7 @@ extern frchainS *frchain_root; frag chain, even if it contains no (complete) frags. */ extern frchainS *frchain_now; -typedef struct segment_info_struct -{ +typedef struct segment_info_struct { frchainS *frchainP; unsigned int hadone : 1; @@ -103,13 +102,12 @@ typedef struct segment_info_struct symbolS *sym; #endif - union - { - /* Current size of section holding stabs strings. */ - unsigned long stab_string_size; - /* Initial frag for ELF. */ - char *p; - } + union { + /* Current size of section holding stabs strings. */ + unsigned long stab_string_size; + /* Initial frag for ELF. */ + char *p; + } stabu; #ifdef NEED_LITERAL_POOL diff --git a/gas/write.c b/gas/write.c index 802d4611a5..f30e0d0bc4 100644 --- a/gas/write.c +++ b/gas/write.c @@ -55,7 +55,7 @@ #ifndef TC_FIX_ADJUSTABLE #define TC_FIX_ADJUSTABLE(fix) 1 #endif - + #ifndef MD_PCREL_FROM_SECTION #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from(FIXP) #endif