From bc7e910e10f8d5072848344140f15a8bab89f069 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 13 Jul 2026 15:06:35 +0200 Subject: [PATCH] [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 --- 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 35ebd924021..42fdd97f12f 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 db423c60b09..c51074c89ff 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 cp_canonicalize_string extern gdb::unique_xmalloc_ptr 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 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::key 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 75154d9c591..62827ffe02c 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -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); diff --git a/gdb/main.c b/gdb/main.c index 4a11b6c5f88..f49d5f48c9d 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -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. */ 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 @@ 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 diff --git a/gdb/remote.c b/gdb/remote.c index d66c15186ec..194c4cbd9bb 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