From patchwork Thu Jul 12 20:51:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 28348 Received: (qmail 56181 invoked by alias); 12 Jul 2018 20:52:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 55957 invoked by uid 89); 12 Jul 2018 20:52:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:4578, UD:dtd, 82711, tty X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.145.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Jul 2018 20:52:30 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway30.websitewelcome.com (Postfix) with ESMTP id AFDCAAA00 for ; Thu, 12 Jul 2018 15:52:28 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id diZPf0mDkBcCXdiZZfhqdm; Thu, 12 Jul 2018 15:52:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=innVleDSlowK1eTqp4t5eYFujee4AkmGKaog6K/HgFo=; b=d/VmPof1HaoU2dLF5HfB1Jj+Us 4HJ1YUretrU+Zgk3m7TzkhZCd+Fk/e1XI7CMr32+6zig5OBJQnWI3wJayb3VqRil/1REWKf9Kdhje E+0BZtuD4F5Rf0VrOi7MfoaeE; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:49432 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fdiZP-001ZuD-9z; Thu, 12 Jul 2018 15:52:11 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 02/13] Unused variable fixes related to conditional compilation Date: Thu, 12 Jul 2018 14:51:57 -0600 Message-Id: <20180712205208.32646-3-tom@tromey.com> In-Reply-To: <20180712205208.32646-1-tom@tromey.com> References: <20180712205208.32646-1-tom@tromey.com> 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-12 Tom Tromey * 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 | 13 +++++++++++++ gdb/btrace.c | 6 ++---- gdb/charset.c | 6 +++--- gdb/guile/guile.c | 2 ++ gdb/inflow.c | 6 ++++-- gdb/remote.c | 2 ++ gdb/windows-nat.c | 2 ++ 7 files changed, 28 insertions(+), 9 deletions(-) diff --git a/gdb/btrace.c b/gdb/btrace.c index 35dc90e8e67..e25f047ce24 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -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) diff --git a/gdb/charset.c b/gdb/charset.c index fcb24a48823..8bb2b4d669f 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -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; diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c index 0bbbf6eac1f..efb59e3d2c3 100644 --- a/gdb/guile/guile.c +++ b/gdb/guile/guile.c @@ -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"; diff --git a/gdb/inflow.c b/gdb/inflow.c index a3b5ba8abef..caff6462070 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -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 diff --git a/gdb/remote.c b/gdb/remote.c index a81d67e5ede..a61680d242c 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -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; diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 8f4646d1cca..f9870b8bd1e 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -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