* configure: Regenerate with proper autoconf 2.13.
[deliverable/binutils-gdb.git] / gdb / gdbtypes.c
index a219ab5eb3c4b1cf04185109cddb0764ed58ceab..2a8817d600360324f523c57041aa00d97811dd80 100644 (file)
@@ -397,11 +397,18 @@ lookup_function_type (struct type *type)
 extern int
 address_space_name_to_int (char *space_identifier)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
+  int type_flags;
   /* Check for known address space delimiters. */
   if (!strcmp (space_identifier, "code"))
     return TYPE_FLAG_CODE_SPACE;
   else if (!strcmp (space_identifier, "data"))
     return TYPE_FLAG_DATA_SPACE;
+  else if (gdbarch_address_class_name_to_type_flags_p (gdbarch)
+           && gdbarch_address_class_name_to_type_flags (gdbarch,
+                                                       space_identifier,
+                                                       &type_flags))
+    return type_flags;
   else
     error ("Unknown address space specifier: \"%s\"", space_identifier);
 }
@@ -409,13 +416,17 @@ address_space_name_to_int (char *space_identifier)
 /* Identify address space identifier by integer flag as defined in 
    gdbtypes.h -- return the string version of the adress space name. */
 
-extern char *
+const char *
 address_space_int_to_name (int space_flag)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
   if (space_flag & TYPE_FLAG_CODE_SPACE)
     return "code";
   else if (space_flag & TYPE_FLAG_DATA_SPACE)
     return "data";
+  else if ((space_flag & TYPE_FLAG_ADDRESS_CLASS_ALL)
+           && gdbarch_address_class_type_flags_to_name_p (gdbarch))
+    return gdbarch_address_class_type_flags_to_name (gdbarch, space_flag);
   else
     return NULL;
 }
@@ -465,14 +476,17 @@ make_qualified_type (struct type *type, int new_flags,
    is identical to the one supplied except that it has an address
    space attribute attached to it (such as "code" or "data").
 
-   This is for Harvard architectures. */
+   The space attributes "code" and "data" are for Harvard architectures.
+   The address space attributes are for architectures which have
+   alternately sized pointers or pointers with alternate representations.  */
 
 struct type *
 make_type_with_address_space (struct type *type, int space_flag)
 {
   struct type *ntype;
   int new_flags = ((TYPE_INSTANCE_FLAGS (type)
-                   & ~(TYPE_FLAG_CODE_SPACE | TYPE_FLAG_DATA_SPACE))
+                   & ~(TYPE_FLAG_CODE_SPACE | TYPE_FLAG_DATA_SPACE
+                       | TYPE_FLAG_ADDRESS_CLASS_ALL))
                   | space_flag);
 
   return make_qualified_type (type, new_flags, NULL);
@@ -1276,13 +1290,12 @@ fill_in_vptr_fieldno (struct type *type)
          virtual (and hence we cannot share the table pointer).  */
       for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
        {
-         fill_in_vptr_fieldno (TYPE_BASECLASS (type, i));
-         if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, i)) >= 0)
+         struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
+         fill_in_vptr_fieldno (baseclass);
+         if (TYPE_VPTR_FIELDNO (baseclass) >= 0)
            {
-             TYPE_VPTR_FIELDNO (type)
-               = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, i));
-             TYPE_VPTR_BASETYPE (type)
-               = TYPE_VPTR_BASETYPE (TYPE_BASECLASS (type, i));
+             TYPE_VPTR_FIELDNO (type) = TYPE_VPTR_FIELDNO (baseclass);
+             TYPE_VPTR_BASETYPE (type) = TYPE_VPTR_BASETYPE (baseclass);
              break;
            }
        }
@@ -1328,8 +1341,11 @@ get_destructor_fn_field (struct type *t, int *method_indexp, int *field_indexp)
    This used to be coded as a macro, but I don't think it is called 
    often enough to merit such treatment.  */
 
-struct complaint stub_noname_complaint =
-{"stub type has NULL name", 0, 0};
+static void
+stub_noname_complaint (void)
+{
+  complaint (&symfile_complaints, "stub type has NULL name");
+}
 
 struct type *
 check_typedef (struct type *type)
@@ -1356,7 +1372,7 @@ check_typedef (struct type *type)
             TYPE_TAG_NAME were separate).  */
          if (name == NULL)
            {
-             complain (&stub_noname_complaint);
+             stub_noname_complaint ();
              return type;
            }
          sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0,
