[gdb] Use using instead of typedef some more (part 2)

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 *);
...

Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Tom de Vries 2026-07-13 15:06:35 +02:00
parent 7e670147b6
commit bc7e910e10
38 changed files with 63 additions and 63 deletions

View file

@ -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. */

View file

@ -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. */

View file

@ -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,

View file

@ -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

View file

@ -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. */

View file

@ -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.

View file

@ -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. */

View file

@ -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);

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -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. */

View file

@ -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,

View file

@ -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);

View file

@ -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);

View file

@ -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 *,

View file

@ -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

View file

@ -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. */

View file

@ -764,7 +764,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);

View file

@ -492,7 +492,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. */

View file

@ -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 */

View file

@ -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 *);

View file

@ -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. */

View file

@ -199,7 +199,7 @@ public:
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

View file

@ -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;

View file

@ -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
{

View file

@ -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] =
{

View file

@ -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);

View file

@ -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,

View file

@ -189,7 +189,7 @@
/*
* typedef
*/
typedef void (*Function) ();
using Function = void (*) ();
/*
* Forward declarations

View file

@ -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

View file

@ -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)));

View file

@ -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

View file

@ -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,

View file

@ -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;

View file

@ -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 */

View file

@ -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