Patchwork [04/36] Fix struct, union, and enum nesting in C++

login
register
mail settings
Submitter Pedro Alves
Date Feb. 9, 2015, 11:20 p.m.
Message ID <1423524046-20605-5-git-send-email-palves@redhat.com>
Download mbox | patch
Permalink /patch/4984/
State New
Headers show

Comments

Pedro Alves - Feb. 9, 2015, 11:20 p.m.
From: Tom Tromey <tromey@redhat.com>

In C, an enum or structure defined inside other structure has global
scope just like it had been defined outside the struct in the first
place.  However, in C++, such a nested structure is given a name that
is nested inside the structure.  This patch moves such affected
structures/enums out to global scope, so that code using them works
the same in C++ as it works today in C.

2015-02-09  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	* dwarf2-frame.c (enum cfa_how_kind, struct
	dwarf2_frame_state_reg_info): Move out of struct
	dwarf2_frame_state.
	* dwarf2read.c (struct tu_stats): Move out of struct
	dwarf2_per_objfile.
	(struct file_entry): Move out of struct line_header.
	(struct nextfield, struct nextfnfield, struct fnfieldlist, struct
	typedef_field_list): Move out of struct field_info.
	* gdbtypes.h (enum dynamic_prop_kind, union dynamic_prop_data):
	Move out of struct dynamic_prop.
	(union type_owner, union field_location, struct field, struct
	range_bounds, union type_specific): Move out of struct main_type.
	(struct fn_fieldlist, struct fn_field, struct typedef_field)
	(VOFFSET_STATIC): Move out of struct cplus_struct_type.
	(struct call_site_target, union call_site_parameter_u, struct
	call_site_parameter): Move out of struct call_site.
	* m32c-tdep.c (enum m32c_prologue_kind): Move out of struct
	m32c_prologue.
	(enum srcdest_kind): Move out of struct srcdest.
	* main.c (enum cmdarg_kind): Move out of struct cmdarg.
	* prologue-value.h (enum prologue_value_kind): Move out of struct
	prologue_value.
	* s390-linux-tdep.c (enum s390_abi_kind): Move out of struct
	gdbarch_tdep.
	* stabsread.c (struct nextfield, struct next_fnfieldlist): Move
	out of struct field_info.
	* symfile.h (struct other_sections): Move out of struct
	section_addr_info.
	* symtab.c (struct symbol_cache_slot): Move out struct
	block_symbol_cache.
	* target-descriptions.c (enum tdesc_type_kind): Move out of
	typedef struct tdesc_type.
	* tui/tui-data.h (enum tui_line_or_address_kind): Move out of
	struct tui_line_or_address.
	* value.c (enum internalvar_kind, union internalvar_data): Move
	out of struct internalvar.
	* xtensa-tdep.h (struct ctype_cache): Move out of struct
	gdbarch_tdep.
---
 gdb/dwarf2-frame.c        |  39 ++--
 gdb/dwarf2read.c          |  96 ++++----
 gdb/gdbtypes.h            | 573 ++++++++++++++++++++++++----------------------
 gdb/m32c-tdep.c           |  35 +--
 gdb/main.c                |  30 +--
 gdb/prologue-value.h      |  41 ++--
 gdb/s390-linux-tdep.c     |   8 +-
 gdb/stabsread.c           |  38 +--
 gdb/symfile.h             |  18 +-
 gdb/symtab.c              |  66 +++---
 gdb/target-descriptions.c |  54 ++---
 gdb/tui/tui-data.h        |   8 +-
 gdb/value.c               | 121 +++++-----
 gdb/xtensa-tdep.h         |  14 +-
 14 files changed, 607 insertions(+), 534 deletions(-)

Patch

diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 57da775..71e3f6b 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -165,29 +165,34 @@  static CORE_ADDR read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
 				     CORE_ADDR func_base);
 
 
+enum cfa_how_kind
+{
+  CFA_UNSET,
+  CFA_REG_OFFSET,
+  CFA_EXP
+};
+
+struct dwarf2_frame_state_reg_info
+{
+  struct dwarf2_frame_state_reg *reg;
+  int num_regs;
+
+  LONGEST cfa_offset;
+  ULONGEST cfa_reg;
+  enum cfa_how_kind cfa_how;
+  const gdb_byte *cfa_exp;
+
+  /* Used to implement DW_CFA_remember_state.  */
+  struct dwarf2_frame_state_reg_info *prev;
+};
+
 /* Structure describing a frame state.  */
 
 struct dwarf2_frame_state
 {
   /* Each register save state can be described in terms of a CFA slot,
      another register, or a location expression.  */
-  struct dwarf2_frame_state_reg_info
-  {
-    struct dwarf2_frame_state_reg *reg;
-    int num_regs;
-
-    LONGEST cfa_offset;
-    ULONGEST cfa_reg;
-    enum {
-      CFA_UNSET,
-      CFA_REG_OFFSET,
-      CFA_EXP
-    } cfa_how;
-    const gdb_byte *cfa_exp;
-
-    /* Used to implement DW_CFA_remember_state.  */
-    struct dwarf2_frame_state_reg_info *prev;
-  } regs;
+  struct dwarf2_frame_state_reg_info regs;
 
   /* The PC described by the current frame state.  */
   CORE_ADDR pc;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9d12112..f8eced8 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -199,6 +199,15 @@  struct mapped_index
 typedef struct dwarf2_per_cu_data *dwarf2_per_cu_ptr;
 DEF_VEC_P (dwarf2_per_cu_ptr);
 
+struct tu_stats
+{
+  int nr_uniq_abbrev_tables;
+  int nr_symtabs;
+  int nr_symtab_sharers;
+  int nr_stmt_less_type_units;
+  int nr_all_type_units_reallocs;
+};
+
 /* Collection of data recorded per objfile.
    This hangs off of dwarf2_objfile_data_key.  */
 
@@ -250,14 +259,7 @@  struct dwarf2_per_objfile
 
   /* Type unit statistics, to see how well the scaling improvements
      are doing.  */
-  struct tu_stats
-  {
-    int nr_uniq_abbrev_tables;
-    int nr_symtabs;
-    int nr_symtab_sharers;
-    int nr_stmt_less_type_units;
-    int nr_all_type_units_reallocs;
-  } tu_stats;
+  struct tu_stats tu_stats;
 
   /* A chain of compilation units that are currently read in, so that
      they can be freed later.  */
@@ -1022,6 +1024,16 @@  typedef void (die_reader_func_ftype) (const struct die_reader_specs *reader,
 				      int has_children,
 				      void *data);
 
+struct file_entry
+{
+  const char *name;
+  unsigned int dir_index;
+  unsigned int mod_time;
+  unsigned int length;
+  int included_p; /* Non-zero if referenced by the Line Number Program.  */
+  struct symtab *symtab; /* The associated symbol table, if any.  */
+};
+
 /* The line number information for a compilation unit (found in the
    .debug_line section) begins with a "statement program header",
    which contains the following information.  */
@@ -1060,15 +1072,7 @@  struct line_header
      with xmalloc; instead, they are pointers into debug_line_buffer.
      Don't try to free them directly.  */
   unsigned int num_file_names, file_names_size;
-  struct file_entry
-  {
-    const char *name;
-    unsigned int dir_index;
-    unsigned int mod_time;
-    unsigned int length;
-    int included_p; /* Non-zero if referenced by the Line Number Program.  */
-    struct symtab *symtab; /* The associated symbol table, if any.  */
-  } *file_names;
+  struct file_entry *file_names;
 
   /* The start and end of the statement program following this
      header.  These point into dwarf2_per_objfile->line_buffer.  */
@@ -1285,20 +1289,40 @@  struct dwarf_block
    and friends.  */
 static int bits_per_byte = 8;
 
+struct nextfield
+{
+  struct nextfield *next;
+  int accessibility;
+  int virtuality;
+  struct field field;
+};
+
+struct nextfnfield
+{
+  struct nextfnfield *next;
+  struct fn_field fnfield;
+};
+
+struct fnfieldlist
+{
+  const char *name;
+  int length;
+  struct nextfnfield *head;
+};
+
+struct typedef_field_list
+{
+  struct typedef_field field;
+  struct typedef_field_list *next;
+};
+
 /* The routines that read and process dies for a C struct or C++ class
    pass lists of data member fields and lists of member function fields
    in an instance of a field_info structure, as defined below.  */
 struct field_info
   {
     /* List of data member and baseclasses fields.  */
-    struct nextfield
-      {
-	struct nextfield *next;
-	int accessibility;
-	int virtuality;
-	struct field field;
-      }
-     *fields, *baseclasses;
+    struct nextfield *fields, *baseclasses;
 
     /* Number of fields (including baseclasses).  */
     int nfields;
@@ -1311,35 +1335,19 @@  struct field_info
 
     /* Member function fields array, entries are allocated in the order they
        are encountered in the object file.  */
-    struct nextfnfield
-      {
-	struct nextfnfield *next;
-	struct fn_field fnfield;
-      }
-     *fnfields;
+    struct nextfnfield *fnfields;
 
     /* Member function fieldlist array, contains name of possibly overloaded
        member function, number of overloaded member functions and a pointer
        to the head of the member function field chain.  */
-    struct fnfieldlist
-      {
-	const char *name;
-	int length;
-	struct nextfnfield *head;
-      }
-     *fnfieldlists;
+    struct fnfieldlist *fnfieldlists;
 
     /* Number of entries in the fnfieldlists array.  */
     int nfnfields;
 
     /* typedefs defined inside this class.  TYPEDEF_FIELD_LIST contains head of
        a NULL terminated list of TYPEDEF_FIELD_LIST_COUNT elements.  */
-    struct typedef_field_list
-      {
-	struct typedef_field field;
-	struct typedef_field_list *next;
-      }
-    *typedef_field_list;
+    struct typedef_field_list *typedef_field_list;
     unsigned typedef_field_list_count;
   };
 
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index ef6d92c..2c5ccf4 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -403,31 +403,35 @@  enum type_instance_flag_value
 #define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
 				   & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
 
+enum dynamic_prop_kind
+{
+  PROP_UNDEFINED, /* Not defined.  */
+  PROP_CONST,     /* Constant.  */
+  PROP_ADDR_OFFSET, /* Address offset.  */
+  PROP_LOCEXPR,   /* Location expression.  */
+  PROP_LOCLIST    /* Location list.  */
+};
+
+union dynamic_prop_data
+{
+  /* Storage for constant property.  */
+
+  LONGEST const_val;
+
+  /* Storage for dynamic property.  */
+
+  void *baton;
+};
+
 /* * Used to store a dynamic property.  */
 
 struct dynamic_prop
 {
   /* Determine which field of the union dynamic_prop.data is used.  */
-  enum
-  {
-    PROP_UNDEFINED, /* Not defined.  */
-    PROP_CONST,     /* Constant.  */
-    PROP_ADDR_OFFSET, /* Address offset.  */
-    PROP_LOCEXPR,   /* Location expression.  */
-    PROP_LOCLIST    /* Location list.  */
-  } kind;
+  enum dynamic_prop_kind kind;
 
   /* Storage for dynamic or static value.  */
-  union data
-  {
-    /* Storage for constant property.  */
-
-    LONGEST const_val;
-
-    /* Storage for dynamic property.  */
-
-    void *baton;
-  } data;
+  union dynamic_prop_data data;
 };
 
 
@@ -465,6 +469,128 @@  enum type_specific_kind
   TYPE_SPECIFIC_SELF_TYPE
 };
 
