* d10v-dis.c: Fix formatting.
[deliverable/binutils-gdb.git] / gdb / stabsread.c
index 48eef6236c07fb52365e9a19b3ae5bd66cac8c6d..169f1f9acd497bb90bad609f07525f574e36c7c4 100644 (file)
@@ -1,5 +1,6 @@
 /* Support routines for decoding "stabs" debugging information format.
-   Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+   1996, 1997, 1998, 1999, 2000
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -51,7 +52,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 +83,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,11 +273,10 @@ 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)
 {
   unsigned int i;
   for (i = 0; i < sizeof (os9k_type_vector) / sizeof (struct type **); i++)
@@ -307,8 +291,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 +398,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 +424,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 +512,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 +536,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 +550,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 +571,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 +607,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 +655,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 +757,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 +815,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 +858,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 +962,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 +1032,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 +1157,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 +1168,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 +1190,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 +1200,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 +1211,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 +1236,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 +1261,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 +1302,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;
     }
 
@@ -1855,9 +1802,10 @@ define_symbol (valu, string, desc, type, objfile)
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGPARM;
       SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
-      if (SYMBOL_VALUE (sym) >= NUM_REGS)
+      if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS)
        {
-         complain (&reg_value_complaint, SYMBOL_VALUE (sym), NUM_REGS,
+         complain (&reg_value_complaint, SYMBOL_VALUE (sym),
+                   NUM_REGS + NUM_PSEUDO_REGS,
                    SYMBOL_SOURCE_NAME (sym));
          SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
        }
@@ -1870,9 +1818,10 @@ define_symbol (valu, string, desc, type, objfile)
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGISTER;
       SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
-      if (SYMBOL_VALUE (sym) >= NUM_REGS)
+      if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS)
        {
-         complain (&reg_value_complaint, SYMBOL_VALUE (sym), NUM_REGS,
+         complain (&reg_value_complaint, SYMBOL_VALUE (sym),
+                   NUM_REGS + NUM_PSEUDO_REGS,
                    SYMBOL_SOURCE_NAME (sym));
          SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
        }
@@ -1899,6 +1848,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 +1956,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);
@@ -2097,9 +2068,10 @@ define_symbol (valu, string, desc, type, objfile)
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
       SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
-      if (SYMBOL_VALUE (sym) >= NUM_REGS)
+      if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS)
        {
-         complain (&reg_value_complaint, SYMBOL_VALUE (sym), NUM_REGS,
+         complain (&reg_value_complaint, SYMBOL_VALUE (sym),
+                   NUM_REGS + NUM_PSEUDO_REGS,
                    SYMBOL_SOURCE_NAME (sym));
          SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
        }
@@ -2156,8 +2128,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 +2180,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 +2248,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 +2310,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 +2342,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 +2772,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 +2947,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 +2993,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 +3036,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 +3238,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;
@@ -3307,8 +3264,13 @@ read_cpp_abbrev (fip, pp, type, objfile)
       switch (cpp_abbrev)
        {
        case 'f':               /* $vf -- a virtual function table pointer */
+         name = type_name_no_tag (context);
+         if (name == NULL)
+         {
+                 name = "";
+         }
          fip->list->field.name =
-           obconcat (&objfile->type_obstack, vptr_name, "", "");
+           obconcat (&objfile->type_obstack, vptr_name, name, "");
          break;
 
        case 'b':               /* $vb -- a virtual bsomethingorother */
@@ -3367,12 +3329,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 +3496,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 +3517,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 +3593,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 +3637,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;
@@ -3768,11 +3720,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;
 
@@ -3850,9 +3799,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;
 
@@ -3876,11 +3823,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;
@@ -3913,7 +3857,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;
@@ -3962,10 +3906,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;
@@ -3978,7 +3920,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;
@@ -4009,10 +3951,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;
@@ -4112,10 +4052,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;
@@ -4162,10 +4099,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;
@@ -4229,10 +4164,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;
@@ -4364,10 +4297,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;
@@ -4439,10 +4369,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;
@@ -4481,10 +4408,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;
@@ -4586,10 +4510,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];
@@ -4681,14 +4602,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.  */
@@ -4788,10 +4713,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 */
@@ -4845,9 +4767,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)
     {
@@ -4866,8 +4786,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
@@ -4930,9 +4849,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)
@@ -4951,8 +4868,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)
     {
@@ -4974,7 +4890,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;
 
@@ -5045,8 +4961,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;
@@ -5204,7 +5119,7 @@ scan_file_globals (objfile)
    to a psymtab.  */
 
 void
-stabsread_init ()
+stabsread_init (void)
 {
 }
 
@@ -5213,7 +5128,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));
@@ -5223,7 +5138,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.  */
@@ -5240,11 +5155,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;
@@ -5252,13 +5167,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;
     }
 }
@@ -5266,7 +5180,7 @@ finish_global_stabs (objfile)
 /* Initializer for this module */
 
 void
-_initialize_stabsread ()
+_initialize_stabsread (void)
 {
   undef_types_allocated = 20;
   undef_types_length = 0;
This page took 0.040563 seconds and 4 git commands to generate.