@@ -1383,7 +1399,7 @@ check_typedef (struct type *type)
       struct type *newtype;
       if (name == NULL)
        {
-         complain (&stub_noname_complaint);
+         stub_noname_complaint ();
          return type;
        }
       newtype = lookup_transparent_type (name);
@@ -1401,7 +1417,7 @@ check_typedef (struct type *type)
       struct symbol *sym;
       if (name == NULL)
        {
-         complain (&stub_noname_complaint);
+         stub_noname_complaint ();
          return type;
        }
       sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0, (struct symtab **) NULL);
@@ -1498,12 +1514,8 @@ add_mangled_type (struct extra *pextras, struct type *t)
          break;
        default:
          {
-
-           static struct complaint msg =
-           {"Bad int type code length x%x\n", 0, 0};
-
-           complain (&msg, tlen);
-
+           complaint (&symfile_complaints, "Bad int type code length x%x",
+                      tlen);
          }
        }
       break;
@@ -1521,9 +1533,8 @@ add_mangled_type (struct extra *pextras, struct type *t)
          break;
        default:
          {
-           static struct complaint msg =
-           {"Bad float type code length x%x\n", 0, 0};
-           complain (&msg, tlen);
+           complaint (&symfile_complaints, "Bad float type code length x%x",
+                      tlen);
          }
        }
       break;
@@ -1537,9 +1548,8 @@ add_mangled_type (struct extra *pextras, struct type *t)
       break;
     case TYPE_CODE_TYPEDEF:
       {
-       static struct complaint msg =
-       {"Typedefs in overloaded functions not yet supported\n", 0, 0};
-       complain (&msg);
+       complaint (&symfile_complaints,
+                  "Typedefs in overloaded functions not yet supported");
       }
       /* followed by type bytes & name */
       break;
@@ -1577,9 +1587,7 @@ add_mangled_type (struct extra *pextras, struct type *t)
     case TYPE_CODE_ERROR:
     default:
       {
-       static struct complaint msg =
-       {"Unknown type code x%x\n", 0, 0};
-       complain (&msg, tcode);
+       complaint (&symfile_complaints, "Unknown type code x%x", tcode);
       }
     }
   if (TYPE_TARGET_TYPE (t))
@@ -1793,7 +1801,7 @@ check_stub_method_group (struct type *type, int method_id)
 {
   int len = TYPE_FN_FIELDLIST_LENGTH (type, method_id);
   struct fn_field *f = TYPE_FN_FIELDLIST1 (type, method_id);
-  int j, found_stub;
+  int j, found_stub = 0;
 
   for (j = 0; j < len; j++)
     if (TYPE_FN_FIELD_STUB (f, j))
@@ -1995,24 +2003,6 @@ is_integral_type (struct type *t)
         || (TYPE_CODE (t) == TYPE_CODE_BOOL)));
 }
 
-/* (OBSOLETE) Chill (OBSOLETE) varying string and arrays are
-   represented as follows:
-
-   struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data};
-
-   Return true if TYPE is such a (OBSOLETE) Chill (OBSOLETE) varying
-   type. */
-
-/* OBSOLETE int */
-/* OBSOLETE chill_varying_type (struct type *type) */
-/* OBSOLETE { */
-/* OBSOLETE   if (TYPE_CODE (type) != TYPE_CODE_STRUCT */
-/* OBSOLETE       || TYPE_NFIELDS (type) != 2 */
-/* OBSOLETE       || strcmp (TYPE_FIELD_NAME (type, 0), "__var_length") != 0) */
-/* OBSOLETE     return 0; */
-/* OBSOLETE   return 1; */
-/* OBSOLETE } */
-
 /* Check whether BASE is an ancestor or base class or DCLASS 
    Return 1 if so, and 0 if not.
    Note: callers may want to check for identity of the types before
@@ -3141,6 +3131,14 @@ recursive_dump_type (struct type *type, int spaces)
     {
       puts_filtered (" TYPE_FLAG_DATA_SPACE");
     }
+  if (TYPE_ADDRESS_CLASS_1 (type))
+    {
+      puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_1");
+    }
+  if (TYPE_ADDRESS_CLASS_2 (type))
+    {
+      puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2");
+    }
   puts_filtered ("\n");
   printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type));
   if (TYPE_UNSIGNED (type))
This page took 0.030662 seconds and 4 git commands to generate.