+union type_owner
+{
+  struct objfile *objfile;
+  struct gdbarch *gdbarch;
+};
+
+union field_location
+{
+  /* * Position of this field, counting in bits from start of
+     containing structure.  For gdbarch_bits_big_endian=1
+     targets, it is the bit offset to the MSB.  For
+     gdbarch_bits_big_endian=0 targets, it is the bit offset to
+     the LSB.  */
+
+  int bitpos;
+
+  /* * Enum value.  */
+  LONGEST enumval;
+
+  /* * For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then
+     physaddr is the location (in the target) of the static
+     field.  Otherwise, physname is the mangled label of the
+     static field.  */
+
+  CORE_ADDR physaddr;
+  const char *physname;
+
+  /* * The field location can be computed by evaluating the
+     following DWARF block.  Its DATA is allocated on
+     objfile_obstack - no CU load is needed to access it.  */
+
+  struct dwarf2_locexpr_baton *dwarf_block;
+};
+
+struct field
+{
+  union field_location loc;
+
+  /* * For a function or member type, this is 1 if the argument is
+     marked artificial.  Artificial arguments should not be shown
+     to the user.  For TYPE_CODE_RANGE it is set if the specific
+     bound is not defined.  */
+
+  unsigned int artificial : 1;
+
+  /* * Discriminant for union field_location.  */
+
+  ENUM_BITFIELD(field_loc_kind) loc_kind : 3;
+
+  /* * Size of this field, in bits, or zero if not packed.
+     If non-zero in an array type, indicates the element size in
+     bits (used only in Ada at the moment).
+     For an unpacked field, the field's type's length
+     says how many bytes the field occupies.  */
+
+  unsigned int bitsize : 28;
+
+  /* * In a struct or union type, type of this field.
+     - In a function or member type, type of this argument.
+     - In an array type, the domain-type of the array.  */
+
+  struct type *type;
+
+  /* * Name of field, value or argument.
+     NULL for range bounds, array domains, and member function
+     arguments.  */
+
+  const char *name;
+};
+
+struct range_bounds
+{
+  /* * Low bound of range.  */
+
+  struct dynamic_prop low;
+
+  /* * High bound of range.  */
+
+  struct dynamic_prop high;
+
+  /* True if HIGH range bound contains the number of elements in the
+     subrange. This affects how the final hight bound is computed.  */
+
+  int flag_upper_bound_is_count : 1;
+
+  /* True if LOW or/and HIGH are resolved into a static bound from
+     a dynamic one.  */
+
+  int flag_bound_evaluated : 1;
+};
+
+union type_specific
+{
+  /* * CPLUS_STUFF is for TYPE_CODE_STRUCT.  It is initialized to
+     point to cplus_struct_default, a default static instance of a
+     struct cplus_struct_type.  */
+
+  struct cplus_struct_type *cplus_stuff;
+
+  /* * GNAT_STUFF is for types for which the GNAT Ada compiler
+     provides additional information.  */
+
+  struct gnat_aux_type *gnat_stuff;
+
+  /* * FLOATFORMAT is for TYPE_CODE_FLT.  It is a pointer to two
+     floatformat objects that describe the floating-point value
+     that resides within the type.  The first is for big endian
+     targets and the second is for little endian targets.  */
+
+  const struct floatformat **floatformat;
+
+  /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types.  */
+
+  struct func_type *func_stuff;
+
+  /* * For types that are pointer to member types (TYPE_CODE_METHODPTR,
+     TYPE_CODE_MEMBERPTR), SELF_TYPE is the type that this pointer
+     is a member of.  */
+
+  struct type *self_type;
+};
+
 /* * Main structure representing a type in GDB.
 
    This structure is space-critical.  Its layout has been tweaked to
@@ -548,11 +674,7 @@  struct main_type
      this is somewhat ugly, but without major overhaul of the internal
      type system, it can't be avoided for now.  */
 
-  union type_owner
-    {
-      struct objfile *objfile;
-      struct gdbarch *gdbarch;
-    } owner;
+  union type_owner owner;
 
   /* * For a pointer type, describes the type of object pointed to.
      - For an array type, describes the type of the elements.
@@ -584,125 +706,18 @@  struct main_type
 
   union 
   {
-    struct field
-    {
-      union field_location
-      {
-	/* * Position of this field, counting in bits from start of
-	   containing structure.  For gdbarch_bits_big_endian=1
-	   targets, it is the bit offset to the MSB.  For
-	   gdbarch_bits_big_endian=0 targets, it is the bit offset to
-	   the LSB.  */
-
-	int bitpos;
-
-	/* * Enum value.  */
-	LONGEST enumval;
-
-	/* * For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then
-	   physaddr is the location (in the target) of the static
-	   field.  Otherwise, physname is the mangled label of the
-	   static field.  */
-
-	CORE_ADDR physaddr;
-	const char *physname;
-
-	/* * The field location can be computed by evaluating the
-	   following DWARF block.  Its DATA is allocated on
-	   objfile_obstack - no CU load is needed to access it.  */
-
-	struct dwarf2_locexpr_baton *dwarf_block;
-      }
-      loc;
-
-      /* * For a function or member type, this is 1 if the argument is
-	 marked artificial.  Artificial arguments should not be shown
-	 to the user.  For TYPE_CODE_RANGE it is set if the specific
-	 bound is not defined.  */
-      unsigned int artificial : 1;
-
-      /* * Discriminant for union field_location.  */
-      ENUM_BITFIELD(field_loc_kind) loc_kind : 3;
-
-      /* * Size of this field, in bits, or zero if not packed.
-	 If non-zero in an array type, indicates the element size in
-	 bits (used only in Ada at the moment).
-	 For an unpacked field, the field's type's length
-	 says how many bytes the field occupies.  */
-
-      unsigned int bitsize : 28;
-
-      /* * In a struct or union type, type of this field.
-	 - In a function or member type, type of this argument.
-	 - In an array type, the domain-type of the array.  */
-
-      struct type *type;
-
-      /* * Name of field, value or argument.
-	 NULL for range bounds, array domains, and member function
-	 arguments.  */
-
-      const char *name;
-    } *fields;
+    struct field *fields;
 
     /* * Union member used for range types.  */
 
-    struct range_bounds
-    {
-      /* * Low bound of range.  */
-
-      struct dynamic_prop low;
-
-      /* * High bound of range.  */
-
-      struct dynamic_prop high;
-
-      /* True if HIGH range bound contains the number of elements in the
-	 subrange. This affects how the final hight bound is computed.  */
-
-      int flag_upper_bound_is_count : 1;
-
-      /* True if LOW or/and HIGH are resolved into a static bound from
-	 a dynamic one.  */
-
-      int flag_bound_evaluated : 1;
-    } *bounds;
+    struct range_bounds *bounds;
 
   } flds_bnds;
 
   /* * Slot to point to additional language-specific fields of this
      type.  */
 
