OSDN Git Service

* config/alpha/osf.h (ASM_OUTPUT_WEAK_ALIAS, ASM_WEAKEN_LABEL,
[pf3gnuchains/gcc-fork.git] / gcc / mips-tfile.c
index 04b3618..5de540a 100644 (file)
@@ -2,7 +2,8 @@
    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, 93, 94, 95, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
    Contributed by Michael Meissner (meissner@cygnus.com).
    
 This file is part of GNU CC.
@@ -600,12 +601,9 @@ Boston, MA 02111-1307, USA.  */
 \f
 
 #include "config.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 #include "system.h"
+#include "version.h"
+#include "intl.h"
 
 #ifndef __SABER__
 #define saber_stop()
@@ -615,36 +613,7 @@ Boston, MA 02111-1307, USA.  */
 #define __LINE__ 0
 #endif
 
-#ifdef __STDC__
-typedef void *PTR_T;
-typedef const void *CPTR_T;
-#define __proto(x) x
-#ifndef VPROTO
-#define PVPROTO(ARGS)          ARGS
-#define VPROTO(ARGS)            ARGS
-#define VA_START(va_list,var)  va_start(va_list,var)
-#endif
-#else
-
-#if defined(_STDIO_H_) || defined(__STDIO_H__)         /* Ultrix 4.0, SGI */
-typedef void *PTR_T;
-typedef void *CPTR_T;
-
-#else
-typedef char *PTR_T;                                   /* Ultrix 3.1 */
-typedef char *CPTR_T;
-#endif
-
-#define __proto(x) ()
-#define const
-#ifndef VPROTO
-#define PVPROTO(ARGS)          ()
-#define VPROTO(ARGS)            (va_alist) va_dcl
-#define VA_START(va_list,var)  va_start(va_list)
-#endif
-#endif
-
-/* Do to size_t being defined in sys/types.h and different
+/* Due to size_t being defined in sys/types.h and different
    in stddef.h, we have to do this by hand.....  Note, these
    types are correct for MIPS based systems, and may not be
    correct for other systems.  Ultrix 4.0 and Silicon Graphics
@@ -663,16 +632,12 @@ typedef char *CPTR_T;
    so they can't be static.  */
 
 extern void    pfatal_with_name
-                               __proto((char *));
-extern void    fancy_abort     __proto((void));
-       void    botch           __proto((const char *));
-extern PTR_T   xmalloc         __proto((Size_t));
-extern PTR_T   xcalloc         __proto((Size_t, Size_t));
-extern PTR_T   xrealloc        __proto((PTR_T, Size_t));
-extern void    xfree           __proto((PTR_T));
-
-extern void    fatal           PVPROTO((const char *format, ...));
-extern void    error           PVPROTO((const char *format, ...));
+                               PARAMS ((const char *)) ATTRIBUTE_NORETURN;
+extern void    fancy_abort     PARAMS ((void)) ATTRIBUTE_NORETURN;
+       void    botch           PARAMS ((const char *)) ATTRIBUTE_NORETURN;
+
+extern void    fatal           PARAMS ((const char *format, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+extern void    error           PARAMS ((const char *format, ...)) ATTRIBUTE_PRINTF_1;
 \f
 #ifndef MIPS_DEBUGGING_INFO
 
@@ -680,8 +645,8 @@ static int   line_number;
 static int      cur_line_start;
 static int      debug;
 static int      had_errors;
-static char    *progname;
-static char    *input_name;
+static const char *progname;
+static const char *input_name;
 
 int
 main ()
@@ -693,13 +658,11 @@ main ()
 #else                          /* MIPS_DEBUGGING defined */
 \f
 /* The local and global symbols have a field index, so undo any defines
-   of index -> strchr and rindex -> strrchr.  */
+   of index -> strchr.  */
 
-#undef rindex
 #undef index
 
 #include <signal.h>
-#include <sys/stat.h>
 
 #ifndef CROSS_COMPILE
 #include <a.out.h>
@@ -707,17 +670,9 @@ main ()
 #include "mips/a.out.h"
 #endif /* CROSS_COMPILE */
 
-#if defined (USG) || !defined (HAVE_STAB_H)
-#include "gstab.h"  /* If doing DBX on sysV, use our own stab.h.  */
-#else
-#include <stab.h>  /* On BSD, use the system's stab.h.  */
-#endif /* not USG */
+#include "gstab.h"
 
-#ifdef __GNU_STAB__
 #define STAB_CODE_TYPE enum __stab_debug_code
-#else
-#define STAB_CODE_TYPE int
-#endif
 
 #ifndef MALLOC_CHECK
 #ifdef __SABER__
@@ -937,7 +892,7 @@ enum alloc_type {
    grow linearly, and which are written in the object file as sequential
    pages.  On systems with a BSD malloc that define USE_MALLOC, the
    MAX_CLUSTER_PAGES should be 1 less than a power of two, since malloc
-   adds it's overhead, and rounds up to the next power of 2.  Pages are
+   adds its overhead, and rounds up to the next power of 2.  Pages are
    linked together via a linked list.
 
    If PAGE_SIZE is > 4096, the string length in the shash_t structure
@@ -1112,6 +1067,37 @@ typedef struct efdr {
 static efdr_t init_file = 
 {
   {                    /* FDR structure */
+#ifdef __alpha
+    0,                 /* adr:         memory address of beginning of file */
+    0,                 /* cbLineOffset: byte offset from header for this file ln's */
+    0,                 /* cbLine:      size of lines for this file */
+    0,                 /* cbSs:        number of bytes in the ss */
+    0,                 /* rss:         file name (of source, if known) */
+    0,                 /* issBase:     file's string space */
+    0,                 /* isymBase:    beginning of symbols */
+    0,                 /* csym:        count file's of symbols */
+    0,                 /* ilineBase:   file's line symbols */
+    0,                 /* cline:       count of file's line symbols */
+    0,                 /* ioptBase:    file's optimization entries */
+    0,                 /* copt:        count of file's optimization entries */
+    0,                 /* ipdFirst:    start of procedures for this file */
+    0,                 /* cpd:         count of procedures for this file */
+    0,                 /* iauxBase:    file's auxiliary entries */
+    0,                 /* caux:        count of file's auxiliary entries */
+    0,                 /* rfdBase:     index into the file indirect table */
+    0,                 /* crfd:        count file indirect entries */
+    langC,             /* lang:        language for this file */
+    1,                 /* fMerge:      whether this file can be merged */
+    0,                 /* fReadin:     true if read in (not just created) */
+#ifdef HOST_WORDS_BIG_ENDIAN
+    1,                 /* fBigendian:  if 1, compiled on big endian machine */
+#else
+    0,                 /* fBigendian:  if 1, compiled on big endian machine */
+#endif
+    0,                 /* fTrim:       whether the symbol table was trimmed */
+    GLEVEL_2,          /* glevel:      level this file was compiled with */
+    0,                 /* reserved:    reserved for future use */
+#else
     0,                 /* adr:         memory address of beginning of file */
     0,                 /* rss:         file name (of source, if known) */
     0,                 /* issBase:     file's string space */
@@ -1140,6 +1126,7 @@ static efdr_t init_file =
     0,                 /* reserved:    reserved for future use */
     0,                 /* cbLineOffset: byte offset from header for this file ln's */
     0,                 /* cbLine:      size of lines for this file */
+#endif
   },
 
   (FDR *) 0,           /* orig_fdr:    original file header pointer */
@@ -1189,7 +1176,7 @@ typedef union page {
 
 /* Structure holding allocation information for small sized structures.  */
 typedef struct alloc_info {
-  char         *alloc_name;    /* name of this allocation type (must be first) */
+  const char   *alloc_name;    /* name of this allocation type (must be first) */
   page_t       *cur_page;      /* current page being allocated from */
   small_free_t  free_list;     /* current free list if any */
   int           unallocated;   /* number of elements unallocated on page */
@@ -1586,7 +1573,7 @@ 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 char    *input_name     = "stdin";      /* name of input file */
+static const 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 */
@@ -1616,129 +1603,111 @@ static char stabs_symbol[] = STABS_SYMBOL;
 #define STATIC static
 #endif
 
-STATIC int     out_of_bounds   __proto((symint_t, symint_t, const char *, int));
+STATIC int     out_of_bounds   PARAMS ((symint_t, symint_t, const char *, int));
 
-STATIC shash_t *hash_string    __proto((const char *,
+STATIC shash_t *hash_string    PARAMS ((const char *,
                                         Ptrdiff_t,
                                         shash_t **,
                                         symint_t *));
 
-STATIC symint_t        add_string      __proto((varray_t *,
+STATIC symint_t        add_string      PARAMS ((varray_t *,
                                         shash_t **,
                                         const char *,
                                         const char *,
                                         shash_t **));
 
 STATIC symint_t        add_local_symbol
-                               __proto((const char *,
+                               PARAMS ((const char *,
                                         const char *,
                                         st_t,
                                         sc_t,
                                         symint_t,
                                         symint_t));
 
-STATIC symint_t        add_ext_symbol  __proto((const char *,
-                                        const char *,
-                                        st_t,
-                                        sc_t,
-                                        long,
-                                        symint_t,
-                                        int));
+STATIC symint_t        add_ext_symbol  PARAMS ((EXTR *,
+                                        int));
 
 STATIC symint_t        add_aux_sym_symint
-                               __proto((symint_t));
+                               PARAMS ((symint_t));
 
 STATIC symint_t        add_aux_sym_rndx
-                               __proto((int, symint_t));
+                               PARAMS ((int, symint_t));
 
-STATIC symint_t        add_aux_sym_tir __proto((type_info_t *,
+STATIC symint_t        add_aux_sym_tir PARAMS ((type_info_t *,
                                         hash_state_t,
                                         thash_t **));
 
-STATIC tag_t * get_tag         __proto((const char *,
+STATIC tag_t * get_tag         PARAMS ((const char *,
                                         const char *,
                                         symint_t,
                                         bt_t));
 
-STATIC void    add_unknown_tag __proto((tag_t *));
+STATIC void    add_unknown_tag PARAMS ((tag_t *));
 
-STATIC void    add_procedure   __proto((const char *,
+STATIC void    add_procedure   PARAMS ((const char *,
                                         const char *));
 
-STATIC void    add_file        __proto((const char *,
+STATIC void    add_file        PARAMS ((const char *,
                                         const char *));
 
-STATIC void    add_bytes       __proto((varray_t *,
+STATIC void    add_bytes       PARAMS ((varray_t *,
                                         char *,
                                         Size_t));
 
-STATIC void    add_varray_page __proto((varray_t *));
-
-STATIC void    update_headers  __proto((void));
-
-STATIC void    write_varray    __proto((varray_t *, off_t, const char *));
-STATIC void    write_object    __proto((void));
-STATIC char    *st_to_string   __proto((st_t));
-STATIC char    *sc_to_string   __proto((sc_t));
-STATIC char    *read_line      __proto((void));
-STATIC void    parse_input     __proto((void));
-STATIC void    mark_stabs      __proto((const char *));
-STATIC void    parse_begin     __proto((const char *));
-STATIC void    parse_bend      __proto((const char *));
-STATIC void    parse_def       __proto((const char *));
-STATIC void    parse_end       __proto((const char *));
-STATIC void    parse_ent       __proto((const char *));
-STATIC void    parse_file      __proto((const char *));
+STATIC void    add_varray_page PARAMS ((varray_t *));
+
+STATIC void    update_headers  PARAMS ((void));
+
+STATIC void    write_varray    PARAMS ((varray_t *, off_t, const char *));
+STATIC void    write_object    PARAMS ((void));
+STATIC const char *st_to_string        PARAMS ((st_t));
+STATIC const char *sc_to_string        PARAMS ((sc_t));
+STATIC char    *read_line      PARAMS ((void));
+STATIC void    parse_input     PARAMS ((void));
+STATIC void    mark_stabs      PARAMS ((const char *));
+STATIC void    parse_begin     PARAMS ((const char *));
+STATIC void    parse_bend      PARAMS ((const char *));
+STATIC void    parse_def       PARAMS ((const char *));
+STATIC void    parse_end       PARAMS ((const char *));
+STATIC void    parse_ent       PARAMS ((const char *));
+STATIC void    parse_file      PARAMS ((const char *));
 STATIC void    parse_stabs_common
-                               __proto((const char *, const char *, const char *));
-STATIC void    parse_stabs     __proto((const char *));
-STATIC void    parse_stabn     __proto((const char *));
-STATIC page_t  *read_seek      __proto((Size_t, off_t, const char *));
-STATIC void    copy_object     __proto((void));
+                               PARAMS ((const char *, const char *, const char *));
+STATIC void    parse_stabs     PARAMS ((const char *));
+STATIC void    parse_stabn     PARAMS ((const char *));
+STATIC page_t  *read_seek      PARAMS ((Size_t, off_t, const char *));
+STATIC void    copy_object     PARAMS ((void));
 
-STATIC void    catch_signal    __proto((int));
-STATIC page_t  *allocate_page  __proto((void));
+STATIC void    catch_signal    PARAMS ((int)) ATTRIBUTE_NORETURN;
+STATIC page_t  *allocate_page  PARAMS ((void));
 
 STATIC page_t  *allocate_multiple_pages
-                               __proto((Size_t));
+                               PARAMS ((Size_t));
 
 STATIC void    free_multiple_pages
-                               __proto((page_t *, Size_t));
+                               PARAMS ((page_t *, Size_t));
 
 #ifndef MALLOC_CHECK
 STATIC page_t  *allocate_cluster
-                               __proto((Size_t));
+                               PARAMS ((Size_t));
 #endif
 
-STATIC forward_t *allocate_forward     __proto((void));
-STATIC scope_t  *allocate_scope        __proto((void));
-STATIC shash_t  *allocate_shash        __proto((void));
-STATIC tag_t    *allocate_tag          __proto((void));
-STATIC thash_t  *allocate_thash        __proto((void));
-STATIC thead_t  *allocate_thead        __proto((void));
-STATIC vlinks_t         *allocate_vlinks       __proto((void));
+STATIC forward_t *allocate_forward     PARAMS ((void));
+STATIC scope_t  *allocate_scope        PARAMS ((void));
+STATIC shash_t  *allocate_shash        PARAMS ((void));
+STATIC tag_t    *allocate_tag          PARAMS ((void));
+STATIC thash_t  *allocate_thash        PARAMS ((void));
+STATIC thead_t  *allocate_thead        PARAMS ((void));
+STATIC vlinks_t         *allocate_vlinks       PARAMS ((void));
 
-STATIC void      free_forward          __proto((forward_t *));
-STATIC void      free_scope            __proto((scope_t *));
-STATIC void      free_tag              __proto((tag_t *));
-STATIC void      free_thead            __proto((thead_t *));
-
-STATIC char     *local_index           __proto((const char *, int));
-STATIC char     *local_rindex          __proto((const char *, int));
-
-extern char  *mktemp                   __proto((char *));
-extern long   strtol                   __proto((const char *, char **, int));
+STATIC void      free_forward          PARAMS ((forward_t *));
+STATIC void      free_scope            PARAMS ((scope_t *));
+STATIC void      free_tag              PARAMS ((tag_t *));
+STATIC void      free_thead            PARAMS ((thead_t *));
 
 extern char *optarg;
 extern int   optind;
 extern int   opterr;
-extern char *version_string;
-#ifndef NO_SYS_SIGLIST
-#ifndef SYS_SIGLIST_DECLARED
-extern char *sys_siglist[NSIG + 1];
-#endif
-#endif
-
 \f
 /* List of assembler pseudo ops and beginning sequences that need
    special actions.  Someday, this should be a hash table, and such,
@@ -1748,7 +1717,7 @@ extern char *sys_siglist[NSIG + 1];
 typedef struct _pseudo_ops {
   const char *name;                    /* pseudo-op in ascii */
   int len;                             /* length of name to compare */
-  void (*func) __proto((const char *));        /* function to handle line */
+  void (*func) PARAMS ((const char *));        /* function to handle line */
 } pseudo_ops_t;
 
 static pseudo_ops_t pseudo_ops[] = {
@@ -1825,9 +1794,9 @@ hash_string (text, hash_len, hash_tbl, ret_hash_index)
     *ret_hash_index = hi;
 
   for (ptr = hash_tbl[hi]; ptr != (shash_t *) 0; ptr = ptr->next)
-    if (hash_len == ptr->len
+    if ((symint_t) hash_len == ptr->len
        && first_ch == ptr->string[0]
-       && memcmp ((CPTR_T) text, (CPTR_T) ptr->string, hash_len) == 0)
+       && memcmp (text, ptr->string, hash_len) == 0)
       break;
 
   return ptr;
@@ -1850,7 +1819,7 @@ add_string (vp, hash_tbl, start, end_p1, ret_hash)
   register shash_t *hash_ptr;
   symint_t hi;
 
-  if (len >= PAGE_USIZE)
+  if (len >= (Ptrdiff_t) PAGE_USIZE)
     fatal ("String too big (%ld bytes)", (long) len);
 
   hash_ptr = hash_string (start, len, hash_tbl, &hi);
@@ -1858,7 +1827,7 @@ add_string (vp, hash_tbl, start, end_p1, ret_hash)
     {
       register char *p;
 
-      if (vp->objects_last_page + len >= PAGE_USIZE)
+      if (vp->objects_last_page + len >= (long) PAGE_USIZE)
        {
          vp->num_allocated
            = ((vp->num_allocated + PAGE_USIZE - 1) / PAGE_USIZE) * PAGE_USIZE;
@@ -2045,8 +2014,8 @@ add_local_symbol (str_start, str_end_p1, type, storage, value, indx)
       && (debug > 2 || type == st_Block || type == st_End
          || type == st_Proc || type == st_StaticProc))
     {
-      char *sc_str = sc_to_string (storage);
-      char *st_str = st_to_string (type);
+      const char *sc_str = sc_to_string (storage);
+      const char *st_str = st_to_string (type);
       int depth = cur_file_ptr->nested_scopes + (scope_delta < 0);
 
       fprintf (stderr,
@@ -2070,23 +2039,24 @@ add_local_symbol (str_start, str_end_p1, type, storage, value, indx)
 /* Add an external symbol.  */
 
 STATIC symint_t
-add_ext_symbol (str_start, str_end_p1, type, storage, value, indx, ifd)
-     const char *str_start;            /* first byte in string */
-     const char *str_end_p1;           /* first byte after string */
-     st_t type;                                /* symbol type */
-     sc_t storage;                     /* storage class */
-     long value;                       /* value of symbol */
-     symint_t indx;                    /* index to local/aux. syms */
+add_ext_symbol (esym, ifd)
+     EXTR *esym;                       /* symbol pointer */
      int ifd;                          /* file index */
 {
+  const char *str_start;               /* first byte in string */
+  const char *str_end_p1;              /* first byte after string */
   register EXTR *psym;
   register varray_t *vp = &ext_symbols;
   shash_t *hash_ptr = (shash_t *) 0;
 
+  str_start = ORIG_ESTRS (esym->asym.iss);
+  str_end_p1 = str_start + strlen(str_start);
+
   if (debug > 1)
     {
-      char *sc_str = sc_to_string (storage);
-      char *st_str = st_to_string (type);
+      long value = esym->asym.value;
+      const char *sc_str = sc_to_string (esym->asym.sc);
+      const char *st_str = st_to_string (esym->asym.st);
 
       fprintf (stderr,
               "\tesym\tv= %10ld, ifd= %2d, sc= %-12s",
@@ -2104,11 +2074,9 @@ add_ext_symbol (str_start, str_end_p1, type, storage, value, indx, ifd)
 
   psym = &vp->last->datum->esym[ vp->objects_last_page++ ];
 
+  *psym = *esym;
   psym->ifd = ifd;
-  psym->asym.value = value;
-  psym->asym.st    = (unsigned) type;
-  psym->asym.sc    = (unsigned) storage;
-  psym->asym.index = indx;
+  psym->asym.index = indexNil;
   psym->asym.iss   = (str_start == (const char *) 0)
                        ? 0
                        : add_string (&ext_strings,
@@ -2368,7 +2336,8 @@ get_tag (tag_start, tag_end_p1, indx, basic_type)
   tag_ptr->same_name   = hash_ptr->tag_ptr;
   tag_ptr->basic_type  = basic_type;
   tag_ptr->indx                = indx;
-  tag_ptr->ifd         = (indx == indexNil) ? -1 : cur_file_ptr->file_index;
+  tag_ptr->ifd         = (indx == indexNil
+                          ? (symint_t) -1 : cur_file_ptr->file_index);
   tag_ptr->same_block  = cur_tag_head->first_tag;
 
   cur_tag_head->first_tag = tag_ptr;
@@ -2394,7 +2363,7 @@ add_unknown_tag (ptag)
 
   if (debug > 1)
     {
-      char *agg_type   = "{unknown aggregate type}";
+      const char *agg_type = "{unknown aggregate type}";
       switch (ptag->basic_type)
        {
        case bt_Struct: agg_type = "struct";    break;
@@ -2488,7 +2457,8 @@ add_procedure (func_start, func_end_p1)
     }
 
   if (cur_oproc_ptr == (PDR *) 0)
-    error ("Did not find a PDR block for %.*s", func_end_p1 - func_start, func_start);
+    error ("Did not find a PDR block for %.*s",
+          (int) (func_end_p1 - func_start), func_start);
 
   /* Determine the start of symbols.  */
   new_proc_ptr->isym = file_ptr->symbols.num_allocated;
@@ -2526,7 +2496,7 @@ add_file (file_start, file_end_p1)
     {
       if (first_ch == file_ptr->name[0]
          && file_ptr->name[len] == '\0'
-         && memcmp ((CPTR_T) file_start, (CPTR_T) file_ptr->name, len) == 0)
+         && memcmp (file_start, file_ptr->name, len) == 0)
        {
          cur_file_ptr = file_ptr;
          break;
@@ -2555,7 +2525,7 @@ add_file (file_start, file_end_p1)
                  &zero_bytes[0],
                  (shash_t **) 0);
 
-      if (file_end_p1 - file_start > PAGE_USIZE-2)
+      if (file_end_p1 - file_start > (long) PAGE_USIZE-2)
        fatal ("Filename goes over one page boundary.");
 
       /* Push the start of the filename. We assume that the filename
@@ -2610,7 +2580,7 @@ add_bytes (vp, input_ptr, nitems)
 
       if (move_bytes >= 32)
        {
-         (void) memcpy ((PTR_T) ptr, (CPTR_T) input_ptr, move_bytes);
+         (void) memcpy (ptr, input_ptr, move_bytes);
          input_ptr += move_bytes;
        }
       else
@@ -2624,7 +2594,7 @@ add_bytes (vp, input_ptr, nitems)
 \f
 /* Convert storage class to string.  */
 
-STATIC char *
+STATIC const char *
 sc_to_string(storage_class)
      sc_t storage_class;
 {
@@ -2662,7 +2632,7 @@ sc_to_string(storage_class)
 \f
 /* Convert symbol type to string.  */
 
-STATIC char *
+STATIC const char *
 st_to_string(symbol_type)
      st_t symbol_type;
 {
@@ -2700,7 +2670,7 @@ st_to_string(symbol_type)
    semi-colon, and return each logical line independently.  */
 
 STATIC char *
-read_line __proto((void))
+read_line ()
 {
   static   int line_split_p    = 0;
   register int string_p                = 0;
@@ -2805,13 +2775,15 @@ parse_begin (start)
 
   if (hash_ptr == (shash_t *) 0)
     {
-      error ("Label %.*s not found for #.begin", end_p1 - start, start);
+      error ("Label %.*s not found for #.begin",
+            (int) (end_p1 - start), start);
       return;
     }
 
   if (cur_oproc_begin == (SYMR *) 0)
     {
-      error ("Procedure table %.*s not found for #.begin", end_p1 - start, start);
+      error ("Procedure table %.*s not found for #.begin",
+            (int) (end_p1 - start), start);
       return;
     }
 
@@ -2855,13 +2827,14 @@ parse_bend (start)
 
   if (hash_ptr == (shash_t *) 0)
     {
-      error ("Label %.*s not found for #.bend", end_p1 - start, start);
+      error ("Label %.*s not found for #.bend", (int) (end_p1 - start), start);
       return;
     }
 
   if (cur_oproc_begin == (SYMR *) 0)
     {
-      error ("Procedure table %.*s not found for #.bend", end_p1 - start, start);
+      error ("Procedure table %.*s not found for #.bend",
+            (int) (end_p1 - start), start);
       return;
     }
 
@@ -2892,8 +2865,8 @@ 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          = 0;                  /* start of tag name */
+  const char *tag_end_p1  = 0;                 /* end+1 of tag name */
   sc_t storage_class     = sc_Nil;
   st_t symbol_type       = st_Nil;
   type_info_t t;
@@ -2965,7 +2938,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 = 0;
       arg_start = dir_end_p1+1;
       ch = *arg_start;
       while (ch == ' ' || ch == '\t')
@@ -3285,7 +3258,7 @@ parse_def (name_start)
 
       if (diff)
        {
-         for (j = (sizeof (t.sizes) / sizeof (t.sizes[0])) - 1; j >= 0; j--)
+         for (j = ARRAY_SIZE (t.sizes) - 1; j >= 0; j--)
            t.sizes[ j ] = ((j-diff) >= 0) ? t.sizes[ j-diff ] : 0;
 
          t.num_sizes = i + 1;
@@ -3317,7 +3290,7 @@ parse_def (name_start)
          if (tag_start == (char *) 0)
            {
              error ("No tag specified for %.*s",
-                    name_end_p1 - name_start,
+                    (int) (name_end_p1 - name_start),
                     name_start);
              return;
            }
@@ -3380,7 +3353,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 = 0;
       value = inside_enumeration = 0;
       break;
 
@@ -3480,7 +3453,7 @@ parse_end (start)
     }
 
   /* Get the function name, skipping whitespace.  */
-  for (start_func = start; ISSPACE (*start_func); start_func++)
+  for (start_func = start; ISSPACE ((unsigned char)*start_func); start_func++)
     ;
 
   ch = *start_func;
@@ -3507,7 +3480,8 @@ parse_end (start)
     value = cur_oproc_end->value;
 
   else
-    error ("Cannot find .end block for %.*s", end_func_p1 - start_func, start_func);
+    error ("Cannot find .end block for %.*s",
+          (int) (end_func_p1 - start_func), start_func);
 
   (void) add_local_symbol (start_func, end_func_p1,
                           st_End, sc_Text,
@@ -3539,7 +3513,7 @@ parse_ent (start)
       return;
     }
 
-  for (start_func = start; ISSPACE (*start_func); start_func++)
+  for (start_func = start; ISSPACE ((unsigned char)*start_func); start_func++)
     ;
 
   ch = *start_func;
@@ -3567,8 +3541,8 @@ 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 = strchr (p, '"')) == (char *) 0
+      || (end_name_p1 = strrchr (++start_name, '"')) == (char *) 0)
     {
       error ("Invalid .file directive");
       return;
@@ -3588,7 +3562,7 @@ parse_file (start)
 
 static void
 mark_stabs (start)
-     const char *start;                        /* Start of directive (ignored) */
+  const char *start ATTRIBUTE_UNUSED;  /* Start of directive (ignored) */
 {
   if (!stabs_seen)
     {
@@ -3686,7 +3660,7 @@ parse_stabs_common (string_start, string_end, rest)
       dummy_symr.index = code;
       if (dummy_symr.index != code)
        {
-         error ("Line number (%d) for .stabs/.stabn directive cannot fit in index field (20 bits)",
+         error ("Line number (%lu) for .stabs/.stabn directive cannot fit in index field (20 bits)",
                 code);
 
          return;
@@ -3834,7 +3808,7 @@ STATIC void
 parse_stabs (start)
      const char *start;                        /* start of directive */
 {
-  const char *end = local_index (start+1, '"');
+  const char *end = strchr (start+1, '"');
 
   if (*start != '"' || end == (const char *) 0 || end[1] != ',')
     {
@@ -3858,10 +3832,10 @@ parse_stabn (start)
    if needed.  */
 
 STATIC void
-parse_input __proto((void))
+parse_input ()
 {
   register char *p;
-  register int i;
+  register Size_t i;
   register thead_t *ptag_head;
   register tag_t *ptag;
   register tag_t *ptag_next;
@@ -3879,16 +3853,16 @@ parse_input __proto((void))
   while ((p = read_line ()) != (char *) 0)
     {
       /* Skip leading blanks */
-      while (ISSPACE (*p))
+      while (ISSPACE ((unsigned char)*p))
        p++;
 
       /* See if it's a directive we handle.  If so, dispatch handler.  */
-      for (i = 0; i < sizeof (pseudo_ops) / sizeof (pseudo_ops[0]); i++)
+      for (i = 0; i < ARRAY_SIZE (pseudo_ops); i++)
        if (memcmp (p, pseudo_ops[i].name, pseudo_ops[i].len) == 0
-           && ISSPACE (p[pseudo_ops[i].len]))
+           && ISSPACE ((unsigned char)(p[pseudo_ops[i].len])))
          {
            p += pseudo_ops[i].len;     /* skip to first argument */
-           while (ISSPACE (*p))
+           while (ISSPACE ((unsigned char)*p))
              p++;
 
            (*pseudo_ops[i].func)( p );
@@ -3921,7 +3895,7 @@ parse_input __proto((void))
    to write out the .T file.  */
 
 STATIC void
-update_headers __proto((void))
+update_headers ()
 {
   register symint_t i;
   register efdr_t *file_ptr;
@@ -4121,7 +4095,7 @@ write_varray (vp, offset, str)
   if (debug)
     {
       fputs ("\twarray\tvp = ", stderr);
-      fprintf (stderr, HOST_PTR_PRINTF, vp);
+      fprintf (stderr, HOST_PTR_PRINTF, (PTR) vp);
       fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
               (unsigned long) offset, vp->num_allocated * vp->object_size, str);
     }
@@ -4136,7 +4110,7 @@ write_varray (vp, offset, str)
        ? vp->objects_last_page * vp->object_size
        : vp->objects_per_page  * vp->object_size;
 
-      sys_write = fwrite ((PTR_T) ptr->datum, 1, num_write, object_stream);
+      sys_write = fwrite ((PTR) ptr->datum, 1, num_write, object_stream);
       if (sys_write <= 0)
        pfatal_with_name (object_name);
 
@@ -4154,7 +4128,7 @@ write_varray (vp, offset, str)
 /* Write out the symbol table in the object file.  */
 
 STATIC void
-write_object __proto((void))
+write_object ()
 {
   int sys_write;
   efdr_t *file_ptr;
@@ -4163,12 +4137,12 @@ write_object __proto((void))
   if (debug)
     {
       fputs ("\n\twrite\tvp = ", stderr);
-      fprintf (stderr, HOST_PTR_PRINTF, (PTR_T *) &symbolic_header);
+      fprintf (stderr, HOST_PTR_PRINTF, (PTR) &symbolic_header);
       fprintf (stderr, ", offset = %7u, size = %7lu, %s\n",
               0, (unsigned long) sizeof (symbolic_header), "symbolic header");
     }
 
-  sys_write = fwrite ((PTR_T) &symbolic_header,
+  sys_write = fwrite ((PTR) &symbolic_header,
                      1,
                      sizeof (symbolic_header),
                      object_stream);
@@ -4178,7 +4152,7 @@ write_object __proto((void))
 
   else if (sys_write != sizeof (symbolic_header))
     fatal ("Wrote %d bytes to %s, system returned %d",
-          sizeof (symbolic_header),
+          (int) sizeof (symbolic_header),
           object_name,
           sys_write);
 
@@ -4196,13 +4170,13 @@ write_object __proto((void))
       if (debug)
        {
          fputs ("\twrite\tvp = ", stderr);
-         fprintf (stderr, HOST_PTR_PRINTF, (PTR_T *) &orig_linenum);
+         fprintf (stderr, HOST_PTR_PRINTF, (PTR) &orig_linenum);
          fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
                   (long) symbolic_header.cbLineOffset,
                   (long) symbolic_header.cbLine, "Line numbers");
        }
 
-      sys_write = fwrite ((PTR_T) orig_linenum,
+      sys_write = fwrite ((PTR) orig_linenum,
                          1,
                          symbolic_header.cbLine,
                          object_stream);
@@ -4211,8 +4185,8 @@ write_object __proto((void))
        pfatal_with_name (object_name);
 
       else if (sys_write != symbolic_header.cbLine)
-       fatal ("Wrote %d bytes to %s, system returned %d",
-              symbolic_header.cbLine,
+       fatal ("Wrote %ld bytes to %s, system returned %ld",
+              (long) symbolic_header.cbLine,
               object_name,
               sys_write);
 
@@ -4231,13 +4205,13 @@ write_object __proto((void))
       if (debug)
        {
          fputs ("\twrite\tvp = ", stderr);
-         fprintf (stderr, HOST_PTR_PRINTF, (PTR_T *) &orig_opt_syms);
+         fprintf (stderr, HOST_PTR_PRINTF, (PTR) &orig_opt_syms);
          fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
                   (long) symbolic_header.cbOptOffset,
                   num_write, "Optimizer symbols");
        }
 
-      sys_write = fwrite ((PTR_T) orig_opt_syms,
+      sys_write = fwrite ((PTR) orig_opt_syms,
                          1,
                          num_write,
                          object_stream);
@@ -4246,7 +4220,7 @@ write_object __proto((void))
        pfatal_with_name (object_name);
 
       else if (sys_write != num_write)
-       fatal ("Wrote %d bytes to %s, system returned %d",
+       fatal ("Wrote %ld bytes to %s, system returned %ld",
               num_write,
               object_name,
               sys_write);
@@ -4323,7 +4297,7 @@ write_object __proto((void))
          if (debug)
            {
              fputs ("\twrite\tvp = ", stderr);
-             fprintf (stderr, HOST_PTR_PRINTF, (PTR_T *) &file_ptr->fdr);
+             fprintf (stderr, HOST_PTR_PRINTF, (PTR) &file_ptr->fdr);
              fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
                       file_offset, (unsigned long) sizeof (FDR),
                       "File header");
@@ -4339,7 +4313,7 @@ write_object __proto((void))
 
          else if (sys_write != sizeof (FDR))
            fatal ("Wrote %d bytes to %s, system returned %d",
-                  sizeof (FDR),
+                  (int) sizeof (FDR),
                   object_name,
                   sys_write);
 
@@ -4359,7 +4333,7 @@ write_object __proto((void))
       if (debug)
        {
          fputs ("\twrite\tvp = ", stderr);
-         fprintf (stderr, HOST_PTR_PRINTF, (PTR_T *) &orig_rfds);
+         fprintf (stderr, HOST_PTR_PRINTF, (PTR) &orig_rfds);
          fprintf (stderr, ", offset = %7lu, size = %7lu, %s\n",
                   (long) symbolic_header.cbRfdOffset,
                   num_write, "Relative file descriptors");
@@ -4373,8 +4347,8 @@ write_object __proto((void))
       if (sys_write <= 0)
        pfatal_with_name (object_name);
 
-      else if (sys_write != num_write)
-       fatal ("Wrote %d bytes to %s, system returned %d",
+      else if (sys_write != (long)num_write)
+       fatal ("Wrote %lu bytes to %s, system returned %ld",
               num_write,
               object_name,
               sys_write);
@@ -4429,9 +4403,9 @@ read_seek (size, offset, str)
          if (sys_read <= 0)
            pfatal_with_name (obj_in_name);
 
-         if (sys_read != difference)
-           fatal ("Wanted to read %d bytes from %s, system returned %d",
-                  size,
+         if ((symint_t)sys_read != difference)
+           fatal ("Wanted to read %lu bytes from %s, system returned %ld",
+                  (unsigned long) size,
                   obj_in_name,
                   sys_read);
        }
@@ -4439,13 +4413,13 @@ read_seek (size, offset, str)
        pfatal_with_name (obj_in_name);
     }
 
-  sys_read = fread ((PTR_T)ptr, 1, size, obj_in_stream);
+  sys_read = fread ((PTRptr, 1, size, obj_in_stream);
   if (sys_read <= 0)
     pfatal_with_name (obj_in_name);
 
-  if (sys_read != size)
-    fatal ("Wanted to read %d bytes from %s, system returned %d",
-          size,
+  if (sys_read != (long) size)
+    fatal ("Wanted to read %lu bytes from %s, system returned %ld",
+          (unsigned long) size,
           obj_in_name,
           sys_read);
 
@@ -4463,7 +4437,7 @@ read_seek (size, offset, str)
    symbol table.  */
 
 STATIC void
-copy_object __proto((void))
+copy_object ()
 {
   char buffer[ PAGE_SIZE ];
   register int sys_read;
@@ -4482,7 +4456,7 @@ copy_object __proto((void))
       || fseek (obj_in_stream, 0L, SEEK_SET) != 0)
     pfatal_with_name (obj_in_name);
 
-  sys_read = fread ((PTR_T) &orig_file_header,
+  sys_read = fread ((PTR) &orig_file_header,
                    1,
                    sizeof (struct filehdr),
                    obj_in_stream);
@@ -4493,23 +4467,23 @@ copy_object __proto((void))
   else if (sys_read == 0 && feof (obj_in_stream))
     return;                    /* create a .T file sans file header */
 
-  else if (sys_read < sizeof (struct filehdr))
+  else if (sys_read < (int) sizeof (struct filehdr))
     fatal ("Wanted to read %d bytes from %s, system returned %d",
-          sizeof (struct filehdr),
+          (int) sizeof (struct filehdr),
           obj_in_name,
           sys_read);
 
 
   if (orig_file_header.f_nsyms != sizeof (HDRR))
-    fatal ("%s symbolic header wrong size (%d bytes, should be %d)",
-          input_name, orig_file_header.f_nsyms, sizeof (HDRR));
+    fatal ("%s symbolic header wrong size (%ld bytes, should be %ld)",
+          input_name, (long) orig_file_header.f_nsyms, (long) sizeof (HDRR));
 
 
   /* Read in the current symbolic header.  */
   if (fseek (obj_in_stream, (long) orig_file_header.f_symptr, SEEK_SET) != 0)
     pfatal_with_name (input_name);
 
-  sys_read = fread ((PTR_T) &orig_sym_hdr,
+  sys_read = fread ((PTR) &orig_sym_hdr,
                    1,
                    sizeof (orig_sym_hdr),
                    obj_in_stream);
@@ -4517,9 +4491,9 @@ copy_object __proto((void))
   if (sys_read < 0)
     pfatal_with_name (object_name);
 
-  else if (sys_read < sizeof (struct filehdr))
+  else if (sys_read < (int) sizeof (struct filehdr))
     fatal ("Wanted to read %d bytes from %s, system returned %d",
-          sizeof (struct filehdr),
+          (int) sizeof (struct filehdr),
           obj_in_name,
           sys_read);
 
@@ -4598,7 +4572,7 @@ copy_object __proto((void))
   if (max_file_offset != stat_buf.st_size)
     fatal ("Symbol table is not last (symbol table ends at %ld, .o ends at %ld",
           max_file_offset,
-          stat_buf.st_size);
+          (long) stat_buf.st_size);
 
 
   /* If the first original file descriptor is a dummy which the assembler
@@ -4608,7 +4582,7 @@ copy_object __proto((void))
       && orig_files->caux == 0)
     {
       char *filename = orig_local_strs + (orig_files->issBase + orig_files->rss);
-      char *suffix = local_rindex (filename, '.');
+      char *suffix = strrchr (filename, '.');
 
       if (suffix != (char *) 0 && strcmp (suffix, ".s") == 0)
        delete_ifd = 1;
@@ -4649,16 +4623,10 @@ copy_object __proto((void))
   for (es = 0; es < orig_sym_hdr.iextMax; es++)
     {
       register EXTR *eptr = orig_ext_syms + es;
-      register char *ename = ORIG_ESTRS (eptr->asym.iss);
       register unsigned ifd = eptr->ifd;
 
-      (void) add_ext_symbol (ename,
-                            ename + strlen (ename),
-                            (st_t) eptr->asym.st,
-                            (sc_t) eptr->asym.sc,
-                            eptr->asym.value,
-                            (symint_t) ((eptr->asym.index == indexNil) ? indexNil : 0),
-                            (ifd < orig_sym_hdr.ifdMax) ? remap_file_number[ ifd ] : ifd);
+      (void) add_ext_symbol (eptr, ((long) ifd < orig_sym_hdr.ifdMax)
+                            ? remap_file_number[ ifd ] : ifd );
     }
 
 
@@ -4810,8 +4778,10 @@ copy_object __proto((void))
        remaining > 0;
        remaining -= num_write)
     {
-      num_write = (remaining <= sizeof (buffer)) ? remaining : sizeof (buffer);
-      sys_read = fread ((PTR_T) buffer, 1, num_write, obj_in_stream);
+      num_write
+       = (remaining <= (int) sizeof (buffer))
+         ? remaining : (int) sizeof (buffer);
+      sys_read = fread ((PTR) buffer, 1, num_write, obj_in_stream);
       if (sys_read <= 0)
        pfatal_with_name (obj_in_name);
 
@@ -4836,13 +4806,15 @@ copy_object __proto((void))
 \f
 /* Ye olde main program.  */
 
+extern int main PARAMS ((int, char **));
+
 int
 main (argc, argv)
      int argc;
-     char *argv[];
+     char **argv;
 {
   int iflag = 0;
-  char *p = local_rindex (argv[0], '/');
+  char *p = strrchr (argv[0], '/');
   char *num_end;
   int option;
   int i;
@@ -4856,13 +4828,13 @@ main (argc, argv)
 #if !defined(__SABER__) && !defined(lint)
   if (sizeof (efdr_t) > PAGE_USIZE)
     fatal ("Efdr_t has a sizeof %d bytes, when it should be less than %d",
-          sizeof (efdr_t),
-          PAGE_USIZE);
+          (int) sizeof (efdr_t),
+          (int) PAGE_USIZE);
 
   if (sizeof (page_t) != PAGE_USIZE)
     fatal ("Page_t has a sizeof %d bytes, when it should be %d",
-          sizeof (page_t),
-          PAGE_USIZE);
+          (int) sizeof (page_t),
+          (int) PAGE_USIZE);
 
 #endif
 
@@ -4943,23 +4915,23 @@ main (argc, argv)
 
   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");
-      fprintf (stderr, "\tmips-tfile [-d <num>] [-v] [-I <o-in-file>] -o <o-out-file> <s-file> (or)\n");
-      fprintf (stderr, "\tmips-tfile [-d <num>] [-v] <s-file> <o-in-file> <o-out-file>\n");
+      fprintf (stderr, _("Calling Sequence:\n"));
+      fprintf (stderr, _("\tmips-tfile [-d <num>] [-v] [-i <o-in-file>] -o <o-out-file> <s-file> (or)\n"));
+      fprintf (stderr, _("\tmips-tfile [-d <num>] [-v] [-I <o-in-file>] -o <o-out-file> <s-file> (or)\n"));
+      fprintf (stderr, _("\tmips-tfile [-d <num>] [-v] <s-file> <o-in-file> <o-out-file>\n"));
       fprintf (stderr, "\n");
-      fprintf (stderr, "Debug levels are:\n");
-      fprintf (stderr, "    1\tGeneral debug + trace functions/blocks.\n");
-      fprintf (stderr, "    2\tDebug level 1 + trace externals.\n");
-      fprintf (stderr, "    3\tDebug level 2 + trace all symbols.\n");
-      fprintf (stderr, "    4\tDebug level 3 + trace memory allocations.\n");
+      fprintf (stderr, _("Debug levels are:\n"));
+      fprintf (stderr, _("    1\tGeneral debug + trace functions/blocks.\n"));
+      fprintf (stderr, _("    2\tDebug level 1 + trace externals.\n"));
+      fprintf (stderr, _("    3\tDebug level 2 + trace all symbols.\n"));
+      fprintf (stderr, _("    4\tDebug level 3 + trace memory allocations.\n"));
       return 1;
     }
 
 
   if (version)
     {
-      fprintf (stderr, "mips-tfile version %s", version_string);
+      fprintf (stderr, _("mips-tfile version %s"), version_string);
 #ifdef TARGET_VERSION
       TARGET_VERSION;
 #endif
@@ -5060,11 +5032,7 @@ catch_signal (signum)
      int signum;
 {
   (void) signal (signum, SIG_DFL);     /* just in case...  */
-#ifdef NO_SYS_SIGLIST
-  fatal ("caught signal");
-#else
-  fatal (sys_siglist[signum]);
-#endif  
+  fatal ("%s", strsignal(signum));
 }
 
 /* Print a fatal error message.  NAME is the text.
@@ -5072,7 +5040,7 @@ catch_signal (signum)
 
 void
 pfatal_with_name (msg)
-     char *msg;
+  const char *msg;
 {
   int save_errno = errno;              /* just in case....  */
   if (line_number > 0)
@@ -5113,7 +5081,7 @@ out_of_bounds (indx, max, str, prog_line)
 
 \f
 /* Allocate a cluster of pages.  USE_MALLOC says that malloc does not
-   like sbrk's behind it's back (or sbrk isn't available).  If we use
+   like sbrk's behind its back (or sbrk isn't available).  If we use
    sbrk, we assume it gives us zeroed pages.  */
 
 #ifndef MALLOC_CHECK
@@ -5123,10 +5091,7 @@ STATIC page_t *
 allocate_cluster (npages)
      Size_t npages;
 {
-  register page_t *value = (page_t *) calloc (npages, PAGE_USIZE);
-
-  if (value == 0)
-    fatal ("Virtual memory exhausted.");
+  register page_t *value = (page_t *) xcalloc (npages, PAGE_USIZE);
 
   if (debug > 3)
     fprintf (stderr, "\talloc\tnpages = %d, value = 0x%.8x\n", npages, value);
@@ -5158,7 +5123,7 @@ allocate_cluster (npages)
     {
       fprintf (stderr, "\talloc\tnpages = %lu, value = ",
               (unsigned long) npages);
-      fprintf (stderr, HOST_PTR_PRINTF, ptr);
+      fprintf (stderr, HOST_PTR_PRINTF, (PTR) ptr);
       fputs ("\n", stderr);
     }
 
@@ -5238,7 +5203,7 @@ free_multiple_pages (page_ptr, npages)
 /* Allocate one page (which is initialized to 0).  */
 
 STATIC page_t *
-allocate_page __proto((void))
+allocate_page ()
 {
 #ifndef MALLOC_CHECK
   if (pages_left == 0)
@@ -5260,7 +5225,7 @@ allocate_page __proto((void))
 /* Allocate scoping information.  */
 
 STATIC scope_t *
-allocate_scope __proto((void))
+allocate_scope ()
 {
   register scope_t *ptr;
   static scope_t initial_scope;
@@ -5309,7 +5274,7 @@ free_scope (ptr)
   alloc_counts[ (int)alloc_type_scope ].free_list.f_scope = ptr;
 
 #else
-  xfree ((PTR_T) ptr);
+  free ((PTR) ptr);
 #endif
 
 }
@@ -5318,7 +5283,7 @@ free_scope (ptr)
 /* Allocate links for pages in a virtual array.  */
 
 STATIC vlinks_t *
-allocate_vlinks __proto((void))
+allocate_vlinks ()
 {
   register vlinks_t *ptr;
   static vlinks_t initial_vlinks;
@@ -5351,7 +5316,7 @@ allocate_vlinks __proto((void))
 /* Allocate string hash buckets.  */
 
 STATIC shash_t *
-allocate_shash __proto((void))
+allocate_shash ()
 {
   register shash_t *ptr;
   static shash_t initial_shash;
@@ -5384,7 +5349,7 @@ allocate_shash __proto((void))
 /* Allocate type hash buckets.  */
 
 STATIC thash_t *
-allocate_thash __proto((void))
+allocate_thash ()
 {
   register thash_t *ptr;
   static thash_t initial_thash;
@@ -5417,7 +5382,7 @@ allocate_thash __proto((void))
 /* Allocate structure, union, or enum tag information.  */
 
 STATIC tag_t *
-allocate_tag __proto((void))
+allocate_tag ()
 {
   register tag_t *ptr;
   static tag_t initial_tag;
@@ -5466,7 +5431,7 @@ free_tag (ptr)
   alloc_counts[ (int)alloc_type_tag ].free_list.f_tag = ptr;
 
 #else
-  xfree ((PTR_T) ptr);
+  free ((PTR) ptr);
 #endif
 
 }
@@ -5475,7 +5440,7 @@ free_tag (ptr)
 /* Allocate forward reference to a yet unknown tag.  */
 
 STATIC forward_t *
-allocate_forward __proto((void))
+allocate_forward ()
 {
   register forward_t *ptr;
   static forward_t initial_forward;
@@ -5524,7 +5489,7 @@ free_forward (ptr)
   alloc_counts[ (int)alloc_type_forward ].free_list.f_forward = ptr;
 
 #else
-  xfree ((PTR_T) ptr);
+  free ((PTR) ptr);
 #endif
 
 }
@@ -5533,7 +5498,7 @@ free_forward (ptr)
 /* Allocate head of type hash list.  */
 
 STATIC thead_t *
-allocate_thead __proto((void))
+allocate_thead ()
 {
   register thead_t *ptr;
   static thead_t initial_thead;
@@ -5582,7 +5547,7 @@ free_thead (ptr)
   alloc_counts[ (int)alloc_type_thead ].free_list.f_thead = ptr;
 
 #else
-  xfree ((PTR_T) ptr);
+  free ((PTR) ptr);
 #endif
 
 }
@@ -5594,17 +5559,17 @@ free_thead (ptr)
 
 /*VARARGS*/
 void
-fatal VPROTO((const char *format, ...))
+fatal VPARAMS ((const char *format, ...))
 {
-#ifndef __STDC__
-  char *format;
+#ifndef ANSI_PROTOTYPES
+  const char *format;
 #endif
   va_list ap;
 
   VA_START (ap, format);
 
-#ifndef __STDC__
-  format = va_arg (ap, char *);
+#ifndef ANSI_PROTOTYPES
+  format = va_arg (ap, const char *);
 #endif
 
   if (line_number > 0)
@@ -5624,16 +5589,16 @@ fatal VPROTO((const char *format, ...))
 
 /*VARARGS*/
 void
-error VPROTO((const char *format, ...))
+error VPARAMS ((const char *format, ...))
 {
-#ifndef __STDC__
+#ifndef ANSI_PROTOTYPES
   char *format;
 #endif
   va_list ap;
 
   VA_START (ap, format);
 
-#ifndef __STDC__
+#ifndef ANSI_PROTOTYPES
   format = va_arg (ap, char *);
 #endif
 
@@ -5670,121 +5635,5 @@ void
 botch (s)
      const char *s;
 {
-  fatal (s);
-}
-
-/* Same as `malloc' but report error if no memory available.  */
-
-PTR_T
-xmalloc (size)
-     Size_t size;
-{
-  register PTR_T value = malloc (size);
-  if (value == 0)
-    fatal ("Virtual memory exhausted.");
-
-  if (debug > 3)
-    {
-      fputs ("\tmalloc\tptr = ", stderr);
-      fprintf (stderr, HOST_PTR_PRINTF, value);
-      fprintf (stderr, ", size = %10lu\n", (unsigned long) size);
-    }
-
-  return value;
-}
-
-/* Same as `calloc' but report error if no memory available.  */
-
-PTR_T
-xcalloc (size1, size2)
-     Size_t size1, size2;
-{
-  register PTR_T value = calloc (size1, size2);
-  if (value == 0)
-    fatal ("Virtual memory exhausted.");
-
-  if (debug > 3)
-    {
-      fputs ("\tcalloc\tptr = ", stderr);
-      fprintf (stderr, HOST_PTR_PRINTF, value);
-      fprintf (stderr, ", size1 = %10lu, size2 = %10lu [%lu]\n",
-              (unsigned long) size1, (unsigned long) size2,
-              (unsigned long) size1*size2);
-    }
-
-  return value;
-}
-
-/* Same as `realloc' but report error if no memory available.  */
-
-PTR_T
-xrealloc (ptr, size)
-     PTR_T ptr;
-     Size_t size;
-{
-  register PTR_T result = realloc (ptr, size);
-  if (!result)
-    fatal ("Virtual memory exhausted.");
-
-  if (debug > 3)
-    {
-      fputs ("\trealloc\tptr = ", stderr);
-      fprintf (stderr, HOST_PTR_PRINTF, result);
-      fprintf (stderr, ", size = %10lu, orig = ", size);
-      fprintf (stderr, HOST_PTR_PRINTF, ptr);
-      fputs ("\n", stderr);
-    }
-
-  return result;
-}
-
-void
-xfree (ptr)
-     PTR_T ptr;
-{
-  if (debug > 3)
-    {
-      fputs ("\tfree\tptr = ", stderr);
-      fprintf (stderr, HOST_PTR_PRINTF, ptr);
-      fputs ("\n", stderr);
-    }
-
-  free (ptr);
-}
-
-\f
-/* Define our own index/rindex, since the local and global symbol
-   structures as defined by MIPS has an 'index' field.  */
-
-STATIC char *
-local_index (str, sentinel)
-     const char *str;
-     int sentinel;
-{
-  int ch;
-
-  for ( ; (ch = *str) != sentinel; str++)
-    {
-      if (ch == '\0')
-       return (char *) 0;
-    }
-
-  return (char *)str;
-}
-
-STATIC char *
-local_rindex (str, sentinel)
-     const char *str;
-     int sentinel;
-{
-  int ch;
-  const char *ret = (const char *) 0;
-
-  for ( ; (ch = *str) != '\0'; str++)
-    {
-      if (ch == sentinel)
-       ret = str;
-    }
-
-  return (char *)ret;
+  fatal ("%s", s);
 }