summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/gcc/mips-tfile.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1998-03-03 21:37:38 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1998-03-03 21:37:38 +0000
commitc826e751760901de543f4640467e3a08df7f49bf (patch)
tree6a2323a78664ba45b78df1709ff3cc077db63ccd /gnu/usr.bin/gcc/mips-tfile.c
parenta4511fe6a5dc69a771b5ffdf64ba574c959cf37d (diff)
GCC 2.8.0 merge
Diffstat (limited to 'gnu/usr.bin/gcc/mips-tfile.c')
-rw-r--r--gnu/usr.bin/gcc/mips-tfile.c383
1 files changed, 191 insertions, 192 deletions
diff --git a/gnu/usr.bin/gcc/mips-tfile.c b/gnu/usr.bin/gcc/mips-tfile.c
index cce203f7ace..39f3bc61f1f 100644
--- a/gnu/usr.bin/gcc/mips-tfile.c
+++ b/gnu/usr.bin/gcc/mips-tfile.c
@@ -2,7 +2,7 @@
contain debugging information specified by the GNU compiler
in the form of comments (the mips assembler does not support
assembly access to debug information).
- Copyright (C) 1991, 1993, 1994. 1995 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
Contributed by Michael Meissner, meissner@osf.org
This file is part of GNU CC.
@@ -599,12 +599,12 @@ Boston, MA 02111-1307, USA. */
*/
+#include "config.h"
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
-#include "config.h"
#include <stdio.h>
#ifndef __SABER__
@@ -939,7 +939,7 @@ typedef enum coff_dt {
typedef enum hash_state {
hash_no = 0, /* don't hash type */
hash_yes = 1, /* ok to hash type, or use previous hash */
- hash_record = 2 /* ok to record hash, but don't use prev. */
+ hash_record = 2 /* ok to record hash, but don't use prev. */
} hash_state_t;
@@ -1014,15 +1014,15 @@ typedef struct varray {
#endif
#define INIT_VARRAY(type) { /* macro to initialize a varray */ \
- (vlinks_t *)0, /* first */ \
- (vlinks_t *)0, /* last */ \
+ (vlinks_t *) 0, /* first */ \
+ (vlinks_t *) 0, /* last */ \
0, /* num_allocated */ \
sizeof (type), /* object_size */ \
OBJECTS_PER_PAGE (type), /* objects_per_page */ \
OBJECTS_PER_PAGE (type), /* objects_last_page */ \
}
-/* Master type for indexes within the symbol table. */
+/* Master type for indexes within the symbol table. */
typedef unsigned long symint_t;
@@ -1171,12 +1171,12 @@ static efdr_t init_file =
0, /* cbLine: size of lines for this file */
},
- (FDR *)0, /* orig_fdr: original file header pointer */
- (char *)0, /* name: pointer to filename */
+ (FDR *) 0, /* orig_fdr: original file header pointer */
+ (char *) 0, /* name: pointer to filename */
0, /* name_len: length of filename */
0, /* void_type: ptr to aux node for void type */
0, /* int_type: ptr to aux node for int type */
- (scope_t *)0, /* cur_scope: current scope being processed */
+ (scope_t *) 0, /* cur_scope: current scope being processed */
0, /* file_index: current file # */
0, /* nested_scopes: # nested scopes */
INIT_VARRAY (char), /* strings: local string varray */
@@ -1184,9 +1184,9 @@ static efdr_t init_file =
INIT_VARRAY (PDR), /* procs: procedure varray */
INIT_VARRAY (AUXU), /* aux_syms: auxiliary symbols varray */
- (struct efdr *)0, /* next_file: next file structure */
+ (struct efdr *) 0, /* next_file: next file structure */
- (shash_t **)0, /* shash_head: string hash table */
+ (shash_t **) 0, /* shash_head: string hash table */
{ 0 }, /* thash_head: type hash table */
};
@@ -1609,17 +1609,17 @@ static PDR *cur_proc_ptr = (PDR *) 0; /* current procedure header */
static SYMR *cur_oproc_begin = (SYMR *) 0; /* original proc. sym begin info */
static SYMR *cur_oproc_end = (SYMR *) 0; /* original proc. sym end info */
static PDR *cur_oproc_ptr = (PDR *) 0; /* current original procedure*/
-static thead_t *cur_tag_head = (thead_t *)0; /* current tag head */
+static thead_t *cur_tag_head = (thead_t *) 0;/* current tag head */
static long file_offset = 0; /* current file offset */
static long max_file_offset = 0; /* maximum file offset */
-static FILE *object_stream = (FILE *)0; /* file desc. to output .o */
-static FILE *obj_in_stream = (FILE *)0; /* file desc. to input .o */
-static char *progname = (char *)0; /* program name for errors */
+static FILE *object_stream = (FILE *) 0; /* file desc. to output .o */
+static FILE *obj_in_stream = (FILE *) 0; /* file desc. to input .o */
+static char *progname = (char *) 0; /* program name for errors */
static char *input_name = "stdin"; /* name of input file */
-static char *object_name = (char *)0; /* tmp. name of object file */
-static char *obj_in_name = (char *)0; /* name of input object file */
-static char *cur_line_start = (char *)0; /* current line read in */
-static char *cur_line_ptr = (char *)0; /* ptr within current line */
+static char *object_name = (char *) 0; /* tmp. name of object file */
+static char *obj_in_name = (char *) 0; /* name of input object file */
+static char *cur_line_start = (char *) 0; /* current line read in */
+static char *cur_line_ptr = (char *) 0; /* ptr within current line */
static unsigned cur_line_nbytes = 0; /* # bytes for current line */
static unsigned cur_line_alloc = 0; /* # bytes total in buffer */
static long line_number = 0; /* current input line number */
@@ -1767,7 +1767,7 @@ extern int optind;
extern int opterr;
extern char *version_string;
#ifndef NO_SYS_SIGLIST
-#ifndef DONT_DECLARE_SYS_SIGLIST
+#ifndef SYS_SIGLIST_DECLARED
extern char *sys_siglist[NSIG + 1];
#endif
#endif
@@ -1782,7 +1782,7 @@ extern char *sys_siglist[NSIG + 1];
/* List of assembler pseudo ops and beginning sequences that need
special actions. Someday, this should be a hash table, and such,
but for now a linear list of names and calls to memcmp will
- do...... */
+ do...... */
typedef struct _pseudo_ops {
const char *name; /* pseudo-op in ascii */
@@ -1826,7 +1826,7 @@ add_varray_page (vp)
new_links->start_index = vp->num_allocated;
vp->objects_last_page = 0;
- if (vp->first == (vlinks_t *)0) /* first allocation? */
+ if (vp->first == (vlinks_t *) 0) /* first allocation? */
vp->first = vp->last = new_links;
else
{ /* 2nd or greater allocation */
@@ -1860,10 +1860,10 @@ hash_string (text, hash_len, hash_tbl, ret_hash_index)
hi &= (1 << HASHBITS) - 1;
hi %= SHASH_SIZE;
- if (ret_hash_index != (symint_t *)0)
+ if (ret_hash_index != (symint_t *) 0)
*ret_hash_index = hi;
- for (ptr = hash_tbl[hi]; ptr != (shash_t *)0; ptr = ptr->next)
+ for (ptr = hash_tbl[hi]; ptr != (shash_t *) 0; ptr = ptr->next)
if (hash_len == ptr->len
&& first_ch == ptr->string[0]
&& memcmp ((CPTR_T) text, (CPTR_T) ptr->string, hash_len) == 0)
@@ -1893,14 +1893,14 @@ add_string (vp, hash_tbl, start, end_p1, ret_hash)
fatal ("String too big (%ld bytes)", (long) len);
hash_ptr = hash_string (start, len, hash_tbl, &hi);
- if (hash_ptr == (shash_t *)0)
+ if (hash_ptr == (shash_t *) 0)
{
register char *p;
if (vp->objects_last_page + len >= PAGE_USIZE)
{
- vp->num_allocated =
- ((vp->num_allocated + PAGE_USIZE - 1) / PAGE_USIZE) * PAGE_USIZE;
+ vp->num_allocated
+ = ((vp->num_allocated + PAGE_USIZE - 1) / PAGE_USIZE) * PAGE_USIZE;
add_varray_page (vp);
}
@@ -1921,7 +1921,7 @@ add_string (vp, hash_tbl, start, end_p1, ret_hash)
*p = '\0';
}
- if (ret_hash != (shash_t **)0)
+ if (ret_hash != (shash_t **) 0)
*ret_hash = hash_ptr;
return hash_ptr->indx;
@@ -1947,7 +1947,7 @@ add_local_symbol (str_start, str_end_p1, type, storage, value, indx)
register tag_t *ptag_next;
register varray_t *vp = &cur_file_ptr->symbols;
register int scope_delta = 0;
- shash_t *hash_ptr = (shash_t *)0;
+ shash_t *hash_ptr = (shash_t *) 0;
if (vp->objects_last_page == vp->objects_per_page)
add_varray_page (vp);
@@ -1958,7 +1958,7 @@ add_local_symbol (str_start, str_end_p1, type, storage, value, indx)
psym->st = (unsigned) type;
psym->sc = (unsigned) storage;
psym->index = indx;
- psym->iss = (str_start == (const char *)0)
+ psym->iss = (str_start == (const char *) 0)
? 0
: add_string (&cur_file_ptr->strings,
&cur_file_ptr->shash_head[0],
@@ -1973,7 +1973,7 @@ add_local_symbol (str_start, str_end_p1, type, storage, value, indx)
/* Save the symbol within the hash table if this is a static
item, and it has a name. */
- if (hash_ptr != (shash_t *)0
+ if (hash_ptr != (shash_t *) 0
&& (type == st_Global || type == st_Static || type == st_Label
|| type == st_Proc || type == st_StaticProc))
hash_ptr->sym_ptr = psym;
@@ -2030,10 +2030,10 @@ add_local_symbol (str_start, str_end_p1, type, storage, value, indx)
cur_tag_head = ptag_head->prev;
for (ptag = ptag_head->first_tag;
- ptag != (tag_t *)0;
+ ptag != (tag_t *) 0;
ptag = ptag_next)
{
- if (ptag->forward_ref != (forward_t *)0)
+ if (ptag->forward_ref != (forward_t *) 0)
add_unknown_tag (ptag);
ptag_next = ptag->same_block;
@@ -2119,7 +2119,7 @@ add_ext_symbol (str_start, str_end_p1, type, storage, value, indx, ifd)
{
register EXTR *psym;
register varray_t *vp = &ext_symbols;
- shash_t *hash_ptr = (shash_t *)0;
+ shash_t *hash_ptr = (shash_t *) 0;
if (debug > 1)
{
@@ -2146,7 +2146,7 @@ add_ext_symbol (str_start, str_end_p1, type, storage, value, indx, ifd)
psym->asym.st = (unsigned) type;
psym->asym.sc = (unsigned) storage;
psym->asym.index = indx;
- psym->asym.iss = (str_start == (const char *)0)
+ psym->asym.iss = (str_start == (const char *) 0)
? 0
: add_string (&ext_strings,
&ext_str_hash[0],
@@ -2232,7 +2232,7 @@ add_aux_sym_tir (t, state, hash_tbl)
/* For anything that adds additional information, we must not hash,
- so check here, and reset our state. */
+ so check here, and reset our state. */
if (state != hash_no
&& (t->type_qualifiers[0] == tq_Array
@@ -2262,17 +2262,17 @@ add_aux_sym_tir (t, state, hash_tbl)
hi %= THASH_SIZE;
for (hash_ptr = hash_tbl[hi];
- hash_ptr != (thash_t *)0;
+ hash_ptr != (thash_t *) 0;
hash_ptr = hash_ptr->next)
{
if (aux.isym == hash_ptr->type.isym)
break;
}
- if (hash_ptr != (thash_t *)0 && state == hash_yes)
+ if (hash_ptr != (thash_t *) 0 && state == hash_yes)
return hash_ptr->indx;
- if (hash_ptr == (thash_t *)0)
+ if (hash_ptr == (thash_t *) 0)
{
hash_ptr = allocate_thash ();
hash_ptr->next = hash_tbl[hi];
@@ -2282,7 +2282,7 @@ add_aux_sym_tir (t, state, hash_tbl)
}
}
- /* Everything is set up, add the aux symbol. */
+ /* Everything is set up, add the aux symbol. */
if (vp->objects_last_page == vp->objects_per_page)
add_varray_page (vp);
@@ -2350,7 +2350,7 @@ add_aux_sym_tir (t, state, hash_tbl)
cur_file_ptr->int_type);
(void) add_aux_sym_symint (cur_file_ptr->file_index); /* file index*/
- (void) add_aux_sym_symint ((symint_t)0); /* low bound */
+ (void) add_aux_sym_symint ((symint_t) 0); /* low bound */
(void) add_aux_sym_symint (t->dimensions[i] - 1); /* high bound*/
(void) add_aux_sym_symint ((t->dimensions[i] == 0) /* stride */
? 0
@@ -2358,7 +2358,7 @@ add_aux_sym_tir (t, state, hash_tbl)
};
/* NOTE: Mips documentation claims that the bitfield width goes here.
- But it needs to be emitted earlier. */
+ But it needs to be emitted earlier. */
return ret;
}
@@ -2378,10 +2378,10 @@ get_tag (tag_start, tag_end_p1, indx, basic_type)
hash_ptr = hash_string (tag_start,
tag_end_p1 - tag_start,
&tag_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if (hash_ptr != (shash_t *)0
- && hash_ptr->tag_ptr != (tag_t *)0)
+ if (hash_ptr != (shash_t *) 0
+ && hash_ptr->tag_ptr != (tag_t *) 0)
{
tag_ptr = hash_ptr->tag_ptr;
if (indx != indexNil)
@@ -2448,17 +2448,17 @@ add_unknown_tag (ptag)
name_end_p1,
st_Block,
sc_Info,
- (symint_t)0,
- (symint_t)0);
+ (symint_t) 0,
+ (symint_t) 0);
(void) add_local_symbol (name_start,
name_end_p1,
st_End,
sc_Info,
- (symint_t)0,
- (symint_t)0);
+ (symint_t) 0,
+ (symint_t) 0);
- while (f_next != (forward_t *)0)
+ while (f_next != (forward_t *) 0)
{
f_cur = f_next;
f_next = f_next->next;
@@ -2490,7 +2490,7 @@ add_procedure (func_start, func_end_p1)
register shash_t *shash_ptr = hash_string (func_start,
func_end_p1 - func_start,
&orig_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
if (debug)
fputc ('\n', stderr);
@@ -2504,14 +2504,14 @@ add_procedure (func_start, func_end_p1)
/* Did the assembler create this procedure? If so, get the PDR information. */
- cur_oproc_ptr = (PDR *)0;
- if (shash_ptr != (shash_t *)0)
+ cur_oproc_ptr = (PDR *) 0;
+ if (shash_ptr != (shash_t *) 0)
{
register PDR *old_proc_ptr = shash_ptr->proc_ptr;
register SYMR *sym_ptr = shash_ptr->sym_ptr;
- if (old_proc_ptr != (PDR *)0
- && sym_ptr != (SYMR *)0
+ if (old_proc_ptr != (PDR *) 0
+ && sym_ptr != (SYMR *) 0
&& ((st_t)sym_ptr->st == st_Proc || (st_t)sym_ptr->st == st_StaticProc))
{
cur_oproc_begin = sym_ptr;
@@ -2524,17 +2524,17 @@ add_procedure (func_start, func_end_p1)
}
}
- if (cur_oproc_ptr == (PDR *)0)
+ if (cur_oproc_ptr == (PDR *) 0)
error ("Did not find a PDR block for %.*s", func_end_p1 - func_start, func_start);
- /* Determine the start of symbols. */
+ /* Determine the start of symbols. */
new_proc_ptr->isym = file_ptr->symbols.num_allocated;
/* Push the start of the function. */
(void) add_local_symbol (func_start, func_end_p1,
proc_type, sc_Text,
value,
- (symint_t)0);
+ (symint_t) 0);
}
@@ -2558,7 +2558,7 @@ add_file (file_start, file_end_p1)
/* See if the file has already been created. */
for (file_ptr = first_file;
- file_ptr != (efdr_t *)0;
+ file_ptr != (efdr_t *) 0;
file_ptr = file_ptr->next_file)
{
if (first_ch == file_ptr->name[0]
@@ -2570,14 +2570,14 @@ add_file (file_start, file_end_p1)
}
}
- /* If this is a new file, create it. */
- if (file_ptr == (efdr_t *)0)
+ /* If this is a new file, create it. */
+ if (file_ptr == (efdr_t *) 0)
{
if (file_desc.objects_last_page == file_desc.objects_per_page)
add_varray_page (&file_desc);
- file_ptr = cur_file_ptr =
- &file_desc.last->datum->file[ file_desc.objects_last_page++ ];
+ file_ptr = cur_file_ptr
+ = &file_desc.last->datum->file[ file_desc.objects_last_page++ ];
*file_ptr = init_file;
file_ptr->file_index = file_desc.num_allocated++;
@@ -2590,7 +2590,7 @@ add_file (file_start, file_end_p1)
&file_ptr->shash_head[0],
&zero_bytes[0],
&zero_bytes[0],
- (shash_t **)0);
+ (shash_t **) 0);
if (file_end_p1 - file_start > PAGE_USIZE-2)
fatal ("Filename goes over one page boundary.");
@@ -2598,7 +2598,7 @@ add_file (file_start, file_end_p1)
/* Push the start of the filename. We assume that the filename
will be stored at string offset 1. */
(void) add_local_symbol (file_start, file_end_p1, st_File, sc_Text,
- (symint_t)0, (symint_t)0);
+ (symint_t) 0, (symint_t) 0);
file_ptr->fdr.rss = 1;
file_ptr->name = &file_ptr->strings.last->datum->byte[1];
file_ptr->name_len = file_end_p1 - file_start;
@@ -2745,7 +2745,7 @@ read_line __proto((void))
register int ch;
register char *ptr;
- if (cur_line_start == (char *)0)
+ if (cur_line_start == (char *) 0)
{ /* allocate initial page */
cur_line_start = (char *) allocate_page ();
cur_line_alloc = PAGE_SIZE;
@@ -2804,8 +2804,8 @@ read_line __proto((void))
if (ferror (stdin))
pfatal_with_name (input_name);
- cur_line_ptr = (char *)0;
- return (char *)0;
+ cur_line_ptr = (char *) 0;
+ return (char *) 0;
}
@@ -2820,13 +2820,13 @@ parse_begin (start)
int ch;
shash_t *hash_ptr; /* hash pointer to lookup label */
- if (cur_file_ptr == (efdr_t *)0)
+ if (cur_file_ptr == (efdr_t *) 0)
{
error ("#.begin directive without a preceding .file directive");
return;
}
- if (cur_proc_ptr == (PDR *)0)
+ if (cur_proc_ptr == (PDR *) 0)
{
error ("#.begin directive without a preceding .ent directive");
return;
@@ -2838,24 +2838,24 @@ parse_begin (start)
hash_ptr = hash_string (start,
end_p1 - start,
&orig_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if (hash_ptr == (shash_t *)0)
+ if (hash_ptr == (shash_t *) 0)
{
error ("Label %.*s not found for #.begin", end_p1 - start, start);
return;
}
- if (cur_oproc_begin == (SYMR *)0)
+ if (cur_oproc_begin == (SYMR *) 0)
{
error ("Procedure table %.*s not found for #.begin", end_p1 - start, start);
return;
}
- (void) add_local_symbol ((const char *)0, (const char *)0,
+ (void) add_local_symbol ((const char *) 0, (const char *) 0,
st_Block, sc_Text,
- (symint_t)hash_ptr->sym_ptr->value - cur_oproc_begin->value,
- (symint_t)0);
+ (symint_t) hash_ptr->sym_ptr->value - cur_oproc_begin->value,
+ (symint_t) 0);
}
@@ -2870,13 +2870,13 @@ parse_bend (start)
int ch;
shash_t *hash_ptr; /* hash pointer to lookup label */
- if (cur_file_ptr == (efdr_t *)0)
+ if (cur_file_ptr == (efdr_t *) 0)
{
error ("#.begin directive without a preceding .file directive");
return;
}
- if (cur_proc_ptr == (PDR *)0)
+ if (cur_proc_ptr == (PDR *) 0)
{
error ("#.bend directive without a preceding .ent directive");
return;
@@ -2888,24 +2888,24 @@ parse_bend (start)
hash_ptr = hash_string (start,
end_p1 - start,
&orig_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if (hash_ptr == (shash_t *)0)
+ if (hash_ptr == (shash_t *) 0)
{
error ("Label %.*s not found for #.bend", end_p1 - start, start);
return;
}
- if (cur_oproc_begin == (SYMR *)0)
+ if (cur_oproc_begin == (SYMR *) 0)
{
error ("Procedure table %.*s not found for #.bend", end_p1 - start, start);
return;
}
- (void) add_local_symbol ((const char *)0, (const char *)0,
+ (void) add_local_symbol ((const char *) 0, (const char *) 0,
st_End, sc_Text,
(symint_t)hash_ptr->sym_ptr->value - cur_oproc_begin->value,
- (symint_t)0);
+ (symint_t) 0);
}
@@ -2929,12 +2929,12 @@ parse_def (name_start)
const char *arg_start; /* start of current argument */
const char *arg_end_p1; /* end+1 of current argument */
const char *name_end_p1; /* end+1 of label */
- const char *tag_start = (const char *)0; /* start of tag name */
- const char *tag_end_p1 = (const char *)0; /* end+1 of tag name */
+ const char *tag_start = (const char *) 0; /* start of tag name */
+ const char *tag_end_p1 = (const char *) 0; /* end+1 of tag name */
sc_t storage_class = sc_Nil;
st_t symbol_type = st_Nil;
type_info_t t;
- EXTR *eptr = (EXTR *)0; /* ext. sym equivalent to def*/
+ EXTR *eptr = (EXTR *) 0; /* ext. sym equivalent to def*/
int is_function = 0; /* != 0 if function */
symint_t value = 0;
symint_t indx = cur_file_ptr->void_type;
@@ -3002,7 +3002,7 @@ parse_def (name_start)
/* Pick up the subdirective argument now. */
arg_was_number = arg_number = 0;
- arg_end_p1 = (const char *)0;
+ arg_end_p1 = (const char *) 0;
arg_start = dir_end_p1+1;
ch = *arg_start;
while (ch == ' ' || ch == '\t')
@@ -3247,20 +3247,20 @@ parse_def (name_start)
ext_hash_ptr = hash_string (arg_start,
arg_end_p1 - arg_start,
&ext_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if (ext_hash_ptr != (shash_t *)0
- && ext_hash_ptr->esym_ptr != (EXTR *)0)
+ if (ext_hash_ptr != (shash_t *) 0
+ && ext_hash_ptr->esym_ptr != (EXTR *) 0)
eptr = ext_hash_ptr->esym_ptr;
orig_hash_ptr = hash_string (arg_start,
arg_end_p1 - arg_start,
&orig_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if ((orig_hash_ptr == (shash_t *)0
- || orig_hash_ptr->sym_ptr == (SYMR *)0)
- && eptr == (EXTR *)0)
+ if ((orig_hash_ptr == (shash_t *) 0
+ || orig_hash_ptr->sym_ptr == (SYMR *) 0)
+ && eptr == (EXTR *) 0)
{
fprintf (stderr, "warning, %.*s not found in original or external symbol tables, value defaults to 0\n",
arg_end_p1 - arg_start,
@@ -3269,8 +3269,8 @@ parse_def (name_start)
}
else
{
- SYMR *ptr = (orig_hash_ptr != (shash_t *)0
- && orig_hash_ptr->sym_ptr != (SYMR *)0)
+ SYMR *ptr = (orig_hash_ptr != (shash_t *) 0
+ && orig_hash_ptr->sym_ptr != (SYMR *) 0)
? orig_hash_ptr->sym_ptr
: &eptr->asym;
@@ -3294,14 +3294,22 @@ parse_def (name_start)
}
- t.extra_sizes = (tag_start != (char *)0);
+ if (storage_class == sc_Bits)
+ {
+ t.bitfield = 1;
+ t.extra_sizes = 1;
+ }
+ else
+ t.extra_sizes = 0;
+
if (t.num_dims > 0)
{
- int diff = t.num_dims - t.num_sizes;
+ int num_real_sizes = t.num_sizes - t.extra_sizes;
+ int diff = t.num_dims - num_real_sizes;
int i = t.num_dims - 1;
int j;
- if (t.num_sizes != 1 || diff < 0)
+ if (num_real_sizes != 1 || diff < 0)
{
error_line = __LINE__;
saber_stop ();
@@ -3312,7 +3320,6 @@ parse_def (name_start)
and sizes were passed, creating extra sizes for multiply
dimensioned arrays if not passed. */
- t.extra_sizes = 0;
if (diff)
{
for (j = (sizeof (t.sizes) / sizeof (t.sizes[0])) - 1; j >= 0; j--)
@@ -3329,14 +3336,6 @@ parse_def (name_start)
}
}
- else if (symbol_type == st_Member && t.num_sizes - t.extra_sizes == 1)
- { /* Is this a bitfield? This is indicated by a structure member
- having a size field that isn't an array. */
-
- t.bitfield = 1;
- }
-
-
/* Except for enumeration members & begin/ending of scopes, put the
type word in the aux. symbol table. */
@@ -3352,7 +3351,7 @@ parse_def (name_start)
|| t.basic_type == bt_Union
|| t.basic_type == bt_Enum)
{
- if (tag_start == (char *)0)
+ if (tag_start == (char *) 0)
{
error ("No tag specified for %.*s",
name_end_p1 - name_start,
@@ -3380,8 +3379,8 @@ parse_def (name_start)
/* If this is an external or static symbol, update the appropriate
external symbol. */
- if (eptr != (EXTR *)0
- && (eptr->asym.index == indexNil || cur_proc_ptr == (PDR *)0))
+ if (eptr != (EXTR *) 0
+ && (eptr->asym.index == indexNil || cur_proc_ptr == (PDR *) 0))
{
eptr->ifd = cur_file_ptr->file_index;
eptr->asym.index = indx;
@@ -3418,7 +3417,7 @@ parse_def (name_start)
that any error reporting above gives the correct name. */
case st_End:
- name_start = name_end_p1 = (const char *)0;
+ name_start = name_end_p1 = (const char *) 0;
value = inside_enumeration = 0;
break;
@@ -3440,9 +3439,9 @@ parse_def (name_start)
/* Add the symbol, except for global symbols outside of functions,
for which the external symbol table is fine enough. */
- if (eptr == (EXTR *)0
+ if (eptr == (EXTR *) 0
|| eptr->asym.st == (int)st_Nil
- || cur_proc_ptr != (PDR *)0)
+ || cur_proc_ptr != (PDR *) 0)
{
symint_t isym = add_local_symbol (name_start, name_end_p1,
symbol_type, storage_class,
@@ -3465,7 +3464,7 @@ parse_def (name_start)
forward_t *f_next = tag_ptr->forward_ref;
forward_t *f_cur;
- while (f_next != (forward_t *)0)
+ while (f_next != (forward_t *) 0)
{
f_cur = f_next;
f_next = f_next->next;
@@ -3476,7 +3475,7 @@ parse_def (name_start)
free_forward (f_cur);
}
- tag_ptr->forward_ref = (forward_t *)0;
+ tag_ptr->forward_ref = (forward_t *) 0;
}
}
@@ -3505,13 +3504,13 @@ parse_end (start)
register symint_t value;
register FDR *orig_fdr;
- if (cur_file_ptr == (efdr_t *)0)
+ if (cur_file_ptr == (efdr_t *) 0)
{
error (".end directive without a preceding .file directive");
return;
}
- if (cur_proc_ptr == (PDR *)0)
+ if (cur_proc_ptr == (PDR *) 0)
{
error (".end directive without a preceding .ent directive");
return;
@@ -3541,7 +3540,7 @@ parse_end (start)
orig_fdr = cur_file_ptr->orig_fdr;
value = 0;
- if (orig_fdr != (FDR *)0 && cur_oproc_end != (SYMR *)0)
+ if (orig_fdr != (FDR *)0 && cur_oproc_end != (SYMR *) 0)
value = cur_oproc_end->value;
else
@@ -3550,9 +3549,9 @@ parse_end (start)
(void) add_local_symbol (start_func, end_func_p1,
st_End, sc_Text,
value,
- (symint_t)0);
+ (symint_t) 0);
- cur_proc_ptr = cur_oproc_ptr = (PDR *)0;
+ cur_proc_ptr = cur_oproc_ptr = (PDR *) 0;
}
@@ -3565,13 +3564,13 @@ parse_ent (start)
register const char *start_func, *end_func_p1;
register int ch;
- if (cur_file_ptr == (efdr_t *)0)
+ if (cur_file_ptr == (efdr_t *) 0)
{
error (".ent directive without a preceding .file directive");
return;
}
- if (cur_proc_ptr != (PDR *)0)
+ if (cur_proc_ptr != (PDR *) 0)
{
error ("second .ent directive found before .end directive");
return;
@@ -3605,14 +3604,14 @@ parse_file (start)
(void) strtol (start, &p, 0);
if (start == p
- || (start_name = local_index (p, '"')) == (char *)0
- || (end_name_p1 = local_rindex (++start_name, '"')) == (char *)0)
+ || (start_name = local_index (p, '"')) == (char *) 0
+ || (end_name_p1 = local_rindex (++start_name, '"')) == (char *) 0)
{
error ("Invalid .file directive");
return;
}
- if (cur_proc_ptr != (PDR *)0)
+ if (cur_proc_ptr != (PDR *) 0)
{
error ("No way to handle .file within .ent/.end section");
return;
@@ -3630,7 +3629,7 @@ mark_stabs (start)
{
if (!stabs_seen)
{
- /* Add a dummy @stabs symbol. */
+ /* Add a dummy @stabs symbol. */
stabs_seen = 1;
(void) add_local_symbol (stabs_symbol,
stabs_symbol + sizeof (stabs_symbol),
@@ -3673,7 +3672,7 @@ STATIC void
parse_stabs_common (string_start, string_end, rest)
const char *string_start; /* start of string or NULL */
const char *string_end; /* end+1 of string or NULL */
- const char *rest; /* rest of the directive. */
+ const char *rest; /* rest of the directive. */
{
efdr_t *save_file_ptr = cur_file_ptr;
symint_t code;
@@ -3733,10 +3732,10 @@ parse_stabs_common (string_start, string_end, rest)
shash_ptr = hash_string (p,
strlen (p) - 1,
&orig_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if (shash_ptr == (shash_t *)0
- || (sym_ptr = shash_ptr->sym_ptr) == (SYMR *)0)
+ if (shash_ptr == (shash_t *) 0
+ || (sym_ptr = shash_ptr->sym_ptr) == (SYMR *) 0)
{
error ("Invalid .stabs/.stabn directive, value not found");
return;
@@ -3796,27 +3795,27 @@ parse_stabs_common (string_start, string_end, rest)
const char *start, *end_p1;
start = p;
- if ((end_p1 = strchr (start, '+')) == (char *)0)
+ if ((end_p1 = strchr (start, '+')) == (char *) 0)
{
- if ((end_p1 = strchr (start, '-')) == (char *)0)
+ if ((end_p1 = strchr (start, '-')) == (char *) 0)
end_p1 = start + strlen(start) - 1;
}
shash_ptr = hash_string (start,
end_p1 - start,
&orig_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if (shash_ptr == (shash_t *)0
- || (sym_ptr = shash_ptr->sym_ptr) == (SYMR *)0)
+ if (shash_ptr == (shash_t *) 0
+ || (sym_ptr = shash_ptr->sym_ptr) == (SYMR *) 0)
{
shash_ptr = hash_string (start,
end_p1 - start,
&ext_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if (shash_ptr == (shash_t *)0
- || shash_ptr->esym_ptr == (EXTR *)0)
+ if (shash_ptr == (shash_t *) 0
+ || shash_ptr->esym_ptr == (EXTR *) 0)
{
error ("Invalid .stabs/.stabn directive, value not found");
return;
@@ -3825,8 +3824,8 @@ parse_stabs_common (string_start, string_end, rest)
sym_ptr = &(shash_ptr->esym_ptr->asym);
}
- /* Traditionally, N_LBRAC and N_RBRAC are *not* relocated. */
- if (code == (int)N_LBRAC || code == (int)N_RBRAC)
+ /* Traditionally, N_LBRAC and N_RBRAC are *not* relocated. */
+ if (code == (int) N_LBRAC || code == (int) N_RBRAC)
{
sc = scNil;
st = stNil;
@@ -3874,7 +3873,7 @@ parse_stabs (start)
{
const char *end = local_index (start+1, '"');
- if (*start != '"' || end == (const char *)0 || end[1] != ',')
+ if (*start != '"' || end == (const char *) 0 || end[1] != ',')
{
error ("Invalid .stabs directive, no string");
return;
@@ -3888,7 +3887,7 @@ STATIC void
parse_stabn (start)
const char *start; /* start of directive */
{
- parse_stabs_common ((const char *)0, (const char *)0, start);
+ parse_stabs_common ((const char *) 0, (const char *) 0, start);
}
@@ -3914,7 +3913,7 @@ parse_input __proto((void))
ptag_head->prev = cur_tag_head;
cur_tag_head = ptag_head;
- while ((p = read_line ()) != (char *)0)
+ while ((p = read_line ()) != (char *) 0)
{
/* Skip leading blanks */
while (isspace (*p))
@@ -3939,10 +3938,10 @@ parse_input __proto((void))
cur_tag_head = ptag_head->prev;
for (ptag = ptag_head->first_tag;
- ptag != (tag_t *)0;
+ ptag != (tag_t *) 0;
ptag = ptag_next)
{
- if (ptag->forward_ref != (forward_t *)0)
+ if (ptag->forward_ref != (forward_t *) 0)
add_unknown_tag (ptag);
ptag_next = ptag->same_block;
@@ -3985,7 +3984,7 @@ update_headers __proto((void))
for the filename. */
for (file_ptr = first_file;
- file_ptr != (efdr_t *)0;
+ file_ptr != (efdr_t *) 0;
file_ptr = file_ptr->next_file)
{
register SYMR *sym_start;
@@ -4015,8 +4014,8 @@ update_headers __proto((void))
hash_ptr = hash_string (str,
(Ptrdiff_t)len,
&file_ptr->shash_head[0],
- (symint_t *)0);
- if (hash_ptr == (shash_t *)0)
+ (symint_t *) 0);
+ if (hash_ptr == (shash_t *) 0)
{
(void) add_local_symbol (str, str + len,
(st_t)sym->st, (sc_t)sym->sc,
@@ -4025,10 +4024,10 @@ update_headers __proto((void))
}
}
}
- (void) add_local_symbol ((const char *)0, (const char *)0,
+ (void) add_local_symbol ((const char *) 0, (const char *) 0,
st_End, sc_Text,
- (symint_t)0,
- (symint_t)0);
+ (symint_t) 0,
+ (symint_t) 0);
file_ptr->fdr.cpd = file_ptr->procs.num_allocated;
file_ptr->fdr.ipdFirst = symbolic_header.ipdMax;
@@ -4092,7 +4091,7 @@ update_headers __proto((void))
file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
}
- i = symbolic_header.iauxMax; /* aux syms. */
+ i = symbolic_header.iauxMax; /* aux syms. */
if (i > 0)
{
symbolic_header.cbAuxOffset = file_offset;
@@ -4164,9 +4163,9 @@ write_varray (vp, offset, str)
&& fseek (object_stream, (long)offset, SEEK_SET) < 0)
pfatal_with_name (object_name);
- for (ptr = vp->first; ptr != (vlinks_t *)0; ptr = ptr->next)
+ for (ptr = vp->first; ptr != (vlinks_t *) 0; ptr = ptr->next)
{
- num_write = (ptr->next == (vlinks_t *)0)
+ num_write = (ptr->next == (vlinks_t *) 0)
? vp->objects_last_page * vp->object_size
: vp->objects_per_page * vp->object_size;
@@ -4284,7 +4283,7 @@ write_object __proto((void))
{
offset = symbolic_header.cbPdOffset;
for (file_ptr = first_file;
- file_ptr != (efdr_t *)0;
+ file_ptr != (efdr_t *) 0;
file_ptr = file_ptr->next_file)
{
write_varray (&file_ptr->procs, offset, "Procedure tables");
@@ -4296,7 +4295,7 @@ write_object __proto((void))
{
offset = symbolic_header.cbSymOffset;
for (file_ptr = first_file;
- file_ptr != (efdr_t *)0;
+ file_ptr != (efdr_t *) 0;
file_ptr = file_ptr->next_file)
{
write_varray (&file_ptr->symbols, offset, "Local symbols");
@@ -4308,7 +4307,7 @@ write_object __proto((void))
{
offset = symbolic_header.cbAuxOffset;
for (file_ptr = first_file;
- file_ptr != (efdr_t *)0;
+ file_ptr != (efdr_t *) 0;
file_ptr = file_ptr->next_file)
{
write_varray (&file_ptr->aux_syms, offset, "Aux. symbols");
@@ -4320,7 +4319,7 @@ write_object __proto((void))
{
offset = symbolic_header.cbSsOffset;
for (file_ptr = first_file;
- file_ptr != (efdr_t *)0;
+ file_ptr != (efdr_t *) 0;
file_ptr = file_ptr->next_file)
{
write_varray (&file_ptr->strings, offset, "Local strings");
@@ -4340,7 +4339,7 @@ write_object __proto((void))
file_offset = offset;
for (file_ptr = first_file;
- file_ptr != (efdr_t *)0;
+ file_ptr != (efdr_t *) 0;
file_ptr = file_ptr->next_file)
{
if (debug)
@@ -4416,7 +4415,7 @@ read_seek (size, offset, str)
long sys_read = 0;
if (size == 0) /* nothing to read */
- return (page_t *)0;
+ return (page_t *) 0;
if (debug)
fprintf (stderr, "\trseek\tsize = %7u, offset = %7u, currently at %7u, %s\n",
@@ -4542,7 +4541,7 @@ copy_object __proto((void))
sections, so in theory no extra seeks are done.
For simplicity sake, round each read up to a page boundary,
- we may want to revisit this later.... */
+ we may want to revisit this later.... */
file_offset = orig_file_header.f_symptr + sizeof (struct filehdr);
@@ -4623,7 +4622,7 @@ copy_object __proto((void))
char *filename = orig_local_strs + (orig_files->issBase + orig_files->rss);
char *suffix = local_rindex (filename, '.');
- if (suffix != (char *)0 && strcmp (suffix, ".s") == 0)
+ if (suffix != (char *) 0 && strcmp (suffix, ".s") == 0)
delete_ifd = 1;
}
@@ -4670,7 +4669,7 @@ copy_object __proto((void))
(st_t) eptr->asym.st,
(sc_t) eptr->asym.sc,
eptr->asym.value,
- (symint_t)((eptr->asym.index == indexNil) ? indexNil : 0),
+ (symint_t) ((eptr->asym.index == indexNil) ? indexNil : 0),
(ifd < orig_sym_hdr.ifdMax) ? remap_file_number[ ifd ] : ifd);
}
@@ -4735,7 +4734,7 @@ copy_object __proto((void))
&orig_str_hash[0],
&hash_index);
- if (shash_ptr != (shash_t *)0)
+ if (shash_ptr != (shash_t *) 0)
error ("internal error, %s is already in original symbol table", str);
else
@@ -4763,9 +4762,9 @@ copy_object __proto((void))
register shash_t *shash_ptr = hash_string (str,
(Ptrdiff_t)len,
&orig_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if (shash_ptr != (shash_t *)0)
+ if (shash_ptr != (shash_t *) 0)
shash_ptr->end_ptr = sym;
}
}
@@ -4793,9 +4792,9 @@ copy_object __proto((void))
register shash_t *shash_ptr = hash_string (str,
(Ptrdiff_t)len,
&orig_str_hash[0],
- (symint_t *)0);
+ (symint_t *) 0);
- if (shash_ptr == (shash_t *)0)
+ if (shash_ptr == (shash_t *) 0)
error ("internal error, function %s is not in original symbol table", str);
else
@@ -4811,12 +4810,12 @@ copy_object __proto((void))
/* Copy all of the object file up to the symbol table. Originally
we were going to use ftruncate, but that doesn't seem to work
- on Ultrix 3.1.... */
+ on Ultrix 3.1.... */
- if (fseek (obj_in_stream, (long)0, SEEK_SET) != 0)
+ if (fseek (obj_in_stream, (long) 0, SEEK_SET) != 0)
pfatal_with_name (obj_in_name);
- if (fseek (object_stream, (long)0, SEEK_SET) != 0)
+ if (fseek (object_stream, (long) 0, SEEK_SET) != 0)
pfatal_with_name (object_name);
for (remaining = orig_file_header.f_symptr;
@@ -4910,7 +4909,7 @@ main (argc, argv)
break;
case 'I':
- if (rename_output || obj_in_name != (char *)0)
+ if (rename_output || obj_in_name != (char *) 0)
had_errors++;
else
rename_output = 1;
@@ -4918,7 +4917,7 @@ main (argc, argv)
/* fall through to 'i' case. */
case 'i':
- if (obj_in_name == (char *)0)
+ if (obj_in_name == (char *) 0)
{
obj_in_name = optarg;
iflag++;
@@ -4928,7 +4927,7 @@ main (argc, argv)
break;
case 'o':
- if (object_name == (char *)0)
+ if (object_name == (char *) 0)
object_name = optarg;
else
had_errors++;
@@ -4939,22 +4938,22 @@ main (argc, argv)
break;
}
- if (obj_in_name == (char *)0 && optind <= argc - 2)
+ if (obj_in_name == (char *) 0 && optind <= argc - 2)
obj_in_name = argv[--argc];
- if (object_name == (char *)0 && optind <= argc - 2)
+ if (object_name == (char *) 0 && optind <= argc - 2)
object_name = argv[--argc];
/* If there is an output name, but no input name use
the same file for both, deleting the name between
opening it for input and opening it for output. */
- if (obj_in_name == (char *)0 && object_name != (char *)0)
+ if (obj_in_name == (char *) 0 && object_name != (char *)0)
{
obj_in_name = object_name;
delete_input = 1;
}
- if (object_name == (char *)0 || had_errors || optind != argc - 1)
+ if (object_name == (char *) 0 || had_errors || optind != argc - 1)
{
fprintf (stderr, "Calling Sequence:\n");
fprintf (stderr, "\tmips-tfile [-d <num>] [-v] [-i <o-in-file>] -o <o-out-file> <s-file> (or)\n");
@@ -4979,7 +4978,7 @@ main (argc, argv)
fputc ('\n', stderr);
}
- if (obj_in_name == (char *)0)
+ if (obj_in_name == (char *) 0)
obj_in_name = object_name;
if (rename_output && rename (object_name, obj_in_name) != 0)
@@ -5024,14 +5023,14 @@ main (argc, argv)
/* Must open input before output, since the output may be the same file, and
we need to get the input handle before truncating it. */
obj_in_stream = fopen (obj_in_name, "r");
- if (obj_in_stream == (FILE *)0)
+ if (obj_in_stream == (FILE *) 0)
pfatal_with_name (obj_in_name);
if (delete_input && unlink (obj_in_name) != 0)
pfatal_with_name (obj_in_name);
object_stream = fopen (object_name, "w");
- if (object_stream == (FILE *)0)
+ if (object_stream == (FILE *) 0)
pfatal_with_name (object_name);
if (strcmp (argv[optind], "-") != 0)
@@ -5072,7 +5071,7 @@ STATIC void
catch_signal (signum)
int signum;
{
- (void) signal (signum, SIG_DFL); /* just in case... */
+ (void) signal (signum, SIG_DFL); /* just in case... */
#ifdef NO_SYS_SIGLIST
fatal ("caught signal");
#else
@@ -5087,7 +5086,7 @@ void
pfatal_with_name (msg)
char *msg;
{
- int save_errno = errno; /* just in case.... */
+ int save_errno = errno; /* just in case.... */
if (line_number > 0)
fprintf (stderr, "%s, %s:%ld ", progname, input_name, line_number);
else
@@ -5275,7 +5274,7 @@ allocate_scope __proto((void))
#ifndef MALLOC_CHECK
ptr = alloc_counts[ (int)alloc_type_scope ].free_list.f_scope;
- if (ptr != (scope_t *)0)
+ if (ptr != (scope_t *) 0)
alloc_counts[ (int)alloc_type_scope ].free_list.f_scope = ptr->free;
else
@@ -5432,7 +5431,7 @@ allocate_tag __proto((void))
#ifndef MALLOC_CHECK
ptr = alloc_counts[ (int)alloc_type_tag ].free_list.f_tag;
- if (ptr != (tag_t *)0)
+ if (ptr != (tag_t *) 0)
alloc_counts[ (int)alloc_type_tag ].free_list.f_tag = ptr->free;
else
@@ -5490,7 +5489,7 @@ allocate_forward __proto((void))
#ifndef MALLOC_CHECK
ptr = alloc_counts[ (int)alloc_type_forward ].free_list.f_forward;
- if (ptr != (forward_t *)0)
+ if (ptr != (forward_t *) 0)
alloc_counts[ (int)alloc_type_forward ].free_list.f_forward = ptr->free;
else
@@ -5548,7 +5547,7 @@ allocate_thead __proto((void))
#ifndef MALLOC_CHECK
ptr = alloc_counts[ (int)alloc_type_thead ].free_list.f_thead;
- if (ptr != (thead_t *)0)
+ if (ptr != (thead_t *) 0)
alloc_counts[ (int)alloc_type_thead ].free_list.f_thead = ptr->free;
else
@@ -5614,7 +5613,7 @@ fatal VPROTO((const char *format, ...))
VA_START (ap, format);
#ifndef __STDC__
- format = va_arg (ap, char*);
+ format = va_arg (ap, char *);
#endif
if (line_number > 0)
@@ -5644,7 +5643,7 @@ error VPROTO((const char *format, ...))
VA_START (ap, format);
#ifndef __STDC__
- format = va_arg (ap, char*);
+ format = va_arg (ap, char *);
#endif
if (line_number > 0)
@@ -5779,7 +5778,7 @@ local_index (str, sentinel)
for ( ; (ch = *str) != sentinel; str++)
{
if (ch == '\0')
- return (char *)0;
+ return (char *) 0;
}
return (char *)str;
@@ -5791,7 +5790,7 @@ local_rindex (str, sentinel)
int sentinel;
{
int ch;
- const char *ret = (const char *)0;
+ const char *ret = (const char *) 0;
for ( ; (ch = *str) != '\0'; str++)
{