From patchwork Thu Oct 7 10:08:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 67027 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 93919B6F06 for ; Thu, 7 Oct 2010 21:14:32 +1100 (EST) Received: from localhost ([127.0.0.1]:53458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3nUb-000564-B2 for incoming@patchwork.ozlabs.org; Thu, 07 Oct 2010 06:14:29 -0400 Received: from [140.186.70.92] (port=32866 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3nOV-00026j-K8 for qemu-devel@nongnu.org; Thu, 07 Oct 2010 06:08:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P3nOU-00009Z-8V for qemu-devel@nongnu.org; Thu, 07 Oct 2010 06:08:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P3nOU-00008s-1x for qemu-devel@nongnu.org; Thu, 07 Oct 2010 06:08:10 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o97A88OK028742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Oct 2010 06:08:08 -0400 Received: from blackfin.pond.sub.org (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o97A87DT010035; Thu, 7 Oct 2010 06:08:07 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 500) id DF36370; Thu, 7 Oct 2010 12:08:05 +0200 (CEST) From: Markus Armbruster To: Blue Swirl Subject: Re: [Qemu-devel] [PATCH 07/11] cris: avoid write only variables References: Date: Thu, 07 Oct 2010 12:08:05 +0200 In-Reply-To: (Blue Swirl's message of "Wed, 6 Oct 2010 21:33:38 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: "Edgar E. Iglesias" , qemu-devel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Blue Swirl writes: > Compiling with GCC 4.6.0 20100925 produced warnings: > /src/qemu/target-cris/op_helper.c: In function 'helper_movl_sreg_reg': > /src/qemu/target-cris/op_helper.c:145:8: error: variable 'tlb_v' set > but not used [-Werror=unused-but-set-variable] > In file included from /src/qemu/target-cris/translate.c:3154:0: > /src/qemu/target-cris/translate_v10.c: In function 'dec10_prep_move_m': > /src/qemu/target-cris/translate_v10.c:111:22: error: variable 'rd' set > but not used [-Werror=unused-but-set-variable] > > Fix by making the variable declarations and their uses also conditional > to debug definition, delete rd. > > Signed-off-by: Blue Swirl > --- > target-cris/op_helper.c | 6 ++++++ > target-cris/translate_v10.c | 5 ++--- > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c > index a60da94..28c79b1 100644 > --- a/target-cris/op_helper.c > +++ b/target-cris/op_helper.c > @@ -142,7 +142,9 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) > uint32_t idx; > uint32_t lo, hi; > uint32_t vaddr; > +#ifdef CRIS_OP_HELPER_DEBUG > int tlb_v; > +#endif > > idx = set = env->sregs[SFR_RW_MM_TLB_SEL]; > set >>= 4; > @@ -157,13 +159,17 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) > vaddr = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].hi, > 13, 31); > vaddr <<= TARGET_PAGE_BITS; > +#ifdef CRIS_OP_HELPER_DEBUG > tlb_v = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo, > 3, 3); > +#endif > env->tlbsets[srs - 1][set][idx].lo = lo; > env->tlbsets[srs - 1][set][idx].hi = hi; > > +#ifdef CRIS_OP_HELPER_DEBUG > D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", > vaddr, tlb_v, env->pc); > +#endif > tlb_flush_page(env, vaddr); > } > } Could we eliminate the bothersome variable instead? Untested. [...] diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c index a60da94..94e3e27 100644 --- a/target-cris/op_helper.c +++ b/target-cris/op_helper.c @@ -142,7 +142,6 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) uint32_t idx; uint32_t lo, hi; uint32_t vaddr; - int tlb_v; idx = set = env->sregs[SFR_RW_MM_TLB_SEL]; set >>= 4; @@ -157,13 +156,14 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) vaddr = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].hi, 13, 31); vaddr <<= TARGET_PAGE_BITS; - tlb_v = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo, + D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", + vaddr, + EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo, 3, 3); + env->pc); env->tlbsets[srs - 1][set][idx].lo = lo; env->tlbsets[srs - 1][set][idx].hi = hi; - D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", - vaddr, tlb_v, env->pc); tlb_flush_page(env, vaddr); } }