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 <simon.marchi@efficios.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
This commit is contained in:
Tom Tromey 2023-11-06 09:31:03 -07:00
parent e0da5ef09c
commit cf0d07fd07
12 changed files with 32 additions and 36 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 <sys/reg.h>
#include <sys/mman.h>

View File

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

View File

@ -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 <signal.h>
#include <pthread.h>
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)

View File

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

View File

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

View File

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