[binutils-gdb] [gdb] Convert template typedefs to using

Tom de Vries via Gdb-cvs <[email protected]> Mon, 13 Jul 2026 13:07:08 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Def5907287aec=
1dc7f5323c66042a4a26f275c5cf

commit ef5907287aec1dc7f5323c66042a4a26f275c5cf
Author: Tom de Vries <[email protected]>
Date:   Mon Jul 13 15:06:35 2026 +0200

    [gdb] Convert template typedefs to using
   =20
    Convert "typedef foo<...> bar" to "using bar =3D foo<...>".
   =20
    Generated by a script written by Claude Code.
   =20
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 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_pti=
d (ptid_t ptid);
=20
 extern int ada_get_task_number (thread_info *thread);
=20
-typedef gdb::function_view<void (struct ada_task_info *task)>
-  ada_task_list_iterator_ftype;
+using ada_task_list_iterator_ftype
+  =3D gdb::function_view<void (struct ada_task_info *task)>;
 extern void iterate_over_live_ada_tasks
   (ada_task_list_iterator_ftype iterator);
=20
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
 };
=20
 /* 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
+  =3D gdb::ref_ptr<bp_location, bp_location_ref_policy>;
=20
 /* 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-suppor=
t.c
index f2b98ab5e2f..f18708846ec 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -649,15 +649,17 @@ private:
=20
 /* The types used for C and C++ program computations.  */
=20
-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
+  =3D 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
+  =3D compile_program<compile_cplus_instance, cplus_push_user_expression,
+		    cplus_pop_user_expression,
+		    cplus_add_code_header, c_add_code_footer,
+		    cplus_add_input>;
=20
 /* The compute_program method for C.  */
=20
diff --git a/gdb/dwarf2/cooked-index-shard.h b/gdb/dwarf2/cooked-index-shar=
d.h
index aff82fad184..84c37958c83 100644
--- a/gdb/dwarf2/cooked-index-shard.h
+++ b/gdb/dwarf2/cooked-index-shard.h
@@ -65,8 +65,8 @@ public:
   friend class cooked_index;
=20
   /* A simple range over part of m_entries.  */
-  typedef iterator_range<std::vector<cooked_index_entry *>::const_iterator>
-       range;
+  using range
+    =3D iterator_range<std::vector<cooked_index_entry *>::const_iterator>;
=20
   /* 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;
=20
 /* Callback types for dwarf2_read_gdb_index.  */
=20
-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
+  =3D gdb::function_view<gdb::array_view<const gdb_byte>(objfile *,
+						       dwarf2_per_bfd *)>;
+using get_gdb_index_contents_dwz_ftype
+  =3D gdb::function_view<gdb::array_view<const gdb_byte>(objfile *, dwz_fi=
le *)>;
=20
 /* 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 ch=
ar *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
+  =3D std::vector<std::unique_ptr<fixed_point_type_info>>;
=20
 /* 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
 };
=20
 /* A unique_ptr specialization for infcall_suspend_state.  */
-typedef std::unique_ptr<infcall_suspend_state, infcall_suspend_state_delet=
er>
-    infcall_suspend_state_up;
+using infcall_suspend_state_up
+  =3D std::unique_ptr<infcall_suspend_state, infcall_suspend_state_deleter=
>;
=20
 extern infcall_suspend_state_up save_infcall_suspend_state ();
=20
@@ -108,8 +108,8 @@ struct infcall_control_state_deleter
 };
=20
 /* A unique_ptr specialization for infcall_control_state.  */
-typedef std::unique_ptr<infcall_control_state, infcall_control_state_delet=
er>
-    infcall_control_state_up;
+using infcall_control_state_up
+  =3D std::unique_ptr<infcall_control_state, infcall_control_state_deleter=
>;
=20
 extern infcall_control_state_up save_infcall_control_state ();
=20
diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c
index e284fe01729..67f570761da 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 kin=
d,
 }
=20
 /* 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
+  =3D std::vector<module_symbol_search>::const_iterator;
=20
 /* 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 f=
rame_info_ptr &frame,
 						  enum language *funlang,
 						  struct symbol **funcp);
=20
-typedef gdb::function_view<void (const char *print_name, struct symbol *sy=
m)>
-     iterate_over_block_arg_local_vars_cb;
+using iterate_over_block_arg_local_vars_cb
+  =3D gdb::function_view<void (const char *print_name, struct symbol *sym)=
>;
=20
 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
=20
 /* A unique pointer specialization that holds a target_desc.  */
=20
-typedef std::unique_ptr<tdesc_arch_data, tdesc_arch_data_deleter>
-  tdesc_arch_data_up;
+using tdesc_arch_data_up
+  =3D std::unique_ptr<tdesc_arch_data, tdesc_arch_data_deleter>;
=20
 /* 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
=20
 /* A unique_ptr specialization for trace_file_writer.  */
=20
-typedef std::unique_ptr<trace_file_writer, trace_file_writer_deleter>
-    trace_file_writer_up;
+using trace_file_writer_up
+  =3D std::unique_ptr<trace_file_writer, trace_file_writer_deleter>;
=20
 /* 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.  */
=20
-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
+  =3D void (struct gdb_xml_parser *parser, const struct gdb_xml_element *e=
lement,
+	  void *user_data, std::vector<gdb_xml_value> &attributes);
=20
 /* A handler called at the end of an element.
=20
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) =3D=3D sizeof(int64_t),
-				    Aux64Info, Aux32Info>::type auxv_type;
+  using auxv_type =3D typename std::conditional<sizeof(T) =3D=3D sizeof(in=
t64_t),
+					      Aux64Info, Aux32Info>::type;
   const size_t auxv_size =3D sizeof (auxv_type);
   const size_t auxv_buf_size =3D 128 * sizeof (auxv_type);
=20
@@ -791,8 +791,8 @@ template <typename T>
 static CORE_ADDR
 get_dynamic (const pid_t pid)
 {
-  typedef typename std::conditional<sizeof(T) =3D=3D sizeof(int64_t),
-				    Elf64_Phdr, Elf32_Phdr>::type phdr_type;
+  using phdr_type =3D typename std::conditional<sizeof(T) =3D=3D sizeof(in=
t64_t),
+					      Elf64_Phdr, Elf32_Phdr>::type;
   const int phdr_size =3D sizeof (phdr_type);
=20
   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) =3D=3D sizeof(int64_t),
-				    Elf64_Dyn, Elf32_Dyn>::type dyn_type;
+  using dyn_type =3D typename std::conditional<sizeof(T) =3D=3D sizeof(int=
64_t),
+					     Elf64_Dyn, Elf32_Dyn>::type;
   const int dyn_size =3D sizeof (dyn_type);
   unsigned char buf[sizeof (dyn_type)];  /* The larger of the two.  */
   CORE_ADDR map =3D -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
=20
 /* A unique pointer to a splay tree.  */
=20
-typedef std::unique_ptr<splay_tree_s, gdb::splay_tree_deleter>
-    gdb_splay_tree_up;
+using gdb_splay_tree_up
+  =3D std::unique_ptr<splay_tree_s, gdb::splay_tree_deleter>;
=20
 #endif /* GDBSUPPORT_GDB_SPLAY_TREE_H */