From: Tom Tromey Date: Mon, 6 Nov 2023 16:31:03 +0000 (-0700) Subject: Remove EXTERN_C and related defines X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cf0d07fd07117934750e4bb94cfc0349e251afae;p=binutils-gdb.git Remove EXTERN_C and related defines common-defs.h has a few defines that I suspect were used during the transition to C++. These aren't needed any more, so remove them. Tested by rebuilding. Approved-By: Simon Marchi Approved-By: Andrew Burgess --- diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 20d3d93f1ad..a1cde54feda 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -493,7 +493,7 @@ cli_mld_flush (const struct match_list_displayer *displayer) fflush (rl_outstream); } -EXTERN_C void _rl_erase_entire_line (void); +extern "C" void _rl_erase_entire_line (void); /* CLI version of displayer.erase_entire_line. */ diff --git a/gdb/completer.c b/gdb/completer.c index 2abf3998345..8942a3f7950 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -2812,7 +2812,7 @@ gdb_complete_get_screenwidth (const struct match_list_displayer *displayer) extern int _rl_completion_prefix_display_length; extern int _rl_print_completions_horizontally; -EXTERN_C int _rl_qsort_string_compare (const void *, const void *); +extern "C" int _rl_qsort_string_compare (const void *, const void *); typedef int QSFUNC (const void *, const void *); /* GDB version of readline/complete.c:rl_display_match_list. diff --git a/gdb/defs.h b/gdb/defs.h index f5af3e617c4..b8612e1ac6d 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -303,7 +303,7 @@ extern int annotation_level; /* in stack.c */ "const char *" in unistd.h, so we can't declare the argument as "char *". */ -EXTERN_C char *re_comp (const char *); +extern "C" char *re_comp (const char *); /* From symfile.c */ diff --git a/gdb/event-top.c b/gdb/event-top.c index 3d6fa896a9c..9886ca46e7b 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -138,7 +138,7 @@ static struct async_signal_handler *async_sigterm_token; void (*after_char_processing_hook) (void); #if RL_VERSION_MAJOR == 7 -EXTERN_C void _rl_signal_handler (int); +extern "C" void _rl_signal_handler (int); #endif /* Wrapper function for calling into the readline library. This takes diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h index 7ac0ade2a30..39bf6f14296 100644 --- a/gdb/gdb_curses.h +++ b/gdb/gdb_curses.h @@ -60,7 +60,7 @@ of the termcap functions will be built from stub-termcap.c. Readline provides its own extern declarations when there's no termcap.h; do the same here for the termcap functions used in GDB. */ -EXTERN_C int tgetnum (const char *); +extern "C" int tgetnum (const char *); #endif /* SunOS's curses.h has a '#define reg register' in it. Thank you Sun. */ diff --git a/gdb/maint.c b/gdb/maint.c index 0635af3dfc4..c1154d0a54e 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -791,7 +791,7 @@ extern char etext; static int profiling_state; -EXTERN_C void _mcleanup (void); +extern "C" void _mcleanup (void); static void mcleanup_wrapper (void) @@ -800,7 +800,7 @@ mcleanup_wrapper (void) _mcleanup (); } -EXTERN_C void monstartup (unsigned long, unsigned long); +extern "C" void monstartup (unsigned long, unsigned long); extern int main (int, char **); static void diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c index b80c7b88893..e259f65058c 100644 --- a/gdb/nat/linux-ptrace.c +++ b/gdb/nat/linux-ptrace.c @@ -70,7 +70,7 @@ linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err) #if defined __i386__ || defined __x86_64__ /* Address of the 'ret' instruction in asm code block below. */ -EXTERN_C void linux_ptrace_test_ret_to_nx_instr (void); +extern "C" void linux_ptrace_test_ret_to_nx_instr (void); #include #include diff --git a/gdb/utils.c b/gdb/utils.c index a191d26a007..f959af3219b 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1112,7 +1112,7 @@ static bool filter_initialized = false; /* See readline's rlprivate.h. */ -EXTERN_C int _rl_term_autowrap; +extern "C" int _rl_term_autowrap; /* See utils.h. */ diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index 609d49a87ef..a5f58fd54eb 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -826,7 +826,7 @@ struct wstep_state #endif -EXTERN_C_PUSH +extern "C" { /* The linked list of all tracepoints. Marked explicitly as used as the in-process library doesn't use it for the fast tracepoints @@ -848,7 +848,7 @@ IP_AGENT_EXPORT_VAR int trace_buffer_is_full; enum eval_result_type values. */ IP_AGENT_EXPORT_VAR int expr_eval_result = expr_eval_no_error; -EXTERN_C_POP +} #ifndef IN_PROCESS_AGENT @@ -868,9 +868,9 @@ static const char * const eval_result_names[] = /* The tracepoint in which the error occurred. */ -EXTERN_C_PUSH +extern "C" { IP_AGENT_EXPORT_VAR struct tracepoint *error_tracepoint; -EXTERN_C_POP +} struct trace_state_variable { @@ -982,7 +982,7 @@ static int circular_trace_buffer; static LONGEST trace_buffer_size; -EXTERN_C_PUSH +extern "C" { /* Pointer to the block of memory that traceframes all go into. */ @@ -993,7 +993,7 @@ IP_AGENT_EXPORT_VAR unsigned char *trace_buffer_lo; IP_AGENT_EXPORT_VAR unsigned char *trace_buffer_hi; -EXTERN_C_POP +} /* Control structure holding the read/write/etc. pointers into the trace buffer. We need more than one of these to implement a @@ -4683,9 +4683,9 @@ collect_data_at_step (struct tracepoint_hit_ctx *ctx, #ifdef IN_PROCESS_AGENT /* The target description index for IPA. Passed from gdbserver, used to select ipa_tdesc. */ -EXTERN_C_PUSH +extern "C" { IP_AGENT_EXPORT_VAR int ipa_tdesc_idx; -EXTERN_C_POP +} #endif static struct regcache * @@ -5749,9 +5749,9 @@ fast_tracepoint_collecting, returning continue-until-break at %s", NULL if it isn't locked. Note that this lock *must* be set while executing any *function other than the jump pad. See fast_tracepoint_collecting. */ -EXTERN_C_PUSH +extern "C" { IP_AGENT_EXPORT_VAR collecting_t *collecting; -EXTERN_C_POP +} /* This is needed for -Wmissing-declarations. */ IP_AGENT_EXPORT_FUNC void gdb_collect (struct tracepoint *tpoint, @@ -5840,14 +5840,14 @@ 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); -EXTERN_C_PUSH +extern "C" { IP_AGENT_EXPORT_VAR gdb_collect_ptr_type gdb_collect_ptr = gdb_collect; IP_AGENT_EXPORT_VAR get_raw_reg_ptr_type get_raw_reg_ptr = get_raw_reg; IP_AGENT_EXPORT_VAR get_trace_state_variable_value_ptr_type get_trace_state_variable_value_ptr = get_trace_state_variable_value; IP_AGENT_EXPORT_VAR set_trace_state_variable_value_ptr_type set_trace_state_variable_value_ptr = set_trace_state_variable_value; -EXTERN_C_POP +} #endif @@ -6834,9 +6834,9 @@ run_inferior_command (char *cmd, int len) /* Thread ID of the helper thread. GDBserver reads this to know which is the help thread. This is an LWP id on Linux. */ -EXTERN_C_PUSH +extern "C" { IP_AGENT_EXPORT_VAR int helper_thread_id; -EXTERN_C_POP +} static int init_named_socket (const char *name) @@ -7265,9 +7265,9 @@ gdb_agent_helper_thread (void *arg) #include #include -EXTERN_C_PUSH +extern "C" { IP_AGENT_EXPORT_VAR int gdb_agent_capability = AGENT_CAPA_STATIC_TRACE; -EXTERN_C_POP +} static void gdb_agent_init (void) diff --git a/gdbserver/tracepoint.h b/gdbserver/tracepoint.h index 1f40d7b5177..91f757fcff6 100644 --- a/gdbserver/tracepoint.h +++ b/gdbserver/tracepoint.h @@ -55,12 +55,12 @@ void initialize_tracepoint (void); must also be exported with C linkage. As we can't both use extern "C" and initialize a variable in the same statement, variables that don't have a separate declaration must use - EXTERN_C_PUSH/EXTERN_C_POP around their definition. */ + extern "C" {...} around their definition. */ #ifdef IN_PROCESS_AGENT -# define IP_AGENT_EXPORT_FUNC EXTERN_C EXPORTED_SYMBOL ATTR_NOINLINE ATTR_USED +# define IP_AGENT_EXPORT_FUNC extern "C" EXPORTED_SYMBOL ATTR_NOINLINE ATTR_USED # define IP_AGENT_EXPORT_VAR EXPORTED_SYMBOL ATTR_USED -# define IP_AGENT_EXPORT_VAR_DECL EXTERN_C EXPORTED_SYMBOL +# define IP_AGENT_EXPORT_VAR_DECL extern "C" EXPORTED_SYMBOL #else # define IP_AGENT_EXPORT_FUNC static # define IP_AGENT_EXPORT_VAR diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h index 5e8ebab620c..6f0d99f949a 100644 --- a/gdbsupport/common-defs.h +++ b/gdbsupport/common-defs.h @@ -214,10 +214,6 @@ #include "common-exceptions.h" #include "gdbsupport/poison.h" -#define EXTERN_C extern "C" -#define EXTERN_C_PUSH extern "C" { -#define EXTERN_C_POP } - /* Pull in gdb::unique_xmalloc_ptr. */ #include "gdbsupport/gdb_unique_ptr.h" diff --git a/gdbsupport/gdb_proc_service.h b/gdbsupport/gdb_proc_service.h index 19d40e0ee10..c289e87dd76 100644 --- a/gdbsupport/gdb_proc_service.h +++ b/gdbsupport/gdb_proc_service.h @@ -25,11 +25,11 @@ /* glibc's proc_service.h doesn't wrap itself with extern "C". Need to do it ourselves. */ -EXTERN_C_PUSH +extern "C" { #include -EXTERN_C_POP +} #else /* HAVE_PROC_SERVICE_H */ @@ -69,7 +69,7 @@ EXTERN_C_POP # endif #endif -EXTERN_C_PUSH +extern "C" { /* Functions in this interface return one of these status codes. */ typedef enum @@ -166,7 +166,7 @@ extern ps_err_e ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid, /* Log a message (sends to gdb_stderr). */ extern void ps_plog (const char *fmt, ...); -EXTERN_C_POP +} #endif /* HAVE_PROC_SERVICE_H */