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
+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
 
 
 /* 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.  */
 
 #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
 }
 
 /* AArch64 prologue unwinder.  */
-struct frame_unwind aarch64_prologue_unwind =
+static frame_unwind aarch64_prologue_unwind =
 {
   NORMAL_FRAME,
   aarch64_prologue_frame_unwind_stop_reason,
 }
 
 /* AArch64 stub unwinder.  */
-struct frame_unwind aarch64_stub_unwind =
+static frame_unwind aarch64_stub_unwind =
 {
   NORMAL_FRAME,
   aarch64_stub_frame_unwind_stop_reason,
 }
 
 /* AArch64 default frame base information.  */
-struct frame_base aarch64_normal_base =
+static frame_base aarch64_normal_base =
 {
   &aarch64_prologue_unwind,
   aarch64_normal_frame_base,
 
 
 /* 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
 
                                       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,
 
 /* 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.  */
 
                                       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,
 
   struct gdbarch_data_registration *registrations;
 };
 
-struct gdbarch_data_registry gdbarch_data_registry =
+static struct gdbarch_data_registry gdbarch_data_registry =
 {
   0, NULL,
 };
 
 #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 *);
 
 
 };
 
 /* From <machine/mcontext.h>.  */
-int i386nbsd_mc_reg_offset[] =
+static int i386nbsd_mc_reg_offset[] =
 {
   11 * 4,                      /* %eax */
   10 * 4,                      /* %ecx */
 
    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'.
     
 
 /* 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 } },
 
 /* 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 } },
 
    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
 
 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.  */
 
 
 /* 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,
 
 }
 
 /* Command list for maint test-options.  */
-struct cmd_list_element *maintenance_test_options_list;
+static cmd_list_element *maintenance_test_options_list;
 
 \f
 void _initialize_maint_test_options ();
 
    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 },
 
 
 /* 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.  */
 
 
 
 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;
 
 #include "solib-svr4.h"
 
 /* Register offsets from <machine/reg.h>.  */
-struct ppc_reg_offsets ppcnbsd_reg_offsets;
+static ppc_reg_offsets ppcnbsd_reg_offsets;
 \f
 
 /* Core file support.  */
 
 #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;
 
 #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 },
 
 
 /* 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"},
 
 
 /* Python RecordGap type.  */
 
-PyTypeObject recpy_gap_type = {
+static PyTypeObject recpy_gap_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
 };
 
 
 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;
 
 /* 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
 {
 
 /* 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 *), \
 
    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 */
 
 
    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.  */
 
 
 /* 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 */
 
 
 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.
 
 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;
 
 
 struct exception {};
 
-int counter = 0;
+static int counter = 0;
 
 struct mixin_counter
 {
 
 
 struct exception {};
 
-int counter = 0;
+static int counter = 0;
 
 struct mixin_counter
 {
 
 
 struct exception {};
 
-int counter = 0;
+static int counter = 0;
 
 struct mixin_counter
 {
 
 
 struct exception {};
 
-int counter = 0;
+static int counter = 0;
 
 struct mixin_counter
 {
 
 
 namespace assign_5 {
 
-int counter = 0;
+static int counter = 0;
 
 struct mixin_counter
 {
 
 
 namespace assign_6 {
 
-int counter = 0;
+static int counter = 0;
 
 struct mixin_counter
 {
 
+2021-01-20  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * 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.
+
 2021-01-20  Tom de Vries  <tdevries@suse.de>
 
        * linux-x86-low.cc (collect_register_i386): New function.
 
 
 int emit_error;
 
-struct bytecode_address
+static struct bytecode_address
 {
   int pc;
   CORE_ADDR address;
 
 #endif
 
 /* Output file for debugging.  Default to standard error.  */
-FILE *debug_file = stderr;
+static FILE *debug_file = stderr;
 
 /* See debug.h.  */
 int debug_threads;
 
   };
 
 /* This is set while stop_all_lwps is in effect.  */
-enum stopping_threads_kind stopping_threads = NOT_STOPPING_THREADS;
+static stopping_threads_kind stopping_threads = NOT_STOPPING_THREADS;
 
 /* FIXME make into a target method?  */
 int using_threads = 1;
 
 /* When the event-loop is doing a step-over, this points at the thread
    being stepped.  */
-ptid_t step_over_bkpt;
+static ptid_t step_over_bkpt;
 
 bool
 linux_process_target::low_supports_breakpoints ()
 
     *size_p = 4;
 }
 
-struct emit_ops amd64_emit_ops =
+static emit_ops amd64_emit_ops =
   {
     amd64_emit_prologue,
     amd64_emit_epilogue,
     *size_p = 4;
 }
 
-struct emit_ops i386_emit_ops =
+static emit_ops i386_emit_ops =
   {
     i386_emit_prologue,
     i386_emit_epilogue,
 
 }
 
 /* Breakpoint at "stop_tracing" in the inferior lib.  */
-struct breakpoint *stop_tracing_bkpt;
+static struct breakpoint *stop_tracing_bkpt;
 static int stop_tracing_handler (CORE_ADDR);
 
 /* Breakpoint at "flush_trace_buffer" in the inferior lib.  */
-struct breakpoint *flush_trace_buffer_bkpt;
+static struct breakpoint *flush_trace_buffer_bkpt;
 static int flush_trace_buffer_handler (CORE_ADDR);
 
 static void download_trace_state_variables (void);
 /* Linked list of all trace state variables.  */
 
 #ifdef IN_PROCESS_AGENT
-struct trace_state_variable *alloced_trace_state_variables;
+static struct trace_state_variable *alloced_trace_state_variables;
 #endif
 
 IP_AGENT_EXPORT_VAR struct trace_state_variable *trace_state_variables;
    it doesn't need to sync with itself.  Define it as array anyway so
    that the rest of the code base doesn't need to care for the
    difference.  */
-struct trace_buffer_control trace_buffer_ctrl[1];
+static trace_buffer_control trace_buffer_ctrl[1];
 # define TRACE_BUFFER_CTRL_CURR 0
 #endif
 
 /* 64-bit timestamps for the trace run's start and finish, expressed
    in microseconds from the Unix epoch.  */
 
-LONGEST tracing_start_time;
-LONGEST tracing_stop_time;
+static LONGEST tracing_start_time;
+static LONGEST tracing_stop_time;
 
 /* The (optional) user-supplied name of the user that started the run.
    This is an arbitrary string, and may be NULL.  */
 
-char *tracing_user_name;
+static char *tracing_user_name;
 
 /* Optional user-supplied text describing the run.  This is
    an arbitrary string, and may be NULL.  */
 
-char *tracing_notes;
+static char *tracing_notes;
 
 /* Optional user-supplied text explaining a tstop command.  This is an
    arbitrary string, and may be NULL.  */
 
-char *tracing_stop_note;
+static char *tracing_stop_note;
 
 #endif