* depend.c: Convert to ISO-C.

* dwarf2dbg.c: Likewise.
	* dwarf2dbg.h: Likewise.
This commit is contained in:
Kazu Hirata 2003-11-21 13:28:35 +00:00
parent 73ee5e4c0f
commit a2e224686a
4 changed files with 81 additions and 129 deletions

View File

@ -1,3 +1,9 @@
2003-11-20 Kazu Hirata <kazu@cs.umass.edu>
* depend.c: Convert to ISO-C.
* dwarf2dbg.c: Likewise.
* dwarf2dbg.h: Likewise.
2003-11-20 Kazu Hirata <kazu@cs.umass.edu>
* app.c: Convert to ISO-C.

View File

@ -35,8 +35,8 @@ static struct dependency * dep_chain = NULL;
/* Current column in output file. */
static int column = 0;
static int quote_string_for_make PARAMS ((FILE *, char *));
static void wrap_output PARAMS ((FILE *, char *, int));
static int quote_string_for_make (FILE *, char *);
static void wrap_output (FILE *, char *, int);
/* Number of columns allowable. */
#define MAX_COLUMNS 72
@ -45,8 +45,7 @@ static void wrap_output PARAMS ((FILE *, char *, int));
never called, then dependency tracking is simply skipped. */
void
start_dependencies (filename)
char *filename;
start_dependencies (char *filename)
{
dep_file = filename;
}
@ -54,8 +53,7 @@ start_dependencies (filename)
/* Noticed a new filename, so try to register it. */
void
register_dependency (filename)
char *filename;
register_dependency (char *filename)
{
struct dependency *dep;
@ -81,9 +79,7 @@ register_dependency (filename)
This code is taken from gcc with only minor changes. */
static int
quote_string_for_make (file, src)
FILE *file;
char *src;
quote_string_for_make (FILE *file, char *src)
{
char *p = src;
int i = 0;
@ -145,10 +141,7 @@ quote_string_for_make (file, src)
wrapping as necessary. */
static void
wrap_output (f, string, spacer)
FILE *f;
char *string;
int spacer;
wrap_output (FILE *f, char *string, int spacer)
{
int len = quote_string_for_make (NULL, string);
@ -186,7 +179,7 @@ wrap_output (f, string, spacer)
/* Print dependency file. */
void
print_dependencies ()
print_dependencies (void)
{
FILE *f;
struct dependency *dep;

View File

@ -156,40 +156,38 @@ static struct dwarf2_line_info current;
/* The size of an address on the target. */
static unsigned int sizeof_address;
static struct line_subseg *get_line_subseg PARAMS ((segT, subsegT));
static unsigned int get_filenum PARAMS ((const char *, unsigned int));
static struct frag *first_frag_for_seg PARAMS ((segT));
static struct frag *last_frag_for_seg PARAMS ((segT));
static void out_byte PARAMS ((int));
static void out_opcode PARAMS ((int));
static void out_two PARAMS ((int));
static void out_four PARAMS ((int));
static void out_abbrev PARAMS ((int, int));
static void out_uleb128 PARAMS ((addressT));
static offsetT get_frag_fix PARAMS ((fragS *));
static void out_set_addr PARAMS ((segT, fragS *, addressT));
static int size_inc_line_addr PARAMS ((int, addressT));
static void emit_inc_line_addr PARAMS ((int, addressT, char *, int));
static void out_inc_line_addr PARAMS ((int, addressT));
static void relax_inc_line_addr PARAMS ((int, segT, fragS *, addressT,
fragS *, addressT));
static void process_entries PARAMS ((segT, struct line_entry *));
static void out_file_list PARAMS ((void));
static void out_debug_line PARAMS ((segT));
static void out_debug_aranges PARAMS ((segT, segT));
static void out_debug_abbrev PARAMS ((segT));
static void out_debug_info PARAMS ((segT, segT, segT));
static struct line_subseg *get_line_subseg (segT, subsegT);
static unsigned int get_filenum (const char *, unsigned int);
static struct frag *first_frag_for_seg (segT);
static struct frag *last_frag_for_seg (segT);
static void out_byte (int);
static void out_opcode (int);
static void out_two (int);
static void out_four (int);
static void out_abbrev (int, int);
static void out_uleb128 (addressT);
static offsetT get_frag_fix (fragS *);
static void out_set_addr (segT, fragS *, addressT);
static int size_inc_line_addr (int, addressT);
static void emit_inc_line_addr (int, addressT, char *, int);
static void out_inc_line_addr (int, addressT);
static void relax_inc_line_addr (int, segT, fragS *, addressT,
fragS *, addressT);
static void process_entries (segT, struct line_entry *);
static void out_file_list (void);
static void out_debug_line (segT);
static void out_debug_aranges (segT, segT);
static void out_debug_abbrev (segT);
static void out_debug_info (segT, segT, segT);
#ifndef TC_DWARF2_EMIT_OFFSET
# define TC_DWARF2_EMIT_OFFSET generic_dwarf2_emit_offset
static void generic_dwarf2_emit_offset PARAMS ((symbolS *, unsigned int));
static void generic_dwarf2_emit_offset (symbolS *, unsigned int);
/* Create an offset to .dwarf2_*. */
static void
generic_dwarf2_emit_offset (symbol, size)
symbolS *symbol;
unsigned int size;
generic_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
{
expressionS expr;
@ -203,9 +201,7 @@ generic_dwarf2_emit_offset (symbol, size)
/* Find or create an entry for SEG+SUBSEG in ALL_SEGS. */
static struct line_subseg *
get_line_subseg (seg, subseg)
segT seg;
subsegT subseg;
get_line_subseg (segT seg, subsegT subseg)
{
static segT last_seg;
static subsegT last_subseg;
@ -254,9 +250,7 @@ get_line_subseg (seg, subseg)
/* Record an entry for LOC ocurring at OFS within the current fragment. */
void
dwarf2_gen_line_info (ofs, loc)
addressT ofs;
struct dwarf2_line_info *loc;
dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc)
{
struct line_subseg *ss;
struct line_entry *e;
@ -290,8 +284,7 @@ dwarf2_gen_line_info (ofs, loc)
}
void
dwarf2_where (line)
struct dwarf2_line_info *line;
dwarf2_where (struct dwarf2_line_info *line)
{
if (debug_type == DEBUG_DWARF2)
{
@ -311,8 +304,7 @@ dwarf2_where (line)
for, emit a line statement appropriately. */
void
dwarf2_emit_insn (size)
int size;
dwarf2_emit_insn (int size)
{
struct dwarf2_line_info loc;
@ -343,9 +335,7 @@ dwarf2_emit_insn (size)
empty one. */
static unsigned int
get_filenum (filename, num)
const char *filename;
unsigned int num;
get_filenum (const char *filename, unsigned int num)
{
static unsigned int last_used, last_used_dir_len;
const char *file;
@ -444,8 +434,7 @@ get_filenum (filename, num)
If an entry is added to the file table, return a pointer to the filename. */
char *
dwarf2_directive_file (dummy)
int dummy ATTRIBUTE_UNUSED;
dwarf2_directive_file (int dummy ATTRIBUTE_UNUSED)
{
offsetT num;
char *filename;
@ -481,8 +470,7 @@ dwarf2_directive_file (dummy)
}
void
dwarf2_directive_loc (dummy)
int dummy ATTRIBUTE_UNUSED;
dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
{
offsetT filenum, line, column;
@ -534,8 +522,7 @@ dwarf2_directive_loc (dummy)
}
static struct frag *
first_frag_for_seg (seg)
segT seg;
first_frag_for_seg (segT seg)
{
frchainS *f, *first = NULL;
@ -548,8 +535,7 @@ first_frag_for_seg (seg)
}
static struct frag *
last_frag_for_seg (seg)
segT seg;
last_frag_for_seg (segT seg)
{
frchainS *f, *last = NULL;
@ -564,8 +550,7 @@ last_frag_for_seg (seg)
/* Emit a single byte into the current segment. */
static inline void
out_byte (byte)
int byte;
out_byte (int byte)
{
FRAG_APPEND_1_CHAR (byte);
}
@ -573,8 +558,7 @@ out_byte (byte)
/* Emit a statement program opcode into the current segment. */
static inline void
out_opcode (opc)
int opc;
out_opcode (int opc)
{
out_byte (opc);
}
@ -582,8 +566,7 @@ out_opcode (opc)
/* Emit a two-byte word into the current segment. */
static inline void
out_two (data)
int data;
out_two (int data)
{
md_number_to_chars (frag_more (2), data, 2);
}
@ -591,8 +574,7 @@ out_two (data)
/* Emit a four byte word into the current segment. */
static inline void
out_four (data)
int data;
out_four (int data)
{
md_number_to_chars (frag_more (4), data, 4);
}
@ -600,8 +582,7 @@ out_four (data)
/* Emit an unsigned "little-endian base 128" number. */
static void
out_uleb128 (value)
addressT value;
out_uleb128 (addressT value)
{
output_leb128 (frag_more (sizeof_leb128 (value, 0)), value, 0);
}
@ -609,8 +590,7 @@ out_uleb128 (value)
/* Emit a tuple for .debug_abbrev. */
static inline void
out_abbrev (name, form)
int name, form;
out_abbrev (int name, int form)
{
out_uleb128 (name);
out_uleb128 (form);
@ -619,8 +599,7 @@ out_abbrev (name, form)
/* Get the size of a fragment. */
static offsetT
get_frag_fix (frag)
fragS *frag;
get_frag_fix (fragS *frag)
{
frchainS *fr;
@ -640,10 +619,7 @@ get_frag_fix (frag)
/* Set an absolute address (may result in a relocation entry). */
static void
out_set_addr (seg, frag, ofs)
segT seg;
fragS *frag;
addressT ofs;
out_set_addr (segT seg, fragS *frag, addressT ofs)
{
expressionS expr;
symbolS *sym;
@ -661,7 +637,7 @@ out_set_addr (seg, frag, ofs)
}
#if DWARF2_LINE_MIN_INSN_LENGTH > 1
static void scale_addr_delta PARAMS ((addressT *));
static void scale_addr_delta (addressT *);
static void
scale_addr_delta (addr_delta)
@ -688,9 +664,7 @@ scale_addr_delta (addr_delta)
exactly the expected number of bytes. */
static int
size_inc_line_addr (line_delta, addr_delta)
int line_delta;
addressT addr_delta;
size_inc_line_addr (int line_delta, addressT addr_delta)
{
unsigned int tmp, opcode;
int len = 0;
@ -749,11 +723,7 @@ size_inc_line_addr (line_delta, addr_delta)
}
static void
emit_inc_line_addr (line_delta, addr_delta, p, len)
int line_delta;
addressT addr_delta;
char *p;
int len;
emit_inc_line_addr (int line_delta, addressT addr_delta, char *p, int len)
{
unsigned int tmp, opcode;
int need_copy = 0;
@ -844,9 +814,7 @@ emit_inc_line_addr (line_delta, addr_delta, p, len)
/* Handy routine to combine calls to the above two routines. */
static void
out_inc_line_addr (line_delta, addr_delta)
int line_delta;
addressT addr_delta;
out_inc_line_addr (int line_delta, addressT addr_delta)
{
int len = size_inc_line_addr (line_delta, addr_delta);
emit_inc_line_addr (line_delta, addr_delta, frag_more (len), len);
@ -856,11 +824,9 @@ out_inc_line_addr (line_delta, addr_delta)
increments between fragments of the target segment. */
static void
relax_inc_line_addr (line_delta, seg, to_frag, to_ofs, from_frag, from_ofs)
int line_delta;
segT seg;
fragS *to_frag, *from_frag;
addressT to_ofs, from_ofs;
relax_inc_line_addr (int line_delta, segT seg,
fragS *to_frag, addressT to_ofs,
fragS *from_frag, addressT from_ofs)
{
symbolS *to_sym, *from_sym;
expressionS expr;
@ -887,8 +853,7 @@ relax_inc_line_addr (line_delta, seg, to_frag, to_ofs, from_frag, from_ofs)
the relaxation loop. We set fr_subtype to the expected length. */
int
dwarf2dbg_estimate_size_before_relax (frag)
fragS *frag;
dwarf2dbg_estimate_size_before_relax (fragS *frag)
{
offsetT addr_delta;
int size;
@ -906,8 +871,7 @@ dwarf2dbg_estimate_size_before_relax (frag)
of the frag. This returns the change in frag length. */
int
dwarf2dbg_relax_frag (frag)
fragS *frag;
dwarf2dbg_relax_frag (fragS *frag)
{
int old_size, new_size;
@ -922,8 +886,7 @@ dwarf2dbg_relax_frag (frag)
fr_subtype will be the desired length of the frag. */
void
dwarf2dbg_convert_frag (frag)
fragS *frag;
dwarf2dbg_convert_frag (fragS *frag)
{
offsetT addr_diff;
@ -947,9 +910,7 @@ dwarf2dbg_convert_frag (frag)
beginning at E, for segment SEG. */
static void
process_entries (seg, e)
segT seg;
struct line_entry *e;
process_entries (segT seg, struct line_entry *e)
{
unsigned filenum = 1;
unsigned line = 1;
@ -1041,7 +1002,7 @@ process_entries (seg, e)
/* Emit the directory and file tables for .debug_line. */
static void
out_file_list ()
out_file_list (void)
{
size_t size;
char *cp;
@ -1083,8 +1044,7 @@ out_file_list ()
/* Emit the collected .debug_line data. */
static void
out_debug_line (line_seg)
segT line_seg;
out_debug_line (segT line_seg)
{
expressionS expr;
symbolS *line_start;
@ -1172,9 +1132,7 @@ out_debug_line (line_seg)
/* Emit data for .debug_aranges. */
static void
out_debug_aranges (aranges_seg, info_seg)
segT aranges_seg;
segT info_seg;
out_debug_aranges (segT aranges_seg, segT info_seg)
{
unsigned int addr_size = sizeof_address;
addressT size, skip;
@ -1250,8 +1208,7 @@ out_debug_aranges (aranges_seg, info_seg)
sync with out_debug_info below. */
static void
out_debug_abbrev (abbrev_seg)
segT abbrev_seg;
out_debug_abbrev (segT abbrev_seg)
{
subseg_set (abbrev_seg, 0);
@ -1277,10 +1234,7 @@ out_debug_abbrev (abbrev_seg)
/* Emit a description of this compilation unit for .debug_info. */
static void
out_debug_info (info_seg, abbrev_seg, line_seg)
segT info_seg;
segT abbrev_seg;
segT line_seg;
out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg)
{
char producer[128];
char *comp_dir;
@ -1397,7 +1351,7 @@ out_debug_info (info_seg, abbrev_seg, line_seg)
}
void
dwarf2_finish ()
dwarf2_finish (void)
{
segT line_seg;
struct line_seg *s;

View File

@ -36,7 +36,7 @@ struct dwarf2_line_info {
/* Implements the .file FILENO "FILENAME" directive. FILENO can be 0
to indicate that no file number has been assigned. All real file
number must be >0. */
extern char *dwarf2_directive_file PARAMS ((int dummy));
extern char *dwarf2_directive_file (int dummy);
/* Implements the .loc FILENO LINENO [COLUMN] directive. FILENO is
the file number, LINENO the line number and the (optional) COLUMN
@ -44,30 +44,29 @@ extern char *dwarf2_directive_file PARAMS ((int dummy));
corresponds to. FILENO can be 0 to indicate that the filename
specified by the textually most recent .file directive should be
used. */
extern void dwarf2_directive_loc PARAMS ((int dummy));
extern void dwarf2_directive_loc (int dummy);
/* Returns the current source information. If .file directives have
been encountered, the info for the corresponding source file is
returned. Otherwise, the info for the assembly source file is
returned. */
extern void dwarf2_where PARAMS ((struct dwarf2_line_info *l));
extern void dwarf2_where (struct dwarf2_line_info *l);
/* This function generates .debug_line info based on the address and
source information passed in the arguments. ADDR should be the
frag-relative offset of the instruction the information is for and
L is the source information that should be associated with that
address. */
extern void dwarf2_gen_line_info PARAMS ((addressT addr,
struct dwarf2_line_info *l));
extern void dwarf2_gen_line_info (addressT addr, struct dwarf2_line_info *l);
/* Must be called for each generated instruction. */
extern void dwarf2_emit_insn PARAMS ((int));
extern void dwarf2_emit_insn (int);
extern void dwarf2_finish PARAMS ((void));
extern void dwarf2_finish (void);
extern int dwarf2dbg_estimate_size_before_relax PARAMS ((fragS *));
extern int dwarf2dbg_relax_frag PARAMS ((fragS *));
extern void dwarf2dbg_convert_frag PARAMS ((fragS *));
extern int dwarf2dbg_estimate_size_before_relax (fragS *);
extern int dwarf2dbg_relax_frag (fragS *);
extern void dwarf2dbg_convert_frag (fragS *);
/* An enumeration which describes the sizes of offsets (to DWARF sections)
and the mechanism by which the size is indicated. */