* [PATCH 01/12] [gdb] Use using instead of typedef some more (part 1)
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
@ 2026-06-16 6:22 ` 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
` (11 subsequent siblings)
12 siblings, 1 reply; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
Result of:
...
$ find gdb* -type f -name "*.[ch]" -o -name "*.cc" \
| egrep -v /testsuite/ \
| xargs sed -i \
's/^\([ \t]*\)typedef \([a-zA-Z_0-9:<>,.() ]*\) \([a-zA-Z_0-9]*\)\(\[.*\]\);/\1using \3 = \2\4;/'
$ find gdb* -type f -name "*.[ch]" -o -name "*.cc" \
| egrep -v /testsuite/ \
| xargs sed -i \
's/^\([ \t]*\)typedef \([a-zA-Z_0-9:<>,.()\* ]*\) \([a-zA-Z_0-9]*\);/\1using \3 = \2;/'
...
---
gdb/arc-linux-tdep.c | 2 +-
gdb/cris-tdep.c | 6 +++---
gdb/dwarf2/frame.c | 2 +-
gdb/frv-linux-tdep.c | 4 ++--
gdb/i386-sol2-nat.c | 2 +-
gdb/mips-linux-tdep.h | 16 ++++++++--------
gdb/mn10300-linux-tdep.c | 6 +++---
gdb/ppc-linux-nat.c | 4 ++--
gdb/remote.c | 2 +-
gdb/solib-dsbt.c | 8 ++++----
gdb/solib-frv.c | 8 ++++----
gdb/tui/tui-layout.h | 2 +-
gdb/tui/tui-winsource.h | 2 +-
gdbsupport/fileio.h | 12 ++++++------
14 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
index 572b39b27d4..51a7c4e1957 100644
--- a/gdb/arc-linux-tdep.c
+++ b/gdb/arc-linux-tdep.c
@@ -715,7 +715,7 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* If we are using Linux, we have in uClibc
(libc/sysdeps/linux/arc/bits/setjmp.h):
- typedef int __jmp_buf[13+1+1+1]; //r13-r25, fp, sp, blink
+ using __jmp_buf = int[13+1+1+1]; //r13-r25, fp, sp, blink
Where "blink" is a stored PC of a caller function.
*/
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 441032971cb..507f06e0aac 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -3750,14 +3750,14 @@ cris_gdb_func (struct gdbarch *gdbarch, enum cris_op_type op_type,
}
/* Originally from <asm/elf.h>. */
-typedef unsigned char cris_elf_greg_t[4];
+using cris_elf_greg_t = unsigned char[4];
/* Same as user_regs_struct struct in <asm/user.h>. */
#define CRISV10_ELF_NGREG 35
-typedef cris_elf_greg_t cris_elf_gregset_t[CRISV10_ELF_NGREG];
+using cris_elf_gregset_t = cris_elf_greg_t[CRISV10_ELF_NGREG];
#define CRISV32_ELF_NGREG 32
-typedef cris_elf_greg_t crisv32_elf_gregset_t[CRISV32_ELF_NGREG];
+using crisv32_elf_gregset_t = cris_elf_greg_t[CRISV32_ELF_NGREG];
/* Unpack a cris_elf_gregset_t into GDB's register cache. */
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 5b9f41cd53a..6f0601a0146 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -136,7 +136,7 @@ struct dwarf2_fde
unsigned char eh_frame_p;
};
-typedef std::vector<dwarf2_fde *> dwarf2_fde_table;
+using dwarf2_fde_table = std::vector<dwarf2_fde *>;
/* A minimal decoding of DWARF2 compilation units. We only decode
what's needed to get to the call frame information. */
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index 3c68921136e..cd9d21c2f14 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -346,10 +346,10 @@ static const struct frame_unwind_legacy frv_linux_sigtramp_frame_unwind (
/* The FRV kernel defines ELF_NGREG as 46. We add 2 in order to include
the loadmap addresses in the register set. (See below for more info.) */
#define FRV_ELF_NGREG (46 + 2)
-typedef unsigned char frv_elf_greg_t[4];
+using frv_elf_greg_t = unsigned char[4];
typedef struct { frv_elf_greg_t reg[FRV_ELF_NGREG]; } frv_elf_gregset_t;
-typedef unsigned char frv_elf_fpreg_t[4];
+using frv_elf_fpreg_t = unsigned char[4];
typedef struct
{
frv_elf_fpreg_t fr[64];
diff --git a/gdb/i386-sol2-nat.c b/gdb/i386-sol2-nat.c
index 5b8b53e4605..b64ffef639b 100644
--- a/gdb/i386-sol2-nat.c
+++ b/gdb/i386-sol2-nat.c
@@ -137,7 +137,7 @@ fill_fpregset (const struct regcache *regcache,
different for each set of registers. For the i386 for example, the
general-purpose register set is typically defined by:
- typedef int gregset_t[19]; (in <sys/regset.h>)
+ using gregset_t = int[19]; (in <sys/regset.h>)
#define GS 0 (in <sys/reg.h>)
#define FS 1
diff --git a/gdb/mips-linux-tdep.h b/gdb/mips-linux-tdep.h
index 8ac1423fb3c..2ba961fde66 100644
--- a/gdb/mips-linux-tdep.h
+++ b/gdb/mips-linux-tdep.h
@@ -26,11 +26,11 @@
#define ELF_NGREG 45
#define ELF_NFPREG 33
-typedef unsigned char mips_elf_greg_t[4];
-typedef mips_elf_greg_t mips_elf_gregset_t[ELF_NGREG];
+using mips_elf_greg_t = unsigned char[4];
+using mips_elf_gregset_t = mips_elf_greg_t[ELF_NGREG];
-typedef unsigned char mips_elf_fpreg_t[8];
-typedef mips_elf_fpreg_t mips_elf_fpregset_t[ELF_NFPREG];
+using mips_elf_fpreg_t = unsigned char[8];
+using mips_elf_fpregset_t = mips_elf_fpreg_t[ELF_NFPREG];
/* 0 - 31 are integer registers, 32 - 63 are fp registers. */
#define FPR_BASE 32
@@ -64,11 +64,11 @@ void mips_fill_gregset (const struct regcache *, mips_elf_gregset_t *, int);
#define MIPS64_ELF_NGREG 45
#define MIPS64_ELF_NFPREG 33
-typedef unsigned char mips64_elf_greg_t[8];
-typedef mips64_elf_greg_t mips64_elf_gregset_t[MIPS64_ELF_NGREG];
+using mips64_elf_greg_t = unsigned char[8];
+using mips64_elf_gregset_t = mips64_elf_greg_t[MIPS64_ELF_NGREG];
-typedef unsigned char mips64_elf_fpreg_t[8];
-typedef mips64_elf_fpreg_t mips64_elf_fpregset_t[MIPS64_ELF_NFPREG];
+using mips64_elf_fpreg_t = unsigned char[8];
+using mips64_elf_fpregset_t = mips64_elf_fpreg_t[MIPS64_ELF_NFPREG];
/* 0 - 31 are integer registers, 32 - 63 are fp registers. */
#define MIPS64_FPR_BASE 32
diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
index cb795999e1f..95e3b123ce3 100644
--- a/gdb/mn10300-linux-tdep.c
+++ b/gdb/mn10300-linux-tdep.c
@@ -36,10 +36,10 @@
#define MN10300_ELF_NGREG 28
#define MN10300_ELF_NFPREG 32
-typedef gdb_byte mn10300_elf_greg_t[4];
-typedef mn10300_elf_greg_t mn10300_elf_gregset_t[MN10300_ELF_NGREG];
+using mn10300_elf_greg_t = gdb_byte [4];
+using mn10300_elf_gregset_t = mn10300_elf_greg_t[MN10300_ELF_NGREG];
-typedef gdb_byte mn10300_elf_fpreg_t[4];
+using mn10300_elf_fpreg_t = gdb_byte [4];
typedef struct
{
mn10300_elf_fpreg_t fpregs[MN10300_ELF_NFPREG];
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 48fde142d62..413e0e0ab97 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -189,7 +189,7 @@ Little-Endian:
VR0 VR31 VSCR VRSAVE
*/
-typedef char gdb_vrregset_t[PPC_LINUX_SIZEOF_VRREGSET];
+using gdb_vrregset_t = char[PPC_LINUX_SIZEOF_VRREGSET];
/* This is the layout of the POWER7 VSX registers and the way they overlap
with the existing FPR and VMX registers.
@@ -223,7 +223,7 @@ typedef char gdb_vrregset_t[PPC_LINUX_SIZEOF_VRREGSET];
the FP registers (doubleword 0) and hence extend them with additional
64 bits (doubleword 1). The other 32 regs overlap with the VMX
registers. */
-typedef char gdb_vsxregset_t[PPC_LINUX_SIZEOF_VSXREGSET];
+using gdb_vsxregset_t = char[PPC_LINUX_SIZEOF_VSXREGSET];
/* On PPC processors that support the Signal Processing Extension
(SPE) APU, the general-purpose registers are 64 bits long.
diff --git a/gdb/remote.c b/gdb/remote.c
index f8c7383cb03..1d51336cd96 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -99,7 +99,7 @@ bool remote_debug = false;
#define OPAQUETHREADBYTES 8
/* a 64 bit opaque identifier */
-typedef unsigned char threadref[OPAQUETHREADBYTES];
+using threadref = unsigned char[OPAQUETHREADBYTES];
struct gdb_ext_thread_info;
struct threads_listing_context;
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 052b170fd9a..d3a0cca5cb7 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -42,9 +42,9 @@ enum { TIC6X_PTR_SIZE = 4 };
/* External versions; the size and alignment of the fields should be
the same as those on the target. When loaded, the placement of
the bits in each field will be the same as on the target. */
-typedef gdb_byte ext_Elf32_Half[2];
-typedef gdb_byte ext_Elf32_Addr[4];
-typedef gdb_byte ext_Elf32_Word[4];
+using ext_Elf32_Half = gdb_byte[2];
+using ext_Elf32_Addr = gdb_byte[4];
+using ext_Elf32_Word = gdb_byte[4];
struct ext_elf32_dsbt_loadseg
{
@@ -99,7 +99,7 @@ struct int_elf32_dsbt_loadmap
/* External link_map and elf32_dsbt_loadaddr struct definitions. */
-typedef gdb_byte ext_ptr[4];
+using ext_ptr = gdb_byte[4];
struct ext_elf32_dsbt_loadaddr
{
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 4f0aac31e73..08ee0a9578f 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -57,9 +57,9 @@ enum { FRV_PTR_SIZE = 4 };
/* External versions; the size and alignment of the fields should be
the same as those on the target. When loaded, the placement of
the bits in each field will be the same as on the target. */
-typedef gdb_byte ext_Elf32_Half[2];
-typedef gdb_byte ext_Elf32_Addr[4];
-typedef gdb_byte ext_Elf32_Word[4];
+using ext_Elf32_Half = gdb_byte[2];
+using ext_Elf32_Addr = gdb_byte[4];
+using ext_Elf32_Word = gdb_byte[4];
struct ext_elf32_fdpic_loadseg
{
@@ -196,7 +196,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
/* External link_map and elf32_fdpic_loadaddr struct definitions. */
-typedef gdb_byte ext_ptr[4];
+using ext_ptr = gdb_byte[4];
struct ext_elf32_fdpic_loadaddr
{
diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h
index 0d39e0ffa48..06ded0dcca8 100644
--- a/gdb/tui/tui-layout.h
+++ b/gdb/tui/tui-layout.h
@@ -363,7 +363,7 @@ extern void tui_adjust_window_width (struct tui_win_info *win,
/* The type of a function that is used to create a TUI window. */
-typedef std::function<tui_win_info * (const char *name)> window_factory;
+using window_factory = std::function<tui_win_info * (const char *name)>;
/* The type for a data structure that maps a window name to that window's
factory function. */
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index 9f94a453749..3e6ad110d28 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -268,7 +268,7 @@ struct tui_source_window_iterator
{
public:
- typedef std::vector<tui_win_info *>::iterator inner_iterator;
+ using inner_iterator = std::vector<tui_win_info *>::iterator;
using self_type = tui_source_window_iterator;
using value_type = struct tui_source_window_base *;
diff --git a/gdbsupport/fileio.h b/gdbsupport/fileio.h
index bb70e404bba..c2592cf8c15 100644
--- a/gdbsupport/fileio.h
+++ b/gdbsupport/fileio.h
@@ -113,12 +113,12 @@ enum fileio_error
#define FIO_LONG_LEN 8
#define FIO_ULONG_LEN 8
-typedef char fio_int_t[FIO_INT_LEN];
-typedef char fio_uint_t[FIO_UINT_LEN];
-typedef char fio_mode_t[FIO_MODE_LEN];
-typedef char fio_time_t[FIO_TIME_LEN];
-typedef char fio_long_t[FIO_LONG_LEN];
-typedef char fio_ulong_t[FIO_ULONG_LEN];
+using fio_int_t = char[FIO_INT_LEN];
+using fio_uint_t = char[FIO_UINT_LEN];
+using fio_mode_t = char[FIO_MODE_LEN];
+using fio_time_t = char[FIO_TIME_LEN];
+using fio_long_t = char[FIO_LONG_LEN];
+using fio_ulong_t = char[FIO_ULONG_LEN];
/* Struct stat as used in protocol. For complete independence
of host/target systems, it's defined as an array with offsets
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 01/12] [gdb] Use using instead of typedef some more (part 1)
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
0 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2026-06-26 15:40 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
Tom> index 572b39b27d4..51a7c4e1957 100644
Tom> --- a/gdb/arc-linux-tdep.c
Tom> +++ b/gdb/arc-linux-tdep.c
Tom> @@ -715,7 +715,7 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
Tom> /* If we are using Linux, we have in uClibc
Tom> (libc/sysdeps/linux/arc/bits/setjmp.h):
Tom> - typedef int __jmp_buf[13+1+1+1]; //r13-r25, fp, sp, blink
Tom> + using __jmp_buf = int[13+1+1+1]; //r13-r25, fp, sp, blink
Tom> Where "blink" is a stored PC of a caller function.
Tom> */
This rewrite seems strange since it's a comment quoting a header that
does not actually say this.
Tom> diff --git a/gdb/i386-sol2-nat.c b/gdb/i386-sol2-nat.c
Tom> index 5b8b53e4605..b64ffef639b 100644
Tom> --- a/gdb/i386-sol2-nat.c
Tom> +++ b/gdb/i386-sol2-nat.c
Tom> @@ -137,7 +137,7 @@ fill_fpregset (const struct regcache *regcache,
Tom> different for each set of registers. For the i386 for example, the
Tom> general-purpose register set is typically defined by:
Tom> - typedef int gregset_t[19]; (in <sys/regset.h>)
Tom> + using gregset_t = int[19]; (in <sys/regset.h>)
Tom> #define GS 0 (in <sys/reg.h>)
Tom> #define FS 1
Likewise here.
Other than these this looks good to me though.
Tom
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 02/12] [gdb] Use using instead of typedef some more (part 2)
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-16 6:22 ` Tom de Vries
2026-06-16 6:22 ` [PATCH 03/12] [gdb] Use using instead of typedef some more (part 3) Tom de Vries
` (10 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
Result of:
...
$ find gdb* -type f -name "*.[ch]" -o -name "*.cc" \
| egrep -v /testsuite/ \
| xargs sed -i \
'/WINAPI/b l;s/^\([ \t]*\)typedef \([a-zA-Z_0-9:<>,.()\* ]*\) \([a-zA-Z_0-9]*\) \((.*)\);/\1using \3 = \2 \4;/;:l'
$ find gdb* -type f -name "*.[ch]" -o -name "*.cc" \
| egrep -v /testsuite/ \
| xargs sed -i \
'/WINAPI/b l;s/^\([ \t]*\)typedef \([a-zA-Z_0-9:<>,.()\* ]*\) (\([a-zA-Z_0-9]*\)) \((.*)\);/\1using \3 = \2 \4;/;:l'
$ find gdb* -type f -name "*.[ch]" -o -name "*.cc" \
| egrep -v /testsuite/ \
| xargs sed -i \
'/WINAPI/b l;s/^\([ \t]*\)typedef \([a-zA-Z_0-9:<>,.()\* ]*\) (\([a-zA-Z_0-9]*\))\((.*)\);/\1using \3 = \2 \4;/;:l'
$ find gdb* -type f -name "*.[ch]" -o -name "*.cc" \
| egrep -v /testsuite/ \
| xargs sed -i \
'/WINAPI/b l;s/^\([ \t]*\)typedef \([a-zA-Z_0-9:<>,.()\* ]*\) (\*\([a-zA-Z_0-9]*\)) \((.*)\);/\1using \3 = \2 (*) \4;/;:l'
...
and fixing up this incorrect rewrite:
...
-typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *);
+using void = int td_key_iter_f (thread_key_t, (*) (void *), void *);
...
---
gdb/ada-lang.c | 2 +-
gdb/arm-tdep.c | 2 +-
gdb/async-event.h | 4 ++--
gdb/cli/cli-option.h | 2 +-
gdb/command.h | 2 +-
gdb/completer.c | 2 +-
gdb/completer.h | 12 ++++++------
gdb/cp-support.h | 2 +-
gdb/dcache.c | 2 +-
gdb/dummy-frame.h | 2 +-
gdb/event-top.h | 4 ++--
gdb/fbsd-nat.c | 2 +-
gdb/frame-base.h | 2 +-
gdb/gdbarch.h | 6 +++---
gdb/gnu-nat.h | 2 +-
gdb/guile/guile-internal.h | 4 ++--
gdb/ia64-libunwind-tdep.c | 8 ++++----
gdb/inferior.h | 2 +-
gdb/jit.c | 2 +-
gdb/language.h | 2 +-
gdb/main.c | 2 +-
gdb/nat/gdb_thread_db.h | 8 ++++----
gdb/nat/glibc_thread_db.h | 4 ++--
gdb/nat/linux-procfs.h | 2 +-
gdb/registry.h | 2 +-
gdb/remote.c | 2 +-
gdb/selftest-arch.h | 2 +-
gdb/ser-go32.c | 2 +-
gdb/serial.h | 2 +-
gdb/sol-thread.c | 8 ++++----
gdb/stubs/sh-stub.c | 2 +-
gdb/target.h | 2 +-
gdb/unittests/function-view-selftests.c | 2 +-
gdb/windows-nat.h | 2 +-
gdbserver/linux-low.h | 4 ++--
gdbserver/tracepoint.cc | 8 ++++----
gdbsupport/event-loop.h | 4 ++--
gdbsupport/search.h | 2 +-
38 files changed, 63 insertions(+), 63 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 564e4d6194a..0b5bd47649e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -11641,7 +11641,7 @@ static const char * const standard_exc[] = {
"tasking_error"
};
-typedef CORE_ADDR (ada_unhandled_exception_name_addr_ftype) (void);
+using ada_unhandled_exception_name_addr_ftype = CORE_ADDR (void);
/* A structure that describes how to support exception catchpoints
for a given executable. */
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 13f45b8dfd5..0e428d5ec0d 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -14537,7 +14537,7 @@ class instruction_reader : public abstract_instruction_reader
} // namespace
-typedef int (*sti_arm_hdl_fp_t) (arm_insn_decode_record*);
+using sti_arm_hdl_fp_t = int (*) (arm_insn_decode_record*);
/* Decode arm/thumb insn depending on condition cods and opcodes; and
dispatch it. */
diff --git a/gdb/async-event.h b/gdb/async-event.h
index 5b75f8b215c..0cc0e1fefb7 100644
--- a/gdb/async-event.h
+++ b/gdb/async-event.h
@@ -23,7 +23,7 @@
struct async_signal_handler;
struct async_event_handler;
-typedef void (sig_handler_func) (gdb_client_data);
+using sig_handler_func = void (gdb_client_data);
/* Type of async event handler callbacks.
@@ -33,7 +33,7 @@ typedef void (sig_handler_func) (gdb_client_data);
is responsible for clearing the async event handler if it no longer needs
to be called. */
-typedef void (async_event_handler_func) (gdb_client_data);
+using async_event_handler_func = void (gdb_client_data);
extern struct async_signal_handler *
create_async_signal_handler (sig_handler_func *proc,
diff --git a/gdb/cli/cli-option.h b/gdb/cli/cli-option.h
index 3e2fd4ec933..b3c051253b0 100644
--- a/gdb/cli/cli-option.h
+++ b/gdb/cli/cli-option.h
@@ -39,7 +39,7 @@ struct option_def
/* The ctor is protected because you're supposed to construct using
one of bool_option_def, etc. below. */
protected:
- typedef void *(erased_get_var_address_ftype) ();
+ using erased_get_var_address_ftype = void * ();
/* Construct an option. NAME_ is the option's name. VAR_TYPE_
defines the option's type. ERASED_GET_VAR_ADDRESS_ is a pointer
diff --git a/gdb/command.h b/gdb/command.h
index 56a4e46b2f3..36287d657f9 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -396,7 +396,7 @@ struct cmd_list_element;
/* The "simple" signature of command callbacks, which doesn't include a
cmd_list_element parameter. */
-typedef void cmd_simple_func_ftype (const char *args, int from_tty);
+using cmd_simple_func_ftype = void (const char *args, int from_tty);
/* This structure specifies notifications to be suppressed by a cli
command interpreter. */
diff --git a/gdb/completer.c b/gdb/completer.c
index 0925891379a..09b1c8054d3 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -3271,7 +3271,7 @@ extern int _rl_completion_prefix_display_length;
extern int _rl_print_completions_horizontally;
extern "C" int _rl_qsort_string_compare (const void *, const void *);
-typedef int QSFUNC (const void *, const void *);
+using QSFUNC = int (const void *, const void *);
/* GDB version of readline/complete.c:rl_display_match_list.
See gdb_display_match_list for a description of MATCHES, LEN, MAX.
diff --git a/gdb/completer.h b/gdb/completer.h
index df247039c76..c84ce3ec28a 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -24,14 +24,14 @@
struct match_list_displayer;
-typedef void mld_crlf_ftype (const struct match_list_displayer *);
-typedef void mld_putch_ftype (const struct match_list_displayer *, int);
+using mld_crlf_ftype = void (const struct match_list_displayer *);
+using mld_putch_ftype = void (const struct match_list_displayer *, int);
typedef void mld_puts_ftype (const struct match_list_displayer *,
const char *);
-typedef void mld_flush_ftype (const struct match_list_displayer *);
-typedef void mld_erase_entire_line_ftype (const struct match_list_displayer *);
-typedef void mld_beep_ftype (const struct match_list_displayer *);
-typedef int mld_read_key_ftype (const struct match_list_displayer *);
+using mld_flush_ftype = void (const struct match_list_displayer *);
+using mld_erase_entire_line_ftype = void (const struct match_list_displayer *);
+using mld_beep_ftype = void (const struct match_list_displayer *);
+using mld_read_key_ftype = int (const struct match_list_displayer *);
/* Interface between CLI/TUI and gdb_match_list_displayer. */
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index fb41a3c15b2..2bd3430a7a8 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -81,7 +81,7 @@ extern gdb::unique_xmalloc_ptr<char> cp_canonicalize_string
extern gdb::unique_xmalloc_ptr<char> cp_canonicalize_string_no_typedefs
(const char *string);
-typedef const char *(canonicalization_ftype) (struct type *, void *);
+using canonicalization_ftype = const char * (struct type *, void *);
extern gdb::unique_xmalloc_ptr<char> cp_canonicalize_string_full
(const char *string, canonicalization_ftype *finder, void *data);
diff --git a/gdb/dcache.c b/gdb/dcache.c
index a85b1bf9b12..9c80bb47461 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -121,7 +121,7 @@ struct dcache_struct
process_stratum_target *proc_target;
};
-typedef void (block_func) (struct dcache_block *block, void *param);
+using block_func = void (struct dcache_block *block, void *param);
static struct dcache_block *dcache_hit (DCACHE *dcache, CORE_ADDR addr);
diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h
index 0f71141786c..7ac12466580 100644
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -58,7 +58,7 @@ extern const struct frame_unwind_legacy dummy_frame_unwind;
/* Destructor for dummy_frame. DATA is supplied by registrant.
REGISTERS_VALID is 1 for dummy_frame_pop, 0 for dummy_frame_discard. */
-typedef void (dummy_frame_dtor_ftype) (void *data, int registers_valid);
+using dummy_frame_dtor_ftype = void (void *data, int registers_valid);
/* Call DTOR with DTOR_DATA when DUMMY_ID frame of thread THREAD gets
discarded. Dummy frame with DUMMY_ID must exist. Multiple
diff --git a/gdb/event-top.h b/gdb/event-top.h
index a7d31d56a5d..4b377f8780e 100644
--- a/gdb/event-top.h
+++ b/gdb/event-top.h
@@ -37,7 +37,7 @@ struct cmd_list_element;
still want to intercept the Ctrl-C and offer to disconnect if the
user presses Ctrl-C multiple times while the target is stuck
waiting for the wedged remote stub. */
-typedef void (quit_handler_ftype) ();
+using quit_handler_ftype = void ();
extern quit_handler_ftype *quit_handler;
/* Exported functions from event-top.c.
@@ -151,7 +151,7 @@ extern void gdb_rl_callback_handler_reinstall (void);
handles the case where readline received EOF. */
extern void gdb_rl_deprep_term_function (void);
-typedef void (*segv_handler_t) (int);
+using segv_handler_t = void (*) (int);
/* On construction, replaces the current thread's SIGSEGV handler with
the provided one. On destruction, restores the handler to the
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index ecd0df95fc7..cf59ae21efc 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1925,7 +1925,7 @@ fbsd_nat_target::detach_fork_children (inferior *inf)
true to terminate the iteration early. This function returns true
if the callback returned true, otherwise it returns false. */
-typedef bool (ptrace_event_ftype) (const struct ptrace_lwpinfo &pl);
+using ptrace_event_ftype = bool (const struct ptrace_lwpinfo &pl);
static bool
iterate_other_ptrace_events (pid_t pid,
diff --git a/gdb/frame-base.h b/gdb/frame-base.h
index 7dcc3a3927d..723d2ba56d3 100644
--- a/gdb/frame-base.h
+++ b/gdb/frame-base.h
@@ -68,7 +68,7 @@ struct frame_base
/* Given THIS frame, return the frame base methods for THIS frame,
or NULL if it can't handle THIS frame. */
-typedef const struct frame_base *(frame_base_sniffer_ftype) (const frame_info_ptr &this_frame);
+using frame_base_sniffer_ftype = const struct frame_base * (const frame_info_ptr &this_frame);
/* Append a frame base sniffer to the list. The sniffers are polled
in the order that they are appended. */
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 7077f9262e9..1e3270911dc 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -242,9 +242,9 @@ struct gdbarch_info
const struct target_desc *target_desc = nullptr;
};
-typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
-typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file);
-typedef bool (gdbarch_supports_arch_info_ftype) (const struct bfd_arch_info *);
+using gdbarch_init_ftype = struct gdbarch * (struct gdbarch_info info, struct gdbarch_list *arches);
+using gdbarch_dump_tdep_ftype = void (struct gdbarch *gdbarch, struct ui_file *file);
+using gdbarch_supports_arch_info_ftype = bool (const struct bfd_arch_info *);
extern void gdbarch_register (enum bfd_architecture architecture,
gdbarch_init_ftype *init,
diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h
index 2ab06c8078e..93f5931fbfb 100644
--- a/gdb/gnu-nat.h
+++ b/gdb/gnu-nat.h
@@ -42,7 +42,7 @@ extern struct inf *gnu_current_inf;
/* Converts a GDB pid to a struct proc. */
struct proc *inf_tid_to_thread (struct inf *inf, int tid);
-typedef void (inf_threads_ftype) (struct proc *thread, void *arg);
+using inf_threads_ftype = void (struct proc *thread, void *arg);
/* Call F for every thread in inferior INF, passing ARG as second parameter. */
void inf_threads (struct inf *inf, inf_threads_ftype *f, void *arg);
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index a86ad48eb12..20709e6a1d1 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -51,7 +51,7 @@ struct symbol;
/* A function to pass to the safe-call routines to ignore things like
memory errors. */
-typedef int excp_matcher_func (SCM key);
+using excp_matcher_func = int (SCM key);
/* Scheme variables to define during initialization. */
@@ -278,7 +278,7 @@ struct objfile;
/* A predicate that returns non-zero if an object is a particular kind
of gsmob. */
-typedef int (gsmob_pred_func) (SCM);
+using gsmob_pred_func = int (SCM);
extern scm_t_bits gdbscm_make_smob_type (const char *name, size_t size);
diff --git a/gdb/ia64-libunwind-tdep.c b/gdb/ia64-libunwind-tdep.c
index 52902dc17f2..d62ff195ff1 100644
--- a/gdb/ia64-libunwind-tdep.c
+++ b/gdb/ia64-libunwind-tdep.c
@@ -58,7 +58,7 @@ static int libunwind_initialized;
static const registry<gdbarch>::key<libunwind_descr> libunwind_descr_handle;
/* Required function pointers from libunwind. */
-typedef int (unw_get_reg_p_ftype) (unw_cursor_t *, unw_regnum_t, unw_word_t *);
+using unw_get_reg_p_ftype = int (unw_cursor_t *, unw_regnum_t, unw_word_t *);
static unw_get_reg_p_ftype *unw_get_reg_p;
typedef int (unw_get_fpreg_p_ftype) (unw_cursor_t *, unw_regnum_t,
unw_fpreg_t *);
@@ -66,9 +66,9 @@ static unw_get_fpreg_p_ftype *unw_get_fpreg_p;
typedef int (unw_get_saveloc_p_ftype) (unw_cursor_t *, unw_regnum_t,
unw_save_loc_t *);
static unw_get_saveloc_p_ftype *unw_get_saveloc_p;
-typedef int (unw_is_signal_frame_p_ftype) (unw_cursor_t *);
+using unw_is_signal_frame_p_ftype = int (unw_cursor_t *);
static unw_is_signal_frame_p_ftype *unw_is_signal_frame_p;
-typedef int (unw_step_p_ftype) (unw_cursor_t *);
+using unw_step_p_ftype = int (unw_cursor_t *);
static unw_step_p_ftype *unw_step_p;
typedef int (unw_init_remote_p_ftype) (unw_cursor_t *, unw_addr_space_t,
void *);
@@ -76,7 +76,7 @@ static unw_init_remote_p_ftype *unw_init_remote_p;
typedef unw_addr_space_t (unw_create_addr_space_p_ftype) (unw_accessors_t *,
int);
static unw_create_addr_space_p_ftype *unw_create_addr_space_p;
-typedef void (unw_destroy_addr_space_p_ftype) (unw_addr_space_t);
+using unw_destroy_addr_space_p_ftype = void (unw_addr_space_t);
static unw_destroy_addr_space_p_ftype *unw_destroy_addr_space_p;
typedef int (unw_search_unwind_table_p_ftype) (unw_addr_space_t, unw_word_t,
unw_dyn_info_t *,
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 9c031035a23..11f5b25ec26 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -173,7 +173,7 @@ extern tribool sharing_input_terminal (int pid);
/* The type of the function that is called when SIGINT is handled. */
-typedef void c_c_handler_ftype (int);
+using c_c_handler_ftype = void (int);
/* Install a new SIGINT handler in a host-dependent way. The previous
handler is returned. It is fine to pass SIG_IGN for FN, but not
diff --git a/gdb/jit.c b/gdb/jit.c
index 251e8331c4a..c0aeb41e5aa 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -142,7 +142,7 @@ struct jit_reader
static struct jit_reader *loaded_jit_reader = NULL;
-typedef struct gdb_reader_funcs * (reader_init_fn_type) (void);
+using reader_init_fn_type = struct gdb_reader_funcs * (void);
static const char reader_init_fn_sym[] = "gdb_init_reader";
/* Try to load FILE_NAME as a JIT debug info reader. */
diff --git a/gdb/language.h b/gdb/language.h
index b43dae66107..84f3ed9d8a4 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -752,7 +752,7 @@ extern void language_info ();
extern void set_language (enum language lang);
-typedef void lazily_set_language_ftype ();
+using lazily_set_language_ftype = void ();
extern void lazily_set_language (lazily_set_language_ftype *fun);
\f
diff --git a/gdb/main.c b/gdb/main.c
index 7272862a3f8..605089619cd 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -491,7 +491,7 @@ handle_command_errors (const struct gdb_exception &e)
/* Type of the command callback passed to the const
catch_command_errors. */
-typedef void (catch_command_errors_const_ftype) (const char *, int);
+using catch_command_errors_const_ftype = void (const char *, int);
/* Wrap calls to commands run before the event loop is started. */
diff --git a/gdb/nat/gdb_thread_db.h b/gdb/nat/gdb_thread_db.h
index 94dd69f373a..c40c1a407a0 100644
--- a/gdb/nat/gdb_thread_db.h
+++ b/gdb/nat/gdb_thread_db.h
@@ -37,11 +37,11 @@
/* Types of the libthread_db functions. */
-typedef td_err_e (td_init_ftype) (void);
+using td_init_ftype = td_err_e (void);
typedef td_err_e (td_ta_new_ftype) (struct ps_prochandle * ps,
td_thragent_t **ta);
-typedef td_err_e (td_ta_delete_ftype) (td_thragent_t *ta_p);
+using td_ta_delete_ftype = td_err_e (td_thragent_t *ta_p);
typedef td_err_e (td_ta_map_lwp2thr_ftype) (const td_thragent_t *ta,
lwpid_t lwpid, td_thrhandle_t *th);
typedef td_err_e (td_ta_thr_iter_ftype) (const td_thragent_t *ta,
@@ -70,7 +70,7 @@ typedef td_err_e (td_thr_tlsbase_ftype) (const td_thrhandle_t *th,
unsigned long int modid,
psaddr_t *base);
-typedef const char ** (td_symbol_list_ftype) (void);
-typedef td_err_e (td_ta_delete_ftype) (td_thragent_t *);
+using td_symbol_list_ftype = const char ** (void);
+using td_ta_delete_ftype = td_err_e (td_thragent_t *);
#endif /* GDB_NAT_GDB_THREAD_DB_H */
diff --git a/gdb/nat/glibc_thread_db.h b/gdb/nat/glibc_thread_db.h
index 4e23de5641d..fc5e7db12da 100644
--- a/gdb/nat/glibc_thread_db.h
+++ b/gdb/nat/glibc_thread_db.h
@@ -244,10 +244,10 @@ using thread_key_t = pthread_key_t;
/* Callback for iteration over threads. */
-typedef int td_thr_iter_f (const td_thrhandle_t *, void *);
+using td_thr_iter_f = int (const td_thrhandle_t *, void *);
/* Callback for iteration over thread local data. */
-typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *);
+using td_key_iter_f = int (thread_key_t, void (*) (void *), void *);
diff --git a/gdb/nat/linux-procfs.h b/gdb/nat/linux-procfs.h
index 3b1d58249f6..70d50eb7271 100644
--- a/gdb/nat/linux-procfs.h
+++ b/gdb/nat/linux-procfs.h
@@ -75,7 +75,7 @@ extern const char *linux_proc_tid_get_name (ptid_t ptid);
/* Callback function for linux_proc_attach_tgid_threads. If the PTID
thread is not yet known, try to attach to it and return true,
otherwise return false. */
-typedef int (*linux_proc_attach_lwp_func) (ptid_t ptid);
+using linux_proc_attach_lwp_func = int (*) (ptid_t ptid);
/* If PID is a tgid, scan the /proc/PID/task/ directory for existing
threads, and call FUNC for each thread found. */
diff --git a/gdb/registry.h b/gdb/registry.h
index d76d3a80be8..4f7d14b0fff 100644
--- a/gdb/registry.h
+++ b/gdb/registry.h
@@ -199,7 +199,7 @@ class registry
private:
/* Registry callbacks have this type. */
- typedef void (*registry_data_callback) (void *);
+ using registry_data_callback = void (*) (void *);
/* Get a new key for this particular registry. FREE is a callback.
When the container object is destroyed, all FREE functions are
diff --git a/gdb/remote.c b/gdb/remote.c
index 1d51336cd96..a99f61a0789 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -103,7 +103,7 @@ using threadref = unsigned char[OPAQUETHREADBYTES];
struct gdb_ext_thread_info;
struct threads_listing_context;
-typedef int (*rmt_thread_action) (threadref *ref, void *context);
+using rmt_thread_action = int (*) (threadref *ref, void *context);
struct protocol_feature;
struct packet_reg;
diff --git a/gdb/selftest-arch.h b/gdb/selftest-arch.h
index 2e589bc587b..6e282c6f2f1 100644
--- a/gdb/selftest-arch.h
+++ b/gdb/selftest-arch.h
@@ -19,7 +19,7 @@
#ifndef GDB_SELFTEST_ARCH_H
#define GDB_SELFTEST_ARCH_H
-typedef void self_test_foreach_arch_function (struct gdbarch *);
+using self_test_foreach_arch_function = void (struct gdbarch *);
namespace selftests
{
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 85f5cd5fe0d..990aae6b954 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -353,7 +353,7 @@ dos_comisr (int irq)
ISR (0) ISR (1) ISR (2) ISR (3) /* OK */
ISR (4) ISR (5) ISR (6) ISR (7) /* OK */
-typedef void (*isr_t) (void);
+using isr_t = void (*) (void);
static isr_t isrs[NINTR] =
{
diff --git a/gdb/serial.h b/gdb/serial.h
index 0a87eabfa12..a170f01bc4e 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -214,7 +214,7 @@ extern int serial_is_async_p (struct serial *scb);
asynchronous mode. To disable asynchronous mode, register a NULL
callback. */
-typedef void (serial_event_ftype) (struct serial *scb, void *context);
+using serial_event_ftype = void (struct serial *scb, void *context);
extern void serial_async (struct serial *scb,
serial_event_ftype *handler, void *context);
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index dc693c1854d..e9dc48208bb 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -132,11 +132,11 @@ static int sol_thread_active = 0;
/* Types of the libthread_db functions. */
-typedef void (td_log_ftype)(const int on_off);
+using td_log_ftype = void (const int on_off);
typedef td_err_e (td_ta_new_ftype)(const struct ps_prochandle *ph_p,
td_thragent_t **ta_pp);
-typedef td_err_e (td_ta_delete_ftype)(td_thragent_t *ta_p);
-typedef td_err_e (td_init_ftype)(void);
+using td_ta_delete_ftype = td_err_e (td_thragent_t *ta_p);
+using td_init_ftype = td_err_e (void);
typedef td_err_e (td_ta_get_ph_ftype)(const td_thragent_t *ta_p,
struct ps_prochandle **ph_pp);
typedef td_err_e (td_ta_get_nthreads_ftype)(const td_thragent_t *ta_p,
@@ -148,7 +148,7 @@ typedef td_err_e (td_ta_thr_iter_ftype)(const td_thragent_t *ta_p,
td_thr_state_e state, int ti_pri,
sigset_t *ti_sigmask_p,
unsigned ti_user_flags);
-typedef td_err_e (td_thr_validate_ftype)(const td_thrhandle_t *th_p);
+using td_thr_validate_ftype = td_err_e (const td_thrhandle_t *th_p);
typedef td_err_e (td_thr_tsd_ftype)(const td_thrhandle_t * th_p,
const thread_key_t key, void **data_pp);
typedef td_err_e (td_thr_get_info_ftype)(const td_thrhandle_t *th_p,
diff --git a/gdb/stubs/sh-stub.c b/gdb/stubs/sh-stub.c
index 3b0667e90e7..88509a85d78 100644
--- a/gdb/stubs/sh-stub.c
+++ b/gdb/stubs/sh-stub.c
@@ -189,7 +189,7 @@
/*
* typedef
*/
-typedef void (*Function) ();
+using Function = void (*) ();
/*
* Forward declarations
diff --git a/gdb/target.h b/gdb/target.h
index 22653138491..34f5e817635 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -2473,7 +2473,7 @@ int target_verify_memory (const gdb_byte *data,
"target TARGET_NAME". The callback routine takes the rest of the
parameters from the command, and (if successful) pushes a new
target onto the stack. */
-typedef void target_open_ftype (const char *args, int from_tty);
+using target_open_ftype = void (const char *args, int from_tty);
/* Add the target described by INFO to the list of possible targets
and add a new command 'target $(INFO->shortname)'. Set COMPLETER
diff --git a/gdb/unittests/function-view-selftests.c b/gdb/unittests/function-view-selftests.c
index 9671efc0864..7a61465d440 100644
--- a/gdb/unittests/function-view-selftests.c
+++ b/gdb/unittests/function-view-selftests.c
@@ -213,7 +213,7 @@ test_make_function_view ()
SELF_CHECK (3 == tmpl_func (1, gdb::make_function_view (&make_fv_test_func)));
/* Reference to const and non-const function pointers. */
- typedef int (*func_ptr) (int);
+ using func_ptr = int (*) (int);
func_ptr ptr = make_fv_test_func;
const func_ptr cptr = make_fv_test_func;
SELF_CHECK (3 == tmpl_func (1, gdb::make_function_view (ptr)));
diff --git a/gdb/windows-nat.h b/gdb/windows-nat.h
index cbe5429fd84..3349755022b 100644
--- a/gdb/windows-nat.h
+++ b/gdb/windows-nat.h
@@ -47,7 +47,7 @@ using windows_nat::windows_thread_info;
/* A pointer to a function that should return non-zero iff REGNUM
corresponds to one of the segment registers. */
-typedef int (segment_register_p_ftype) (int regnum);
+using segment_register_p_ftype = int (int regnum);
/* Maintain a linked list of "so" information. */
struct windows_solib
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index 03e11202955..60154240ddd 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -36,8 +36,8 @@
#define PTRACE_XFER_TYPE long
#ifdef HAVE_LINUX_REGSETS
-typedef void (*regset_fill_func) (struct regcache *, void *);
-typedef void (*regset_store_func) (struct regcache *, const void *);
+using regset_fill_func = void (*) (struct regcache *, void *);
+using regset_store_func = void (*) (struct regcache *, const void *);
enum regset_type {
GENERAL_REGS,
FP_REGS,
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc
index 1e1ca8b5e64..4f1a03237c9 100644
--- a/gdbserver/tracepoint.cc
+++ b/gdbserver/tracepoint.cc
@@ -5420,10 +5420,10 @@ gdb_collect (struct tracepoint *tpoint, unsigned char *regs)
results in returning the actual code pointer, instead of the descriptor
pointer. */
-typedef void (*gdb_collect_ptr_type) (struct tracepoint *, unsigned char *);
-typedef ULONGEST (*get_raw_reg_ptr_type) (const unsigned char *, int);
-typedef LONGEST (*get_trace_state_variable_value_ptr_type) (int);
-typedef void (*set_trace_state_variable_value_ptr_type) (int, LONGEST);
+using gdb_collect_ptr_type = void (*) (struct tracepoint *, unsigned char *);
+using get_raw_reg_ptr_type = ULONGEST (*) (const unsigned char *, int);
+using get_trace_state_variable_value_ptr_type = LONGEST (*) (int);
+using set_trace_state_variable_value_ptr_type = void (*) (int, LONGEST);
extern "C" {
IP_AGENT_EXPORT_VAR gdb_collect_ptr_type gdb_collect_ptr = gdb_collect;
diff --git a/gdbsupport/event-loop.h b/gdbsupport/event-loop.h
index 8c29f63a877..85cae592965 100644
--- a/gdbsupport/event-loop.h
+++ b/gdbsupport/event-loop.h
@@ -71,8 +71,8 @@
Corollary tasks are the creation and deletion of event sources. */
using gdb_client_data = void *;
-typedef void (handler_func) (int, gdb_client_data);
-typedef void (timer_handler_func) (gdb_client_data);
+using handler_func = void (int, gdb_client_data);
+using timer_handler_func = void (gdb_client_data);
/* Exported functions from event-loop.c */
diff --git a/gdbsupport/search.h b/gdbsupport/search.h
index 88c31992ff5..8321f7c0550 100644
--- a/gdbsupport/search.h
+++ b/gdbsupport/search.h
@@ -28,7 +28,7 @@
wants to be able to examine trace data when searching, and
target_read_memory does not do this. */
-typedef bool target_read_memory_ftype (CORE_ADDR, gdb_byte *, size_t);
+using target_read_memory_ftype = bool (CORE_ADDR, gdb_byte *, size_t);
/* Utility implementation of searching memory. */
extern int simple_search_memory
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 03/12] [gdb] Use using instead of typedef some more (part 3)
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-16 6:22 ` [PATCH 02/12] [gdb] Use using instead of typedef some more (part 2) Tom de Vries
@ 2026-06-16 6:22 ` 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
` (9 subsequent siblings)
12 siblings, 1 reply; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
Fix the remaining hits of:
...
$ find gdb* -type f -name "*.[ch]" -o -name "*.cc" \
| egrep -v /testsuite/ \
| xargs grep '^[ \t]*typedef .*;.*$' \
| grep -v WINAPI
...
except for C example in a comment.
---
gdb/expop.h | 2 +-
gdb/frv-linux-tdep.c | 2 +-
gdb/go32-nat.c | 2 +-
gdb/interps.h | 2 +-
gdb/stubs/m68k-stub.c | 4 ++--
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gdb/expop.h b/gdb/expop.h
index fb4139d3b33..41331c4a780 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -2094,7 +2094,7 @@ class unop_cast_type_operation
override;
};
-typedef value *cxx_cast_ftype (struct type *, value *);
+using cxx_cast_ftype = value * (struct type *, value *);
/* This implements dynamic_cast and reinterpret_cast. static_cast and
const_cast are handled by the ordinary case operations. */
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index cd9d21c2f14..66f434ed8b7 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -347,7 +347,7 @@ static const struct frame_unwind_legacy frv_linux_sigtramp_frame_unwind (
the loadmap addresses in the register set. (See below for more info.) */
#define FRV_ELF_NGREG (46 + 2)
using frv_elf_greg_t = unsigned char[4];
-typedef struct { frv_elf_greg_t reg[FRV_ELF_NGREG]; } frv_elf_gregset_t;
+using frv_elf_gregset_t = struct { frv_elf_greg_t reg[FRV_ELF_NGREG]; };
using frv_elf_fpreg_t = unsigned char[4];
typedef struct
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index b3ea5c1fd5c..eeaff9d8117 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -219,7 +219,7 @@ redir_debug_init (cmdline_t *ptr)
}
#endif /* __DJGPP_MINOR < 3 */
-typedef enum { wp_insert, wp_remove, wp_count } wp_op;
+using wp_op = enum { wp_insert, wp_remove, wp_count };
/* This holds the current reference counts for each debug register. */
static int dr_ref_count[4];
diff --git a/gdb/interps.h b/gdb/interps.h
index d92d6b977cf..121f2ecca84 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -35,7 +35,7 @@ struct inferior;
struct solib;
struct trace_state_variable;
-typedef struct interp *(*interp_factory_func) (const char *name);
+using interp_factory_func = struct interp * (*) (const char *name);
/* Each interpreter kind (CLI, MI, etc.) registers itself with a call
to this function, passing along its name, and a pointer to a
diff --git a/gdb/stubs/m68k-stub.c b/gdb/stubs/m68k-stub.c
index c63eee7d2c9..57437dd04f7 100644
--- a/gdb/stubs/m68k-stub.c
+++ b/gdb/stubs/m68k-stub.c
@@ -113,8 +113,8 @@
*
* external low-level support routines
*/
-typedef void (*ExceptionHook)(int); /* pointer to function with int parm */
-typedef void (*Function)(); /* pointer to a function */
+using ExceptionHook = void (*) (int); /* Pointer to function with int parm. */
+using Function = void (*) (); /* Pointer to a function. */
extern void putDebugChar(); /* write a single character */
extern int getDebugChar(); /* read and return a single char */
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 04/12] [gdb] Convert function pointer typedefs to using
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (2 preceding siblings ...)
2026-06-16 6:22 ` [PATCH 03/12] [gdb] Use using instead of typedef some more (part 3) Tom de Vries
@ 2026-06-16 6:22 ` Tom de Vries
2026-06-16 6:22 ` [PATCH 05/12] [gdb] Convert template " Tom de Vries
` (8 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
Transform "typedef void (*foo) ()" into "using foo = void (*) ()".
Generated by a script written by Claude Code.
---
gdb/dwarf2/frame.h | 4 ++--
gdb/infrun.c | 4 ++--
gdb/rs6000-tdep.c | 4 ++--
gdb/target-descriptions.h | 6 +++---
gdbserver/tracepoint.cc | 4 ++--
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/gdb/dwarf2/frame.h b/gdb/dwarf2/frame.h
index d3c71c3d16e..6462d008cc2 100644
--- a/gdb/dwarf2/frame.h
+++ b/gdb/dwarf2/frame.h
@@ -66,8 +66,8 @@ enum dwarf2_frame_reg_rule
/* Register state. */
-typedef struct value *(*fn_prev_register) (const frame_info_ptr &this_frame,
- void **this_cache, int regnum);
+using fn_prev_register = struct value *(*) (const frame_info_ptr &this_frame,
+ void **this_cache, int regnum);
struct dwarf2_frame_state_reg
{
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 00bedc7b6ae..fe85a05dd36 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3984,8 +3984,8 @@ delete_thread_infrun_breakpoints (struct thread_info *tp)
just stopped. In all-stop, that's all the non-exited threads; in
non-stop, that's the current thread, only. */
-typedef void (*for_each_just_stopped_thread_callback_func)
- (struct thread_info *tp);
+using for_each_just_stopped_thread_callback_func
+ = void (*) (struct thread_info *tp);
static void
for_each_just_stopped_thread (for_each_just_stopped_thread_callback_func func)
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index e135df94a40..a63f138047a 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2769,8 +2769,8 @@ rs6000_value_from_register (gdbarch *gdbarch, type *type, int regnum,
/* The type of a function that moves the value of REG between CACHE
or BUF --- in either direction. */
-typedef enum register_status (*move_ev_register_func) (struct regcache *,
- int, void *);
+using move_ev_register_func = enum register_status (*) (struct regcache *,
+ int, void *);
/* Move SPE vector register values between a 64-bit buffer and the two
32-bit raw register halves in a regcache. This function handles
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index 25dbf393c2d..39b56d80e5f 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -80,9 +80,9 @@ void set_tdesc_pseudo_register_reggroup_p
appear in the target description. This means all unknown registers
within a single feature will be called one after another. */
-typedef int (*tdesc_unknown_register_ftype)
- (struct gdbarch *gdbarch, tdesc_feature *feature,
- const char *reg_name, int possible_regnum);
+using tdesc_unknown_register_ftype
+ = int (*) (struct gdbarch *gdbarch, tdesc_feature *feature,
+ const char *reg_name, int possible_regnum);
/* A deleter adapter for a target arch data. */
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc
index 4f1a03237c9..e5d95726422 100644
--- a/gdbserver/tracepoint.cc
+++ b/gdbserver/tracepoint.cc
@@ -585,8 +585,8 @@ enum tracepoint_type
fast_tracepoint,
};
-typedef enum eval_result_type (*condfn) (unsigned char *,
- ULONGEST *);
+using condfn = enum eval_result_type (*) (unsigned char *,
+ ULONGEST *);
/* The definition of a tracepoint. */
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 05/12] [gdb] Convert template typedefs to using
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (3 preceding siblings ...)
2026-06-16 6:22 ` [PATCH 04/12] [gdb] Convert function pointer typedefs to using Tom de Vries
@ 2026-06-16 6:22 ` Tom de Vries
2026-06-16 6:22 ` [PATCH 06/12] [gdb] Convert function " Tom de Vries
` (7 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
Convert "typedef foo<...> bar" to "using bar = foo<...>".
Generated by a script written by Claude Code.
---
gdb/ada-lang.h | 4 ++--
gdb/breakpoint.h | 4 ++--
gdb/compile/compile-c-support.c | 20 +++++++++++---------
gdb/dwarf2/cooked-index-shard.h | 4 ++--
gdb/dwarf2/read-gdb-index.h | 11 +++++------
gdb/gdbtypes.c | 4 ++--
gdb/inferior.h | 8 ++++----
gdb/mi/mi-symbol-cmds.c | 4 ++--
gdb/stack.h | 4 ++--
gdb/target-descriptions.h | 4 ++--
gdb/tracefile.c | 4 ++--
gdb/xml-support.h | 6 +++---
gdbserver/netbsd-low.cc | 12 ++++++------
gdbsupport/gdb_splay_tree.h | 4 ++--
14 files changed, 47 insertions(+), 46 deletions(-)
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index cd2fce73d61..85470e2e8d1 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -372,8 +372,8 @@ extern struct ada_task_info *ada_get_task_info_from_ptid (ptid_t ptid);
extern int ada_get_task_number (thread_info *thread);
-typedef gdb::function_view<void (struct ada_task_info *task)>
- ada_task_list_iterator_ftype;
+using ada_task_list_iterator_ftype
+ = gdb::function_view<void (struct ada_task_info *task)>;
extern void iterate_over_live_ada_tasks
(ada_task_list_iterator_ftype iterator);
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 7149211a055..722d75390fa 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -537,8 +537,8 @@ struct bp_location_ref_policy
};
/* A gdb::ref_ptr that has been specialized for bp_location. */
-typedef gdb::ref_ptr<bp_location, bp_location_ref_policy>
- bp_location_ref_ptr;
+using bp_location_ref_ptr
+ = gdb::ref_ptr<bp_location, bp_location_ref_policy>;
/* The possible return values for print_bpstat, print_it_normal,
print_it_done, print_it_noop. */
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index f2b98ab5e2f..f18708846ec 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -649,15 +649,17 @@ class compile_program
/* The types used for C and C++ program computations. */
-typedef compile_program<compile_c_instance,
- c_push_user_expression, pop_user_expression_nop,
- c_add_code_header, c_add_code_footer,
- c_add_input> c_compile_program;
-
-typedef compile_program<compile_cplus_instance,
- cplus_push_user_expression, cplus_pop_user_expression,
- cplus_add_code_header, c_add_code_footer,
- cplus_add_input> cplus_compile_program;
+using c_compile_program
+ = compile_program<compile_c_instance, c_push_user_expression,
+ pop_user_expression_nop,
+ c_add_code_header, c_add_code_footer,
+ c_add_input>;
+
+using cplus_compile_program
+ = compile_program<compile_cplus_instance, cplus_push_user_expression,
+ cplus_pop_user_expression,
+ cplus_add_code_header, c_add_code_footer,
+ cplus_add_input>;
/* The compute_program method for C. */
diff --git a/gdb/dwarf2/cooked-index-shard.h b/gdb/dwarf2/cooked-index-shard.h
index aff82fad184..84c37958c83 100644
--- a/gdb/dwarf2/cooked-index-shard.h
+++ b/gdb/dwarf2/cooked-index-shard.h
@@ -65,8 +65,8 @@ class cooked_index_shard
friend class cooked_index;
/* A simple range over part of m_entries. */
- typedef iterator_range<std::vector<cooked_index_entry *>::const_iterator>
- range;
+ using range
+ = iterator_range<std::vector<cooked_index_entry *>::const_iterator>;
/* Return a range of all the entries. */
range all_entries () const
diff --git a/gdb/dwarf2/read-gdb-index.h b/gdb/dwarf2/read-gdb-index.h
index cf703ed01c1..56e112c6cbb 100644
--- a/gdb/dwarf2/read-gdb-index.h
+++ b/gdb/dwarf2/read-gdb-index.h
@@ -43,12 +43,11 @@ struct objfile;
/* Callback types for dwarf2_read_gdb_index. */
-typedef gdb::function_view
- <gdb::array_view<const gdb_byte>(objfile *, dwarf2_per_bfd *)>
- get_gdb_index_contents_ftype;
-typedef gdb::function_view
- <gdb::array_view<const gdb_byte>(objfile *, dwz_file *)>
- get_gdb_index_contents_dwz_ftype;
+using get_gdb_index_contents_ftype
+ = gdb::function_view<gdb::array_view<const gdb_byte>(objfile *,
+ dwarf2_per_bfd *)>;
+using get_gdb_index_contents_dwz_ftype
+ = gdb::function_view<gdb::array_view<const gdb_byte>(objfile *, dwz_file *)>;
/* Read .gdb_index. If everything went ok, initialize the "quick"
elements of all the CUs and return true. Otherwise, return
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index eac5cb87fe2..d1a2914e1e6 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5618,8 +5618,8 @@ append_composite_type_field (struct type *t, const char *name,
hash the contents of an mpq_t; so it's a bit of a pain to hash-cons
them. If we did do this, they could be moved to the per-BFD and
shared across objfiles. */
-typedef std::vector<std::unique_ptr<fixed_point_type_info>>
- fixed_point_type_storage;
+using fixed_point_type_storage
+ = std::vector<std::unique_ptr<fixed_point_type_info>>;
/* Key used for managing the storage of fixed-point type info. */
static const struct registry<objfile>::key<fixed_point_type_storage>
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 11f5b25ec26..5c7a52319e7 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -92,8 +92,8 @@ struct infcall_suspend_state_deleter
};
/* A unique_ptr specialization for infcall_suspend_state. */
-typedef std::unique_ptr<infcall_suspend_state, infcall_suspend_state_deleter>
- infcall_suspend_state_up;
+using infcall_suspend_state_up
+ = std::unique_ptr<infcall_suspend_state, infcall_suspend_state_deleter>;
extern infcall_suspend_state_up save_infcall_suspend_state ();
@@ -108,8 +108,8 @@ struct infcall_control_state_deleter
};
/* A unique_ptr specialization for infcall_control_state. */
-typedef std::unique_ptr<infcall_control_state, infcall_control_state_deleter>
- infcall_control_state_up;
+using infcall_control_state_up
+ = std::unique_ptr<infcall_control_state, infcall_control_state_deleter>;
extern infcall_control_state_up save_infcall_control_state ();
diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c
index d7535c51d2a..993a647a9c9 100644
--- a/gdb/mi/mi-symbol-cmds.c
+++ b/gdb/mi/mi-symbol-cmds.c
@@ -241,8 +241,8 @@ mi_info_functions_or_variables (domain_search_flags kind,
}
/* Type for an iterator over a vector of module_symbol_search results. */
-typedef std::vector<module_symbol_search>::const_iterator
- module_symbol_search_iterator;
+using module_symbol_search_iterator
+ = std::vector<module_symbol_search>::const_iterator;
/* Helper for mi_info_module_functions_or_variables. Display the results
from ITER up to END or until we find a symbol that is in a different
diff --git a/gdb/stack.h b/gdb/stack.h
index ad2700b59a7..48096a29286 100644
--- a/gdb/stack.h
+++ b/gdb/stack.h
@@ -24,8 +24,8 @@ gdb::unique_xmalloc_ptr<char> find_frame_funname (const frame_info_ptr &frame,
enum language *funlang,
struct symbol **funcp);
-typedef gdb::function_view<void (const char *print_name, struct symbol *sym)>
- iterate_over_block_arg_local_vars_cb;
+using iterate_over_block_arg_local_vars_cb
+ = gdb::function_view<void (const char *print_name, struct symbol *sym)>;
void iterate_over_block_arg_vars (const struct block *block,
iterate_over_block_arg_local_vars_cb cb);
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index 39b56d80e5f..c9cc743386d 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -93,8 +93,8 @@ struct tdesc_arch_data_deleter
/* A unique pointer specialization that holds a target_desc. */
-typedef std::unique_ptr<tdesc_arch_data, tdesc_arch_data_deleter>
- tdesc_arch_data_up;
+using tdesc_arch_data_up
+ = std::unique_ptr<tdesc_arch_data, tdesc_arch_data_deleter>;
/* Update GDBARCH to use the TARGET_DESC for registers. TARGET_DESC
may be GDBARCH's target description or (if GDBARCH does not have
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index c4ebb823126..a9921594727 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -52,8 +52,8 @@ struct trace_file_writer_deleter
/* A unique_ptr specialization for trace_file_writer. */
-typedef std::unique_ptr<trace_file_writer, trace_file_writer_deleter>
- trace_file_writer_up;
+using trace_file_writer_up
+ = std::unique_ptr<trace_file_writer, trace_file_writer_deleter>;
/* Save tracepoint data to file named FILENAME through WRITER. WRITER
determines the trace file format. If TARGET_DOES_SAVE is non-zero,
diff --git a/gdb/xml-support.h b/gdb/xml-support.h
index c840dd3a082..95e21499345 100644
--- a/gdb/xml-support.h
+++ b/gdb/xml-support.h
@@ -142,9 +142,9 @@ enum gdb_xml_element_flag
fixed offsets can be used to find any non-optional attributes as
long as no optional attributes precede them. */
-typedef void (gdb_xml_element_start_handler)
- (struct gdb_xml_parser *parser, const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes);
+using gdb_xml_element_start_handler
+ = void (struct gdb_xml_parser *parser, const struct gdb_xml_element *element,
+ void *user_data, std::vector<gdb_xml_value> &attributes);
/* A handler called at the end of an element.
diff --git a/gdbserver/netbsd-low.cc b/gdbserver/netbsd-low.cc
index ddbf0b97f54..326b4d55860 100644
--- a/gdbserver/netbsd-low.cc
+++ b/gdbserver/netbsd-low.cc
@@ -741,8 +741,8 @@ template <typename T>
int get_phdr_phnum_from_proc_auxv (const pid_t pid,
CORE_ADDR *phdr_memaddr, int *num_phdr)
{
- typedef typename std::conditional<sizeof(T) == sizeof(int64_t),
- Aux64Info, Aux32Info>::type auxv_type;
+ using auxv_type = typename std::conditional<sizeof(T) == sizeof(int64_t),
+ Aux64Info, Aux32Info>::type;
const size_t auxv_size = sizeof (auxv_type);
const size_t auxv_buf_size = 128 * sizeof (auxv_type);
@@ -791,8 +791,8 @@ template <typename T>
static CORE_ADDR
get_dynamic (const pid_t pid)
{
- typedef typename std::conditional<sizeof(T) == sizeof(int64_t),
- Elf64_Phdr, Elf32_Phdr>::type phdr_type;
+ using phdr_type = typename std::conditional<sizeof(T) == sizeof(int64_t),
+ Elf64_Phdr, Elf32_Phdr>::type;
const int phdr_size = sizeof (phdr_type);
CORE_ADDR phdr_memaddr;
@@ -853,8 +853,8 @@ template <typename T>
static CORE_ADDR
get_r_debug (const pid_t pid)
{
- typedef typename std::conditional<sizeof(T) == sizeof(int64_t),
- Elf64_Dyn, Elf32_Dyn>::type dyn_type;
+ using dyn_type = typename std::conditional<sizeof(T) == sizeof(int64_t),
+ Elf64_Dyn, Elf32_Dyn>::type;
const int dyn_size = sizeof (dyn_type);
unsigned char buf[sizeof (dyn_type)]; /* The larger of the two. */
CORE_ADDR map = -1;
diff --git a/gdbsupport/gdb_splay_tree.h b/gdbsupport/gdb_splay_tree.h
index a72b515364a..62302d04b2f 100644
--- a/gdbsupport/gdb_splay_tree.h
+++ b/gdbsupport/gdb_splay_tree.h
@@ -36,7 +36,7 @@ struct splay_tree_deleter
/* A unique pointer to a splay tree. */
-typedef std::unique_ptr<splay_tree_s, gdb::splay_tree_deleter>
- gdb_splay_tree_up;
+using gdb_splay_tree_up
+ = std::unique_ptr<splay_tree_s, gdb::splay_tree_deleter>;
#endif /* GDBSUPPORT_GDB_SPLAY_TREE_H */
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 06/12] [gdb] Convert function typedefs to using
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (4 preceding siblings ...)
2026-06-16 6:22 ` [PATCH 05/12] [gdb] Convert template " Tom de Vries
@ 2026-06-16 6:22 ` Tom de Vries
2026-06-16 6:22 ` [PATCH 07/12] [gdb] Fix redundant struct typedefs Tom de Vries
` (6 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
Convert "typedef void foo ()" to "using foo = void ()".
Generated by a script written by Claude Code.
---
gdb/ada-exp.h | 8 ++--
gdb/command.h | 18 ++++----
gdb/completer.h | 2 +-
gdb/expop.h | 16 ++++----
gdb/extension.h | 14 +++----
gdb/f-exp.h | 12 +++---
gdb/frame-base.h | 12 +++---
gdb/frame-unwind.h | 21 +++++-----
gdb/gdbarch.h | 6 +--
gdb/ia64-libunwind-tdep.c | 26 ++++++------
gdb/linux-tdep.c | 4 +-
gdb/m32c-tdep.c | 12 +++---
gdb/macrotab.h | 8 ++--
gdb/mi/mi-cmds.h | 4 +-
gdb/nat/gdb_thread_db.h | 52 +++++++++++------------
gdb/regset.h | 10 ++---
gdb/rs6000-tdep.c | 4 +-
gdb/sol-thread.c | 86 +++++++++++++++++++--------------------
gdb/stap-probe.c | 2 +-
gdb/svr4-tls-tdep.h | 12 +++---
gdb/symtab.h | 7 ++--
gdb/target.h | 5 +--
gdb/xml-support.h | 6 +--
gdbserver/server.cc | 4 +-
24 files changed, 175 insertions(+), 176 deletions(-)
diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h
index 134f767ae5e..be9b441d0c1 100644
--- a/gdb/ada-exp.h
+++ b/gdb/ada-exp.h
@@ -372,10 +372,10 @@ class ada_var_msym_value_operation
using operation::do_generate_ax;
};
-typedef struct value *ada_atr_ftype (struct expression *exp,
- enum noside noside,
- struct type *type,
- struct value *arg);
+using ada_atr_ftype = struct value * (struct expression *exp,
+ enum noside noside,
+ struct type *type,
+ struct value *arg);
/* Implement several Ada attributes. */
template<ada_atr_ftype FUNC>
diff --git a/gdb/command.h b/gdb/command.h
index 36287d657f9..7640bd33ca4 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -507,7 +507,7 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
struct cmd_list_element
**);
-typedef void cmd_func_ftype (const char *args, int from_tty,
+using cmd_func_ftype = void (const char *args, int from_tty,
cmd_list_element *c);
/* A completion routine. Add possible completions to tracker.
@@ -519,14 +519,14 @@ typedef void cmd_func_ftype (const char *args, int from_tty,
relative to this position. For example, suppose TEXT is "foo" and
we want to complete to "foobar". If WORD is "oo", return "oobar";
if WORD is "baz/foo", return "baz/foobar". */
-typedef void completer_ftype (struct cmd_list_element *,
+using completer_ftype = void (struct cmd_list_element *,
completion_tracker &tracker,
const char *text, const char *word);
/* Same, but for set_cmd_completer_handle_brkchars. */
-typedef void completer_handle_brkchars_ftype (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *text, const char *word);
+using completer_handle_brkchars_ftype
+ = void (struct cmd_list_element *, completion_tracker &tracker,
+ const char *text, const char *word);
extern void set_cmd_completer (struct cmd_list_element *, completer_ftype *);
@@ -668,10 +668,10 @@ extern void help_list (struct cmd_list_element *, const char *,
command_classes, struct ui_file *);
/* Method for show a set/show variable's VALUE on FILE. */
-typedef void (show_value_ftype) (struct ui_file *file,
- int from_tty,
- struct cmd_list_element *cmd,
- const char *value);
+using show_value_ftype = void (struct ui_file *file,
+ int from_tty,
+ struct cmd_list_element *cmd,
+ const char *value);
/* Various sets of extra literals accepted. */
extern const literal_def integer_unlimited_literals[];
diff --git a/gdb/completer.h b/gdb/completer.h
index c84ce3ec28a..6e8f5e62d86 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -26,7 +26,7 @@ struct match_list_displayer;
using mld_crlf_ftype = void (const struct match_list_displayer *);
using mld_putch_ftype = void (const struct match_list_displayer *, int);
-typedef void mld_puts_ftype (const struct match_list_displayer *,
+using mld_puts_ftype = void (const struct match_list_displayer *,
const char *);
using mld_flush_ftype = void (const struct match_list_displayer *);
using mld_erase_entire_line_ftype = void (const struct match_list_displayer *);
diff --git a/gdb/expop.h b/gdb/expop.h
index 41331c4a780..6d6f4acdc24 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -1271,10 +1271,10 @@ class sub_operation
}
};
-typedef struct value *binary_ftype (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2);
+using binary_ftype = struct value * (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside, enum exp_opcode op,
+ struct value *arg1, struct value *arg2);
template<enum exp_opcode OP, binary_ftype FUNC>
class binop_operation
@@ -1450,10 +1450,10 @@ class comma_operation
override;
};
-typedef struct value *unary_ftype (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1);
+using unary_ftype = struct value * (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside, enum exp_opcode op,
+ struct value *arg1);
/* Base class for unary operations. */
template<enum exp_opcode OP, unary_ftype FUNC>
diff --git a/gdb/extension.h b/gdb/extension.h
index b7bbf2a502d..38a2ca5f887 100644
--- a/gdb/extension.h
+++ b/gdb/extension.h
@@ -41,21 +41,21 @@ struct program_space;
/* A function to load and process a script file.
The file has been opened and is ready to be read from the beginning.
Any exceptions are not caught, and are passed to the caller. */
-typedef void script_sourcer_func (const struct extension_language_defn *,
+using script_sourcer_func = void (const struct extension_language_defn *,
FILE *stream, const char *filename);
/* A function to load and process a script for an objfile.
The file has been opened and is ready to be read from the beginning.
Any exceptions are not caught, and are passed to the caller. */
-typedef void objfile_script_sourcer_func
- (const struct extension_language_defn *,
- struct objfile *, FILE *stream, const char *filename);
+using objfile_script_sourcer_func
+ = void (const struct extension_language_defn *,
+ struct objfile *, FILE *stream, const char *filename);
/* A function to execute a script for an objfile.
Any exceptions are not caught, and are passed to the caller. */
-typedef void objfile_script_executor_func
- (const struct extension_language_defn *,
- struct objfile *, const char *name, const char *script);
+using objfile_script_executor_func
+ = void (const struct extension_language_defn *,
+ struct objfile *, const char *name, const char *script);
/* Enum of each extension(/scripting) language. */
diff --git a/gdb/f-exp.h b/gdb/f-exp.h
index 71ec3128515..1b2e75fb49e 100644
--- a/gdb/f-exp.h
+++ b/gdb/f-exp.h
@@ -198,9 +198,9 @@ namespace expr
/* Function prototype for Fortran intrinsic functions taking one argument and
one kind argument. */
-typedef value *binary_kind_ftype (type *expect_type, expression *exp,
- noside noside, exp_opcode op, value *arg1,
- type *kind_arg);
+using binary_kind_ftype = value * (type *expect_type, expression *exp,
+ noside noside, exp_opcode op, value *arg1,
+ type *kind_arg);
/* Two-argument operation with the second argument being a kind argument. */
template<exp_opcode OP, binary_kind_ftype FUNC>
@@ -224,9 +224,9 @@ class fortran_kind_2arg
/* Function prototype for Fortran intrinsic functions taking two arguments and
one kind argument. */
-typedef value *ternary_kind_ftype (type *expect_type, expression *exp,
- noside noside, exp_opcode op, value *arg1,
- value *arg2, type *kind_arg);
+using ternary_kind_ftype = value * (type *expect_type, expression *exp,
+ noside noside, exp_opcode op, value *arg1,
+ value *arg2, type *kind_arg);
/* Three-argument operation with the third argument being a kind argument. */
template<exp_opcode OP, ternary_kind_ftype FUNC>
diff --git a/gdb/frame-base.h b/gdb/frame-base.h
index 723d2ba56d3..d8cdc0a98b9 100644
--- a/gdb/frame-base.h
+++ b/gdb/frame-base.h
@@ -42,18 +42,18 @@ struct regcache;
/* A generic base address. */
-typedef CORE_ADDR (frame_this_base_ftype) (const frame_info_ptr &this_frame,
- void **this_base_cache);
+using frame_this_base_ftype = CORE_ADDR (const frame_info_ptr &this_frame,
+ void **this_base_cache);
/* The base address of the frame's local variables. */
-typedef CORE_ADDR (frame_this_locals_ftype) (const frame_info_ptr &this_frame,
- void **this_base_cache);
+using frame_this_locals_ftype = CORE_ADDR (const frame_info_ptr &this_frame,
+ void **this_base_cache);
/* The base address of the frame's arguments / parameters. */
-typedef CORE_ADDR (frame_this_args_ftype) (const frame_info_ptr &this_frame,
- void **this_base_cache);
+using frame_this_args_ftype = CORE_ADDR (const frame_info_ptr &this_frame,
+ void **this_base_cache);
struct frame_base
{
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index 3cff06b0ede..a1edb92a4ad 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -49,12 +49,13 @@ struct value;
cases (0 return) is invalid. In case of exception, the caller has
to set *THIS_PROLOGUE_CACHE to NULL. */
-typedef int (frame_sniffer_ftype) (const struct frame_unwind *self,
- const frame_info_ptr &this_frame,
- void **this_prologue_cache);
+using frame_sniffer_ftype = int (const struct frame_unwind *self,
+ const frame_info_ptr &this_frame,
+ void **this_prologue_cache);
-typedef unwind_stop_reason (frame_unwind_stop_reason_ftype)
- (const frame_info_ptr &this_frame, void **this_prologue_cache);
+using frame_unwind_stop_reason_ftype
+ = unwind_stop_reason (const frame_info_ptr &this_frame,
+ void **this_prologue_cache);
/* A default frame sniffer which always accepts the frame. Used by
fallback prologue unwinders. */
@@ -105,9 +106,9 @@ extern CORE_ADDR default_unwind_sp (struct gdbarch *gdbarch,
with the other unwind methods. Memory for that cache should be
allocated using frame_obstack_zalloc. */
-typedef void (frame_this_id_ftype) (const frame_info_ptr &this_frame,
- void **this_prologue_cache,
- struct frame_id *this_id);
+using frame_this_id_ftype = void (const frame_info_ptr &this_frame,
+ void **this_prologue_cache,
+ struct frame_id *this_id);
/* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
use THIS frame, and implicitly the NEXT frame's register unwind
@@ -146,8 +147,8 @@ typedef value *(frame_prev_register_ftype) (const frame_info_ptr &this_frame,
/* Deallocate extra memory associated with the frame cache if any. */
-typedef void (frame_dealloc_cache_ftype) (frame_info *self,
- void *this_cache);
+using frame_dealloc_cache_ftype = void (frame_info *self,
+ void *this_cache);
/* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
use THIS frame, and implicitly the NEXT frame's register unwind
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 1e3270911dc..70a2c5a84aa 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -84,9 +84,9 @@ using gdbarch_tdep_up = std::unique_ptr<gdbarch_tdep_base>;
is used for diagnostic messages. CB_DATA should have been passed
unchanged through the iterator. */
-typedef void (iterate_over_regset_sections_cb)
- (const char *sect_name, int supply_size, int collect_size,
- const struct regset *regset, const char *human_name, void *cb_data);
+using iterate_over_regset_sections_cb
+ = void (const char *sect_name, int supply_size, int collect_size,
+ const struct regset *regset, const char *human_name, void *cb_data);
/* For a function call, does the function return a value using a
normal value return or a structure return - passing a hidden
diff --git a/gdb/ia64-libunwind-tdep.c b/gdb/ia64-libunwind-tdep.c
index d62ff195ff1..5911a8f8add 100644
--- a/gdb/ia64-libunwind-tdep.c
+++ b/gdb/ia64-libunwind-tdep.c
@@ -60,30 +60,30 @@ static const registry<gdbarch>::key<libunwind_descr> libunwind_descr_handle;
/* Required function pointers from libunwind. */
using unw_get_reg_p_ftype = int (unw_cursor_t *, unw_regnum_t, unw_word_t *);
static unw_get_reg_p_ftype *unw_get_reg_p;
-typedef int (unw_get_fpreg_p_ftype) (unw_cursor_t *, unw_regnum_t,
- unw_fpreg_t *);
+using unw_get_fpreg_p_ftype = int (unw_cursor_t *, unw_regnum_t,
+ unw_fpreg_t *);
static unw_get_fpreg_p_ftype *unw_get_fpreg_p;
-typedef int (unw_get_saveloc_p_ftype) (unw_cursor_t *, unw_regnum_t,
- unw_save_loc_t *);
+using unw_get_saveloc_p_ftype = int (unw_cursor_t *, unw_regnum_t,
+ unw_save_loc_t *);
static unw_get_saveloc_p_ftype *unw_get_saveloc_p;
using unw_is_signal_frame_p_ftype = int (unw_cursor_t *);
static unw_is_signal_frame_p_ftype *unw_is_signal_frame_p;
using unw_step_p_ftype = int (unw_cursor_t *);
static unw_step_p_ftype *unw_step_p;
-typedef int (unw_init_remote_p_ftype) (unw_cursor_t *, unw_addr_space_t,
- void *);
+using unw_init_remote_p_ftype = int (unw_cursor_t *, unw_addr_space_t,
+ void *);
static unw_init_remote_p_ftype *unw_init_remote_p;
-typedef unw_addr_space_t (unw_create_addr_space_p_ftype) (unw_accessors_t *,
- int);
+using unw_create_addr_space_p_ftype
+ = unw_addr_space_t (unw_accessors_t *, int);
static unw_create_addr_space_p_ftype *unw_create_addr_space_p;
using unw_destroy_addr_space_p_ftype = void (unw_addr_space_t);
static unw_destroy_addr_space_p_ftype *unw_destroy_addr_space_p;
-typedef int (unw_search_unwind_table_p_ftype) (unw_addr_space_t, unw_word_t,
- unw_dyn_info_t *,
- unw_proc_info_t *, int, void *);
+using unw_search_unwind_table_p_ftype
+ = int (unw_addr_space_t, unw_word_t, unw_dyn_info_t *,
+ unw_proc_info_t *, int, void *);
static unw_search_unwind_table_p_ftype *unw_search_unwind_table_p;
-typedef unw_word_t (unw_find_dyn_list_p_ftype) (unw_addr_space_t,
- unw_dyn_info_t *, void *);
+using unw_find_dyn_list_p_ftype = unw_word_t (unw_addr_space_t,
+ unw_dyn_info_t *, void *);
static unw_find_dyn_list_p_ftype *unw_find_dyn_list_p;
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index a7381677498..61bcda60bd8 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1439,8 +1439,8 @@ using linux_find_memory_region_ftype
bool /* hole */,
const std::string & /* filename */)>;
-typedef bool linux_dump_mapping_p_ftype (filter_flags filterflags,
- const smaps_data &map);
+using linux_dump_mapping_p_ftype
+ = bool (filter_flags filterflags, const smaps_data &map);
/* Parse a KEY value out of a /proc/pid/smaps line. KEYWORD is the
keyword that was extracted out of the LINE we're considering.
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index a06a601dee3..5c828d1880b 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -39,13 +39,13 @@ static const reggroup *m32c_dma_reggroup;
/* The type of a function that moves the value of REG between CACHE or
BUF --- in either direction. */
-typedef enum register_status (m32c_write_reg_t) (struct m32c_reg *reg,
- struct regcache *cache,
- const gdb_byte *buf);
+using m32c_write_reg_t = enum register_status (struct m32c_reg *reg,
+ struct regcache *cache,
+ const gdb_byte *buf);
-typedef enum register_status (m32c_read_reg_t) (struct m32c_reg *reg,
- readable_regcache *cache,
- gdb_byte *buf);
+using m32c_read_reg_t = enum register_status (struct m32c_reg *reg,
+ readable_regcache *cache,
+ gdb_byte *buf);
struct m32c_reg
{
diff --git a/gdb/macrotab.h b/gdb/macrotab.h
index 1a4c46a1cb1..47eb7890bf6 100644
--- a/gdb/macrotab.h
+++ b/gdb/macrotab.h
@@ -335,10 +335,10 @@ struct macro_source_file *macro_definition_location
is the name of the macro, and DEFINITION is the definition. SOURCE
is the file at the start of the include path, and LINE is the line
number of the SOURCE file where the macro was defined. */
-typedef void (macro_callback_fn) (const char *name,
- const struct macro_definition *definition,
- struct macro_source_file *source,
- int line);
+using macro_callback_fn = void (const char *name,
+ const struct macro_definition *definition,
+ struct macro_source_file *source,
+ int line);
/* Call the callable FN for each macro in the macro table TABLE. */
void macro_for_each (struct macro_table *table,
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index 81c4f0b4e37..108ff645107 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -33,8 +33,8 @@ enum print_values {
PRINT_SIMPLE_VALUES
};
-typedef void (mi_cmd_argv_ftype) (const char *command, const char *const *argv,
- int argc);
+using mi_cmd_argv_ftype = void (const char *command, const char *const *argv,
+ int argc);
/* Declarations of the functions implementing each command. */
diff --git a/gdb/nat/gdb_thread_db.h b/gdb/nat/gdb_thread_db.h
index c40c1a407a0..5a3bb5f4389 100644
--- a/gdb/nat/gdb_thread_db.h
+++ b/gdb/nat/gdb_thread_db.h
@@ -39,36 +39,36 @@
using td_init_ftype = td_err_e (void);
-typedef td_err_e (td_ta_new_ftype) (struct ps_prochandle * ps,
- td_thragent_t **ta);
+using td_ta_new_ftype = td_err_e (struct ps_prochandle * ps,
+ td_thragent_t **ta);
using td_ta_delete_ftype = td_err_e (td_thragent_t *ta_p);
-typedef td_err_e (td_ta_map_lwp2thr_ftype) (const td_thragent_t *ta,
- lwpid_t lwpid, td_thrhandle_t *th);
-typedef td_err_e (td_ta_thr_iter_ftype) (const td_thragent_t *ta,
- td_thr_iter_f *callback, void *cbdata_p,
- td_thr_state_e state, int ti_pri,
- sigset_t *ti_sigmask_p,
- unsigned int ti_user_flags);
-typedef td_err_e (td_ta_event_addr_ftype) (const td_thragent_t *ta,
- td_event_e event, td_notify_t *ptr);
-typedef td_err_e (td_ta_set_event_ftype) (const td_thragent_t *ta,
+using td_ta_map_lwp2thr_ftype = td_err_e (const td_thragent_t *ta,
+ lwpid_t lwpid, td_thrhandle_t *th);
+using td_ta_thr_iter_ftype = td_err_e (const td_thragent_t *ta,
+ td_thr_iter_f *callback, void *cbdata_p,
+ td_thr_state_e state, int ti_pri,
+ sigset_t *ti_sigmask_p,
+ unsigned int ti_user_flags);
+using td_ta_event_addr_ftype = td_err_e (const td_thragent_t *ta,
+ td_event_e event, td_notify_t *ptr);
+using td_ta_set_event_ftype = td_err_e (const td_thragent_t *ta,
+ td_thr_events_t *event);
+using td_ta_clear_event_ftype = td_err_e (const td_thragent_t *ta,
td_thr_events_t *event);
-typedef td_err_e (td_ta_clear_event_ftype) (const td_thragent_t *ta,
- td_thr_events_t *event);
-typedef td_err_e (td_ta_event_getmsg_ftype) (const td_thragent_t *ta,
- td_event_msg_t *msg);
+using td_ta_event_getmsg_ftype = td_err_e (const td_thragent_t *ta,
+ td_event_msg_t *msg);
-typedef td_err_e (td_thr_get_info_ftype) (const td_thrhandle_t *th,
- td_thrinfo_t *infop);
-typedef td_err_e (td_thr_event_enable_ftype) (const td_thrhandle_t *th,
- int event);
+using td_thr_get_info_ftype = td_err_e (const td_thrhandle_t *th,
+ td_thrinfo_t *infop);
+using td_thr_event_enable_ftype = td_err_e (const td_thrhandle_t *th,
+ int event);
-typedef td_err_e (td_thr_tls_get_addr_ftype) (const td_thrhandle_t *th,
- psaddr_t map_address,
- size_t offset, psaddr_t *address);
-typedef td_err_e (td_thr_tlsbase_ftype) (const td_thrhandle_t *th,
- unsigned long int modid,
- psaddr_t *base);
+using td_thr_tls_get_addr_ftype = td_err_e (const td_thrhandle_t *th,
+ psaddr_t map_address,
+ size_t offset, psaddr_t *address);
+using td_thr_tlsbase_ftype = td_err_e (const td_thrhandle_t *th,
+ unsigned long int modid,
+ psaddr_t *base);
using td_symbol_list_ftype = const char ** (void);
using td_ta_delete_ftype = td_err_e (td_thragent_t *);
diff --git a/gdb/regset.h b/gdb/regset.h
index 94fa74e9ec7..b63b026c756 100644
--- a/gdb/regset.h
+++ b/gdb/regset.h
@@ -25,11 +25,11 @@ struct regcache;
/* Data structure describing a register set. */
-typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
- int, const void *, size_t);
-typedef void (collect_regset_ftype) (const struct regset *,
- const struct regcache *,
- int, void *, size_t);
+using supply_regset_ftype = void (const struct regset *, struct regcache *,
+ int, const void *, size_t);
+using collect_regset_ftype = void (const struct regset *,
+ const struct regcache *,
+ int, void *, size_t);
struct regset
{
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index a63f138047a..a248ec9b738 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -822,8 +822,8 @@ rs6000_fetch_pointer_argument (const frame_info_ptr &frame, int argi,
constexpr gdb_byte big_breakpoint[] = { 0x7f, 0xe0, 0x00, 0x08 };
constexpr gdb_byte little_breakpoint[] = { 0x08, 0x00, 0xe0, 0x7f };
-typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint)
- rs6000_breakpoint;
+using rs6000_breakpoint
+ = BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint);
/* Instruction masks for displaced stepping. */
#define OP_MASK 0xfc000000
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index e9dc48208bb..8151f7e3a56 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -133,53 +133,53 @@ static int sol_thread_active = 0;
/* Types of the libthread_db functions. */
using td_log_ftype = void (const int on_off);
-typedef td_err_e (td_ta_new_ftype)(const struct ps_prochandle *ph_p,
- td_thragent_t **ta_pp);
+using td_ta_new_ftype = td_err_e (const struct ps_prochandle *ph_p,
+ td_thragent_t **ta_pp);
using td_ta_delete_ftype = td_err_e (td_thragent_t *ta_p);
using td_init_ftype = td_err_e (void);
-typedef td_err_e (td_ta_get_ph_ftype)(const td_thragent_t *ta_p,
- struct ps_prochandle **ph_pp);
-typedef td_err_e (td_ta_get_nthreads_ftype)(const td_thragent_t *ta_p,
- int *nthread_p);
-typedef td_err_e (td_ta_tsd_iter_ftype)(const td_thragent_t *ta_p,
- td_key_iter_f *cb, void *cbdata_p);
-typedef td_err_e (td_ta_thr_iter_ftype)(const td_thragent_t *ta_p,
- td_thr_iter_f *cb, void *cbdata_p,
- td_thr_state_e state, int ti_pri,
- sigset_t *ti_sigmask_p,
- unsigned ti_user_flags);
+using td_ta_get_ph_ftype = td_err_e (const td_thragent_t *ta_p,
+ struct ps_prochandle **ph_pp);
+using td_ta_get_nthreads_ftype = td_err_e (const td_thragent_t *ta_p,
+ int *nthread_p);
+using td_ta_tsd_iter_ftype = td_err_e (const td_thragent_t *ta_p,
+ td_key_iter_f *cb, void *cbdata_p);
+using td_ta_thr_iter_ftype = td_err_e (const td_thragent_t *ta_p,
+ td_thr_iter_f *cb, void *cbdata_p,
+ td_thr_state_e state, int ti_pri,
+ sigset_t *ti_sigmask_p,
+ unsigned ti_user_flags);
using td_thr_validate_ftype = td_err_e (const td_thrhandle_t *th_p);
-typedef td_err_e (td_thr_tsd_ftype)(const td_thrhandle_t * th_p,
- const thread_key_t key, void **data_pp);
-typedef td_err_e (td_thr_get_info_ftype)(const td_thrhandle_t *th_p,
- td_thrinfo_t *ti_p);
-typedef td_err_e (td_thr_getfpregs_ftype)(const td_thrhandle_t *th_p,
- prfpregset_t *fpregset);
-typedef td_err_e (td_thr_getxregsize_ftype)(const td_thrhandle_t *th_p,
- int *xregsize);
-typedef td_err_e (td_thr_getxregs_ftype)(const td_thrhandle_t *th_p,
- const caddr_t xregset);
-typedef td_err_e (td_thr_sigsetmask_ftype)(const td_thrhandle_t *th_p,
- const sigset_t ti_sigmask);
-typedef td_err_e (td_thr_setprio_ftype)(const td_thrhandle_t *th_p,
- const int ti_pri);
-typedef td_err_e (td_thr_setsigpending_ftype)(const td_thrhandle_t *th_p,
- const uchar_t ti_pending_flag,
- const sigset_t ti_pending);
-typedef td_err_e (td_thr_setfpregs_ftype)(const td_thrhandle_t *th_p,
- const prfpregset_t *fpregset);
-typedef td_err_e (td_thr_setxregs_ftype)(const td_thrhandle_t *th_p,
- const caddr_t xregset);
-typedef td_err_e (td_ta_map_id2thr_ftype)(const td_thragent_t *ta_p,
- thread_t tid,
+using td_thr_tsd_ftype = td_err_e (const td_thrhandle_t * th_p,
+ const thread_key_t key, void **data_pp);
+using td_thr_get_info_ftype = td_err_e (const td_thrhandle_t *th_p,
+ td_thrinfo_t *ti_p);
+using td_thr_getfpregs_ftype = td_err_e (const td_thrhandle_t *th_p,
+ prfpregset_t *fpregset);
+using td_thr_getxregsize_ftype = td_err_e (const td_thrhandle_t *th_p,
+ int *xregsize);
+using td_thr_getxregs_ftype = td_err_e (const td_thrhandle_t *th_p,
+ const caddr_t xregset);
+using td_thr_sigsetmask_ftype = td_err_e (const td_thrhandle_t *th_p,
+ const sigset_t ti_sigmask);
+using td_thr_setprio_ftype = td_err_e (const td_thrhandle_t *th_p,
+ const int ti_pri);
+using td_thr_setsigpending_ftype
+ = td_err_e (const td_thrhandle_t *th_p, const uchar_t ti_pending_flag,
+ const sigset_t ti_pending);
+using td_thr_setfpregs_ftype = td_err_e (const td_thrhandle_t *th_p,
+ const prfpregset_t *fpregset);
+using td_thr_setxregs_ftype = td_err_e (const td_thrhandle_t *th_p,
+ const caddr_t xregset);
+using td_ta_map_id2thr_ftype = td_err_e (const td_thragent_t *ta_p,
+ thread_t tid,
+ td_thrhandle_t *th_p);
+using td_ta_map_lwp2thr_ftype = td_err_e (const td_thragent_t *ta_p,
+ lwpid_t lwpid,
td_thrhandle_t *th_p);
-typedef td_err_e (td_ta_map_lwp2thr_ftype)(const td_thragent_t *ta_p,
- lwpid_t lwpid,
- td_thrhandle_t *th_p);
-typedef td_err_e (td_thr_getgregs_ftype)(const td_thrhandle_t *th_p,
- prgregset_t regset);
-typedef td_err_e (td_thr_setgregs_ftype)(const td_thrhandle_t *th_p,
- const prgregset_t regset);
+using td_thr_getgregs_ftype = td_err_e (const td_thrhandle_t *th_p,
+ prgregset_t regset);
+using td_thr_setgregs_ftype = td_err_e (const td_thrhandle_t *th_p,
+ const prgregset_t regset);
/* Pointers to routines from libthread_db resolved by dlopen(). */
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index d28cee8168c..986ff38c586 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -429,7 +429,7 @@ stap_get_opcode (const char **s)
return op;
}
-typedef expr::operation_up binop_maker_ftype (expr::operation_up &&,
+using binop_maker_ftype = expr::operation_up (expr::operation_up &&,
expr::operation_up &&);
/* Map from an expression opcode to a function that can create a
binary operation of that type. */
diff --git a/gdb/svr4-tls-tdep.h b/gdb/svr4-tls-tdep.h
index 6c747218fc2..50a964b8f0e 100644
--- a/gdb/svr4-tls-tdep.h
+++ b/gdb/svr4-tls-tdep.h
@@ -31,15 +31,15 @@ enum svr4_tls_libc
/* Function type for "get_tls_dtv_addr" method. */
-typedef CORE_ADDR (get_tls_dtv_addr_ftype) (struct gdbarch *gdbarch,
- ptid_t ptid,
- enum svr4_tls_libc libc);
+using get_tls_dtv_addr_ftype = CORE_ADDR (struct gdbarch *gdbarch,
+ ptid_t ptid,
+ enum svr4_tls_libc libc);
/* Function type for "get_tls_dtp_offset" method. */
-typedef CORE_ADDR (get_tls_dtp_offset_ftype) (struct gdbarch *gdbarch,
- ptid_t ptid,
- enum svr4_tls_libc libc);
+using get_tls_dtp_offset_ftype = CORE_ADDR (struct gdbarch *gdbarch,
+ ptid_t ptid,
+ enum svr4_tls_libc libc);
/* Register architecture specific methods for fetching the TLS DTV
and TLS DTP, used by linux_get_thread_local_address. */
diff --git a/gdb/symtab.h b/gdb/symtab.h
index b29b72aba00..a181e3175f2 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -391,10 +391,9 @@ class lookup_name_info final
LOOKUP_NAME. E.g., in C++, in linespec/wild mode, if the symbol is
"foo::function()" and LOOKUP_NAME is "function(", MATCH_FOR_LCD
points to "function()" inside SYMBOL_SEARCH_NAME. */
-typedef bool (symbol_name_matcher_ftype)
- (const char *symbol_search_name,
- const lookup_name_info &lookup_name,
- completion_match_result *comp_match_res);
+using symbol_name_matcher_ftype
+ = bool (const char *symbol_search_name, const lookup_name_info &lookup_name,
+ completion_match_result *comp_match_res);
/* Some of the structures in this file are space critical.
The space-critical structures are:
diff --git a/gdb/target.h b/gdb/target.h
index 34f5e817635..6d1c21f29f6 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -237,9 +237,8 @@ enum target_xfer_status
extern const char *
target_xfer_status_to_string (enum target_xfer_status status);
-typedef enum target_xfer_status
- target_xfer_partial_ftype (struct target_ops *ops,
- enum target_object object,
+using target_xfer_partial_ftype
+ = enum target_xfer_status (struct target_ops *ops, enum target_object object,
const char *annex,
gdb_byte *readbuf,
const gdb_byte *writebuf,
diff --git a/gdb/xml-support.h b/gdb/xml-support.h
index 95e21499345..a15b60689c0 100644
--- a/gdb/xml-support.h
+++ b/gdb/xml-support.h
@@ -152,9 +152,9 @@ using gdb_xml_element_start_handler
is any accumulated body text inside the element, with leading and
trailing whitespace removed. It will never be NULL. */
-typedef void (gdb_xml_element_end_handler)
- (struct gdb_xml_parser *, const struct gdb_xml_element *,
- void *user_data, const char *body_text);
+using gdb_xml_element_end_handler
+ = void (struct gdb_xml_parser *, const struct gdb_xml_element *,
+ void *user_data, const char *body_text);
/* An expected element and the handlers to call when it is
encountered. Arrays of struct gdb_xml_element are terminated
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index baccdf00172..ba172b2f332 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -3129,8 +3129,8 @@ static void gdb_wants_all_threads_stopped (void);
static void resume (struct thread_resume *actions, size_t n);
/* The callback that is passed to visit_actioned_threads. */
-typedef int (visit_actioned_threads_callback_ftype)
- (const struct thread_resume *, thread_info *);
+using visit_actioned_threads_callback_ftype
+ = int (const struct thread_resume *, thread_info *);
/* Call CALLBACK for any thread to which ACTIONS applies to. Returns
true if CALLBACK returns true. Returns false if no matching thread
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 07/12] [gdb] Fix redundant struct typedefs
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (5 preceding siblings ...)
2026-06-16 6:22 ` [PATCH 06/12] [gdb] Convert function " Tom de Vries
@ 2026-06-16 6:22 ` Tom de Vries
2026-06-16 6:22 ` [PATCH 08/12] [gdb] Convert anonymous " Tom de Vries
` (5 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
Convert "typedef struct foo { ... } foo" into "struct foo { ... }".
Generated by a script written by Claude Code.
---
gdb/procfs.c | 4 ++--
gdbserver/tracepoint.cc | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 64a71ea2883..8d96bf588da 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -224,7 +224,7 @@ procfs_target::auxv_parse (const gdb_byte **readptr,
#define STATUS_PROC_NAME_FMT "/proc/%d/status"
#define MAX_PROC_NAME_SIZE sizeof("/proc/999999/lwp/0123456789/lwpstatus")
-typedef struct procinfo {
+struct procinfo {
struct procinfo *next;
int pid; /* Process ID */
int tid; /* Thread/LWP id */
@@ -253,7 +253,7 @@ typedef struct procinfo {
int gregs_valid : 1;
int fpregs_valid : 1;
int threads_valid: 1;
-} procinfo;
+};
/* Function prototypes for procinfo module: */
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc
index e5d95726422..593dca65f76 100644
--- a/gdbserver/tracepoint.cc
+++ b/gdbserver/tracepoint.cc
@@ -5094,7 +5094,7 @@ fast_tracepoint_from_ipa_tpoint_address (CORE_ADDR ipa_tpoint_obj)
/* The type of the object that is used to synchronize fast tracepoint
collection. */
-typedef struct collecting_t
+struct collecting_t
{
/* The fast tracepoint number currently collecting. */
uintptr_t tpoint;
@@ -5107,7 +5107,7 @@ typedef struct collecting_t
register, which is readable with a single insn on several
architectures. */
uintptr_t thread_area;
-} collecting_t;
+};
#ifndef IN_PROCESS_AGENT
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 08/12] [gdb] Convert anonymous struct typedefs
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (6 preceding siblings ...)
2026-06-16 6:22 ` [PATCH 07/12] [gdb] Fix redundant struct typedefs Tom de Vries
@ 2026-06-16 6:22 ` Tom de Vries
2026-06-16 6:22 ` [PATCH 09/12] [gdb] Convert typedef of named struct Tom de Vries
` (4 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 09/12] [gdb] Convert typedef of named struct
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (7 preceding siblings ...)
2026-06-16 6:22 ` [PATCH 08/12] [gdb] Convert anonymous " Tom de Vries
@ 2026-06-16 6:22 ` 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
` (3 subsequent siblings)
12 siblings, 1 reply; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 10/12] [gdb] convert struct pointer typedefs
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (8 preceding siblings ...)
2026-06-16 6:22 ` [PATCH 09/12] [gdb] Convert typedef of named struct Tom de Vries
@ 2026-06-16 6:22 ` Tom de Vries
2026-06-16 6:22 ` [PATCH 11/12] [gdb] Convert typedef on separate line Tom de Vries
` (2 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
Convert "typedef struct foo { ... } *bar" to
"struct foo { ... }; using bar = foo *".
Generated by a script written by Claude Code.
---
gdbserver/notif.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdbserver/notif.h b/gdbserver/notif.h
index dc3164e91cd..caa2f36f66d 100644
--- a/gdbserver/notif.h
+++ b/gdbserver/notif.h
@@ -38,7 +38,7 @@ struct notif_event
/* A type notification to GDB. An object of 'struct notif_server'
represents a type of notification. */
-typedef struct notif_server
+struct notif_server
{
/* The name of ack packet, for example, 'vStopped'. */
const char *ack_name;
@@ -54,7 +54,8 @@ typedef struct notif_server
/* Write event EVENT to OWN_BUF. */
void (*write) (struct notif_event *event, char *own_buf);
-} *notif_server_p;
+};
+using notif_server_p = struct notif_server *;
extern struct notif_server notif_stop;
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 11/12] [gdb] Convert typedef on separate line
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (9 preceding siblings ...)
2026-06-16 6:22 ` [PATCH 10/12] [gdb] convert struct pointer typedefs Tom de Vries
@ 2026-06-16 6:22 ` 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
12 siblings, 0 replies; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
Convert "typedef struct foo { ... } bar" into "using bar = struct foo { ... }".
Variant where typedef is on its own line.
Generated by a script written by Claude Code.
---
gdb/cris-tdep.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 507f06e0aac..593c4f1e528 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -470,8 +470,7 @@ crisv32_single_step_through_delay (struct gdbarch *gdbarch,
/* The instruction environment needed to find single-step breakpoints. */
-typedef
-struct instruction_environment
+using inst_env_type = struct instruction_environment
{
unsigned long reg[NUM_GENREGS];
unsigned long preg[NUM_SPECREGS];
@@ -486,7 +485,7 @@ struct instruction_environment
int xflag_found;
int disable_interrupt;
enum bfd_endian byte_order;
-} inst_env_type;
+};
/* Machine-dependencies in CRIS for opcodes. */
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 12/12] [gdb] Use using in compat_x32_clock_t typedef
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (10 preceding siblings ...)
2026-06-16 6:22 ` [PATCH 11/12] [gdb] Convert typedef on separate line Tom de Vries
@ 2026-06-16 6:22 ` Tom de Vries
2026-06-26 16:05 ` [PATCH 00/12] [gdb] Use using instead of typedef some more Tom Tromey
12 siblings, 0 replies; 18+ messages in thread
From: Tom de Vries @ 2026-06-16 6:22 UTC (permalink / raw)
To: gdb-patches
In commit 6c85ef111b0 ("[gdb] Use using instead of typedef"), I did:
...
-typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t;
+using compat_x32_clock_t = long __attribute__ ((__aligned__ (4)));
...
which I had to revert because clang ignores the attribute in this variant.
Pedro suggested instead using:
...
using compat_x32_clock_t [[gnu::aligned (4)]] = long;
...
which does work with both clang and gcc.
[ Note that it's not a question of how the attribute is worded, this also works:
...
using compat_x32_clock_t __attribute__ ((__aligned__ (4))) = long;
...
It's just a question of where the attribute is placed. ]
Fix this by using Pedro's suggestion.
Suggested-By: Pedro Alves <pedro@palves.net>
---
gdb/nat/amd64-linux-siginfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c
index 99faccabf37..d524cb9f80a 100644
--- a/gdb/nat/amd64-linux-siginfo.c
+++ b/gdb/nat/amd64-linux-siginfo.c
@@ -203,7 +203,7 @@ struct compat_siginfo_t
};
/* For x32, clock_t in _sigchld is 64bit aligned at 4 bytes. */
-typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t;
+using compat_x32_clock_t [[gnu::aligned (4)]] = long;
struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo_t
{
--
2.51.0
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 00/12] [gdb] Use using instead of typedef some more
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
` (11 preceding siblings ...)
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 ` Tom Tromey
2026-07-13 13:07 ` Tom de Vries
12 siblings, 1 reply; 18+ messages in thread
From: Tom Tromey @ 2026-06-26 16:05 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
Tom> My understanding is that because the tranformation done by the
Tom> script is a trivial and mechanical transformation, there are no
Tom> copyright/licensing issues.
Seems reasonable to me.
I sent some notes on this series but this is ok with those fixed.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 18+ messages in thread