OSDN Git Service

Replace free() with xfree().
[pf3gnuchains/pf3gnuchains3x.git] / gdb / stabsread.c
index 98f377a..ae3802b 100644 (file)
@@ -51,7 +51,7 @@
 #include "stabsread.h"         /* Our own declarations */
 #undef EXTERN
 
-extern void _initialize_stabsread PARAMS ((void));
+extern void _initialize_stabsread (void);
 
 /* The routines that read and process a complete stabs for a C struct or 
    C++ class pass lists of data member fields and lists of member function
@@ -82,119 +82,103 @@ struct field_info
   };
 
 static void
-read_one_struct_field PARAMS ((struct field_info *, char **, char *,
-                              struct type *, struct objfile *));
+read_one_struct_field (struct field_info *, char **, char *,
+                      struct type *, struct objfile *);
 
-static char *
-  get_substring PARAMS ((char **, int));
+static char *get_substring (char **, int);
 
-static struct type *
-  dbx_alloc_type PARAMS ((int[2], struct objfile *));
+static struct type *dbx_alloc_type (int[2], struct objfile *);
 
-static long read_huge_number PARAMS ((char **, int, int *));
+static long read_huge_number (char **, int, int *);
 
-static struct type *error_type PARAMS ((char **, struct objfile *));
+static struct type *error_type (char **, struct objfile *);
 
 static void
-patch_block_stabs PARAMS ((struct pending *, struct pending_stabs *,
-                          struct objfile *));
+patch_block_stabs (struct pending *, struct pending_stabs *,
+                  struct objfile *);
 
-static void
-fix_common_block PARAMS ((struct symbol *, int));
+static void fix_common_block (struct symbol *, int);
 
-static int
-read_type_number PARAMS ((char **, int *));
+static int read_type_number (char **, int *);
 
-static struct type *
-  read_range_type PARAMS ((char **, int[2], struct objfile *));
+static struct type *read_range_type (char **, int[2], struct objfile *);
 
-static struct type *
-  read_sun_builtin_type PARAMS ((char **, int[2], struct objfile *));
+static struct type *read_sun_builtin_type (char **, int[2], struct objfile *);
 
-static struct type *
-  read_sun_floating_type PARAMS ((char **, int[2], struct objfile *));
+static struct type *read_sun_floating_type (char **, int[2],
+                                           struct objfile *);
 
-static struct type *
-  read_enum_type PARAMS ((char **, struct type *, struct objfile *));
+static struct type *read_enum_type (char **, struct type *, struct objfile *);
 
-static struct type *
-  rs6000_builtin_type PARAMS ((int));
+static struct type *rs6000_builtin_type (int);
 
 static int
-read_member_functions PARAMS ((struct field_info *, char **, struct type *,
-                              struct objfile *));
+read_member_functions (struct field_info *, char **, struct type *,
+                      struct objfile *);
 
 static int
-read_struct_fields PARAMS ((struct field_info *, char **, struct type *,
-                           struct objfile *));
+read_struct_fields (struct field_info *, char **, struct type *,
+                   struct objfile *);
 
 static int
-read_baseclasses PARAMS ((struct field_info *, char **, struct type *,
-                         struct objfile *));
+read_baseclasses (struct field_info *, char **, struct type *,
+                 struct objfile *);
 
 static int
-read_tilde_fields PARAMS ((struct field_info *, char **, struct type *,
-                          struct objfile *));
+read_tilde_fields (struct field_info *, char **, struct type *,
+                  struct objfile *);
 
-static int
-attach_fn_fields_to_type PARAMS ((struct field_info *, struct type *));
+static int attach_fn_fields_to_type (struct field_info *, struct type *);
 
 static int
-attach_fields_to_type PARAMS ((struct field_info *, struct type *,
-                              struct objfile *));
+attach_fields_to_type (struct field_info *, struct type *, struct objfile *);
 
-static struct type *
-  read_struct_type PARAMS ((char **, struct type *, struct objfile *));
+static struct type *read_struct_type (char **, struct type *,
+                                     struct objfile *);
 
-static struct type *
-  read_array_type PARAMS ((char **, struct type *, struct objfile *));
+static struct type *read_array_type (char **, struct type *,
+                                    struct objfile *);
 
-static struct type **
-  read_args PARAMS ((char **, int, struct objfile *));
+static struct type **read_args (char **, int, struct objfile *);
 
 static int
-read_cpp_abbrev PARAMS ((struct field_info *, char **, struct type *,
-                        struct objfile *));
+read_cpp_abbrev (struct field_info *, char **, struct type *,
+                struct objfile *);
 
 /* new functions added for cfront support */
 
 static int
