Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 08/12] [gdb] Convert anonymous struct typedefs
Date: Tue, 16 Jun 2026 08:22:53 +0200	[thread overview]
Message-ID: <20260616062257.3164438-9-tdevries@suse.de> (raw)
In-Reply-To: <20260616062257.3164438-1-tdevries@suse.de>

Convert "typedef struct { ... } foo" into "struct foo { ... }".

Generated by a script written by Claude Code.
---
 gdb/arch/xtensa.h              |  4 ++--
 gdb/arm-linux-nat.c            |  4 ++--
 gdb/frv-linux-tdep.c           |  4 ++--
 gdb/go32-nat.c                 | 14 ++++++--------
 gdb/mn10300-linux-tdep.c       |  4 ++--
 gdb/nat/glibc_thread_db.h      | 24 ++++++++++++------------
 gdb/stubs/sh-stub.c            | 10 ++++------
 gdb/xtensa-tdep.h              | 12 ++++++------
 gdb/xtensa-xtregs.c            |  4 ++--
 gdbserver/linux-arm-low.cc     |  4 ++--
 gdbserver/linux-low.cc         |  8 ++++----
 gdbserver/xtensa-xtregs.cc     |  4 ++--
 gdbsupport/common-exceptions.h |  4 ++--
 gdbsupport/gdb_proc_service.h  |  4 ++--
 14 files changed, 50 insertions(+), 54 deletions(-)

diff --git a/gdb/arch/xtensa.h b/gdb/arch/xtensa.h
index 079a4515fef..711911f6c21 100644
--- a/gdb/arch/xtensa.h
+++ b/gdb/arch/xtensa.h
@@ -25,7 +25,7 @@
 
 using xtensa_elf_greg_t = uint32_t;
 
-typedef struct
+struct xtensa_elf_gregset_t
 {
   xtensa_elf_greg_t pc;
   xtensa_elf_greg_t ps;
@@ -38,7 +38,7 @@ typedef struct
   xtensa_elf_greg_t threadptr;
   xtensa_elf_greg_t reserved[7+48];
   xtensa_elf_greg_t ar[64];
-} xtensa_elf_gregset_t;
+};
 
 #define XTENSA_ELF_NGREG (sizeof (xtensa_elf_gregset_t) \
 			  / sizeof (xtensa_elf_greg_t))
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 8f31e2bc56a..05da1a8bf69 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -687,13 +687,13 @@ arm_linux_nat_target::can_use_hw_breakpoint (enum bptype type,
 }
 
 /* Enum describing the different types of ARM hardware break-/watch-points.  */
-typedef enum
+enum arm_hwbp_type
 {
   arm_hwbp_break = 0,
   arm_hwbp_load = 1,
   arm_hwbp_store = 2,
   arm_hwbp_access = 3
-} arm_hwbp_type;
+};
 
 /* Type describing an ARM Hardware Breakpoint Control register value.  */
 using arm_hwbp_control_t = unsigned int;
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index 66f434ed8b7..956990824cf 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -350,7 +350,7 @@ using frv_elf_greg_t = unsigned char[4];
 using frv_elf_gregset_t = struct { frv_elf_greg_t reg[FRV_ELF_NGREG]; };
 
 using frv_elf_fpreg_t = unsigned char[4];
-typedef struct
+struct frv_elf_fpregset_t
 {
   frv_elf_fpreg_t fr[64];
   frv_elf_fpreg_t fner[2];
@@ -358,7 +358,7 @@ typedef struct
   frv_elf_fpreg_t acc[8];
   unsigned char accg[8];
   frv_elf_fpreg_t fsr[1];
-} frv_elf_fpregset_t;
+};
 
 /* Register maps.  */
 
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index eeaff9d8117..275dd5576ea 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -120,7 +120,7 @@
 #if __DJGPP_MINOR__ < 3
 /* This code will be provided from DJGPP 2.03 on.  Until then I code it
    here.  */
-typedef struct
+struct NPXREG
   {
     unsigned short sig0;
     unsigned short sig1;
@@ -128,10 +128,9 @@ typedef struct
     unsigned short sig3;
     unsigned short exponent:15;
     unsigned short sign:1;
-  }
-NPXREG;
+  };
 
-typedef struct
+struct NPX
   {
     unsigned int control;
     unsigned int status;
@@ -141,8 +140,7 @@ typedef struct
     unsigned int dataptr;
     unsigned int datasel;
     NPXREG reg[8];
-  }
-NPX;
+  };
 
 static NPX npx;
 