-  union type_specific
-  {
-    /* * CPLUS_STUFF is for TYPE_CODE_STRUCT.  It is initialized to
-       point to cplus_struct_default, a default static instance of a
-       struct cplus_struct_type.  */
-
-    struct cplus_struct_type *cplus_stuff;
-
-    /* * GNAT_STUFF is for types for which the GNAT Ada compiler
-       provides additional information.  */
-
-    struct gnat_aux_type *gnat_stuff;
-
-    /* * FLOATFORMAT is for TYPE_CODE_FLT.  It is a pointer to two
-       floatformat objects that describe the floating-point value
-       that resides within the type.  The first is for big endian
-       targets and the second is for little endian targets.  */
-
-    const struct floatformat **floatformat;
-
-    /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types.  */
-
-    struct func_type *func_stuff;
-
-    /* * For types that are pointer to member types (TYPE_CODE_METHODPTR,
-       TYPE_CODE_MEMBERPTR), SELF_TYPE is the type that this pointer
-       is a member of.  */
-
-    struct type *self_type;
-  } type_specific;
+  union type_specific type_specific;
 
   /* * Contains a location description value for the current type. Evaluating
      this field yields to the location of the data for an object.  */
@@ -780,6 +795,101 @@  struct type
 
 #define	NULL_TYPE ((struct type *) 0)
 
+struct fn_fieldlist
+{
+
+  /* * The overloaded name.
+     This is generally allocated in the objfile's obstack.
+     However stabsread.c sometimes uses malloc.  */
+
+  const char *name;
+
+  /* * The number of methods with this name.  */
+
+  int length;
+
+  /* * The list of methods.  */
+
+  struct fn_field *fn_fields;
+};
+
+
+
+struct fn_field
+{
+  /* * If is_stub is clear, this is the mangled name which we can look
+     up to find the address of the method (FIXME: it would be cleaner
+     to have a pointer to the struct symbol here instead).
+
+     If is_stub is set, this is the portion of the mangled name which
+     specifies the arguments.  For example, "ii", if there are two int
+     arguments, or "" if there are no arguments.  See gdb_mangle_name
+     for the conversion from this format to the one used if is_stub is
+     clear.  */
+
+  const char *physname;
+
+  /* * The function type for the method.
+	       
+     (This comment used to say "The return value of the method", but
+     that's wrong.  The function type is expected here, i.e. something
+     with TYPE_CODE_METHOD, and *not* the return-value type).  */
+
+  struct type *type;
+
+  /* * For virtual functions.  First baseclass that defines this
+     virtual function.  */
+
+  struct type *fcontext;
+
+  /* Attributes.  */
+
+  unsigned int is_const:1;
+  unsigned int is_volatile:1;
+  unsigned int is_private:1;
+  unsigned int is_protected:1;
+  unsigned int is_public:1;
+  unsigned int is_abstract:1;
+  unsigned int is_static:1;
+  unsigned int is_final:1;
+  unsigned int is_synchronized:1;
+  unsigned int is_native:1;
+  unsigned int is_artificial:1;
+
+  /* * A stub method only has some fields valid (but they are enough
+     to reconstruct the rest of the fields).  */
+
+  unsigned int is_stub:1;
+
+  /* * True if this function is a constructor, false otherwise.  */
+
+  unsigned int is_constructor : 1;
+
+  /* * Unused.  */
+
+  unsigned int dummy:3;
+
+  /* * Index into that baseclass's virtual function table, minus 2;
+     else if static: VOFFSET_STATIC; else: 0.  */
+
+  unsigned int voffset:16;
+
+#define VOFFSET_STATIC 1
+
+};
+
+struct typedef_field
+{
+  /* * Unqualified name to be prefixed by owning class qualified
+     name.  */
+
+  const char *name;
+
+  /* * Type this typedef named NAME represents.  */
+
+  struct type *type;
+};
+
 /* * C++ language-specific information for TYPE_CODE_STRUCT and
    TYPE_CODE_UNION nodes.  */
 
@@ -876,107 +986,13 @@  struct cplus_struct_type
 
        fn_fieldlists points to an array of nfn_fields of these.  */
 
-    struct fn_fieldlist
-      {
-
-	/* * The overloaded name.
-	   This is generally allocated in the objfile's obstack.
-	   However stabsread.c sometimes uses malloc.  */
-
-	const char *name;
-
-	/* * The number of methods with this name.  */
-
-	int length;
-
-	/* * The list of methods.  */
-
-	struct fn_field
-	  {
-
-	    /* * If is_stub is clear, this is the mangled name which
-	       we can look up to find the address of the method
-	       (FIXME: it would be cleaner to have a pointer to the
-	       struct symbol here instead).
-
-	       If is_stub is set, this is the portion of the mangled
-	       name which specifies the arguments.  For example, "ii",
-	       if there are two int arguments, or "" if there are no
-	       arguments.  See gdb_mangle_name for the conversion from
-	       this format to the one used if is_stub is clear.  */
-
-	    const char *physname;
-
-	    /* * The function type for the method.
-	       
-	       (This comment used to say "The return value of the
-	       method", but that's wrong.  The function type is
-	       expected here, i.e. something with TYPE_CODE_METHOD, and
-	       *not* the return-value type).  */
-
-	    struct type *type;
-
-	    /* * For virtual functions.
-	       First baseclass that defines this virtual function.  */
-
-	    struct type *fcontext;
-
-	    /* Attributes.  */
-
-	    unsigned int is_const:1;
-	    unsigned int is_volatile:1;
-	    unsigned int is_private:1;
-	    unsigned int is_protected:1;
-	    unsigned int is_public:1;
-	    unsigned int is_abstract:1;
-	    unsigned int is_static:1;
-	    unsigned int is_final:1;
-	    unsigned int is_synchronized:1;
-	    unsigned int is_native:1;
-	    unsigned int is_artificial:1;
-
-	    /* * A stub method only has some fields valid (but they
-	       are enough to reconstruct the rest of the fields).  */
-
-	    unsigned int is_stub:1;
-
-	    /* * True if this function is a constructor, false
-	       otherwise.  */
-
-	    unsigned int is_constructor : 1;
-
-	    /* * Unused.  */
-
-	    unsigned int dummy:3;
-
-	    /* * Index into that baseclass's virtual function table,
-	       minus 2; else if static: VOFFSET_STATIC; else: 0.  */
-
-	    unsigned int voffset:16;
-
-#define VOFFSET_STATIC 1
-
-	  }
-	 *fn_fields;
-
-      }
-     *fn_fieldlists;
+    struct fn_fieldlist *fn_fieldlists;
 
     /* * typedefs defined inside this class.  typedef_field points to
        an array of typedef_field_count elements.  */
 
-    struct typedef_field
-      {
-	/* * Unqualified name to be prefixed by owning class qualified
-	   name.  */
-
-	const char *name;
-
-	/* * Type this typedef named NAME represents.  */
+    struct typedef_field *typedef_field;
 
-	struct type *type;
-      }
-    *typedef_field;
     unsigned typedef_field_count;
 
     /* * The template arguments.  This is an array with
@@ -1067,6 +1083,55 @@  enum call_site_parameter_kind
   CALL_SITE_PARAMETER_PARAM_OFFSET
 };
 
+struct call_site_target
+{
+  union field_location loc;
+
+  /* * Discriminant for union field_location.  */
+
+  ENUM_BITFIELD(field_loc_kind) loc_kind : 3;
+};
+
+union call_site_parameter_u
+{
+  /* * DW_TAG_formal_parameter's DW_AT_location's DW_OP_regX
+     as DWARF register number, for register passed
+     parameters.  */
+
+  int dwarf_reg;
+
+  /* * Offset from the callee's frame base, for stack passed
+     parameters.  This equals offset from the caller's stack
+     pointer.  */
+
+  CORE_ADDR fb_offset;
+
+  /* * Offset relative to the start of this PER_CU to
+     DW_TAG_formal_parameter which is referenced by both
+     caller and the callee.  */
+
+  cu_offset param_offset;
+};
+
+struct call_site_parameter
+{
+  ENUM_BITFIELD (call_site_parameter_kind) kind : 2;
+
+  union call_site_parameter_u u;
+
+  /* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_value.  It
+     is never NULL.  */
+
+  const gdb_byte *value;
+  size_t value_size;
+
+  /* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_data_value.
+     It may be NULL if not provided by DWARF.  */
+
+  const gdb_byte *data_value;
+  size_t data_value_size;
+};
+
 /* * A place where a function gets called from, represented by
    DW_TAG_GNU_call_site.  It can be looked up from
    symtab->call_site_htab.  */
@@ -1086,15 +1151,7 @@  struct call_site
     /* * Describe DW_AT_GNU_call_site_target.  Missing attribute uses
        FIELD_LOC_KIND_DWARF_BLOCK with FIELD_DWARF_BLOCK == NULL.  */
 
-    struct
-      {
-	union field_location loc;
-
-	/* * Discriminant for union field_location.  */
-
-	ENUM_BITFIELD(field_loc_kind) loc_kind : 3;
-      }
-    target;
+    struct call_site_target target;
 
     /* * Size of the PARAMETER array.  */
 
@@ -1107,45 +1164,7 @@  struct call_site
 
     /* * Describe DW_TAG_GNU_call_site's DW_TAG_formal_parameter.  */
 
-    struct call_site_parameter
-      {
-	ENUM_BITFIELD (call_site_parameter_kind) kind : 2;
-
-	union call_site_parameter_u
-	  {
-	    /* * DW_TAG_formal_parameter's DW_AT_location's DW_OP_regX
-	       as DWARF register number, for register passed
-	       parameters.  */
-
-	    int dwarf_reg;
-
-	    /* * Offset from the callee's frame base, for stack passed
-	       parameters.  This equals offset from the caller's stack
-	       pointer.  */
-
-	    CORE_ADDR fb_offset;
-
-	    /* * Offset relative to the start of this PER_CU to
-	       DW_TAG_formal_parameter which is referenced by both
-	       caller and the callee.  */
-
-	    cu_offset param_offset;
-	  }
-	u;
-
-	/* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_value.  It
-	   is never NULL.  */
-
-	const gdb_byte *value;
-	size_t value_size;
-
-	/* * DW_TAG_formal_parameter's DW_AT_GNU_call_site_data_value.
-	   It may be NULL if not provided by DWARF.  */
-
-	const gdb_byte *data_value;
-	size_t data_value_size;
-      }
-    parameter[1];
+    struct call_site_parameter parameter[1];
   };
 
 /* * The default value of TYPE_CPLUS_SPECIFIC(T) points to this shared
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index f6b8289..60b5cfb 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -1010,6 +1010,19 @@  m32c_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
 
 /* Prologue analysis.  */
 
+enum m32c_prologue_kind
+{
+  /* This function uses a frame pointer.  */
+  prologue_with_frame_ptr,
+
+  /* This function has no frame pointer.  */
+  prologue_sans_frame_ptr,
+
+  /* This function sets up the stack, so its frame is the first
+     frame on the stack.  */
+  prologue_first_frame
+};
+
 struct m32c_prologue
 {
   /* For consistency with the DWARF 2 .debug_frame info generated by
@@ -1019,18 +1032,7 @@  struct m32c_prologue
   /* The architecture for which we generated this prologue info.  */
   struct gdbarch *arch;
 
-  enum {
-    /* This function uses a frame pointer.  */
-    prologue_with_frame_ptr,
-
-    /* This function has no frame pointer.  */
-    prologue_sans_frame_ptr,
-
-    /* This function sets up the stack, so its frame is the first
-       frame on the stack.  */
-    prologue_first_frame
-
-  } kind;
+  enum m32c_prologue_kind kind;
 
   /* If KIND is prologue_with_frame_ptr, this is the offset from the
      CFA to where the frame pointer points.  This is always zero or
@@ -1100,6 +1102,13 @@  m32c_pv_push (struct m32c_pv_state *state, pv_t value, int size)
 }
 
 
+enum srcdest_kind
+{
+  srcdest_reg,
+  srcdest_partial_reg,
+  srcdest_mem
+};
+
 /* A source or destination location for an m16c or m32c
    instruction.  */
 struct srcdest
@@ -1108,7 +1117,7 @@  struct srcdest
      If srcdest_partial_reg, the location is part of a register pointed
      to by REG.  We don't try to handle this too well.
      If srcdest_mem, the location is memory whose address is ADDR.  */
-  enum { srcdest_reg, srcdest_partial_reg, srcdest_mem } kind;
+  enum srcdest_kind kind;
   pv_t *reg, addr;
 };
 