-copy_cfront_struct_fields PARAMS ((struct field_info *, struct type *,
-                                  struct objfile *));
+copy_cfront_struct_fields (struct field_info *, struct type *,
+                          struct objfile *);
 
-static char *
-  get_cfront_method_physname PARAMS ((char *));
+static char *get_cfront_method_physname (char *);
 
 static int
-read_cfront_baseclasses PARAMS ((struct field_info *, char **,
-                                struct type *, struct objfile *));
+read_cfront_baseclasses (struct field_info *, char **,
+                        struct type *, struct objfile *);
 
 static int
-read_cfront_static_fields PARAMS ((struct field_info *, char **,
-                                  struct type *, struct objfile *));
+read_cfront_static_fields (struct field_info *, char **,
+                          struct type *, struct objfile *);
 static int
-read_cfront_member_functions PARAMS ((struct field_info *, char **,
-                                     struct type *, struct objfile *));
+read_cfront_member_functions (struct field_info *, char **,
+                             struct type *, struct objfile *);
 
 /* end new functions added for cfront support */
 
 static void
-add_live_range PARAMS ((struct objfile *, struct symbol *,
-                       CORE_ADDR, CORE_ADDR));
+add_live_range (struct objfile *, struct symbol *, CORE_ADDR, CORE_ADDR);
 
-static int
-resolve_live_range PARAMS ((struct objfile *, struct symbol *, char *));
+static int resolve_live_range (struct objfile *, struct symbol *, char *);
 
-static int
-process_reference PARAMS ((char **string));
+static int process_reference (char **string);
 
-static CORE_ADDR
-  ref_search_value PARAMS ((int refnum));
+static CORE_ADDR ref_search_value (int refnum);
 
 static int
-resolve_symbol_reference PARAMS ((struct objfile *, struct symbol *, char *));
+resolve_symbol_reference (struct objfile *, struct symbol *, char *);
 
-void stabsread_clear_cache PARAMS ((void));
+void stabsread_clear_cache (void);
 
 static const char vptr_name[] =
 {'_', 'v', 'p', 't', 'r', CPLUS_MARKER, '\0'};
@@ -288,13 +272,12 @@ static struct type **os9k_type_vector[] =
   &builtin_type_long_double
 };
 
-static void os9k_init_type_vector PARAMS ((struct type **));
+static void os9k_init_type_vector (struct type **);
 
 static void
-os9k_init_type_vector (tv)
-     struct type **tv;
+os9k_init_type_vector (struct type **tv)
 {
-  int i;
+  unsigned int i;
   for (i = 0; i < sizeof (os9k_type_vector) / sizeof (struct type **); i++)
     tv[i] = (os9k_type_vector[i] == 0 ? 0 : *(os9k_type_vector[i]));
 }
@@ -307,8 +290,7 @@ os9k_init_type_vector (tv)
    or for associating a new type with the pair.  */
 
 struct type **