@@ -183,10 +181,10 @@ load_npx (void)
 }
 /* ------------------------------------------------------------------------- */
 /* Stubs for the missing redirection functions.  */
-typedef struct {
+struct cmdline_t {
   char *command;
   int redirected;
-} cmdline_t;
+};
 
 void
 redir_cmdline_delete (cmdline_t *ptr)
diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
index 95e3b123ce3..4ec236b2e5d 100644
--- a/gdb/mn10300-linux-tdep.c
+++ b/gdb/mn10300-linux-tdep.c
@@ -40,11 +40,11 @@ using mn10300_elf_greg_t = gdb_byte  [4];
 using mn10300_elf_gregset_t = mn10300_elf_greg_t[MN10300_ELF_NGREG];
 
 using mn10300_elf_fpreg_t = gdb_byte  [4];
-typedef struct
+struct mn10300_elf_fpregset_t
 {
   mn10300_elf_fpreg_t fpregs[MN10300_ELF_NFPREG];
   gdb_byte    fpcr[4];
-} mn10300_elf_fpregset_t;
+};
 
 /* elf_gregset_t register indices stolen from include/asm-mn10300/ptrace.h.  */
 #define MN10300_ELF_GREGSET_T_REG_INDEX_A3	0
diff --git a/gdb/nat/glibc_thread_db.h b/gdb/nat/glibc_thread_db.h
index fc5e7db12da..0831537146c 100644
--- a/gdb/nat/glibc_thread_db.h
+++ b/gdb/nat/glibc_thread_db.h
@@ -29,7 +29,7 @@
 
 
 /* Error codes of the library.  */
-typedef enum
+enum td_err_e
 {
   TD_OK,	  /* No error.  */
   TD_ERR,	  /* No further specified error.  */
@@ -56,12 +56,12 @@ typedef enum
   TD_NOTALLOC = TD_TLSDEFER,
   TD_VERSION,	  /* Version if libpthread and libthread_db do not match.  */
   TD_NOTLS	  /* There is no TLS segment in the given module.  */
-} td_err_e;
+};
 
 
 /* Possible thread states.  TD_THR_ANY_STATE is a pseudo-state used to
    select threads regardless of state in td_ta_thr_iter().  */
-typedef enum
+enum td_thr_state_e
 {
   TD_THR_ANY_STATE,
   TD_THR_UNKNOWN,
@@ -71,16 +71,16 @@ typedef enum
   TD_THR_ZOMBIE,
   TD_THR_SLEEP,
   TD_THR_STOPPED_ASLEEP
-} td_thr_state_e;
+};
 
 /* Thread type: user or system.  TD_THR_ANY_TYPE is a pseudo-type used
    to select threads regardless of type in td_ta_thr_iter().  */
-typedef enum
+enum td_thr_type_e
 {
   TD_THR_ANY_TYPE,
   TD_THR_USER,
   TD_THR_SYSTEM
-} td_thr_type_e;
+};
 
 
 /* Types of the debugging library.  */
@@ -151,7 +151,7 @@ typedef struct td_thr_events
 #endif
 
 /* Events reportable by the thread implementation.  */
-typedef enum
+enum td_event_e
 {
   TD_ALL_EVENTS,		 /* Pseudo-event number.  */
   TD_EVENT_NONE = TD_ALL_EVENTS, /* Depends on context.  */
@@ -172,16 +172,16 @@ typedef enum
   TD_MIN_EVENT_NUM = TD_READY,
   TD_MAX_EVENT_NUM = TD_TIMEOUT,
   TD_EVENTS_ENABLE = 31		/* Event reporting enabled.  */
-} td_event_e;
+};
 
 /* Values representing the different ways events are reported.  */
-typedef enum
+enum td_notify_e
 {
   NOTIFY_BPT,			/* User must insert breakpoint at u.bptaddr. */
   NOTIFY_AUTOBPT,		/* Breakpoint at u.bptaddr is automatically
 				   inserted.  */
   NOTIFY_SYSCALL		/* System call u.syscallno will be invoked.  */
-} td_notify_e;
+};
 
 /* Description how event type is reported.  */
 typedef struct td_notify
@@ -209,12 +209,12 @@ typedef struct td_event_msg
 } td_event_msg_t;
 
 /* Structure containing event data available in each thread structure.  */
-typedef struct
+struct td_eventbuf_t
 {
   td_thr_events_t eventmask;	/* Mask of enabled events.  */
   td_event_e eventnum;		/* Number of last event.  */
   void *eventdata;		/* Data associated with event.  */
-} td_eventbuf_t;
+};
 
 
 /* Gathered statistics about the process.  */
