From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 01/12] [gdb] Use using instead of typedef some more (part 1)
Date: Tue, 16 Jun 2026 08:22:46 +0200 [thread overview]
Message-ID: <20260616062257.3164438-2-tdevries@suse.de> (raw)
In-Reply-To: <20260616062257.3164438-1-tdevries@suse.de>
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
next prev parent reply other threads:[~2026-06-16 6:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
2026-06-16 6:22 ` Tom de Vries [this message]
2026-06-26 15:40 ` [PATCH 01/12] [gdb] Use using instead of typedef some more (part 1) Tom Tromey
2026-06-16 6:22 ` [PATCH 02/12] [gdb] Use using instead of typedef some more (part 2) Tom de Vries
2026-06-16 6:22 ` [PATCH 03/12] [gdb] Use using instead of typedef some more (part 3) Tom de Vries
2026-06-26 15:49 ` Tom Tromey
2026-06-16 6:22 ` [PATCH 04/12] [gdb] Convert function pointer typedefs to using Tom de Vries
2026-06-16 6:22 ` [PATCH 05/12] [gdb] Convert template " Tom de Vries
2026-06-16 6:22 ` [PATCH 06/12] [gdb] Convert function " Tom de Vries
2026-06-16 6:22 ` [PATCH 07/12] [gdb] Fix redundant struct typedefs Tom de Vries
2026-06-16 6:22 ` [PATCH 08/12] [gdb] Convert anonymous " Tom de Vries
2026-06-16 6:22 ` [PATCH 09/12] [gdb] Convert typedef of named struct Tom de Vries
2026-06-26 16:04 ` Tom Tromey
2026-06-16 6:22 ` [PATCH 10/12] [gdb] convert struct pointer typedefs Tom de Vries
2026-06-16 6:22 ` [PATCH 11/12] [gdb] Convert typedef on separate line Tom de Vries
2026-06-16 6:22 ` [PATCH 12/12] [gdb] Use using in compat_x32_clock_t typedef Tom de Vries
2026-06-26 16:05 ` [PATCH 00/12] [gdb] Use using instead of typedef some more Tom Tromey
2026-07-13 13:07 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260616062257.3164438-2-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox