[PATCH 11/14] ODR warnings for "struct insn_info"

Tom Tromey tromey@adacore.com
Wed May 18 18:00:46 GMT 2022


"struct insn_info" is defined in multiple .c files, causing ODR
warnings.  This patch renames the type in z80-tdep.c, leaving the
other one alone.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
---
 gdb/z80-tdep.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index 0b282237c4a..d27e567c358 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -139,7 +139,7 @@ enum z80_instruction_type
   insn_force_nop /* invalid opcode prefix */
 };
 
-struct insn_info
+struct z80_insn_info
 {
   gdb_byte code;
   gdb_byte mask;
@@ -149,7 +149,7 @@ struct insn_info
 
 /* Constants */
 
-static const struct insn_info *
+static const struct z80_insn_info *
 z80_get_insn_info (struct gdbarch *gdbarch, const gdb_byte *buf, int *size);
 
 static const char *z80_reg_names[] =
@@ -776,7 +776,7 @@ z80_software_single_step (struct regcache *regcache)
   ULONGEST addr;
   int opcode;
   int size;
-  const struct insn_info *info;
+  const struct z80_insn_info *info;
   std::vector<CORE_ADDR> ret (1);
   struct gdbarch *gdbarch = target_gdbarch ();
 
@@ -1007,7 +1007,7 @@ z80_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
   gdb_byte buf[8];
   int size;
-  const struct insn_info *info;
+  const struct z80_insn_info *info;
   read_memory (addr, buf, sizeof(buf));
   info = z80_get_insn_info (gdbarch, buf, &size);
   if (info)
@@ -1027,7 +1027,7 @@ z80_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
   gdb_byte buf[8];
   int size;
-  const struct insn_info *info;
+  const struct z80_insn_info *info;
   read_memory (addr, buf, sizeof(buf));
   info = z80_get_insn_info (gdbarch, buf, &size);
   if (info)
@@ -1046,7 +1046,7 @@ z80_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
   gdb_byte buf[8];
   int size;
-  const struct insn_info *info;
+  const struct z80_insn_info *info;
   read_memory (addr, buf, sizeof(buf));
   info = z80_get_insn_info (gdbarch, buf, &size);
   if (info)
@@ -1190,7 +1190,7 @@ z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 }
 
 /* Table to disassemble machine codes without prefix.  */
-static const struct insn_info
+static const struct z80_insn_info
 ez80_main_insn_table[] =
 { /* table with double prefix check */
   { 0100, 0377, 0, insn_force_nop}, //double prefix
@@ -1237,7 +1237,7 @@ ez80_main_insn_table[] =
   { 0000, 0000, 1, insn_default  }  //others
 } ;
 
-static const struct insn_info
+static const struct z80_insn_info
 ez80_adl_main_insn_table[] =
 { /* table with double prefix check */
   { 0100, 0377, 0, insn_force_nop}, //double prefix
@@ -1286,7 +1286,7 @@ ez80_adl_main_insn_table[] =
 /* ED prefix opcodes table.
    Note the instruction length does include the ED prefix (+ 1 byte)
 */
-static const struct insn_info
+static const struct z80_insn_info
 ez80_ed_insn_table[] =
 {
   /* eZ80 only instructions */
@@ -1306,7 +1306,7 @@ ez80_ed_insn_table[] =
   { 0000, 0000, 1, insn_default    }
 };
 
-static const struct insn_info
+static const struct z80_insn_info
 ez80_adl_ed_insn_table[] =
 {
   { 0002, 0366, 2, insn_default }, //"lea rr,ii+d"
@@ -1324,7 +1324,7 @@ ez80_adl_ed_insn_table[] =
 };
 
 /* table for FD and DD prefixed instructions */
-static const struct insn_info
+static const struct z80_insn_info
 ez80_ddfd_insn_table[] =
 {
   /* ez80 only instructions */
@@ -1355,7 +1355,7 @@ ez80_ddfd_insn_table[] =
   { 0000, 0000, 0, insn_default }  //not an instruction, exec DD/FD as NOP
 };
 
-static const struct insn_info
+static const struct z80_insn_info
 ez80_adl_ddfd_insn_table[] =
 {
   { 0007, 0307, 2, insn_default }, //"ld rr,(ii+d)"
@@ -1386,11 +1386,11 @@ ez80_adl_ddfd_insn_table[] =
 
 /* Return pointer to instruction information structure corresponded to opcode
    in buf.  */
-static const struct insn_info *
+static const struct z80_insn_info *
 z80_get_insn_info (struct gdbarch *gdbarch, const gdb_byte *buf, int *size)
 {
   int code;
-  const struct insn_info *info;
+  const struct z80_insn_info *info;
   unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
   *size = 0;
   switch (mach)
-- 
2.34.1



More information about the Gdb-patches mailing list