Unused variable fixes related to conditional compilation
authorTom Tromey <tom@tromey.com>
Sun, 8 Jul 2018 18:39:36 +0000 (12:39 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 22 Jul 2018 19:20:02 +0000 (13:20 -0600)
This patch fixes various unused variable warnings that are related to
conditional compilation.  In these cases, either the variable is now
protected by the same #if as its uses, or the declaration is simply
lowered into the conditionally-compiled block.

gdb/ChangeLog
2018-07-22  Tom Tromey  <tom@tromey.com>

* windows-nat.c (saved_context): Conditionally define.
* remote.c (remote_target::remote_btrace_maybe_reopen):
Conditionally declare "warned".
* inflow.c (sigquit_ours): Conditionally define.
(new_tty): Move "tty" declaration inside #if.
* guile/guile.c (guile_datadir): Conditionally define.
* charset.c (set_be_le_names): Move some declarations inside #if.
* btrace.c (parse_xml_btrace): Move "errcode" declaration inside
#if.
(parse_xml_btrace_conf): Likewise.

gdb/ChangeLog
gdb/btrace.c
gdb/charset.c
gdb/guile/guile.c
gdb/inflow.c
gdb/remote.c
gdb/windows-nat.c

index 67315f7..224d91d 100644 (file)
@@ -1,5 +1,18 @@
 2018-07-22  Tom Tromey  <tom@tromey.com>
 
+       * windows-nat.c (saved_context): Conditionally define.
+       * remote.c (remote_target::remote_btrace_maybe_reopen):
+       Conditionally declare "warned".
+       * inflow.c (sigquit_ours): Conditionally define.
+       (new_tty): Move "tty" declaration inside #if.
+       * guile/guile.c (guile_datadir): Conditionally define.
+       * charset.c (set_be_le_names): Move some declarations inside #if.
+       * btrace.c (parse_xml_btrace): Move "errcode" declaration inside
+       #if.
+       (parse_xml_btrace_conf): Likewise.
+
+2018-07-22  Tom Tromey  <tom@tromey.com>
+
        * spu-tdep.c (spu_get_overlay_table): Remove unused variable.
 
 2018-07-22  Tom Tromey  <tom@tromey.com>
index 35dc90e..e25f047 100644 (file)
@@ -2202,10 +2202,9 @@ static const struct gdb_xml_element btrace_elements[] = {
 void
 parse_xml_btrace (struct btrace_data *btrace, const char *buffer)
 {
-  int errcode;
-
 #if defined (HAVE_LIBEXPAT)
 
+  int errcode;
   btrace_data result;
   result.format = BTRACE_FORMAT_NONE;
 
@@ -2303,10 +2302,9 @@ static const struct gdb_xml_element btrace_conf_elements[] = {
 void
 parse_xml_btrace_conf (struct btrace_config *conf, const char *xml)
 {
-  int errcode;
-
 #if defined (HAVE_LIBEXPAT)
 
+  int errcode;
   errcode = gdb_xml_parse_quick (_("btrace-conf"), "btrace-conf.dtd",
                                 btrace_conf_elements, xml, conf);
   if (errcode != 0)
index fcb24a4..8bb2b4d 100644 (file)
@@ -295,9 +295,6 @@ static struct gdbarch *be_le_arch;
 static void
 set_be_le_names (struct gdbarch *gdbarch)
 {
-  int i, len;
-  const char *target_wide;
-
   if (be_le_arch == gdbarch)
     return;
   be_le_arch = gdbarch;
@@ -307,6 +304,9 @@ set_be_le_names (struct gdbarch *gdbarch)
   target_wide_charset_le_name = "UTF-32LE";
   target_wide_charset_be_name = "UTF-32BE";
 #else
+  int i, len;
+  const char *target_wide;
+
   target_wide_charset_le_name = NULL;
   target_wide_charset_be_name = NULL;
 
index 6353b35..95b36fe 100644 (file)
@@ -46,8 +46,10 @@ int gdbscm_guile_major_version;
 int gdbscm_guile_minor_version;
 int gdbscm_guile_micro_version;
 
+#ifdef HAVE_GUILE
 /* The guile subdirectory within gdb's data-directory.  */
 static const char *guile_datadir;
+#endif
 
 /* Declared constants and enum for guile exception printing.  */
 const char gdbscm_print_excp_none[] = "none";
index a3b5ba8..caff646 100644 (file)
@@ -138,7 +138,9 @@ private:
    to SIG_IGN.  */
 
 static sighandler_t sigint_ours;
+#ifdef SIGQUIT
 static sighandler_t sigquit_ours;
+#endif
 
 /* The name of the tty (from the `tty' command) that we're giving to
    the inferior when starting it up.  This is only (and should only
@@ -825,11 +827,11 @@ check_syscall (const char *msg, int result)
 void
 new_tty (void)
 {
-  int tty;
-
   if (inferior_thisrun_terminal == 0)
     return;
 #if !defined(__GO32__) && !defined(_WIN32)
+  int tty;
+
 #ifdef TIOCNOTTY
   /* Disconnect the child process from our controlling terminal.  On some
      systems (SVR4 for example), this may cause a SIGTTOU, so temporarily
index a81d67e..a61680d 100644 (file)
@@ -13717,7 +13717,9 @@ remote_target::remote_btrace_maybe_reopen ()
   struct remote_state *rs = get_remote_state ();
   struct thread_info *tp;
   int btrace_target_pushed = 0;
+#if !defined (HAVE_LIBIPT)
   int warned = 0;
+#endif
 
   scoped_restore_current_thread restore_thread;
 
index 3f722a1..e0e422c 100644 (file)
@@ -146,8 +146,10 @@ static GetConsoleFontSize_ftype *GetConsoleFontSize;
 
 static int have_saved_context; /* True if we've saved context from a
                                   cygwin signal.  */
+#ifdef __CYGWIN__
 static CONTEXT saved_context;  /* Containes the saved context from a
                                   cygwin signal.  */
+#endif
 
 /* If we're not using the old Cygwin header file set, define the
    following which never should have been in the generic Win32 API