diff --git a/gdb/main.c b/gdb/main.c
index 86804d2..0833c81 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -400,22 +400,26 @@  catch_command_errors_const (catch_command_errors_const_ftype *command,
   return handle_command_errors (e);
 }
 
-/* Arguments of --command option and its counterpart.  */
-typedef struct cmdarg {
-  /* Type of this option.  */
-  enum {
-    /* Option type -x.  */
-    CMDARG_FILE,
+/* Type of this option.  */
+enum cmdarg_kind
+{
+  /* Option type -x.  */
+  CMDARG_FILE,
 
-    /* Option type -ex.  */
-    CMDARG_COMMAND,
+  /* Option type -ex.  */
+  CMDARG_COMMAND,
 
-    /* Option type -ix.  */
-    CMDARG_INIT_FILE,
+  /* Option type -ix.  */
+  CMDARG_INIT_FILE,
     
-    /* Option type -iex.  */
-    CMDARG_INIT_COMMAND
-  } type;
+  /* Option type -iex.  */
+  CMDARG_INIT_COMMAND
+};
+
+/* Arguments of --command option and its counterpart.  */
+typedef struct cmdarg {
+  /* Type of this option.  */
+  enum cmdarg_kind type;
 
   /* Value of this option - filename or the GDB command itself.  String memory
      is not owned by this structure despite it is 'const'.  */
diff --git a/gdb/prologue-value.h b/gdb/prologue-value.h
index dfd7b33..7d3d779 100644
--- a/gdb/prologue-value.h
+++ b/gdb/prologue-value.h
@@ -19,6 +19,27 @@ 
 #ifndef PROLOGUE_VALUE_H
 #define PROLOGUE_VALUE_H
 
+/* What sort of value is this?  This determines the interpretation
+   of subsequent fields.  */
+enum prologue_value_kind
+{
+  /* We don't know anything about the value.  This is also used for
+     values we could have kept track of, when doing so would have
+     been too complex and we don't want to bother.  The bottom of
+     our lattice.  */
+  pvk_unknown,
+
+  /* A known constant.  K is its value.  */
+  pvk_constant,
+
+  /* The value that register REG originally had *UPON ENTRY TO THE
+     FUNCTION*, plus K.  If K is zero, this means, obviously, just
+     the value REG had upon entry to the function.  REG is a GDB
+     register number.  Before we start interpreting, we initialize
+     every register R to { pvk_register, R, 0 }.  */
+  pvk_register,
+};
+
 /* When we analyze a prologue, we're really doing 'abstract
    interpretation' or 'pseudo-evaluation': running the function's code
    in simulation, but using conservative approximations of the values
@@ -120,25 +141,7 @@  struct prologue_value {
 
   /* What sort of value is this?  This determines the interpretation
      of subsequent fields.  */
-  enum {
-
-    /* We don't know anything about the value.  This is also used for
-       values we could have kept track of, when doing so would have
-       been too complex and we don't want to bother.  The bottom of
-       our lattice.  */
-    pvk_unknown,
-
-    /* A known constant.  K is its value.  */
-    pvk_constant,
-
-    /* The value that register REG originally had *UPON ENTRY TO THE
-       FUNCTION*, plus K.  If K is zero, this means, obviously, just
-       the value REG had upon entry to the function.  REG is a GDB
-       register number.  Before we start interpreting, we initialize
-       every register R to { pvk_register, R, 0 }.  */
-    pvk_register,
-
-  } kind;
+  enum prologue_value_kind kind;
 
   /* The meanings of the following fields depend on 'kind'; see the
      comments for the specific 'kind' values.  */
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 9bd25fe..5c28d0a 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -70,12 +70,18 @@ 
 #define XML_SYSCALL_FILENAME_S390 "syscalls/s390-linux.xml"
 #define XML_SYSCALL_FILENAME_S390X "syscalls/s390x-linux.xml"
 
+enum s390_abi_kind
+{
+  ABI_LINUX_S390,
+  ABI_LINUX_ZSERIES
+};
+
 /* The tdep structure.  */
 
 struct gdbarch_tdep
 {
   /* ABI version.  */
-  enum { ABI_LINUX_S390, ABI_LINUX_ZSERIES } abi;
+  enum s390_abi_kind abi;
 
   /* Pseudo register numbers.  */
   int gpr_full_regnum;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index a0e6388..03c9eb1 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -53,6 +53,24 @@ 
 
 extern void _initialize_stabsread (void);
 
+struct nextfield
+{
+  struct nextfield *next;
+
+  /* This is the raw visibility from the stab.  It is not checked
+     for being one of the visibilities we recognize, so code which
+     examines this field better be able to deal.  */
+  int visibility;
+
+  struct field field;
+};
+
+struct next_fnfieldlist
+{
+  struct next_fnfieldlist *next;
+  struct fn_fieldlist fn_fieldlist;
+};
+
 /* 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
    fields in an instance of a field_info structure, as defined below.
@@ -61,24 +79,8 @@  extern void _initialize_stabsread (void);
 
 struct field_info
   {
-    struct nextfield
-      {
-	struct nextfield *next;
-
-	/* This is the raw visibility from the stab.  It is not checked
-	   for being one of the visibilities we recognize, so code which
-	   examines this field better be able to deal.  */
-	int visibility;
-
-	struct field field;
-      }
-     *list;
-    struct next_fnfieldlist
-      {
-	struct next_fnfieldlist *next;
-	struct fn_fieldlist fn_fieldlist;
-      }
-     *fnlist;
+    struct nextfield *list;
+    struct next_fnfieldlist *fnlist;
   };
 
 static void
diff --git a/gdb/symfile.h b/gdb/symfile.h
index c23e7c8..0feb41c 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -72,6 +72,15 @@  struct psymbol_allocation_list
   int size;
 };
 
+struct other_sections
+{
+  CORE_ADDR addr;
+  char *name;
+
+  /* SECTINDEX must be valid for associated BFD or set to -1.  */
+  int sectindex;
+};
+
 /* Define an array of addresses to accommodate non-contiguous dynamic
    loading of modules.  This is for use when entering commands, so we
    can keep track of the section names until we read the file and can
@@ -85,14 +94,7 @@  struct section_addr_info
      available.  */
   size_t num_sections;
   /* Sections whose names are file format dependent.  */
-  struct other_sections
-  {
-    CORE_ADDR addr;
-    char *name;
-
-    /* SECTINDEX must be valid for associated BFD or set to -1.  */
-    int sectindex;
-  } other[1];
+  struct other_sections other[1];
 };
 
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 5302c0e..95bc53d 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -133,6 +133,39 @@  enum symbol_cache_slot_state
   SYMBOL_SLOT_FOUND
 };
 
+struct symbol_cache_slot
+{
+  enum symbol_cache_slot_state state;
+
+  /* The objfile that was current when the symbol was looked up.
+     This is only needed for global blocks, but for simplicity's sake
+     we allocate the space for both.  If data shows the extra space used
+     for static blocks is a problem, we can split things up then.
+
+     Global blocks need cache lookup to include the objfile context because
+     we need to account for gdbarch_iterate_over_objfiles_in_search_order
+     which can traverse objfiles in, effectively, any order, depending on
+     the current objfile, thus affecting which symbol is found.  Normally,
+     only the current objfile is searched first, and then the rest are
+     searched in recorded order; but putting cache lookup inside
+     gdbarch_iterate_over_objfiles_in_search_order would be awkward.
+     Instead we just make the current objfile part of the context of
+     cache lookup.  This means we can record the same symbol multiple times,
+     each with a different "current objfile" that was in effect when the
+     lookup was saved in the cache, but cache space is pretty cheap.  */
+  const struct objfile *objfile_context;
+
+  union
+  {
+    struct symbol *found;
+    struct
+    {
+      char *name;
+      domain_enum domain;
+    } not_found;
+  } value;
+};
+
 /* Symbols don't specify global vs static block.
    So keep them in separate caches.  */
 
@@ -148,38 +181,7 @@  struct block_symbol_cache
      on which to decide.  */
   unsigned int size;
 
-  struct symbol_cache_slot
-  {
-    enum symbol_cache_slot_state state;
-
-    /* The objfile that was current when the symbol was looked up.
-       This is only needed for global blocks, but for simplicity's sake
-       we allocate the space for both.  If data shows the extra space used
-       for static blocks is a problem, we can split things up then.
-
-       Global blocks need cache lookup to include the objfile context because
-       we need to account for gdbarch_iterate_over_objfiles_in_search_order
-       which can traverse objfiles in, effectively, any order, depending on
-       the current objfile, thus affecting which symbol is found.  Normally,
-       only the current objfile is searched first, and then the rest are
-       searched in recorded order; but putting cache lookup inside
-       gdbarch_iterate_over_objfiles_in_search_order would be awkward.
-       Instead we just make the current objfile part of the context of
-       cache lookup.  This means we can record the same symbol multiple times,
-       each with a different "current objfile" that was in effect when the
-       lookup was saved in the cache, but cache space is pretty cheap.  */
-    const struct objfile *objfile_context;
-
-    union
-    {
-      struct symbol *found;
-      struct
-      {
-	char *name;
-	domain_enum domain;
-      } not_found;
-    } value;
-  } symbols[1];
+  struct symbol_cache_slot symbols[1];
 };
 
 /* The symbol cache.
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 885d461..0eec6be 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -101,38 +101,40 @@  typedef struct tdesc_type_flag
 } tdesc_type_flag;
 DEF_VEC_O(tdesc_type_flag);
 
+enum tdesc_type_kind
+{
+  /* Predefined types.  */
+  TDESC_TYPE_INT8,
+  TDESC_TYPE_INT16,
+  TDESC_TYPE_INT32,
+  TDESC_TYPE_INT64,
+  TDESC_TYPE_INT128,
+  TDESC_TYPE_UINT8,
+  TDESC_TYPE_UINT16,
+  TDESC_TYPE_UINT32,
+  TDESC_TYPE_UINT64,
+  TDESC_TYPE_UINT128,
+  TDESC_TYPE_CODE_PTR,
+  TDESC_TYPE_DATA_PTR,
+  TDESC_TYPE_IEEE_SINGLE,
+  TDESC_TYPE_IEEE_DOUBLE,
+  TDESC_TYPE_ARM_FPA_EXT,
+  TDESC_TYPE_I387_EXT,
+
+  /* Types defined by a target feature.  */
+  TDESC_TYPE_VECTOR,
+  TDESC_TYPE_STRUCT,
+  TDESC_TYPE_UNION,
+  TDESC_TYPE_FLAGS
+};
+
 typedef struct tdesc_type
 {
   /* The name of this type.  */
   char *name;
 
   /* Identify the kind of this type.  */
-  enum
-  {
-    /* Predefined types.  */
-    TDESC_TYPE_INT8,
-    TDESC_TYPE_INT16,
-    TDESC_TYPE_INT32,
-    TDESC_TYPE_INT64,
-    TDESC_TYPE_INT128,
-    TDESC_TYPE_UINT8,
-    TDESC_TYPE_UINT16,
-    TDESC_TYPE_UINT32,
-    TDESC_TYPE_UINT64,
-    TDESC_TYPE_UINT128,
-    TDESC_TYPE_CODE_PTR,
-    TDESC_TYPE_DATA_PTR,
-    TDESC_TYPE_IEEE_SINGLE,
-    TDESC_TYPE_IEEE_DOUBLE,
-    TDESC_TYPE_ARM_FPA_EXT,
-    TDESC_TYPE_I387_EXT,
-
-    /* Types defined by a target feature.  */
-    TDESC_TYPE_VECTOR,
-    TDESC_TYPE_STRUCT,
-    TDESC_TYPE_UNION,
-    TDESC_TYPE_FLAGS
-  } kind;
+  enum tdesc_type_kind kind;
 
   /* Kind-specific data.  */
   union
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 8bfb4b3..f87c45d 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -145,10 +145,16 @@  enum tui_register_display_type
   TUI_GENERAL_AND_SPECIAL_REGS
 };
 
+enum tui_line_or_address_kind
+{
+  LOA_LINE,
+  LOA_ADDRESS
+};
+
 /* Structure describing source line or line address.  */
 struct tui_line_or_address
 {
-  enum { LOA_LINE, LOA_ADDRESS } loa;
+  enum tui_line_or_address_kind loa;
   union
     {
       int line_no;
diff --git a/gdb/value.c b/gdb/value.c
index 06da269..b9a45ef 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1891,6 +1891,66 @@  show_values (char *num_exp, int from_tty)
     }
 }
 
+enum internalvar_kind
+{
+  /* The internal variable is empty.  */
+  INTERNALVAR_VOID,
+
+  /* The value of the internal variable is provided directly as
+     a GDB value object.  */
+  INTERNALVAR_VALUE,
+
+  /* A fresh value is computed via a call-back routine on every
+     access to the internal variable.  */
+  INTERNALVAR_MAKE_VALUE,
+
+  /* The internal variable holds a GDB internal convenience function.  */
+  INTERNALVAR_FUNCTION,
+
+  /* The variable holds an integer value.  */
+  INTERNALVAR_INTEGER,
+
+  /* The variable holds a GDB-provided string.  */
+  INTERNALVAR_STRING,
+};
+
+union internalvar_data
+{
+  /* A value object used with INTERNALVAR_VALUE.  */
+  struct value *value;
+
+  /* The call-back routine used with INTERNALVAR_MAKE_VALUE.  */
+  struct
+  {
+    /* The functions to call.  */
+    const struct internalvar_funcs *functions;
+
+    /* The function's user-data.  */
+    void *data;
+  } make_value;
+
+  /* The internal function used with INTERNALVAR_FUNCTION.  */
+  struct
+  {
+    struct internal_function *function;
+    /* True if this is the canonical name for the function.  */
+    int canonical;
+  } fn;
+
+  /* An integer value used with INTERNALVAR_INTEGER.  */
+  struct
+  {
+    /* If type is non-NULL, it will be used as the type to generate
+       a value for this internal variable.  If type is NULL, a default
+       integer type for the architecture is used.  */
+    struct type *type;
+    LONGEST val;
+  } integer;
+
+  /* A string value used with INTERNALVAR_STRING.  */
+  char *string;
+};
+
 /* Internal variables.  These are variables within the debugger
    that hold values assigned by debugger commands.
    The user refers to them with a '$' prefix
@@ -1905,66 +1965,9 @@  struct internalvar
      enum internalvar_kind specifies the kind, and union internalvar_data
      provides the data associated with this particular kind.  */
 
-  enum internalvar_kind
-    {
-      /* The internal variable is empty.  */
-      INTERNALVAR_VOID,
-
-      /* The value of the internal variable is provided directly as
-	 a GDB value object.  */
-      INTERNALVAR_VALUE,
-
-      /* A fresh value is computed via a call-back routine on every
-	 access to the internal variable.  */
-      INTERNALVAR_MAKE_VALUE,
-
-      /* The internal variable holds a GDB internal convenience function.  */
-      INTERNALVAR_FUNCTION,
-
-      /* The variable holds an integer value.  */
-      INTERNALVAR_INTEGER,
-
-      /* The variable holds a GDB-provided string.  */
-      INTERNALVAR_STRING,
-
-    } kind;
+  enum internalvar_kind kind;
 
-  union internalvar_data
-    {
-      /* A value object used with INTERNALVAR_VALUE.  */
-      struct value *value;
-
-      /* The call-back routine used with INTERNALVAR_MAKE_VALUE.  */
-      struct
-        {
-	  /* The functions to call.  */
-	  const struct internalvar_funcs *functions;
-
-	  /* The function's user-data.  */
-	  void *data;
-        } make_value;
-
-      /* The internal function used with INTERNALVAR_FUNCTION.  */
-      struct
-	{
-	  struct internal_function *function;
-	  /* True if this is the canonical name for the function.  */
-	  int canonical;
-	} fn;
-
-      /* An integer value used with INTERNALVAR_INTEGER.  */
-      struct
-        {
-	  /* If type is non-NULL, it will be used as the type to generate
-	     a value for this internal variable.  If type is NULL, a default
-	     integer type for the architecture is used.  */
-	  struct type *type;
-	  LONGEST val;
-        } integer;
-
-      /* A string value used with INTERNALVAR_STRING.  */
-      char *string;
-    } u;
+  union internalvar_data u;
 };
 
 static struct internalvar *internalvars;
diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index 090aaca..adacaf8 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -162,6 +162,13 @@  typedef enum
 } call_abi_t;
 
 
+struct ctype_cache
+{
+  struct ctype_cache *next;
+  int size;
+  struct type *virtual_type;
+};
+
 /*  Xtensa-specific target dependencies.  */
 
 struct gdbarch_tdep
@@ -228,12 +235,7 @@  struct gdbarch_tdep
   unsigned long *gregmap;
 
   /* Cached register types.  */
-  struct ctype_cache
-    {
-      struct ctype_cache *next;
-      int size;
-      struct type *virtual_type;
-    } *type_entries;
+  struct ctype_cache *type_entries;
 };
 
 /* Macro to instantiate a gdbarch_tdep structure.  */