-dbx_lookup_type (typenums)
-     int typenums[2];
+dbx_lookup_type (int typenums[2])
 {
   register int filenum = typenums[0];
   register int index = typenums[1];
@@ -415,9 +397,7 @@ Invalid symbol data: type number (%d,%d) out of range at symtab pos %d.",
    put into the type vector, and so may not be referred to by number. */
 
 static struct type *
-dbx_alloc_type (typenums, objfile)
-     int typenums[2];
-     struct objfile *objfile;
+dbx_alloc_type (int typenums[2], struct objfile *objfile)
 {
   register struct type **type_addr;
 
@@ -443,10 +423,8 @@ dbx_alloc_type (typenums, objfile)
    and fix their symbols in given symbol vector. */
 
 static void
-patch_block_stabs (symbols, stabs, objfile)
-     struct pending *symbols;
-     struct pending_stabs *stabs;
-     struct objfile *objfile;
+patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
+                  struct objfile *objfile)
 {
   int ii;
   char *name;
@@ -533,9 +511,7 @@ patch_block_stabs (symbols, stabs, objfile)
    Returns 0 for success, -1 for error.  */
 
 static int
-read_type_number (pp, typenums)
-     register char **pp;
-     register int *typenums;
+read_type_number (register char **pp, register int *typenums)
 {
   int nbits;
   if (**pp == '(')
@@ -559,10 +535,6 @@ read_type_number (pp, typenums)
 }
 \f
 
-#if !defined (REG_STRUCT_HAS_ADDR)
-#define REG_STRUCT_HAS_ADDR(gcc_p,type) 0
-#endif
-
 #define VISIBILITY_PRIVATE     '0'     /* Stabs character for private field */
 #define VISIBILITY_PROTECTED   '1'     /* Stabs character for protected fld */
 #define VISIBILITY_PUBLIC      '2'     /* Stabs character for public field */
@@ -577,9 +549,7 @@ read_type_number (pp, typenums)
    suibstring. */
 
 static char *
-get_substring (p, c)
-     char **p;
-     int c;
+get_substring (char **p, int c)
 {
   char *str;
   str = *p;
@@ -600,8 +570,7 @@ get_substring (p, c)
    eg: for sname="a" and fname="foo__1aFPFs_i" return "FPFs_i" */
 
 static char *
-get_cfront_method_physname (fname)
-     char *fname;
+get_cfront_method_physname (char *fname)
 {
   int len = 0;
   /* FIXME would like to make this generic for g++ too, but 
@@ -637,11 +606,8 @@ get_cfront_method_physname (fname)
  */
 
 static int
-read_cfront_baseclasses (fip, pp, type, objfile)
-     struct field_info *fip;
-     struct objfile *objfile;
-     char **pp;
-     struct type *type;
+read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type,
+                        struct objfile *objfile)
 {
   static struct complaint msg_unknown =
   {"\
@@ -688,7 +654,7 @@ read_cfront_baseclasses (fip, pp, type, objfile)
   for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
     {
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -790,11 +756,8 @@ read_cfront_baseclasses (fip, pp, type, objfile)
  */
 
 static int
-read_cfront_member_functions (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_cfront_member_functions (struct field_info *fip, char **pp,
+                             struct type *type, struct objfile *objfile)
 {
   /* This code extracted from read_member_functions 
      so as to do the similar thing for our funcs */
@@ -851,7 +814,7 @@ read_cfront_member_functions (fip, pp, type, objfile)
 
       new_fnlist = (struct next_fnfieldlist *)
        xmalloc (sizeof (struct next_fnfieldlist));
-      make_cleanup (free, new_fnlist);
+      make_cleanup (xfree, new_fnlist);
       memset (new_fnlist, 0, sizeof (struct next_fnfieldlist));
 
       /* The following is code to work around cfront generated stabs.
@@ -894,7 +857,7 @@ read_cfront_member_functions (fip, pp, type, objfile)
 
       new_sublist =
        (struct next_fnfield *) xmalloc (sizeof (struct next_fnfield));
-      make_cleanup (free, new_sublist);
+      make_cleanup (xfree, new_sublist);
       memset (new_sublist, 0, sizeof (struct next_fnfield));
 
       /* eat 1; from :;2A.; */
@@ -998,10 +961,8 @@ read_cfront_member_functions (fip, pp, type, objfile)
    to add information such as methods to classes.
    Examples of "p": "sA;;__ct__1AFv foo__1AFv ;;;" */
 int
-resolve_cfront_continuation (objfile, sym, p)
-     struct objfile *objfile;
-     struct symbol *sym;
-     char *p;
+resolve_cfront_continuation (struct objfile *objfile, struct symbol *sym,
+                            char *p)
 {
   struct symbol *ref_sym = 0;
   char *sname;
@@ -1070,10 +1031,7 @@ resolve_cfront_continuation (objfile, sym, p)
    symbol definition.  Returns 0 on failure, non-zero on success.  */
 
 static int
-resolve_symbol_reference (objfile, sym, p)
-     struct objfile *objfile;
-     struct symbol *sym;
-     char *p;
+resolve_symbol_reference (struct objfile *objfile, struct symbol *sym, char *p)
 {
   int refnum;
   struct symbol *ref_sym = 0;
@@ -1198,7 +1156,7 @@ static int ref_chunk = 0;
    table. If the symbol table changes, this cache must be cleared
    or we are left holding onto data in invalid obstacks. */
 void
-stabsread_clear_cache ()
+stabsread_clear_cache (void)
 {
   ref_count = 0;
   ref_chunk = 0;
@@ -1209,11 +1167,7 @@ stabsread_clear_cache ()
    find them, using their reference numbers as our index. 
    These will be used later when we resolve references. */
 void
-ref_add (refnum, sym, stabs, value)
-     int refnum;
-     struct symbol *sym;
-     char *stabs;
-     CORE_ADDR value;
+ref_add (int refnum, struct symbol *sym, char *stabs, CORE_ADDR value)
 {
   if (ref_count == 0)
     ref_chunk = 0;
@@ -1235,8 +1189,7 @@ ref_add (refnum, sym, stabs, value)
 
 /* Return defined sym for the reference REFNUM.  */
 struct symbol *
-ref_search (refnum)
-     int refnum;
+ref_search (int refnum)
 {
   if (refnum < 0 || refnum > ref_count)
     return 0;
@@ -1246,8 +1199,7 @@ ref_search (refnum)
 /* Return value for the reference REFNUM.  */
 
 static CORE_ADDR
-ref_search_value (refnum)
-     int refnum;
+ref_search_value (int refnum)
 {
   if (refnum < 0 || refnum > ref_count)
     return 0;
@@ -1258,8 +1210,7 @@ ref_search_value (refnum)
    reference number.  Move STRING beyond the reference id.  */
 
 static int
-process_reference (string)
-     char **string;
+process_reference (char **string)
 {
   char *p;
   int refnum = 0;
@@ -1284,8 +1235,7 @@ process_reference (string)
    definition for later use.  Return the reference number.  */
 
 int
-symbol_reference_defined (string)
-     char **string;
+symbol_reference_defined (char **string)
 {
   char *p = *string;
   int refnum = 0;
@@ -1310,12 +1260,8 @@ symbol_reference_defined (string)
 
 /* ARGSUSED */
 struct symbol *
-define_symbol (valu, string, desc, type, objfile)
-     CORE_ADDR valu;
-     char *string;
-     int desc;
-     int type;
-     struct objfile *objfile;
+define_symbol (CORE_ADDR valu, char *string, int desc, int type,
+              struct objfile *objfile)
 {
   register struct symbol *sym;
   char *p = (char *) strchr (string, ':');
@@ -1355,13 +1301,13 @@ define_symbol (valu, string, desc, type, objfile)
   switch (type & N_TYPE)
     {
     case N_TEXT:
-      SYMBOL_SECTION (sym) = SECT_OFF_TEXT;
+      SYMBOL_SECTION (sym) = SECT_OFF_TEXT (objfile);
       break;
     case N_DATA:
-      SYMBOL_SECTION (sym) = SECT_OFF_DATA;
+      SYMBOL_SECTION (sym) = SECT_OFF_DATA (objfile);
       break;
     case N_BSS:
-      SYMBOL_SECTION (sym) = SECT_OFF_BSS;
+      SYMBOL_SECTION (sym) = SECT_OFF_BSS (objfile);
       break;
     }
 
@@ -1899,6 +1845,7 @@ define_symbol (valu, string, desc, type, objfile)
          if (local_symbols
              && local_symbols->nsyms > 0
 #ifndef USE_REGISTER_NOT_ARG
+             && REG_STRUCT_HAS_ADDR_P ()
              && REG_STRUCT_HAS_ADDR (processing_gcc_compilation,
                                      SYMBOL_TYPE (sym))
              && (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
@@ -2006,6 +1953,27 @@ define_symbol (valu, string, desc, type, objfile)
 
                 Fortunately, this check seems not to be necessary
                 for anything except pointers or functions.  */
+              /* ezannoni: 2000-10-26. This seems to apply for
+                versions of gcc older than 2.8. This was the original
+                problem: with the following code gdb would tell that
+                the type for name1 is caddr_t, and func is char()
+                typedef char *caddr_t;
+                char *name2;
+                struct x
+                {
+                char *name1;
+                } xx;
+                char *func()
+                {
+                }
+                main () {}
+                */
+
+             /* Pascal accepts names for pointer types. */
+             if (current_subfile->language == language_pascal)
+               {
+                 TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NAME (sym);
+               }
            }
          else
            TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NAME (sym);
@@ -2156,8 +2124,9 @@ define_symbol (valu, string, desc, type, objfile)
   /* When passing structures to a function, some systems sometimes pass
      the address in a register, not the structure itself. */
 
-  if (REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym))
-    && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
+  if (REG_STRUCT_HAS_ADDR_P ()
+      && REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym))
+      && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
     {
       struct type *symbol_type = check_typedef (SYMBOL_TYPE (sym));
 
@@ -2207,10 +2176,7 @@ define_symbol (valu, string, desc, type, objfile)
    non-zero on success, zero otherwise.  */
 
 static int
-resolve_live_range (objfile, sym, p)
-     struct objfile *objfile;
-     struct symbol *sym;
-     char *p;
+resolve_live_range (struct objfile *objfile, struct symbol *sym, char *p)
 {
   int refnum;
   CORE_ADDR start, end;
@@ -2278,10 +2244,8 @@ resolve_live_range (objfile, sym, p)
    in objfile OBJFILE.  */
 
 static void
-add_live_range (objfile, sym, start, end)
-     struct objfile *objfile;
-     struct symbol *sym;
-     CORE_ADDR start, end;
+add_live_range (struct objfile *objfile, struct symbol *sym, CORE_ADDR start,
+               CORE_ADDR end)
 {
   struct range_list *r, *rs;
 
@@ -2342,9 +2306,7 @@ add_live_range (objfile, sym, start, end)
    debugger will be able to read the new symbol tables.  */
 
 static struct type *
-error_type (pp, objfile)
-     char **pp;
-     struct objfile *objfile;
+error_type (char **pp, struct objfile *objfile)
 {
   complain (&error_type_complaint);
   while (1)
@@ -2376,9 +2338,7 @@ error_type (pp, objfile)
    deciding whether to call read_type.  */
 
 struct type *
-read_type (pp, objfile)
-     register char **pp;
-     struct objfile *objfile;
+read_type (register char **pp, struct objfile *objfile)
 {
   register struct type *type = 0;
   struct type *type1;
@@ -2808,8 +2768,7 @@ again:
    Return the proper type node for a given builtin type number. */
 
 static struct type *
-rs6000_builtin_type (typenum)
-     int typenum;
+rs6000_builtin_type (int typenum)
 {
   /* We recognize types numbered from -NUMBER_RECOGNIZED to -1.  */
 #define NUMBER_RECOGNIZED 34
@@ -2984,11 +2943,8 @@ rs6000_builtin_type (typenum)
    Returns 1 for success, 0 for failure.  */
 
 static int
-read_member_functions (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_member_functions (struct field_info *fip, char **pp, struct type *type,
+                      struct objfile *objfile)
 {
   int nfn_fields = 0;
   int length = 0;
@@ -3033,7 +2989,7 @@ read_member_functions (fip, pp, type, objfile)
 
       new_fnlist = (struct next_fnfieldlist *)
        xmalloc (sizeof (struct next_fnfieldlist));
-      make_cleanup (free, new_fnlist);
+      make_cleanup (xfree, new_fnlist);
       memset (new_fnlist, 0, sizeof (struct next_fnfieldlist));
 
       if ((*pp)[0] == 'o' && (*pp)[1] == 'p' && is_cplus_marker ((*pp)[2]))
@@ -3076,7 +3032,7 @@ read_member_functions (fip, pp, type, objfile)
        {
          new_sublist =
            (struct next_fnfield *) xmalloc (sizeof (struct next_fnfield));
-         make_cleanup (free, new_sublist);
+         make_cleanup (xfree, new_sublist);
          memset (new_sublist, 0, sizeof (struct next_fnfield));
 
          /* Check for and handle cretinous dbx symbol name continuation!  */
@@ -3278,11 +3234,8 @@ read_member_functions (fip, pp, type, objfile)
    keep parsing and it's time for error_type().  */
 
 static int
-read_cpp_abbrev (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type,
+                struct objfile *objfile)
 {
   register char *p;
   char *name;
@@ -3367,12 +3320,8 @@ read_cpp_abbrev (fip, pp, type, objfile)
 }
 
 static void
-read_one_struct_field (fip, pp, p, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     char *p;
-     struct type *type;
-     struct objfile *objfile;
+read_one_struct_field (struct field_info *fip, char **pp, char *p,
+                      struct type *type, struct objfile *objfile)
 {
   /* The following is code to work around cfront generated stabs.
      The stabs contains full mangled name for each field.
@@ -3538,11 +3487,8 @@ read_one_struct_field (fip, pp, p, type, objfile)
    Returns 1 for success, 0 for failure.  */
 
 static int
-read_struct_fields (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_struct_fields (struct field_info *fip, char **pp, struct type *type,
+                   struct objfile *objfile)
 {
   register char *p;
   struct nextfield *new;
@@ -3562,7 +3508,7 @@ read_struct_fields (fip, pp, type, objfile)
       STABS_CONTINUE (pp, objfile);
       /* Get space to record the next field's data.  */
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -3638,11 +3584,8 @@ read_struct_fields (fip, pp, type, objfile)
 
 
 static int
-read_baseclasses (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_baseclasses (struct field_info *fip, char **pp, struct type *type,
+                 struct objfile *objfile)
 {
   int i;
   struct nextfield *new;
@@ -3685,7 +3628,7 @@ read_baseclasses (fip, pp, type, objfile)
   for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
     {
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -3724,7 +3667,8 @@ read_baseclasses (fip, pp, type, objfile)
          {
            static struct complaint msg =
            {
-             "Unknown visibility `%c' for baseclass", 0, 0};
+             "Unknown visibility `%c' for baseclass", 0, 0
+           };
            complain (&msg, new->visibility);
            new->visibility = VISIBILITY_PUBLIC;
          }
@@ -3767,11 +3711,8 @@ read_baseclasses (fip, pp, type, objfile)
    so we can look for the vptr base class info.  */
 
 static int
-read_tilde_fields (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_tilde_fields (struct field_info *fip, char **pp, struct type *type,
+                  struct objfile *objfile)
 {
   register char *p;
 
@@ -3849,9 +3790,7 @@ read_tilde_fields (fip, pp, type, objfile)
 }
 
 static int
-attach_fn_fields_to_type (fip, type)
-     struct field_info *fip;
-     register struct type *type;
+attach_fn_fields_to_type (struct field_info *fip, register struct type *type)
 {
   register int n;
 
@@ -3875,11 +3814,8 @@ attach_fn_fields_to_type (fip, type)
  */
 
 static int
-read_cfront_static_fields (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_cfront_static_fields (struct field_info *fip, char **pp, struct type *type,
+                          struct objfile *objfile)
 {
   struct nextfield *new;
   struct type *stype;
@@ -3912,7 +3848,7 @@ read_cfront_static_fields (fip, pp, type, objfile)
 
       /* allocate a new fip */
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -3961,10 +3897,8 @@ read_cfront_static_fields (fip, pp, type, objfile)
    once we have collected all the class members. */
 
 static int
-copy_cfront_struct_fields (fip, type, objfile)
-     struct field_info *fip;
-     struct type *type;
-     struct objfile *objfile;
+copy_cfront_struct_fields (struct field_info *fip, struct type *type,
+                          struct objfile *objfile)
 {
   int nfields = TYPE_NFIELDS (type);
   int i;
@@ -3977,7 +3911,7 @@ copy_cfront_struct_fields (fip, type, objfile)
     {
       /* allocate a new fip */
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -4008,10 +3942,8 @@ copy_cfront_struct_fields (fip, type, objfile)
    for this class's virtual functions.  */
 
 static int
-attach_fields_to_type (fip, type, objfile)
-     struct field_info *fip;
-     register struct type *type;
-     struct objfile *objfile;
+attach_fields_to_type (struct field_info *fip, register struct type *type,
+                      struct objfile *objfile)
 {
   register int nfields = 0;
   register int non_public_fields = 0;
@@ -4111,10 +4043,7 @@ attach_fields_to_type (fip, type, objfile)
  */
 
 static struct type *
-read_struct_type (pp, type, objfile)
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_struct_type (char **pp, struct type *type, struct objfile *objfile)
 {
   struct cleanup *back_to;
   struct field_info fi;
@@ -4161,10 +4090,8 @@ read_struct_type (pp, type, objfile)
    array.  */
 
 static struct type *
-read_array_type (pp, type, objfile)
-     register char **pp;
-     register struct type *type;
-     struct objfile *objfile;
+read_array_type (register char **pp, register struct type *type,
+                struct objfile *objfile)
 {
   struct type *index_type, *element_type, *range_type;
   int lower, upper;
@@ -4228,10 +4155,8 @@ read_array_type (pp, type, objfile)
    Also defines the symbols that represent the values of the type.  */
 
 static struct type *
-read_enum_type (pp, type, objfile)
-     register char **pp;
-     register struct type *type;
-     struct objfile *objfile;
+read_enum_type (register char **pp, register struct type *type,
+               struct objfile *objfile)
 {
   register char *p;
   char *name;
@@ -4363,10 +4288,7 @@ read_enum_type (pp, type, objfile)
    FIXME.  */
 
 static struct type *
-read_sun_builtin_type (pp, typenums, objfile)
-     char **pp;
-     int typenums[2];
-     struct objfile *objfile;
+read_sun_builtin_type (char **pp, int typenums[2], struct objfile *objfile)
 {
   int type_bits;
   int nbits;
@@ -4438,10 +4360,7 @@ read_sun_builtin_type (pp, typenums, objfile)
 }
 
 static struct type *
-read_sun_floating_type (pp, typenums, objfile)
-     char **pp;
-     int typenums[2];
-     struct objfile *objfile;
+read_sun_floating_type (char **pp, int typenums[2], struct objfile *objfile)
 {
   int nbits;
   int details;
@@ -4480,10 +4399,7 @@ read_sun_floating_type (pp, typenums, objfile)
    If encounter garbage, set *BITS to -1 and return 0.  */
 
 static long
-read_huge_number (pp, end, bits)
-     char **pp;
-     int end;
-     int *bits;
+read_huge_number (char **pp, int end, int *bits)
 {
   char *p = *pp;
   int sign = 1;
@@ -4585,10 +4501,7 @@ read_huge_number (pp, end, bits)
 }
 
 static struct type *
-read_range_type (pp, typenums, objfile)
-     char **pp;
-     int typenums[2];
-     struct objfile *objfile;
+read_range_type (char **pp, int typenums[2], struct objfile *objfile)
 {
   char *orig_pp = *pp;
   int rangenums[2];
@@ -4680,14 +4593,18 @@ read_range_type (pp, typenums, objfile)
 
   if (n3 == 0 && n2 > 0)
     {
+      struct type *float_type
+       = init_type (TYPE_CODE_FLT, n2, 0, NULL, objfile);
+
       if (self_subrange)
        {
-         return init_type (TYPE_CODE_COMPLEX, 2 * n2, 0, NULL, objfile);
+         struct type *complex_type = 
+           init_type (TYPE_CODE_COMPLEX, 2 * n2, 0, NULL, objfile);
+         TYPE_TARGET_TYPE (complex_type) = float_type;
+         return complex_type;
        }
       else
-       {
-         return init_type (TYPE_CODE_FLT, n2, 0, NULL, objfile);
-       }
+       return float_type;
     }
 
   /* If the upper bound is -1, it must really be an unsigned int.  */
@@ -4787,10 +4704,7 @@ handle_true_range:
    **)-1 if there is an error.  */
 
 static struct type **
-read_args (pp, end, objfile)
-     char **pp;
-     int end;
-     struct objfile *objfile;
+read_args (char **pp, int end, struct objfile *objfile)
 {
   /* FIXME!  Remove this arbitrary limit!  */
   struct type *types[1024], **rval;    /* allow for fns of 1023 parameters */
@@ -4844,9 +4758,7 @@ static char *common_block_name;
    to remain after this function returns.  */
 
 void
-common_block_start (name, objfile)
-     char *name;
-     struct objfile *objfile;
+common_block_start (char *name, struct objfile *objfile)
 {
   if (common_block_name != NULL)
     {
@@ -4865,8 +4777,7 @@ common_block_start (name, objfile)
 /* Process a N_ECOMM symbol.  */
 
 void
-common_block_end (objfile)
-     struct objfile *objfile;
+common_block_end (struct objfile *objfile)
 {
   /* Symbols declared since the BCOMM are to have the common block
      start address added in when we know it.  common_block and
@@ -4929,9 +4840,7 @@ common_block_end (objfile)
    the common block name).  */
 
 static void
-fix_common_block (sym, valu)
-     struct symbol *sym;
-     int valu;
+fix_common_block (struct symbol *sym, int valu)
 {
   struct pending *next = (struct pending *) SYMBOL_TYPE (sym);
   for (; next; next = next->next)
@@ -4950,8 +4859,7 @@ fix_common_block (sym, valu)
    once this file has been read in.  */
 
 void
-add_undefined_type (type)
-     struct type *type;
+add_undefined_type (struct type *type)
 {
   if (undef_types_length == undef_types_allocated)
     {
@@ -4973,7 +4881,7 @@ add_undefined_type (type)
    yet defined at the time a pointer to it was made.
    Fix:  Do a full lookup on the struct/union tag.  */
 void
-cleanup_undefined_types ()
+cleanup_undefined_types (void)
 {
   struct type **type;
 
@@ -5044,8 +4952,7 @@ GDB internal error.  cleanup_undefined_types with bad type %d.", 0, 0};
    to.  Get these symbols from the minimal symbol table.  */
 
 void
-scan_file_globals (objfile)
-     struct objfile *objfile;
+scan_file_globals (struct objfile *objfile)
 {
   int hash;
   struct minimal_symbol *msymbol;
@@ -5203,7 +5110,7 @@ scan_file_globals (objfile)
    to a psymtab.  */
 
 void
-stabsread_init ()
+stabsread_init (void)
 {
 }
 
@@ -5212,7 +5119,7 @@ stabsread_init ()
    file, e.g. a shared library).  */
 
 void
-stabsread_new_init ()
+stabsread_new_init (void)
 {
   /* Empty the hash table of global syms looking for values.  */
   memset (global_sym_chain, 0, sizeof (global_sym_chain));
@@ -5222,7 +5129,7 @@ stabsread_new_init ()
    start_symtab() is called. */
 
 void
-start_stabs ()
+start_stabs (void)
 {
   global_stabs = NULL;         /* AIX COFF */
   /* Leave FILENUM of 0 free for builtin types and this file's types.  */
@@ -5239,11 +5146,11 @@ start_stabs ()
 /* Call after end_symtab() */
 
 void
-end_stabs ()
+end_stabs (void)
 {
   if (type_vector)
     {
-      free ((char *) type_vector);
+      xfree (type_vector);
     }
   type_vector = 0;
   type_vector_length = 0;
@@ -5251,13 +5158,12 @@ end_stabs ()
 }
 
 void
-finish_global_stabs (objfile)
-     struct objfile *objfile;
+finish_global_stabs (struct objfile *objfile)
 {
   if (global_stabs)
     {
       patch_block_stabs (global_symbols, global_stabs, objfile);
-      free ((PTR) global_stabs);
+      xfree (global_stabs);
       global_stabs = NULL;
     }
 }
@@ -5265,7 +5171,7 @@ finish_global_stabs (objfile)
 /* Initializer for this module */
 
 void
-_initialize_stabsread ()
+_initialize_stabsread (void)
 {
   undef_types_allocated = 20;
   undef_types_length = 0;