From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 09/12] [gdb] Convert typedef of named struct
Date: Tue, 16 Jun 2026 08:22:54 +0200 [thread overview]
Message-ID: <20260616062257.3164438-10-tdevries@suse.de> (raw)
In-Reply-To: <20260616062257.3164438-1-tdevries@suse.de>
Convert "typedef struct foo { ... } bar" to "using bar = struct foo { ...}".
Generated by a script written by Claude Code.
---
gdb/guile/scm-breakpoint.c | 4 ++--
gdb/nat/aarch64-linux.h | 8 ++++----
gdb/nat/glibc_thread_db.h | 24 ++++++++++++------------
gdb/stubs/m68k-stub.c | 4 ++--
gdb/windows-tdep.c | 10 ++++------
gdb/xtensa-tdep.c | 16 ++++++++--------
6 files changed, 32 insertions(+), 34 deletions(-)
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index 62256ee53bf..5df2c00f5d3 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -42,7 +42,7 @@
any side-effects. This means that the smob needs to store everything
that was passed to make-breakpoint. */
-typedef struct gdbscm_breakpoint_object
+using breakpoint_smob = struct gdbscm_breakpoint_object
{
/* This always appears first. */
gdb_smob base;
@@ -90,7 +90,7 @@ typedef struct gdbscm_breakpoint_object
/* A stop condition or #f. */
SCM stop;
-} breakpoint_smob;
+};
static const char breakpoint_smob_name[] = "gdb:breakpoint";
diff --git a/gdb/nat/aarch64-linux.h b/gdb/nat/aarch64-linux.h
index 5f699e1f351..67107855d7a 100644
--- a/gdb/nat/aarch64-linux.h
+++ b/gdb/nat/aarch64-linux.h
@@ -37,13 +37,13 @@ struct compat_timeval
int tv_usec;
};
-typedef union compat_sigval
+using compat_sigval_t = union compat_sigval
{
compat_int_t sival_int;
compat_uptr_t sival_ptr;
-} compat_sigval_t;
+};
-typedef struct compat_siginfo
+using compat_siginfo_t = struct compat_siginfo
{
int si_signo;
int si_errno;
@@ -99,7 +99,7 @@ typedef struct compat_siginfo
int _fd;
} _sigpoll;
} _sifields;
-} compat_siginfo_t;
+};
#define cpt_si_pid _sifields._kill._pid
#define cpt_si_uid _sifields._kill._uid
diff --git a/gdb/nat/glibc_thread_db.h b/gdb/nat/glibc_thread_db.h
index 0831537146c..6695bf599e2 100644
--- a/gdb/nat/glibc_thread_db.h
+++ b/gdb/nat/glibc_thread_db.h
@@ -89,11 +89,11 @@ enum td_thr_type_e
using td_thragent_t = struct td_thragent;
/* The actual thread handle type. This is also opaque. */
-typedef struct td_thrhandle
+using td_thrhandle_t = struct td_thrhandle
{
td_thragent_t *th_ta_p;
psaddr_t th_unique;
-} td_thrhandle_t;
+};
/* Forward declaration of a type defined by and for the dynamic linker. */
@@ -112,10 +112,10 @@ struct link_map;
#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */
/* Bitmask of enabled events. */
-typedef struct td_thr_events
+using td_thr_events_t = struct td_thr_events
{
uint32_t event_bits[TD_EVENTSIZE];
-} td_thr_events_t;
+};
/* Event set manipulation macros. */
#define __td_eventmask(n) \
@@ -184,7 +184,7 @@ enum td_notify_e
};
/* Description how event type is reported. */
-typedef struct td_notify
+using td_notify_t = struct td_notify
{
td_notify_e type; /* Way the event is reported. */
union
@@ -192,10 +192,10 @@ typedef struct td_notify
psaddr_t bptaddr; /* Address of breakpoint. */
int syscallno; /* Number of system call used. */
} u;
-} td_notify_t;
+};
/* Structure used to report event. */
-typedef struct td_event_msg
+using td_event_msg_t = struct td_event_msg
{
td_event_e event; /* Event type being reported. */
const td_thrhandle_t *th_p; /* Thread reporting the event. */
@@ -206,7 +206,7 @@ typedef struct td_event_msg
#endif
uintptr_t data; /* Event specific data. */
} msg;
-} td_event_msg_t;
+};
/* Structure containing event data available in each thread structure. */
struct td_eventbuf_t
@@ -218,7 +218,7 @@ struct td_eventbuf_t
/* Gathered statistics about the process. */
-typedef struct td_ta_stats
+using td_ta_stats_t = struct td_ta_stats
{
int nthreads; /* Total number of threads in use. */
int r_concurrency; /* Concurrency level requested by user. */
@@ -234,7 +234,7 @@ typedef struct td_ta_stats
numerator. */
int nidle_den; /* Average number of idling processes,
denominator. */
-} td_ta_stats_t;
+};
/* Since Sun's library is based on Solaris threads we have to define a few
@@ -256,7 +256,7 @@ struct ps_prochandle;
/* Information about the thread. */
-typedef struct td_thrinfo
+using td_thrinfo_t = struct td_thrinfo
{
td_thragent_t *ti_ta_p; /* Process handle. */
unsigned int ti_user_flags; /* Unused. */
@@ -285,7 +285,7 @@ typedef struct td_thrinfo
unsigned char ti_pirecflag; /* Unused. */
sigset_t ti_pending; /* Set of pending signals. */
td_thr_events_t ti_events; /* Set of enabled events. */
-} td_thrinfo_t;
+};
diff --git a/gdb/stubs/m68k-stub.c b/gdb/stubs/m68k-stub.c
index 57437dd04f7..b0a36a17142 100644
--- a/gdb/stubs/m68k-stub.c
+++ b/gdb/stubs/m68k-stub.c
@@ -159,7 +159,7 @@ enum regnames {D0,D1,D2,D3,D4,D5,D6,D7,
other registers. This should not be a performance problem if the
ability to read individual registers is added to the protocol. */
-typedef struct FrameStruct
+using Frame = struct FrameStruct
{
struct FrameStruct *previous;
int exceptionPC; /* pc value when this frame created */
@@ -170,7 +170,7 @@ typedef struct FrameStruct
short format;
int fsaveHeader;
int morejunk[0]; /* exception frame, fp save... */
-} Frame;
+};
#define FRAMESIZE 500
int gdbFrameStack[FRAMESIZE];
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 78bf49b9c81..c0a743914b1 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -110,7 +110,7 @@ static constexpr unsigned int NOTE_INFO_MODULE64 = 4;
struct cmd_list_element *info_w32_cmdlist;
-typedef struct thread_information_block_32
+using thread_information_32 = struct thread_information_block_32
{
uint32_t current_seh; /* %fs:0x0000 */
uint32_t current_top_of_stack; /* %fs:0x0004 */
@@ -126,10 +126,9 @@ typedef struct thread_information_block_32
uint32_t thread_local_storage; /* %fs:0x002c */
uint32_t process_environment_block; /* %fs:0x0030 */
uint32_t last_error_number; /* %fs:0x0034 */
- }
-thread_information_32;
+ };
-typedef struct thread_information_block_64
+using thread_information_64 = struct thread_information_block_64
{
uint64_t current_seh; /* %gs:0x0000 */
uint64_t current_top_of_stack; /* %gs:0x0008 */
@@ -145,8 +144,7 @@ typedef struct thread_information_block_64
uint64_t thread_local_storage; /* %gs:0x0058 */
uint64_t process_environment_block; /* %gs:0x0060 */
uint64_t last_error_number; /* %gs:0x0068 */
- }
-thread_information_64;
+ };
static const char* TIB_NAME[] =
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 8641915e8aa..9af18a857ba 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -890,7 +890,7 @@ xtensa_iterate_over_regset_sections (struct gdbarch *gdbarch,
#define XTENSA_NUM_SAVED_AREGS 12
/* Frame cache part for Windowed ABI. */
-typedef struct xtensa_windowed_frame_cache
+using xtensa_windowed_frame_cache_t = struct xtensa_windowed_frame_cache
{
int wb; /* WINDOWBASE of the previous frame. */
int callsize; /* Call size of this frame. */
@@ -902,7 +902,7 @@ typedef struct xtensa_windowed_frame_cache
/* Addresses of spilled A-registers.
AREGS[i] == -1, if corresponding AR is alive. */
CORE_ADDR aregs[XTENSA_NUM_SAVED_AREGS];
-} xtensa_windowed_frame_cache_t;
+};
/* Call0 ABI Definitions. */
@@ -928,17 +928,17 @@ typedef struct xtensa_windowed_frame_cache
extern xtensa_isa xtensa_default_isa;
-typedef struct xtensa_c0reg
+using xtensa_c0reg_t = struct xtensa_c0reg
{
int fr_reg; /* original register from which register content
is derived, or C0_CONST, or C0_INEXP. */
int fr_ofs; /* constant offset from reg, or immediate value. */
int to_stk; /* offset from original SP to register (4-byte aligned),
or C0_NOSTK if register has not been saved. */
-} xtensa_c0reg_t;
+};
/* Frame cache part for Call0 ABI. */
-typedef struct xtensa_call0_frame_cache
+using xtensa_call0_frame_cache_t = struct xtensa_call0_frame_cache
{
int c0_frmsz; /* Stack frame size. */
int c0_hasfp; /* Current frame uses frame pointer. */
@@ -954,9 +954,9 @@ typedef struct xtensa_call0_frame_cache
stack offset. C0_NOSTK otherwise. */
xtensa_c0reg_t c0_rt[C0_NREGS]; /* Register tracking information. */
-} xtensa_call0_frame_cache_t;
+};
-typedef struct xtensa_frame_cache
+using xtensa_frame_cache_t = struct xtensa_frame_cache
{
CORE_ADDR base; /* Stack pointer of this frame. */
CORE_ADDR pc; /* PC of this frame at the function entry point. */
@@ -969,7 +969,7 @@ typedef struct xtensa_frame_cache
xtensa_windowed_frame_cache_t wd; /* call0 == false. */
xtensa_call0_frame_cache_t c0; /* call0 == true. */
};
-} xtensa_frame_cache_t;
+};
static struct xtensa_frame_cache *
--
2.51.0
next prev parent reply other threads:[~2026-06-16 6:24 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 ` [PATCH 08/12] [gdb] Convert anonymous " Tom de Vries
2026-06-16 6:22 ` Tom de Vries [this message]
2026-06-26 16:04 ` [PATCH 09/12] [gdb] Convert typedef of named struct 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-10-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