in the form of comments (the mips assembler does not support
assembly access to debug information).
Copyright (C) 1991, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Michael Meissner (meissner@cygnus.com).
This file is part of GCC.
so they can't be static. */
extern void pfatal_with_name (const char *) ATTRIBUTE_NORETURN;
-extern void fancy_abort (void) ATTRIBUTE_NORETURN;
extern void botch (const char *) ATTRIBUTE_NORETURN;
extern void fatal (const char *format, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
st_StaticProc = stStaticProc, /* load time only static procs */
st_Constant = stConstant, /* const */
st_Str = stStr, /* string */
- st_Number = stNumber, /* pure number (ie. 4 NOR 2+2) */
+ st_Number = stNumber, /* pure number (i.e. 4 NOR 2+2) */
st_Expr = stExpr, /* 2+2 vs. 4 */
st_Type = stType, /* post-coercion SER */
st_Max = stMax /* max type+1 */
#ifdef MALLOC_CHECK
if (vp->object_size > 1)
- new_links->datum = (page_t *) xcalloc (1, vp->object_size);
+ new_links->datum = xcalloc (1, vp->object_size);
else
#endif
new_links->datum = allocate_page ();
\f
/* Add a local symbol. The symbol string starts at STR_START and the
- first byte after it is makred by STR_END_P1. The symbol has type
+ first byte after it is marked by STR_END_P1. The symbol has type
TYPE and storage class STORAGE and value VALUE. INDX is an index
to local/aux. symbols. */
STATIC void
initialize_init_file (void)
{
- memset ((void*) &init_file, 0, sizeof (init_file));
+ memset (&init_file, 0, sizeof (init_file));
init_file.fdr.lang = langC;
init_file.fdr.fMerge = 1;
init_file.fdr.glevel = GLEVEL_2;
-#ifdef HOST_WORDS_BIG_ENDIAN
+#ifdef WORDS_BIG_ENDIAN
init_file.fdr.fBigendian = 1;
#endif
value,
indx);
- /* deal with struct, union, and enum tags. */
+ /* Deal with struct, union, and enum tags. */
if (symbol_type == st_Block)
{
/* Create or update the tag information. */
return;
if (debug)
- {
- fputs ("\twarray\tvp = ", stderr);
- fprintf (stderr, HOST_PTR_PRINTF, (void *) vp);
- fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
- (unsigned long) offset, vp->num_allocated * vp->object_size, str);
- }
+ fprintf (stderr, "\twarray\tvp = " HOST_PTR_PRINTF
+ ", offset = %7lu, size = %7lu, %s\n",
+ (void *) vp, (unsigned long) offset,
+ vp->num_allocated * vp->object_size, str);
if (file_offset != (unsigned long) offset
&& fseek (object_stream, (long) offset, SEEK_SET) < 0)
off_t offset;
if (debug)
- {
- fputs ("\n\twrite\tvp = ", stderr);
- fprintf (stderr, HOST_PTR_PRINTF, (void *) &symbolic_header);
- fprintf (stderr, ", offset = %7u, size = %7lu, %s\n",
- 0, (unsigned long) sizeof (symbolic_header), "symbolic header");
- }
+ fprintf (stderr, "\n\twrite\tvp = " HOST_PTR_PRINTF
+ ", offset = %7u, size = %7lu, %s\n",
+ (void *) &symbolic_header, 0,
+ (unsigned long) sizeof (symbolic_header), "symbolic header");
sys_write = fwrite (&symbolic_header,
1,
pfatal_with_name (object_name);
if (debug)
- {
- fputs ("\twrite\tvp = ", stderr);
- fprintf (stderr, HOST_PTR_PRINTF, (void *) &orig_linenum);
- fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
- (long) symbolic_header.cbLineOffset,
- (long) symbolic_header.cbLine, "Line numbers");
- }
+ fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF
+ ", offset = %7lu, size = %7lu, %s\n",
+ (void *) &orig_linenum, (long) symbolic_header.cbLineOffset,
+ (long) symbolic_header.cbLine, "Line numbers");
sys_write = fwrite (orig_linenum,
1,
pfatal_with_name (object_name);
if (debug)
- {
- fputs ("\twrite\tvp = ", stderr);
- fprintf (stderr, HOST_PTR_PRINTF, (void *) &orig_opt_syms);
- fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
- (long) symbolic_header.cbOptOffset,
- num_write, "Optimizer symbols");
- }
+ fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF
+ ", offset = %7lu, size = %7lu, %s\n",
+ (void *) &orig_opt_syms, (long) symbolic_header.cbOptOffset,
+ num_write, "Optimizer symbols");
sys_write = fwrite (orig_opt_syms,
1,
file_ptr = file_ptr->next_file)
{
if (debug)
- {
- fputs ("\twrite\tvp = ", stderr);
- fprintf (stderr, HOST_PTR_PRINTF, (void *) &file_ptr->fdr);
- fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
- file_offset, (unsigned long) sizeof (FDR),
- "File header");
- }
+ fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF
+ ", offset = %7lu, size = %7lu, %s\n",
+ (void *) &file_ptr->fdr, file_offset,
+ (unsigned long) sizeof (FDR), "File header");
sys_write = fwrite (&file_ptr->fdr,
1,
pfatal_with_name (object_name);
if (debug)
- {
- fputs ("\twrite\tvp = ", stderr);
- fprintf (stderr, HOST_PTR_PRINTF, (void *) &orig_rfds);
- fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
- (long) symbolic_header.cbRfdOffset,
- num_write, "Relative file descriptors");
- }
+ fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF
+ ", offset = %7lu, size = %7lu, %s\n",
+ (void *) &orig_rfds, (long) symbolic_header.cbRfdOffset,
+ num_write, "Relative file descriptors");
sys_write = fwrite (orig_rfds,
1,
#ifndef MALLOC_CHECK
ptr = allocate_multiple_pages ((size + PAGE_USIZE - 1) / PAGE_USIZE);
#else
- ptr = (page_t *) xcalloc (1, size);
+ ptr = xcalloc (1, size);
#endif
/* If we need to seek, and the distance is nearby, just do some reads,
file_offset = orig_file_header.f_symptr + sizeof (struct filehdr);
if (orig_sym_hdr.cbLine > 0) /* line numbers */
- orig_linenum = (char *) read_seek ((Size_t) orig_sym_hdr.cbLine,
+ orig_linenum = (char *) read_seek (orig_sym_hdr.cbLine,
orig_sym_hdr.cbLineOffset,
"Line numbers");
if (orig_sym_hdr.ipdMax > 0) /* procedure tables */
- orig_procs = (PDR *) read_seek ((Size_t) orig_sym_hdr.ipdMax * sizeof (PDR),
+ orig_procs = (PDR *) read_seek (orig_sym_hdr.ipdMax * sizeof (PDR),
orig_sym_hdr.cbPdOffset,
"Procedure tables");
if (orig_sym_hdr.isymMax > 0) /* local symbols */
- orig_local_syms = (SYMR *) read_seek ((Size_t) orig_sym_hdr.isymMax * sizeof (SYMR),
+ orig_local_syms = (SYMR *) read_seek (orig_sym_hdr.isymMax * sizeof (SYMR),
orig_sym_hdr.cbSymOffset,
"Local symbols");
if (orig_sym_hdr.iauxMax > 0) /* aux symbols */
- orig_aux_syms = (AUXU *) read_seek ((Size_t) orig_sym_hdr.iauxMax * sizeof (AUXU),
+ orig_aux_syms = (AUXU *) read_seek (orig_sym_hdr.iauxMax * sizeof (AUXU),
orig_sym_hdr.cbAuxOffset,
"Aux. symbols");
if (orig_sym_hdr.issMax > 0) /* local strings */
- orig_local_strs = (char *) read_seek ((Size_t) orig_sym_hdr.issMax,
+ orig_local_strs = (char *) read_seek (orig_sym_hdr.issMax,
orig_sym_hdr.cbSsOffset,
"Local strings");
if (orig_sym_hdr.issExtMax > 0) /* external strings */
- orig_ext_strs = (char *) read_seek ((Size_t) orig_sym_hdr.issExtMax,
+ orig_ext_strs = (char *) read_seek (orig_sym_hdr.issExtMax,
orig_sym_hdr.cbSsExtOffset,
"External strings");
if (orig_sym_hdr.ifdMax > 0) /* file tables */
- orig_files = (FDR *) read_seek ((Size_t) orig_sym_hdr.ifdMax * sizeof (FDR),
+ orig_files = (FDR *) read_seek (orig_sym_hdr.ifdMax * sizeof (FDR),
orig_sym_hdr.cbFdOffset,
"File tables");
if (orig_sym_hdr.crfd > 0) /* relative file descriptors */
- orig_rfds = (symint_t *) read_seek ((Size_t) orig_sym_hdr.crfd * sizeof (symint_t),
+ orig_rfds = (symint_t *) read_seek (orig_sym_hdr.crfd * sizeof (symint_t),
orig_sym_hdr.cbRfdOffset,
"Relative file descriptors");
if (orig_sym_hdr.issExtMax > 0) /* external symbols */
- orig_ext_syms = (EXTR *) read_seek ((Size_t) orig_sym_hdr.iextMax * sizeof (EXTR),
+ orig_ext_syms = (EXTR *) read_seek (orig_sym_hdr.iextMax * sizeof (EXTR),
orig_sym_hdr.cbExtOffset,
"External symbols");
if (orig_sym_hdr.idnMax > 0) /* dense numbers */
{
- orig_dense = (DNR *) read_seek ((Size_t) orig_sym_hdr.idnMax * sizeof (DNR),
+ orig_dense = (DNR *) read_seek (orig_sym_hdr.idnMax * sizeof (DNR),
orig_sym_hdr.cbDnOffset,
"Dense numbers");
- add_bytes (&dense_num, (char *) orig_dense, (Size_t) orig_sym_hdr.idnMax);
+ add_bytes (&dense_num, (char *) orig_dense, orig_sym_hdr.idnMax);
}
if (orig_sym_hdr.ioptMax > 0) /* opt symbols */
- orig_opt_syms = (OPTR *) read_seek ((Size_t) orig_sym_hdr.ioptMax * sizeof (OPTR),
+ orig_opt_syms = (OPTR *) read_seek (orig_sym_hdr.ioptMax * sizeof (OPTR),
orig_sym_hdr.cbOptOffset,
"Optimizer symbols");
- /* Abort if the symbol table is not last. */
+ /* The symbol table should be last. */
if (max_file_offset != (unsigned long) stat_buf.st_size)
fatal ("symbol table is not last (symbol table ends at %ld, .o ends at %ld",
max_file_offset,
(in case there are duplicate filenames, we collapse them into one
file section, the MIPS assembler may or may not collapse them). */
- remap_file_number = (int *) alloca (sizeof (int) * orig_sym_hdr.ifdMax);
+ remap_file_number = alloca (sizeof (int) * orig_sym_hdr.ifdMax);
for (fd = delete_ifd; fd < orig_sym_hdr.ifdMax; fd++)
{
else
rename_output = 1;
- /* fall through to 'i' case. */
+ /* Fall through to 'i' case. */
case 'i':
if (obj_in_name == (char *) 0)
if (version)
{
printf (_("mips-tfile (GCC) %s\n"), version_string);
- fputs (_("Copyright (C) 2003 Free Software Foundation, Inc.\n"), stdout);
+ fputs ("Copyright (C) 2004 Free Software Foundation, Inc.\n", stdout);
fputs (_("This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"),
stdout);
}
\f
-/* Procedure to abort with an out of bounds error message. It has
+/* Procedure to die with an out of bounds error message. It has
type int, so it can be used with an ?: expression within the
ORIG_xxx macros, but the function never returns. */
STATIC page_t *
allocate_cluster (Size_t npages)
{
- page_t *value = (page_t *) xcalloc (npages, PAGE_USIZE);
+ page_t *value = xcalloc (npages, PAGE_USIZE);
if (debug > 3)
fprintf (stderr, "\talloc\tnpages = %d, value = 0x%.8x\n", npages, value);
pfatal_with_name ("allocate_cluster");
if (debug > 3)
- {
- fprintf (stderr, "\talloc\tnpages = %lu, value = ",
- (unsigned long) npages);
- fprintf (stderr, HOST_PTR_PRINTF, (void *) ptr);
- fputs ("\n", stderr);
- }
+ fprintf (stderr, "\talloc\tnpages = %lu, value = " HOST_PTR_PRINTF "\n",
+ (unsigned long) npages, (void *) ptr);
return ptr;
}
return allocate_cluster (npages);
#else /* MALLOC_CHECK */
- return (page_t *) xcalloc (npages, PAGE_SIZE);
+ return xcalloc (npages, PAGE_SIZE);
#endif /* MALLOC_CHECK */
}
return cluster_ptr++;
#else /* MALLOC_CHECK */
- return (page_t *) xcalloc (1, PAGE_SIZE);
+ return xcalloc (1, PAGE_SIZE);
#endif /* MALLOC_CHECK */
}
}
#else
- ptr = (scope_t *) xmalloc (sizeof (scope_t));
+ ptr = xmalloc (sizeof (scope_t));
#endif
alloc_counts[ (int) alloc_type_vlinks ].unallocated = unallocated;
#else
- ptr = (vlinks_t *) xmalloc (sizeof (vlinks_t));
+ ptr = xmalloc (sizeof (vlinks_t));
#endif
alloc_counts[ (int) alloc_type_shash ].unallocated = unallocated;
#else
- ptr = (shash_t *) xmalloc (sizeof (shash_t));
+ ptr = xmalloc (sizeof (shash_t));
#endif
alloc_counts[ (int) alloc_type_thash ].unallocated = unallocated;
#else
- ptr = (thash_t *) xmalloc (sizeof (thash_t));
+ ptr = xmalloc (sizeof (thash_t));
#endif
}
#else
- ptr = (tag_t *) xmalloc (sizeof (tag_t));
+ ptr = xmalloc (sizeof (tag_t));
#endif
}
#else
- ptr = (forward_t *) xmalloc (sizeof (forward_t));
+ ptr = xmalloc (sizeof (forward_t));
#endif
}
#else
- ptr = (thead_t *) xmalloc (sizeof (thead_t));
+ ptr = xmalloc (sizeof (thead_t));
#endif
saber_stop ();
}
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
+/* More 'friendly' abort that prints the line and file. */
void
-fancy_abort (void)
+fancy_abort (const char *file, int line, const char *func)
{
- fatal ("internal abort");
+ fatal ("abort in %s, at %s:%d", func, file, line);
}
\f