From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5722 invoked by alias); 2 May 2012 10:55:36 -0000 Received: (qmail 5706 invoked by uid 22791); 2 May 2012 10:55:34 -0000 X-SWARE-Spam-Status: No, hits=-7.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,TW_BJ,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 May 2012 10:55:19 +0000 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.14.4/8.14.4) with ESMTP id q42AtJgJ031824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 May 2012 06:55:19 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q42AtHVi000921; Wed, 2 May 2012 06:55:18 -0400 Message-ID: <4FA11295.6050103@redhat.com> Date: Wed, 02 May 2012 10:55:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120424 Thunderbird/12.0 MIME-Version: 1.0 To: Sergio Durigan Junior CC: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag) References: <4F968B4D.3050209@redhat.com> <87wr55do66.fsf@fleche.redhat.com> <4F96E79C.6030208@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00017.txt.bz2 On 05/02/2012 06:30 AM, Sergio Durigan Junior wrote: > Ok, sorry for taking so long to respond, this patch is huge and I was > doing something else... > > Well, here's the "obvious" patch that I came up with. It contains only > declarations of variables, not assignments to them. No it doesn't. ;-) > > I know it's "obvious", but I prefer to ask than to apologize, so: is it > OK to apply? > > Of course, if you really want some rationale to the changes below, I > will need to dive into the code and see why those variables are not > used. > > OK to apply? > index aedda41..a7b67c5 100644 > --- a/gdb/gcore.c > +++ b/gdb/gcore.c > @@ -472,13 +472,12 @@ objfile_find_memory_regions (find_memory_region_ftype func, void *obfd) > /* Call callback function for each objfile section. */ > ALL_OBJSECTIONS (objfile, objsec) > { > - bfd *ibfd = objfile->obfd; > asection *isec = objsec->the_bfd_section; > - flagword flags = bfd_get_section_flags (ibfd, isec); > + flagword flags = bfd_get_section_flags (objfile->obfd, isec); > > if ((flags & SEC_ALLOC) || (flags & SEC_LOAD)) > { > - int size = bfd_section_size (ibfd, isec); > + int size = bfd_section_size (objfile->obfd, isec); > int ret; > > ret = (*func) (obj_section_addr (objsec), size, As I've pointed out before, this needs a rationale. (IMO, we should fix the macro). Several other places in the patch do this. On 05/02/2012 06:30 AM, Sergio Durigan Junior wrote: > @@ -238,8 +237,12 @@ m32r_supply_register (struct regcache *regcache, char *regname, > monitor_supply_register (regcache, regno, val); > if (regno == PSW_REGNUM) > { > +#if defined SM_REGNUM || defined BSM_REGNUM || defined IE_REGNUM \ > + || defined BIE_REGNUM || defined COND_REGNUM || defined CBR_REGNUM \ > + || defined BPC_REGNUM || defined BCARRY_REGNUM > unsigned long psw = strtoul (val, NULL, 16); > char *zero = "00000000", *one = "00000001"; > +#endif This doesn't fit in the category, but okay. :-) Could you wrap the multiline predicate in parenthesis though, please? #if (defined SM_REGNUM || defined BSM_REGNUM || defined IE_REGNUM \ || defined ...) The rest looked good to me. -- Pedro Alves