From patchwork Sat Jul 14 21:50:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 28396 Received: (qmail 85701 invoked by alias); 14 Jul 2018 21:50:12 -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 85687 invoked by uid 89); 14 Jul 2018 21:50:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=whatsoever, SPE, spe X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 14 Jul 2018 21:50:10 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 0A12C1E093; Sat, 14 Jul 2018 17:50:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1531605006; bh=RED3VW0VobO1bQR77k2OXtYCCG/8AUUhvty0RMLyo1Q=; h=Subject:From:To:References:Date:In-Reply-To:From; b=YoK1KmxCuwQAg8K4rZBMzzXinD4CY4LL2za5F0FF0LKaCcvDg0lFU0UD5zO0LNxNw FuikqR8yWVR1TaH3jCyiiF7EMPmkKlB7xABSmNxHqNlHUepwd4EFdgy+JkhsRbcHZu xR/GljLny6Eg0WE2R+tvZ9AJGnwGfG0lGbQjDKsY= Subject: Re: [RFA 02/13] Unused variable fixes related to conditional compilation From: Simon Marchi To: Tom Tromey , gdb-patches@sourceware.org References: <20180712205208.32646-1-tom@tromey.com> <20180712205208.32646-3-tom@tromey.com> <2ca3e97a-2d06-ac81-c992-40a9bfd2740e@simark.ca> Message-ID: Date: Sat, 14 Jul 2018 17:50:05 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <2ca3e97a-2d06-ac81-c992-40a9bfd2740e@simark.ca> On 2018-07-13 09:16 PM, Simon Marchi wrote: > On 2018-07-12 04:51 PM, Tom Tromey wrote: >> 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. > > This LGTM. > > Simon > I found a few more in a cross-compilation build that has !HAVE_ELF, for some reason. From e590cfda6ccb63a5270e36c636fb7daa567aa781 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 13 Jul 2018 21:44:52 -0400 Subject: [PATCH] conditional compilation --- gdb/arm-tdep.c | 13 +++++++------ gdb/rs6000-tdep.c | 5 ++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index b1a05bbeba2d..c3280ee211d1 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -8955,7 +8955,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else if (ei_osabi == ELFOSABI_NONE || ei_osabi == ELFOSABI_GNU) { int eabi_ver = EF_ARM_EABI_VERSION (e_flags); - int attr_arch, attr_profile; switch (eabi_ver) { @@ -9026,11 +9025,13 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) executable file includes build attributes; GCC does copy them to the executable, but e.g. RealView does not. */ - attr_arch = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC, - Tag_CPU_arch); - attr_profile = bfd_elf_get_obj_attr_int (info.abfd, - OBJ_ATTR_PROC, - Tag_CPU_arch_profile); + int attr_arch + = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC, + Tag_CPU_arch); + int attr_profile + = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC, + Tag_CPU_arch_profile); + /* GCC specifies the profile for v6-M; RealView only specifies the profile for architectures starting with V7 (as opposed to architectures with a tag diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 45bf98267a99..e78de49b2e69 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -3558,7 +3558,6 @@ bfd_uses_spe_extensions (bfd *abfd) bfd_size_type size; gdb_byte *ptr; int success = 0; - int vector_abi; if (!abfd) return 0; @@ -3567,8 +3566,8 @@ bfd_uses_spe_extensions (bfd *abfd) /* Using Tag_GNU_Power_ABI_Vector here is a bit of a hack, as the user could be using the SPE vector abi without actually using any spe bits whatsoever. But it's close enough for now. */ - vector_abi = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_GNU, - Tag_GNU_Power_ABI_Vector); + int vector_abi = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_GNU, + Tag_GNU_Power_ABI_Vector); if (vector_abi == 3) return 1; #endif