From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 05/12] [gdb] Convert template typedefs to using
Date: Tue, 16 Jun 2026 08:22:50 +0200 [thread overview]
Message-ID: <20260616062257.3164438-6-tdevries@suse.de> (raw)
In-Reply-To: <20260616062257.3164438-1-tdevries@suse.de>
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
next prev parent reply other threads:[~2026-06-16 6:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 6:22 [PATCH 00/12] [gdb] Use using instead of typedef some more Tom de Vries
2026-06-16 6:22 ` [PATCH 01/12] [gdb] Use using instead of typedef some more (part 1) Tom de Vries
2026-06-26 15:40 ` Tom Tromey
2026-06-16 6:22 ` [PATCH 02/12] [gdb] Use using instead of typedef some more (part 2) Tom de Vries
2026-06-16 6:22 ` [PATCH 03/12] [gdb] Use using instead of typedef some more (part 3) Tom de Vries
2026-06-26 15:49 ` Tom Tromey
2026-06-16 6:22 ` [PATCH 04/12] [gdb] Convert function pointer typedefs to using Tom de Vries
2026-06-16 6:22 ` Tom de Vries [this message]
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-6-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