diff --git a/gdb/stubs/sh-stub.c b/gdb/stubs/sh-stub.c
index 88509a85d78..0f8d3c7e124 100644
--- a/gdb/stubs/sh-stub.c
+++ b/gdb/stubs/sh-stub.c
@@ -266,12 +266,11 @@ enum regnames
     TICKS, STALLS, CYCLES, INSTS, PLR
   };
 
-typedef struct
+struct stepData
   {
     short *memAddr;
     short oldInstr;
-  }
-stepData;
+  };
 
 int registers[NUMREGBYTES / 4];
 stepData instrBuffer;
@@ -841,15 +840,14 @@ breakpoint (void)
 
 /* SH1/SH2 exception vector table format */
 
-typedef struct
+struct vec_type
   {
     void (*func_cold) ();
     int *stack_cold;
     void (*func_warm) ();
     int *stack_warm;
     void (*(handler[256 - 4])) ();
-  }
-vec_type;
+  };
 
 /* vectable is the SH1/SH2 vector table. It must be at address 0
    or wherever your vbr points. */
diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index 6733eee0263..ad71c6685e8 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -89,23 +89,23 @@ enum xtensa_target_flags_t
 
 /*  Mask.  */
 
-typedef struct
+struct xtensa_reg_mask_t
 {
   int reg_num;
   int bit_start;
   int bit_size;
-} xtensa_reg_mask_t;
+};
 
-typedef struct
+struct xtensa_mask_t
 {
   int count;
   xtensa_reg_mask_t *mask;
-} xtensa_mask_t;
+};
 
 
 /*  Xtensa register representation.  */
 
-typedef struct
+struct xtensa_register_t
 {
   const char *name;            	/* Register name.  */
   int offset;             	/* Offset.  */
@@ -124,7 +124,7 @@ typedef struct
   const xtensa_mask_t *mask;	/* Register is a compilation of other regs.  */
   const char *fetch;		/* Instruction sequence to fetch register.  */
   const char *store;		/* Instruction sequence to store register.  */
-} xtensa_register_t;
+};
 
 /*  For xtensa-config.c to expand to the structure above.  */
 #define XTREG(index,ofs,bsz,sz,al,tnum,flg,cp,ty,gr,name,fet,sto,mas,ct,x,y) \
diff --git a/gdb/xtensa-xtregs.c b/gdb/xtensa-xtregs.c
index 23e153f9ddb..fc0f7d55dbb 100644
--- a/gdb/xtensa-xtregs.c
+++ b/gdb/xtensa-xtregs.c
@@ -17,7 +17,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-typedef struct
+struct xtensa_regtable_t
 {
   int gdb_regnum;
   int gdb_offset;
@@ -27,7 +27,7 @@ typedef struct
   int coproc;
   int dbnum;
   const char *name;
-} xtensa_regtable_t;
+};
 
 #define XTENSA_ELF_XTREG_SIZE 4
 
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index c0705588d60..34492c979f1 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -175,13 +175,13 @@ static struct
 } arm_linux_hwbp_cap;
 
 /* Enum describing the different types of ARM hardware break-/watch-points.  */
-typedef enum
+enum arm_hwbp_type
 {
   arm_hwbp_break = 0,
   arm_hwbp_load = 1,
   arm_hwbp_store = 2,
   arm_hwbp_access = 3
-} arm_hwbp_type;
+};
 
 /* Type describing an ARM Hardware Breakpoint Control register value.  */
 using arm_hwbp_control_t = unsigned int;
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index ade5e9e2a1c..b9a92bac533 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -104,7 +104,7 @@
 
 #ifndef HAVE_ELF32_AUXV_T
 /* Copied from glibc's elf.h.  */
-typedef struct
+struct Elf32_auxv_t
 {
   uint32_t a_type;		/* Entry type */
   union
@@ -114,12 +114,12 @@ typedef struct
 	 though, since it does not work when using 32-bit definitions
 	 on 64-bit platforms and vice versa.  */
     } a_un;
-} Elf32_auxv_t;
+};
 #endif
 
 #ifndef HAVE_ELF64_AUXV_T
 /* Copied from glibc's elf.h.  */
-typedef struct
+struct Elf64_auxv_t
 {
   uint64_t a_type;		/* Entry type */
   union
@@ -129,7 +129,7 @@ typedef struct
 	 though, since it does not work when using 32-bit definitions
 	 on 64-bit platforms and vice versa.  */
     } a_un;
-} Elf64_auxv_t;
+};
 #endif
 
 /* See nat/linux-nat.h.  */
diff --git a/gdbserver/xtensa-xtregs.cc b/gdbserver/xtensa-xtregs.cc
index 87df8bfbdea..1d138186fd4 100644
--- a/gdbserver/xtensa-xtregs.cc
+++ b/gdbserver/xtensa-xtregs.cc
@@ -17,7 +17,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-typedef struct {
+struct xtensa_regtable_t {
   int   gdb_regnum;
   int   gdb_offset;
   int   ptrace_cp_offset;
@@ -26,7 +26,7 @@ typedef struct {
   int   coproc;
   int   dbnum;
   char* name
-;} xtensa_regtable_t;
+;};
 
 #define XTENSA_ELF_XTREG_SIZE	4
 
diff --git a/gdbsupport/common-exceptions.h b/gdbsupport/common-exceptions.h
index 1f3bc84216e..f510825d49f 100644
--- a/gdbsupport/common-exceptions.h
+++ b/gdbsupport/common-exceptions.h
@@ -44,13 +44,13 @@ enum return_reason
 
 #define RETURN_MASK(reason)	(1 << (int)(-reason))
 
-typedef enum
+enum return_mask
 {
   RETURN_MASK_FORCED_QUIT = RETURN_MASK (RETURN_FORCED_QUIT),
   RETURN_MASK_QUIT = RETURN_MASK (RETURN_QUIT),
   RETURN_MASK_ERROR = RETURN_MASK (RETURN_ERROR),
   RETURN_MASK_ALL = (RETURN_MASK_FORCED_QUIT | RETURN_MASK_QUIT | RETURN_MASK_ERROR)
-} return_mask;
+};
 
 /* Describe all exceptions.  */
 
diff --git a/gdbsupport/gdb_proc_service.h b/gdbsupport/gdb_proc_service.h
index c7a240306b5..6bac4aaea06 100644
--- a/gdbsupport/gdb_proc_service.h
+++ b/gdbsupport/gdb_proc_service.h
@@ -72,7 +72,7 @@ extern "C" {
 extern "C" {
 
 /* Functions in this interface return one of these status codes.  */
-typedef enum
+enum ps_err_e
 {
   PS_OK,		/* Generic "call succeeded".  */
   PS_ERR,		/* Generic error.  */
@@ -81,7 +81,7 @@ typedef enum
   PS_BADADDR,		/* Bad address.  */
   PS_NOSYM,		/* Could not find given symbol.  */
   PS_NOFREGS		/* FPU register set not available for given LWP.  */
-} ps_err_e;
+};
 
 #ifndef HAVE_LWPID_T
 using lwpid_t = unsigned int;
-- 
2.51.0


  parent reply	other threads:[~2026-06-16  7:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16  6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
2026-06-16  6:22 ` [PATCH 01/12] [gdb] Use using instead of typedef some more (part 1) Tom de Vries
2026-06-26 15:40   ` Tom Tromey
2026-06-16  6:22 ` [PATCH 02/12] [gdb] Use using instead of typedef some more (part 2) Tom de Vries
2026-06-16  6:22 ` [PATCH 03/12] [gdb] Use using instead of typedef some more (part 3) Tom de Vries
2026-06-26 15:49   ` Tom Tromey
2026-06-16  6:22 ` [PATCH 04/12] [gdb] Convert function pointer typedefs to using Tom de Vries
2026-06-16  6:22 ` [PATCH 05/12] [gdb] Convert template " Tom de Vries
2026-06-16  6:22 ` [PATCH 06/12] [gdb] Convert function " Tom de Vries
2026-06-16  6:22 ` [PATCH 07/12] [gdb] Fix redundant struct typedefs Tom de Vries
2026-06-16  6:22 ` Tom de Vries [this message]
2026-06-16  6:22 ` [PATCH 09/12] [gdb] Convert typedef of named struct Tom de Vries
2026-06-26 16:04   ` Tom Tromey
2026-06-16  6:22 ` [PATCH 10/12] [gdb] convert struct pointer typedefs Tom de Vries
2026-06-16  6:22 ` [PATCH 11/12] [gdb] Convert typedef on separate line Tom de Vries
2026-06-16  6:22 ` [PATCH 12/12] [gdb] Use using in compat_x32_clock_t typedef Tom de Vries
2026-06-26 16:05 ` [PATCH 00/12] [gdb] Use using instead of typedef some more Tom Tromey
2026-07-13 13:07   ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260616062257.3164438-9-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox