[PATCH] Rename gdbarch_tdep template function to gdbarch_tdep_cast for g++ 4.8

Andrew Burgess aburgess@redhat.com
Tue Jul 26 11:05:52 GMT 2022


Mark Wielaard <mark@klomp.org> writes:

> Hi Andrew,
>
> On Mon, 2022-07-25 at 12:19 +0100, Andrew Burgess wrote:
>> Mark Wielaard <mark@klomp.org> writes:
>> 
>> > commit 08106042d "gdb: move the type cast into gdbarch_tdep" created
>> > a template function with the same name as a struct gdbarch_tdep. This
>> > confused g++ 4.8 believing the struct gdbarch_tdep was an incomplete
>> > type. Fix this by renaming the template function to gdbarch_tdep_cast.
>> 
>> Honestly, I'm not a fan of the proposed new name.  Using names that end
>> in _cast should, I think, be reserved for functions that exhibit casting
>> like behaviour, i.e. take an object, or pointer, and return the same
>> object, or pointer, converted to some alternative type, which isn't what
>> we're doing here.
>> 
>> Instead of renaming the function, I'd like to propose that we rename the
>> structure instead, so 'struct gdbarch_tdep' to 'struct
>> gdbarch_tdep_base'.
>> 
>> Given the structure is only ever used as a base class, I think the new
>> name is good, and this allows the function name to be left unchanged.
>> 
>> I tested this on a CentOS VM using g++ 4.8.5, and it seems to build
>> fine.
>> 
>> Thoughts?
>
> I agree with your reasoning. And now that you mention it I don't know
> why I did rename the "cast" function instead of the base struct name. I
> like your patch better.

Thanks.  I pushed the patch below, which also updates a couple of
related comments.

Thanks,
Andrew

---

commit ab25d9bbe4a04aefb47d2514b4b02e6035ff769e
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Mon Jul 25 12:07:11 2022 +0100

    gdb: rename gdbarch_tdep struct to fix g++ 4.8 build
    
    After the commit:
    
      commit 08106042d9f5fdff60c129bf33190639f1a98b2a
      Date:   Thu May 19 13:20:17 2022 +0100
    
          gdb: move the type cast into gdbarch_tdep
    
    GDB would no longer build using g++ 4.8.  The issue appears to be some
    confusion caused by GDB having 'struct gdbarch_tdep', but also a
    templated function called 'gdbarch_tdep'.  Prior to the above commit
    the gdbarch_tdep function was not templated, and this compiled just
    fine.  Note that the above commit compiles just fine with later
    versions of g++, so this issue was clearly fixed at some point, though
    I've not tried to track down exactly when.
    
    In this commit I propose to fix the g++ 4.8 build problem by renaming
    'struct gdbarch_tdep' to 'struct gdbarch_tdep_base'.  This rename
    better represents that the struct is only ever used as a base class,
    and removes the overloading of the name, which allows GDB to build
    with g++ 4.8.
    
    I've also updated the comment on 'struct gdbarch_tdep_base' to fix a
    typo, and the comment on the 'gdbarch_tdep' function, to mention that
    in maintainer mode a run-time type check is performed.

diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h
index b85a3d33cc9..5bdd733dce3 100644
--- a/gdb/aarch64-tdep.h
+++ b/gdb/aarch64-tdep.h
@@ -60,7 +60,7 @@ struct regset;
 #define AARCH64_DISPLACED_MODIFIED_INSNS 1
 
 /* Target-dependent structure in gdbarch.  */
-struct aarch64_gdbarch_tdep : gdbarch_tdep
+struct aarch64_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Lowest address at which instructions will appear.  */
   CORE_ADDR lowest_pc = 0;
diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h
index 420ea1adc9c..bc4a8407249 100644
--- a/gdb/alpha-tdep.h
+++ b/gdb/alpha-tdep.h
@@ -70,7 +70,7 @@ struct regcache;
 #define ALPHA_NUM_ARG_REGS   6
 
 /* Target-dependent structure in gdbarch.  */
-struct alpha_gdbarch_tdep : gdbarch_tdep
+struct alpha_gdbarch_tdep : gdbarch_tdep_base
 {
   CORE_ADDR vm_min_address = 0;	/* Used by alpha_heuristic_proc_start.  */
 
diff --git a/gdb/arc-tdep.h b/gdb/arc-tdep.h
index 53e5d8476fc..eba435f62f0 100644
--- a/gdb/arc-tdep.h
+++ b/gdb/arc-tdep.h
@@ -121,7 +121,7 @@ extern bool arc_debug;
 
 /* Target-dependent information.  */
 
-struct arc_gdbarch_tdep : gdbarch_tdep
+struct arc_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Offset to PC value in jump buffer.  If this is negative, longjmp
      support will be disabled.  */
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 360b8d694be..4e55b2797b9 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -1200,7 +1200,7 @@ gdbarch_free (struct gdbarch *arch)
 
 /* See gdbarch.h.  */
 
-struct gdbarch_tdep *
+struct gdbarch_tdep_base *
 gdbarch_tdep_1 (struct gdbarch *gdbarch)
 {
   if (gdbarch_debug >= 2)
diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index 0fc4774a20c..67dd1151da4 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -87,7 +87,7 @@ enum struct_return
 };
 
 /* Target-dependent structure in gdbarch.  */
-struct arm_gdbarch_tdep : gdbarch_tdep
+struct arm_gdbarch_tdep : gdbarch_tdep_base
 {
   /* The ABI for this architecture.  It should never be set to
      ARM_ABI_AUTO.  */
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 4722f7ee748..357f5bb8f2d 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -189,7 +189,7 @@ struct avr_unwind_cache
   trad_frame_saved_reg *saved_regs;
 };
 
-struct avr_gdbarch_tdep : gdbarch_tdep
+struct avr_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Number of bytes stored to the stack by call instructions.
      2 bytes for avr1-5 and avrxmega1-5, 3 bytes for avr6 and avrxmega6-7.  */
diff --git a/gdb/bfin-tdep.h b/gdb/bfin-tdep.h
index b7e3b9b327c..267149684e0 100644
--- a/gdb/bfin-tdep.h
+++ b/gdb/bfin-tdep.h
@@ -96,7 +96,7 @@ enum bfin_abi
 };
 
 /* Target-dependent structure in gdbarch.  */
-struct bfin_gdbarch_tdep : gdbarch_tdep
+struct bfin_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Which ABI is in use?  */
   enum bfin_abi bfin_abi {};
diff --git a/gdb/bpf-tdep.c b/gdb/bpf-tdep.c
index 09030cf8fa1..a5df478063c 100644
--- a/gdb/bpf-tdep.c
+++ b/gdb/bpf-tdep.c
@@ -58,7 +58,7 @@ enum bpf_regnum
 #define BPF_NUM_REGS	(BPF_PC_REGNUM + 1)
 
 /* Target-dependent structure in gdbarch.  */
-struct bpf_gdbarch_tdep : gdbarch_tdep
+struct bpf_gdbarch_tdep : gdbarch_tdep_base
 {
 };
 
diff --git a/gdb/cris-tdep.h b/gdb/cris-tdep.h
index 0b1801afa04..981515a4e9f 100644
--- a/gdb/cris-tdep.h
+++ b/gdb/cris-tdep.h
@@ -26,7 +26,7 @@
 #include "gdbarch.h"
 
 /* CRIS architecture specific information.  */
-struct cris_gdbarch_tdep : gdbarch_tdep
+struct cris_gdbarch_tdep : gdbarch_tdep_base
 {
   unsigned int cris_version = 0;
   const char *cris_mode = nullptr;
diff --git a/gdb/csky-tdep.h b/gdb/csky-tdep.h
index 4cfc0a5d086..54000ab8287 100644
--- a/gdb/csky-tdep.h
+++ b/gdb/csky-tdep.h
@@ -31,7 +31,7 @@ enum lr_type_t
 };
 
 /* Target-dependent structure in gdbarch.  */
