aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-01-20 20:55:05 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2021-01-20 20:55:05 -0500
commit6bd434d6caa4c08a5ea87fe327d802c1e00a5c5e (patch)
treea4594767b41b738b1003388904f1e9593d0d7c3d /gdb
parenta6c11cbb14cea4900a97f8cb20762fefec6fda54 (diff)
downloadgdb-6bd434d6caa4c08a5ea87fe327d802c1e00a5c5e.zip
gdb-6bd434d6caa4c08a5ea87fe327d802c1e00a5c5e.tar.gz
gdb-6bd434d6caa4c08a5ea87fe327d802c1e00a5c5e.tar.bz2
gdb: make some variables static
I'm trying to enable clang's -Wmissing-variable-declarations warning. This patch fixes all the obvious spots where we can simply add "static" (at least, found when building on x86-64 Linux). gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static. * aarch64-tdep.c (tdesc_aarch64_list, aarch64_prologue_unwind, aarch64_stub_unwind, aarch64_normal_base, ): Make static. * arm-linux-tdep.c (arm_prologue_unwind): Make static. * arm-tdep.c (struct frame_unwind): Make static. * auto-load.c (auto_load_safe_path_vec): Make static. * csky-tdep.c (csky_stub_unwind): Make static. * gdbarch.c (gdbarch_data_registry): Make static. * gnu-v2-abi.c (gnu_v2_abi_ops): Make static. * i386-netbsd-tdep.c (i386nbsd_mc_reg_offset): Make static. * i386-tdep.c (i386_frame_setup_skip_insns, i386_tramp_chain_in_reg_insns, i386_tramp_chain_on_stack_insns): Make static. * infrun.c (observer_mode): Make static. * linux-nat.c (sigchld_action): Make static. * linux-thread-db.c (thread_db_list): Make static. * maint-test-options.c (maintenance_test_options_list): * mep-tdep.c (mep_csr_registers): Make static. * mi/mi-cmds.c (struct mi_cmd_stats): Remove struct type name. (stats): Make static. * nat/linux-osdata.c (struct osdata_type): Make static. * ppc-netbsd-tdep.c (ppcnbsd_reg_offsets): Make static. * progspace.c (last_program_space_num): Make static. * python/py-param.c (struct parm_constant): Remove struct type name. (parm_constants): Make static. * python/py-record-btrace.c (btpy_list_methods): Make static. * python/py-record.c (recpy_gap_type): Make static. * record.c (record_goto_cmdlist): Make static. * regcache.c (regcache_descr_handle): Make static. * registry.h (DEFINE_REGISTRY): Make definition static. * symmisc.c (std_in, std_out, std_err): Make static. * top.c (previous_saved_command_line): Make static. * tracepoint.c (trace_user, trace_notes, trace_stop_notes): Make static. * unittests/command-def-selftests.c (nr_duplicates, nr_invalid_prefixcmd, lists): Make static. * unittests/observable-selftests.c (test_notification): Make static. * unittests/optional/assignment/1.cc (counter): Make static. * unittests/optional/assignment/2.cc (counter): Make static. * unittests/optional/assignment/3.cc (counter): Make static. * unittests/optional/assignment/4.cc (counter): Make static. * unittests/optional/assignment/5.cc (counter): Make static. * unittests/optional/assignment/6.cc (counter): Make static. gdbserver/ChangeLog: * ax.cc (bytecode_address_table): Make static. * debug.cc (debug_file): Make static. * linux-low.cc (stopping_threads): Make static. (step_over_bkpt): Make static. * linux-x86-low.cc (amd64_emit_ops, i386_emit_ops): Make static. * tracepoint.cc (stop_tracing_bkpt, flush_trace_buffer_bkpt, alloced_trace_state_variables, trace_buffer_ctrl, tracing_start_time, tracing_stop_time, tracing_user_name, tracing_notes, tracing_stop_note): Make static. Change-Id: Ic1d8034723b7802502bda23770893be2338ab020
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog48
-rw-r--r--gdb/aarch64-linux-tdep.c2
-rw-r--r--gdb/aarch64-tdep.c8
-rw-r--r--gdb/arm-linux-tdep.c2
-rw-r--r--gdb/arm-tdep.c2
-rw-r--r--gdb/auto-load.c2
-rw-r--r--gdb/csky-tdep.c2
-rw-r--r--gdb/gdbarch.c2
-rw-r--r--gdb/gnu-v2-abi.c2
-rw-r--r--gdb/i386-netbsd-tdep.c2
-rw-r--r--gdb/i386-tdep.c6
-rw-r--r--gdb/infrun.c2
-rw-r--r--gdb/linux-nat.c2
-rw-r--r--gdb/linux-thread-db.c2
-rw-r--r--gdb/maint-test-options.c2
-rw-r--r--gdb/mep-tdep.c2
-rw-r--r--gdb/mi/mi-cmds.c5
-rw-r--r--gdb/nat/linux-osdata.c2
-rw-r--r--gdb/ppc-netbsd-tdep.c2
-rw-r--r--gdb/progspace.c2
-rw-r--r--gdb/python/py-param.c7
-rw-r--r--gdb/python/py-record-btrace.c2
-rw-r--r--gdb/python/py-record.c2
-rw-r--r--gdb/record.c2
-rw-r--r--gdb/regcache.c2
-rw-r--r--gdb/registry.h2
-rw-r--r--gdb/symmisc.c6
-rw-r--r--gdb/top.c2
-rw-r--r--gdb/tracepoint.c6
-rw-r--r--gdb/unittests/command-def-selftests.c6
-rw-r--r--gdb/unittests/observable-selftests.c2
-rw-r--r--gdb/unittests/optional/assignment/1.cc2
-rw-r--r--gdb/unittests/optional/assignment/2.cc2
-rw-r--r--gdb/unittests/optional/assignment/3.cc2
-rw-r--r--gdb/unittests/optional/assignment/4.cc2
-rw-r--r--gdb/unittests/optional/assignment/5.cc2
-rw-r--r--gdb/unittests/optional/assignment/6.cc2
37 files changed, 97 insertions, 53 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4c686a9..a2759ef 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,51 @@
+2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static.
+ * aarch64-tdep.c (tdesc_aarch64_list, aarch64_prologue_unwind,
+ aarch64_stub_unwind, aarch64_normal_base, ): Make static.
+ * arm-linux-tdep.c (arm_prologue_unwind): Make static.
+ * arm-tdep.c (struct frame_unwind): Make static.
+ * auto-load.c (auto_load_safe_path_vec): Make static.
+ * csky-tdep.c (csky_stub_unwind): Make static.
+ * gdbarch.c (gdbarch_data_registry): Make static.
+ * gnu-v2-abi.c (gnu_v2_abi_ops): Make static.
+ * i386-netbsd-tdep.c (i386nbsd_mc_reg_offset): Make static.
+ * i386-tdep.c (i386_frame_setup_skip_insns,
+ i386_tramp_chain_in_reg_insns, i386_tramp_chain_on_stack_insns):
+ Make static.
+ * infrun.c (observer_mode): Make static.
+ * linux-nat.c (sigchld_action): Make static.
+ * linux-thread-db.c (thread_db_list): Make static.
+ * maint-test-options.c (maintenance_test_options_list):
+ * mep-tdep.c (mep_csr_registers): Make static.
+ * mi/mi-cmds.c (struct mi_cmd_stats): Remove struct type name.
+ (stats): Make static.
+ * nat/linux-osdata.c (struct osdata_type): Make static.
+ * ppc-netbsd-tdep.c (ppcnbsd_reg_offsets): Make static.
+ * progspace.c (last_program_space_num): Make static.
+ * python/py-param.c (struct parm_constant): Remove struct type
+ name.
+ (parm_constants): Make static.
+ * python/py-record-btrace.c (btpy_list_methods): Make static.
+ * python/py-record.c (recpy_gap_type): Make static.
+ * record.c (record_goto_cmdlist): Make static.
+ * regcache.c (regcache_descr_handle): Make static.
+ * registry.h (DEFINE_REGISTRY): Make definition static.
+ * symmisc.c (std_in, std_out, std_err): Make static.
+ * top.c (previous_saved_command_line): Make static.
+ * tracepoint.c (trace_user, trace_notes, trace_stop_notes): Make
+ static.
+ * unittests/command-def-selftests.c (nr_duplicates,
+ nr_invalid_prefixcmd, lists): Make static.
+ * unittests/observable-selftests.c (test_notification): Make
+ static.
+ * unittests/optional/assignment/1.cc (counter): Make static.
+ * unittests/optional/assignment/2.cc (counter): Make static.
+ * unittests/optional/assignment/3.cc (counter): Make static.
+ * unittests/optional/assignment/4.cc (counter): Make static.
+ * unittests/optional/assignment/5.cc (counter): Make static.
+ * unittests/optional/assignment/6.cc (counter): Make static.
+
2021-01-20 Joel Sherrill <joel@rtems.org>
PR gdb/27219
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 954b05c..b1bbd55 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -849,7 +849,7 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
/* AArch64 process record-replay constructs: syscall, signal etc. */
-struct linux_record_tdep aarch64_linux_record_tdep;
+static linux_record_tdep aarch64_linux_record_tdep;
/* Enum that defines the AArch64 linux specific syscall identifiers used for
process record/replay. */
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 3e26a95..d1e1549 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -58,7 +58,7 @@
#define HA_MAX_NUM_FLDS 4
/* All possible aarch64 target descriptors. */
-struct target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1][2/*pauth*/];
+static target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1][2/*pauth*/];
/* The standard register names, and all the valid aliases for them. */
static const struct
@@ -1109,7 +1109,7 @@ aarch64_prologue_prev_register (struct frame_info *this_frame,
}
/* AArch64 prologue unwinder. */
-struct frame_unwind aarch64_prologue_unwind =
+static frame_unwind aarch64_prologue_unwind =
{
NORMAL_FRAME,
aarch64_prologue_frame_unwind_stop_reason,
@@ -1203,7 +1203,7 @@ aarch64_stub_unwind_sniffer (const struct frame_unwind *self,
}
/* AArch64 stub unwinder. */
-struct frame_unwind aarch64_stub_unwind =
+static frame_unwind aarch64_stub_unwind =
{
NORMAL_FRAME,
aarch64_stub_frame_unwind_stop_reason,
@@ -1225,7 +1225,7 @@ aarch64_normal_frame_base (struct frame_info *this_frame, void **this_cache)
}
/* AArch64 default frame base information. */
-struct frame_base aarch64_normal_base =
+static frame_base aarch64_normal_base =
{
&aarch64_prologue_unwind,
aarch64_normal_frame_base,
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index ada7f11..20cae5b 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1248,7 +1248,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
/* ARM process record-replay constructs: syscall, signal etc. */
-struct linux_record_tdep arm_linux_record_tdep;
+static linux_record_tdep arm_linux_record_tdep;
/* arm_canonicalize_syscall maps from the native arm Linux set
of syscall ids into a canonical set of syscall ids used by
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 0184c25..7916c97 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -2024,7 +2024,7 @@ arm_prologue_prev_register (struct frame_info *this_frame,
prev_regnum);
}
-struct frame_unwind arm_prologue_unwind = {
+static frame_unwind arm_prologue_unwind = {
NORMAL_FRAME,
arm_prologue_unwind_stop_reason,
arm_prologue_this_id,
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index b9acb8f..522f43b 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -170,7 +170,7 @@ static char *auto_load_safe_path;
/* Vector of directory elements of AUTO_LOAD_SAFE_PATH with each one normalized
by tilde_expand and possibly each entries has added its gdb_realpath
counterpart. */
-std::vector<gdb::unique_xmalloc_ptr<char>> auto_load_safe_path_vec;
+static std::vector<gdb::unique_xmalloc_ptr<char>> auto_load_safe_path_vec;
/* Expand $datadir and $debugdir in STRING according to the rules of
substitute_path_component. */
diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index 3ec18a2..609b684 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -1998,7 +1998,7 @@ csky_stub_prev_register (struct frame_info *this_frame,
prev_regnum);
}
-struct frame_unwind csky_stub_unwind = {
+static frame_unwind csky_stub_unwind = {
NORMAL_FRAME,
default_frame_unwind_stop_reason,
csky_stub_this_id,
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 4bdf406..43d1c15 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -5314,7 +5314,7 @@ struct gdbarch_data_registry
struct gdbarch_data_registration *registrations;
};
-struct gdbarch_data_registry gdbarch_data_registry =
+static struct gdbarch_data_registry gdbarch_data_registry =
{
0, NULL,
};
diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
index 45b8bb6..466ae6c 100644
--- a/gdb/gnu-v2-abi.c
+++ b/gdb/gnu-v2-abi.c
@@ -29,7 +29,7 @@
#include "cp-support.h"
#include <ctype.h>
-struct cp_abi_ops gnu_v2_abi_ops;
+static cp_abi_ops gnu_v2_abi_ops;
static int vb_match (struct type *, int, struct type *);
diff --git a/gdb/i386-netbsd-tdep.c b/gdb/i386-netbsd-tdep.c
index 873bbe9..76dcc4d 100644
--- a/gdb/i386-netbsd-tdep.c
+++ b/gdb/i386-netbsd-tdep.c
@@ -76,7 +76,7 @@ static int i386nbsd_sc_reg_offset[] =
};
/* From <machine/mcontext.h>. */
-int i386nbsd_mc_reg_offset[] =
+static int i386nbsd_mc_reg_offset[] =
{
11 * 4, /* %eax */
10 * 4, /* %ecx */
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 991218d..6386716 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1467,7 +1467,7 @@ i386_match_insn_block (CORE_ADDR pc, struct i386_insn *insn_patterns)
yet, and only the scratch registers %eax, %ecx and %edx can be
touched. */
-struct i386_insn i386_frame_setup_skip_insns[] =
+static i386_insn i386_frame_setup_skip_insns[] =
{
/* Check for `movb imm8, r' and `movl imm32, r'.
@@ -2333,7 +2333,7 @@ static const struct frame_unwind i386_epilogue_frame_unwind =
/* Static chain passed in register. */
-struct i386_insn i386_tramp_chain_in_reg_insns[] =
+static i386_insn i386_tramp_chain_in_reg_insns[] =
{
/* `movl imm32, %eax' and `movl imm32, %ecx' */
{ 5, { 0xb8 }, { 0xfe } },
@@ -2346,7 +2346,7 @@ struct i386_insn i386_tramp_chain_in_reg_insns[] =
/* Static chain passed on stack (when regparm=3). */
-struct i386_insn i386_tramp_chain_on_stack_insns[] =
+static i386_insn i386_tramp_chain_on_stack_insns[] =
{
/* `push imm32' */
{ 5, { 0x68 }, { 0xff } },
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 940f575..3f14397 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -221,7 +221,7 @@ show_non_stop (struct ui_file *file, int from_tty,
non-stop, in which all GDB operations that might affect the
target's execution have been disabled. */
-bool observer_mode = false;
+static bool observer_mode = false;
static bool observer_mode_1 = false;
static void
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index dc524cf..3c7117b 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -757,7 +757,7 @@ static sigset_t suspend_mask;
static sigset_t blocked_mask;
/* SIGCHLD action. */
-struct sigaction sigchld_action;
+static struct sigaction sigchld_action;
/* Block child signals (SIGCHLD and linux threads signals), and store
the previous mask in PREV_MASK. */
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 2ce31dc..0a32e40 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -209,7 +209,7 @@ struct thread_db_info
/* List of known processes using thread_db, and the required
bookkeeping. */
-struct thread_db_info *thread_db_list;
+static thread_db_info *thread_db_list;
static void thread_db_find_new_threads_1 (thread_info *stopped);
static void thread_db_find_new_threads_2 (thread_info *stopped,
diff --git a/gdb/maint-test-options.c b/gdb/maint-test-options.c
index 9483f56..16ecd1d 100644
--- a/gdb/maint-test-options.c
+++ b/gdb/maint-test-options.c
@@ -409,7 +409,7 @@ maintenance_test_options_unknown_is_operand_command_completer
}
/* Command list for maint test-options. */
-struct cmd_list_element *maintenance_test_options_list;
+static cmd_list_element *maintenance_test_options_list;
void _initialize_maint_test_options ();
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index eaa713f..0dcfa48 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -661,7 +661,7 @@ struct mep_csr_register
We just list the register numbers here explicitly to help catch
typos. */
#define CSR(name) MEP_RAW_ ## name ## _REGNUM, MEP_ ## name ## _REGNUM
-struct mep_csr_register mep_csr_registers[] = {
+static mep_csr_register mep_csr_registers[] = {
{ CSR(PC), 0xffffffff }, /* manual says r/o, but we can write it */
{ CSR(LP), 0xffffffff },
{ CSR(SAR), 0x0000003f },
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 93a8262..df4290a 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -220,13 +220,12 @@ mi_lookup (const char *command)
/* Used for collecting hash hit/miss statistics. */
-struct mi_cmd_stats
+static struct
{
int hit;
int miss;
int rehash;
-};
-struct mi_cmd_stats stats;
+} stats;
/* Look up a command. */
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index ce436c1..7034dd8 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -1284,7 +1284,7 @@ linux_xfer_osdata_modules (struct buffer *buffer)
static void linux_xfer_osdata_info_os_types (struct buffer *buffer);
-struct osdata_type {
+static struct osdata_type {
const char *type;
const char *title;
const char *description;
diff --git a/gdb/ppc-netbsd-tdep.c b/gdb/ppc-netbsd-tdep.c
index 1230014..31f1199 100644
--- a/gdb/ppc-netbsd-tdep.c
+++ b/gdb/ppc-netbsd-tdep.c
@@ -33,7 +33,7 @@
#include "solib-svr4.h"
/* Register offsets from <machine/reg.h>. */
-struct ppc_reg_offsets ppcnbsd_reg_offsets;
+static ppc_reg_offsets ppcnbsd_reg_offsets;
/* Core file support. */
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 8683970..ebbc784 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -29,7 +29,7 @@
#include <algorithm>
/* The last program space number assigned. */
-int last_program_space_num = 0;
+static int last_program_space_num = 0;
/* The head of the program spaces list. */
std::vector<struct program_space *> program_spaces;
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index d37fd30..49819ce 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -29,13 +29,10 @@
#include "arch-utils.h"
/* Parameter constants and their values. */
-struct parm_constant
-{
+static struct {
const char *name;
int value;
-};
-
-struct parm_constant parm_constants[] =
+} parm_constants[] =
{
{ "PARAM_BOOLEAN", var_boolean }, /* ARI: var_boolean */
{ "PARAM_AUTO_BOOLEAN", var_auto_boolean },
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index d5a3da9..1c10a05 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -808,7 +808,7 @@ recpy_bt_goto (PyObject *self, PyObject *args)
/* BtraceList methods. */
-struct PyMethodDef btpy_list_methods[] =
+static PyMethodDef btpy_list_methods[] =
{
{ "count", btpy_list_count, METH_O, "count number of occurrences"},
{ "index", btpy_list_index, METH_O, "index of entry"},
diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c
index ddfb5d8..1747f74 100644
--- a/gdb/python/py-record.c
+++ b/gdb/python/py-record.c
@@ -45,7 +45,7 @@ PyTypeObject recpy_func_type = {
/* Python RecordGap type. */
-PyTypeObject recpy_gap_type = {
+static PyTypeObject recpy_gap_type = {
PyVarObject_HEAD_INIT (NULL, 0)
};
diff --git a/gdb/record.c b/gdb/record.c
index 9e19261..cd541b5 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -48,7 +48,7 @@ static unsigned int record_call_history_size = 10;
static unsigned int record_call_history_size_setshow_var;
struct cmd_list_element *record_cmdlist = NULL;
-struct cmd_list_element *record_goto_cmdlist = NULL;
+static struct cmd_list_element *record_goto_cmdlist = NULL;
struct cmd_list_element *set_record_cmdlist = NULL;
struct cmd_list_element *show_record_cmdlist = NULL;
struct cmd_list_element *info_record_cmdlist = NULL;
diff --git a/gdb/regcache.c b/gdb/regcache.c
index a0407c7..27c0ae5 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -41,7 +41,7 @@
/* Per-architecture object describing the layout of a register cache.
Computed once when the architecture is created. */
-struct gdbarch_data *regcache_descr_handle;
+static struct gdbarch_data *regcache_descr_handle;
struct regcache_descr
{
diff --git a/gdb/registry.h b/gdb/registry.h
index 972ebf3..7b0b284 100644
--- a/gdb/registry.h
+++ b/gdb/registry.h
@@ -154,7 +154,7 @@ void *registry_data (struct registry_fields *fields,
/* Define a new registry implementation. */
#define DEFINE_REGISTRY(TAG, ACCESS) \
-struct registry_data_registry TAG ## _data_registry = { NULL, 0 }; \
+static struct registry_data_registry TAG ## _data_registry = { NULL, 0 }; \
\
const struct TAG ## _data * \
register_ ## TAG ## _data_with_cleanup (void (*save) (struct TAG *, void *), \
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 07631e1..a8f8856 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -47,9 +47,9 @@
debugging GDB with itself. Because stdin et al need not be constants,
we initialize them in the _initialize_symmisc function at the bottom
of the file. */
-FILE *std_in;
-FILE *std_out;
-FILE *std_err;
+static FILE *std_in;
+static FILE *std_out;
+static FILE *std_err;
/* Prototypes for local functions */
diff --git a/gdb/top.c b/gdb/top.c
index 2c13864..4b0defd 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -161,7 +161,7 @@ static const char *repeat_arguments;
command. We need this as when a command is running, saved_command_line
already contains the line of the currently executing command. */
-char *previous_saved_command_line;
+static char *previous_saved_command_line;
/* If not NULL, the arguments that should be passed if the
previous_saved_command_line is repeated. */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 17d70a6..0cbd2c6 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -145,15 +145,15 @@ static int trace_buffer_size = -1;
/* Textual notes applying to the current and/or future trace runs. */
-char *trace_user = NULL;
+static char *trace_user = NULL;
/* Textual notes applying to the current and/or future trace runs. */
-char *trace_notes = NULL;
+static char *trace_notes = NULL;
/* Textual notes applying to the stopping of a trace. */
-char *trace_stop_notes = NULL;
+static char *trace_stop_notes = NULL;
/* support routines */
diff --git a/gdb/unittests/command-def-selftests.c b/gdb/unittests/command-def-selftests.c
index 7b0cb2d..e6aadf3 100644
--- a/gdb/unittests/command-def-selftests.c
+++ b/gdb/unittests/command-def-selftests.c
@@ -107,13 +107,13 @@ help_doc_invariants_tests ()
namespace command_structure_tests {
/* Nr of commands in which a duplicated list is found. */
-unsigned int nr_duplicates = 0;
+static unsigned int nr_duplicates = 0;
/* Nr of commands in a list having no valid prefix cmd. */
-unsigned int nr_invalid_prefixcmd = 0;
+static unsigned int nr_invalid_prefixcmd = 0;
/* A map associating a list with the prefix leading to it. */
-std::map<cmd_list_element **, const char *> lists;
+static std::map<cmd_list_element **, const char *> lists;
/* Store each command list in lists, associated with the prefix to reach it. A
list must only be found once.
diff --git a/gdb/unittests/observable-selftests.c b/gdb/unittests/observable-selftests.c
index 1b22e86..e19eaf8 100644
--- a/gdb/unittests/observable-selftests.c
+++ b/gdb/unittests/observable-selftests.c
@@ -24,7 +24,7 @@
namespace selftests {
namespace observers {
-gdb::observers::observable<int> test_notification ("test_notification");
+static gdb::observers::observable<int> test_notification ("test_notification");
static int test_first_observer = 0;
static int test_second_observer = 0;
diff --git a/gdb/unittests/optional/assignment/1.cc b/gdb/unittests/optional/assignment/1.cc
index f711c4d..80eaa24 100644
--- a/gdb/unittests/optional/assignment/1.cc
+++ b/gdb/unittests/optional/assignment/1.cc
@@ -19,7 +19,7 @@ namespace assign_1 {
struct exception {};
-int counter = 0;
+static int counter = 0;
struct mixin_counter
{
diff --git a/gdb/unittests/optional/assignment/2.cc b/gdb/unittests/optional/assignment/2.cc
index fdc07f1..85c41c5 100644
--- a/gdb/unittests/optional/assignment/2.cc
+++ b/gdb/unittests/optional/assignment/2.cc
@@ -19,7 +19,7 @@ namespace assign_2 {
struct exception {};
-int counter = 0;
+static int counter = 0;
struct mixin_counter
{
diff --git a/gdb/unittests/optional/assignment/3.cc b/gdb/unittests/optional/assignment/3.cc
index e479f9c..03f6018 100644
--- a/gdb/unittests/optional/assignment/3.cc
+++ b/gdb/unittests/optional/assignment/3.cc
@@ -19,7 +19,7 @@ namespace assign_3 {
struct exception {};
-int counter = 0;
+static int counter = 0;
struct mixin_counter
{
diff --git a/gdb/unittests/optional/assignment/4.cc b/gdb/unittests/optional/assignment/4.cc
index 2bfe562..aa04292 100644
--- a/gdb/unittests/optional/assignment/4.cc
+++ b/gdb/unittests/optional/assignment/4.cc
@@ -19,7 +19,7 @@ namespace assign_4 {
struct exception {};
-int counter = 0;
+static int counter = 0;
struct mixin_counter
{
diff --git a/gdb/unittests/optional/assignment/5.cc b/gdb/unittests/optional/assignment/5.cc
index 4112e9f..8c27e7b 100644
--- a/gdb/unittests/optional/assignment/5.cc
+++ b/gdb/unittests/optional/assignment/5.cc
@@ -17,7 +17,7 @@
namespace assign_5 {
-int counter = 0;
+static int counter = 0;
struct mixin_counter
{
diff --git a/gdb/unittests/optional/assignment/6.cc b/gdb/unittests/optional/assignment/6.cc
index 423b3e7..da01fd5 100644
--- a/gdb/unittests/optional/assignment/6.cc
+++ b/gdb/unittests/optional/assignment/6.cc
@@ -17,7 +17,7 @@
namespace assign_6 {
-int counter = 0;
+static int counter = 0;
struct mixin_counter
{