-struct csky_gdbarch_tdep : gdbarch_tdep
+struct csky_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Save FPU, VDSP ABI.  */
   unsigned int fpu_abi;
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 34f437764a9..55a6cfd9618 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -68,7 +68,7 @@ struct frv_unwind_cache		/* was struct frame_extra_info */
    of structures, each of which gives all the necessary info for one
    register.  Don't stick parallel arrays in here --- that's so
    Fortran.  */
-struct frv_gdbarch_tdep : gdbarch_tdep
+struct frv_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Which ABI is in use?  */
   enum frv_abi frv_abi {};
diff --git a/gdb/ft32-tdep.h b/gdb/ft32-tdep.h
index e66a417198e..e9befaba9d4 100644
--- a/gdb/ft32-tdep.h
+++ b/gdb/ft32-tdep.h
@@ -22,7 +22,7 @@
 
 #include "gdbarch.h"
 
-struct ft32_gdbarch_tdep : gdbarch_tdep
+struct ft32_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Type for a pointer to a function.  Used for the type of PC.  */
   struct type *pc_type = nullptr;
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 5d14aec1455..d4ea5d33c9c 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -43,7 +43,7 @@ struct gdbarch
   const struct target_desc * target_desc;
 
   /* target specific vector.  */
-  struct gdbarch_tdep *tdep;
+  struct gdbarch_tdep_base *tdep;
   gdbarch_dump_tdep_ftype *dump_tdep;
 
   /* per-architecture data-pointers.  */
@@ -258,7 +258,7 @@ struct gdbarch
 
 struct gdbarch *
 gdbarch_alloc (const struct gdbarch_info *info,
-	       struct gdbarch_tdep *tdep)
+	       struct gdbarch_tdep_base *tdep)
 {
   struct gdbarch *gdbarch;
 
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 16c73915c64..324958469a7 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -61,11 +61,11 @@ struct inferior;
 
 /* The base class for every architecture's tdep sub-class.  The virtual
    destructor ensures the class has RTTI information, which allows
-   gdb::checked_static_cast to be used, the gdbarch_tdep the function.  */
+   gdb::checked_static_cast to be used in the gdbarch_tdep function.  */
 
-struct gdbarch_tdep
+struct gdbarch_tdep_base
 {
-  virtual ~gdbarch_tdep() = default;
+  virtual ~gdbarch_tdep_base() = default;
 };
 
 /* The architecture associated with the inferior through the
@@ -151,20 +151,23 @@ using read_core_file_mappings_loop_ftype =
 #include "gdbarch-gen.h"
 
 /* An internal function that should _only_ be called from gdbarch_tdep.
-   Returns the gdbarch_tdep field held within GDBARCH.  */
+   Returns the gdbarch_tdep_base field held within GDBARCH.  */
 
-extern struct gdbarch_tdep *gdbarch_tdep_1 (struct gdbarch *gdbarch);
+extern struct gdbarch_tdep_base *gdbarch_tdep_1 (struct gdbarch *gdbarch);
 
-/* Return the gdbarch_tdep object held within GDBARCH cast to the type
-   TDepType, which should be a sub-class of gdbarch_tdep.  There is no
-   checking done that the gdbarch_tdep within GDBARCH actually is of the
-   type TDepType, we just assume the caller knows what they are doing.  */
+/* Return the gdbarch_tdep_base object held within GDBARCH cast to the type
+   TDepType, which should be a sub-class of gdbarch_tdep_base.
+
+   When GDB is compiled in maintainer mode a run-time check is performed
+   that the gdbarch_tdep_base within GDBARCH really is of type TDepType.
+   When GDB is compiled in release mode the run-time check is not
+   performed, and we assume the caller knows what they are doing.  */
 
 template<typename TDepType>
 static inline TDepType *
 gdbarch_tdep (struct gdbarch *gdbarch)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep_1 (gdbarch);
+  struct gdbarch_tdep_base *tdep = gdbarch_tdep_1 (gdbarch);
   return gdb::checked_static_cast<TDepType *> (tdep);
 }
 
@@ -293,7 +296,7 @@ extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *ar
    parameters.  set_gdbarch_*() functions are called to complete the
    initialization of the object.  */
 
-extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
+extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep_base *tdep);
 
 
 /* Helper function.  Free a partially-constructed ``struct gdbarch''.
diff --git a/gdb/gdbarch.py b/gdb/gdbarch.py
index 8956a9c38aa..bb08081af5a 100755
--- a/gdb/gdbarch.py
+++ b/gdb/gdbarch.py
@@ -267,7 +267,7 @@ with open("gdbarch.c", "w") as f:
         print(f"  {c.type} {c.name};", file=f)
     print(file=f)
     print("  /* target specific vector.  */", file=f)
-    print("  struct gdbarch_tdep *tdep;", file=f)
+    print("  struct gdbarch_tdep_base *tdep;", file=f)
     print("  gdbarch_dump_tdep_ftype *dump_tdep;", file=f)
     print(file=f)
     print("  /* per-architecture data-pointers.  */", file=f)
@@ -290,7 +290,7 @@ with open("gdbarch.c", "w") as f:
     print(file=f)
     print("struct gdbarch *", file=f)
     print("gdbarch_alloc (const struct gdbarch_info *info,", file=f)
-    print("	       struct gdbarch_tdep *tdep)", file=f)
+    print("	       struct gdbarch_tdep_base *tdep)", file=f)
     print("{", file=f)
     print("  struct gdbarch *gdbarch;", file=f)
     print("", file=f)
diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h
index f1e24a272c4..c2c9e0e0b5e 100644
--- a/gdb/hppa-tdep.h
+++ b/gdb/hppa-tdep.h
@@ -84,7 +84,7 @@ enum hppa_regnum
 #define HPPA_INSN_SIZE 4
 
 /* Target-dependent structure in gdbarch.  */
-struct hppa_gdbarch_tdep : gdbarch_tdep
+struct hppa_gdbarch_tdep : gdbarch_tdep_base
 {
   /* The number of bytes in an address.  For now, this field is designed
      to allow us to differentiate hppa32 from hppa64 targets.  */
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index a8067cf6b6c..cd77e0308e0 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -57,7 +57,7 @@ enum struct_return
 };
 
 /* i386 architecture specific information.  */
-struct i386_gdbarch_tdep : gdbarch_tdep
+struct i386_gdbarch_tdep : gdbarch_tdep_base
 {
   /* General-purpose registers.  */
   int *gregset_reg_offset = 0;
diff --git a/gdb/ia64-tdep.h b/gdb/ia64-tdep.h
index 675d0d871b2..f06974fd296 100644
--- a/gdb/ia64-tdep.h
+++ b/gdb/ia64-tdep.h
@@ -229,7 +229,7 @@ struct ia64_infcall_ops
   void (*set_function_addr) (struct regcache *regcache, CORE_ADDR func_addr);
 };
 
-struct ia64_gdbarch_tdep : gdbarch_tdep
+struct ia64_gdbarch_tdep : gdbarch_tdep_base
 {
   CORE_ADDR (*sigcontext_register_address) (struct gdbarch *, CORE_ADDR, int)
     = nullptr;
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 4a781c394e9..4cbff537fab 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -43,7 +43,7 @@
 #define LM32_REG2(insn)         ((insn >> 11) & 0x1f)
 #define LM32_IMM16(insn)        ((((long)insn & 0xffff) << 16) >> 16)
 
-struct lm32_gdbarch_tdep : gdbarch_tdep
+struct lm32_gdbarch_tdep : gdbarch_tdep_base
 {
   /* gdbarch target dependent data here.  Currently unused for LM32.  */
 };
diff --git a/gdb/loongarch-tdep.h b/gdb/loongarch-tdep.h
index e35b6cf4c7a..c5527f7d148 100644
--- a/gdb/loongarch-tdep.h
+++ b/gdb/loongarch-tdep.h
@@ -32,7 +32,7 @@ extern const struct regset loongarch_gregset;
 extern const struct regset loongarch_fpregset;
 
 /* Target-dependent structure in gdbarch.  */
-struct loongarch_gdbarch_tdep : gdbarch_tdep
+struct loongarch_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Features about the abi that impact how the gdbarch is configured.  */
   struct loongarch_gdbarch_features abi_features;
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 37456d16cb3..30f716b6969 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -96,7 +96,7 @@ struct m32c_reg
 #define M32C_MAX_DWARF_REGNUM (40)
 
 
-struct m32c_gdbarch_tdep : gdbarch_tdep
+struct m32c_gdbarch_tdep : gdbarch_tdep_base
 {
   /* All the registers for this variant, indexed by GDB register
      number, and the number of registers present.  */
diff --git a/gdb/m32r-tdep.h b/gdb/m32r-tdep.h
index 1fa143adc74..09d5b245770 100644
--- a/gdb/m32r-tdep.h
+++ b/gdb/m32r-tdep.h
@@ -22,7 +22,7 @@
 
 #include "gdbarch.h"
 
-struct m32r_gdbarch_tdep : gdbarch_tdep
+struct m32r_gdbarch_tdep : gdbarch_tdep_base
 {
   /* gdbarch target dependent data here.  Currently unused for M32R.  */
 };
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 9eb18b937be..7ea1f9a5b91 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -124,7 +124,7 @@ enum insn_return_kind {
 #define M68HC12_HARD_PC_REGNUM  (SOFT_D32_REGNUM+1)
 
 struct insn_sequence;
-struct m68gc11_gdbarch_tdep : gdbarch_tdep
+struct m68gc11_gdbarch_tdep : gdbarch_tdep_base
   {
     /* Stack pointer correction value.  For 68hc11, the stack pointer points
        to the next push location.  An offset of 1 must be applied to obtain
diff --git a/gdb/m68k-tdep.h b/gdb/m68k-tdep.h
index c70a26e8554..785e3fdb84f 100644
--- a/gdb/m68k-tdep.h
+++ b/gdb/m68k-tdep.h
@@ -69,7 +69,7 @@ enum m68k_flavour
 
 /* Target-dependent structure in gdbarch.  */
 
-struct m68k_gdbarch_tdep : gdbarch_tdep
+struct m68k_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Offset to PC value in the jump buffer.  If this is negative,
      longjmp support will be disabled.  */
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index d5ba78c6df9..170b4b07460 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -116,7 +116,7 @@
      options are present on the current processor.  */
 
 
-struct mep_gdbarch_tdep : gdbarch_tdep
+struct mep_gdbarch_tdep : gdbarch_tdep_base
 {
   /* A CGEN cpu descriptor for this BFD architecture and machine.
 
diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
index 4d90e8785dc..48b2581fcc7 100644
--- a/gdb/microblaze-tdep.h
+++ b/gdb/microblaze-tdep.h
@@ -23,7 +23,7 @@
 #include "gdbarch.h"
 
 /* Microblaze architecture-specific information.  */
-struct microblaze_gdbarch_tdep : gdbarch_tdep
+struct microblaze_gdbarch_tdep : gdbarch_tdep_base
 {
 };
 
diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h
index 4d2664d4273..24ed678a521 100644
--- a/gdb/mips-tdep.h
+++ b/gdb/mips-tdep.h
@@ -93,7 +93,7 @@ enum mips_fpu_type
 };
 
 /* MIPS specific per-architecture information.  */
-struct mips_gdbarch_tdep : gdbarch_tdep
+struct mips_gdbarch_tdep : gdbarch_tdep_base
 {
   /* from the elf header */
   int elf_flags = 0;
diff --git a/gdb/mn10300-tdep.h b/gdb/mn10300-tdep.h
index 87b861ead90..dacfb9d2948 100644
--- a/gdb/mn10300-tdep.h
+++ b/gdb/mn10300-tdep.h
@@ -76,7 +76,7 @@ enum frame_kind {
 };
 
 /* mn10300 private data.  */
-struct mn10300_gdbarch_tdep : gdbarch_tdep
+struct mn10300_gdbarch_tdep : gdbarch_tdep_base
 {
   int am33_mode;
 };
diff --git a/gdb/moxie-tdep.h b/gdb/moxie-tdep.h
index 91d007fd723..69bb5d0fa3a 100644
--- a/gdb/moxie-tdep.h
+++ b/gdb/moxie-tdep.h
@@ -22,7 +22,7 @@
 
 #include "gdbarch.h"
 
-struct moxie_gdbarch_tdep : gdbarch_tdep
+struct moxie_gdbarch_tdep : gdbarch_tdep_base
 {
   /* gdbarch target dependent data here.  Currently unused for MOXIE.  */
 };
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 4ae8b3d5626..cf4106d1a34 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -105,7 +105,7 @@ enum
 
 /* Architecture specific data.  */
 
-struct msp430_gdbarch_tdep : gdbarch_tdep
+struct msp430_gdbarch_tdep : gdbarch_tdep_base
 {
   /* The ELF header flags specify the multilib used.  */
   int elf_flags = 0;
diff --git a/gdb/nds32-tdep.h b/gdb/nds32-tdep.h
index 2cabd6a173f..e68017b4667 100644
--- a/gdb/nds32-tdep.h
+++ b/gdb/nds32-tdep.h
@@ -42,7 +42,7 @@ enum nds32_regnum
   NDS32_FD0_REGNUM = NDS32_NUM_REGS,
 };
 
-struct nds32_gdbarch_tdep : gdbarch_tdep
+struct nds32_gdbarch_tdep : gdbarch_tdep_base
 {
   /* The guessed FPU configuration.  */
   int fpu_freg = 0;
diff --git a/gdb/nios2-tdep.h b/gdb/nios2-tdep.h
index b8913ed1baa..cbf2599f5c0 100644
--- a/gdb/nios2-tdep.h
+++ b/gdb/nios2-tdep.h
@@ -69,7 +69,7 @@
 #define NIOS2_CDX_OPCODE_SIZE 2
 
 /* Target-dependent structure in gdbarch.  */
-struct nios2_gdbarch_tdep : gdbarch_tdep
+struct nios2_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Assumes FRAME is stopped at a syscall (trap) instruction; returns
      the expected next PC.  */
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index 4699b755d42..360a7cb36c1 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -63,7 +63,7 @@ show_or1k_debug (struct ui_file *file, int from_tty,
 
 /* The target-dependent structure for gdbarch.  */
 
-struct or1k_gdbarch_tdep : gdbarch_tdep
+struct or1k_gdbarch_tdep : gdbarch_tdep_base
 {
   int bytes_per_word = 0;
   int bytes_per_address = 0;
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index 80a7dd080a2..44f63b145c6 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -205,7 +205,7 @@ enum powerpc_long_double_abi
   POWERPC_LONG_DOUBLE_LAST
 };
 
-struct ppc_gdbarch_tdep : gdbarch_tdep
+struct ppc_gdbarch_tdep : gdbarch_tdep_base
   {
     int wordsize = 0;		/* Size in bytes of fixed-point word.  */
     int soft_float = 0;		/* Avoid FP registers for arguments?  */
diff --git a/gdb/riscv-tdep.h b/gdb/riscv-tdep.h
index ac4b4b7144d..826a002ef92 100644
--- a/gdb/riscv-tdep.h
+++ b/gdb/riscv-tdep.h
@@ -76,7 +76,7 @@ enum
 };
 
 /* RISC-V specific per-architecture information.  */
-struct riscv_gdbarch_tdep : gdbarch_tdep
+struct riscv_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Features about the target hardware that impact how the gdbarch is
      configured.  Two gdbarch instances are compatible only if this field
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index 2462e7a191d..be668bfa6fe 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -210,7 +210,7 @@ enum
 
 /* Architecture specific data.  */
 
-struct rl78_gdbarch_tdep : gdbarch_tdep
+struct rl78_gdbarch_tdep : gdbarch_tdep_base
 {
   /* The ELF header flags specify the multilib used.  */
   int elf_flags = 0;
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index c67d4057195..989d90096bd 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -69,7 +69,7 @@ enum rx_frame_type {
 };
 
 /* Architecture specific data.  */
-struct rx_gdbarch_tdep : gdbarch_tdep
+struct rx_gdbarch_tdep : gdbarch_tdep_base
 {
   /* The ELF header flags specify the multilib used.  */
   int elf_flags = 0;
diff --git a/gdb/s12z-tdep.c b/gdb/s12z-tdep.c
index 4e33faaea9a..5e49c615f1b 100644
--- a/gdb/s12z-tdep.c
+++ b/gdb/s12z-tdep.c
@@ -458,7 +458,7 @@ constexpr gdb_byte s12z_break_insn[] = {0x00};
 
 typedef BP_MANIPULATION (s12z_break_insn) s12z_breakpoint;
 
-struct s12z_gdbarch_tdep : gdbarch_tdep
+struct s12z_gdbarch_tdep : gdbarch_tdep_base
 {
 };
 
diff --git a/gdb/s390-tdep.h b/gdb/s390-tdep.h
index ac08da1c7c8..f51423cb018 100644
--- a/gdb/s390-tdep.h
+++ b/gdb/s390-tdep.h
@@ -38,7 +38,7 @@ enum s390_vector_abi_kind
 
 /* The tdep structure.  */
 
-struct s390_gdbarch_tdep : gdbarch_tdep
+struct s390_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Target description.  */
   const struct target_desc *tdesc = nullptr;
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
index bc0383fb075..54aa7ff828f 100644
--- a/gdb/sh-tdep.h
+++ b/gdb/sh-tdep.h
@@ -91,7 +91,7 @@ struct sh_corefile_regmap
   unsigned int offset;
 };
 
-struct sh_gdbarch_tdep : gdbarch_tdep
+struct sh_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Non-NULL when debugging from a core file.  Provides the offset
      where each general-purpose register is stored inside the associated
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index 36ff5349a0a..f2070f10e12 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -57,7 +57,7 @@ struct sparc_fpregmap
 
 /* SPARC architecture-specific information.  */
 
-struct sparc_gdbarch_tdep : gdbarch_tdep
+struct sparc_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Register numbers for the PN and nPC registers.  The definitions
      for (64-bit) UltraSPARC differ from the (32-bit) SPARC
diff --git a/gdb/tic6x-tdep.h b/gdb/tic6x-tdep.h
index d9b9644f8df..ebfd6e686fa 100644
--- a/gdb/tic6x-tdep.h
+++ b/gdb/tic6x-tdep.h
@@ -46,7 +46,7 @@ extern const gdb_byte tic6x_bkpt_illegal_opcode_be[];
 extern const gdb_byte tic6x_bkpt_illegal_opcode_le[];
 
 /* Target-dependent structure in gdbarch.  */
-struct tic6x_gdbarch_tdep : gdbarch_tdep
+struct tic6x_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Return the expected next PC if FRAME is stopped at a syscall
      instruction.  */
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 4de5faa6a47..f7094e37a92 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -265,7 +265,7 @@ enum v850_abi
 
 /* Architecture specific data.  */
 
-struct v850_gdbarch_tdep : gdbarch_tdep
+struct v850_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Fields from the ELF header.  */
   int e_flags = 0;
diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index 1840ef98b49..da7a7080afd 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -167,7 +167,7 @@ struct ctype_cache
 
 /*  Xtensa-specific target dependencies.  */
 
-struct xtensa_gdbarch_tdep : gdbarch_tdep
+struct xtensa_gdbarch_tdep : gdbarch_tdep_base
 {
   xtensa_gdbarch_tdep (xtensa_register_t *regmap)
     : regmap (regmap)
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index 6a11883e7b4..1ab375c5014 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -55,7 +55,7 @@
      next frame - frame of caller, which has called current function
 */
 
-struct z80_gdbarch_tdep : gdbarch_tdep
+struct z80_gdbarch_tdep : gdbarch_tdep_base
 {
   /* Number of bytes used for address:
       2 bytes for all Z80 family



More information about the Gdb-patches mailing list