From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4608 invoked by alias); 23 Apr 2012 18:39:17 -0000 Received: (qmail 4542 invoked by uid 22791); 23 Apr 2012 18:39:15 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from shell4.bayarea.net (HELO shell4.bayarea.net) (209.128.82.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Apr 2012 18:39:00 +0000 Received: (qmail 31116 invoked from network); 23 Apr 2012 11:38:59 -0700 Received: from c-76-102-3-160.hsd1.ca.comcast.net (HELO redwood.eagercon.com) (76.102.3.160) by shell4.bayarea.net with SMTP; 23 Apr 2012 11:38:59 -0700 Message-ID: <4F95A1C0.6010805@eagerm.com> Date: Mon, 23 Apr 2012 18:39:00 -0000 From: Michael Eager User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Pedro Alves CC: Sergio Durigan Junior , Tom Tromey , Jan Kratochvil , gdb@sourceware.org Subject: Re: Switch -Wunused-variable on? References: <20120422082240.GA21311@host2.jankratochvil.net> <87sjfufrlr.fsf@fleche.redhat.com> <4F95907B.9060807@redhat.com> In-Reply-To: <4F95907B.9060807@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00188.txt.bz2 On 04/23/2012 10:25 AM, Pedro Alves wrote: > On 04/23/2012 04:49 PM, Sergio Durigan Junior wrote: > >> On Monday, April 23 2012, Tom Tromey wrote: >> >>> I'd say that the best approach would be to make the declarations >>> conditional in the same way that the uses are. >>> >>> If there are a lot of problem cases with this approach, or if it makes >>> the code too ugly, then maybe it would be better just not to use this >>> flag. >> >> Ok, that makes sense to me. Since there are tons of places with unused >> variables in the code, I will take some time to look and convert the >> proper places to use this solution. > > > I don't think there'll be that many such cases. > > In case it helps, here's how I peek at this sort of thing: > > $ .....configure --enable-targets=3Dall > $ make -j8 > $ cd gdb > $ make clean > $ make WERROR_CFLAGS=3D"-Wunused-variable" -j8 2>&1 1>/dev/null | tee war= nings.txt > ... > > There aren't _that_ many warnings: > > $ grep warning warnings.txt | wc -l > 512 > > (This doesn't catch files only built on other hosts, of course.) > > And the worse offenders account for a lot of the instances: > > $ grep warning warnings.txt | sed 's/\.c.*/\.c/g' | sort | uniq -c | sort= -nr > 50 ../../src/gdb/arm-tdep.c > 15 ../../src/gdb/cris-tdep.c > 13 ../../src/gdb/ia64-tdep.c > 12 ../../src/gdb/dwarf2read.c > 12 ../../src/gdb/c-lang.c > 12 ../../src/gdb/breakpoint.c > 11 ../../src/gdb/mips-tdep.c > 11 ../../src/gdb/m32c-tdep.c > 10 ../../src/gdb/spu-tdep.c > 10 ../../src/gdb/lm32-tdep.c > 10 ../../src/gdb/hppa-tdep.c > ../../src/gdb/microblaze-tdep.c: In function =E2=80=98microblaze_alloc_fr= ame_cache=E2=80=99: > ../../src/gdb/microblaze-tdep.c:176:7: warning: unused variable =E2=80=98= i=E2=80=99 [-Wunused-variable] > ../../src/gdb/microblaze-tdep.c: In function =E2=80=98microblaze_analyze_= prologue=E2=80=99: > ../../src/gdb/microblaze-tdep.c:234:7: warning: unused variable =E2=80=98= rn=E2=80=99 [-Wunused-variable] > ../../src/gdb/microblaze-tdep.c: In function =E2=80=98microblaze_frame_ca= che=E2=80=99: > ../../src/gdb/microblaze-tdep.c:464:23: warning: unused variable =E2=80= =98fp=E2=80=99 [-Wunused-variable] > ../../src/gdb/microblaze-tdep.c:464:19: warning: unused variable =E2=80= =98pc=E2=80=99 [-Wunused-variable] > ../../src/gdb/microblaze-linux-tdep.c: In function =E2=80=98microblaze_li= nux_sigtramp_cache=E2=80=99: > ../../src/gdb/microblaze-linux-tdep.c:76:24: warning: unused variable =E2= =80=98tdep=E2=80=99 [-Wunused-variable] > ../../src/gdb/microblaze-linux-tdep.c: In function =E2=80=98microblaze_li= nux_init_abi=E2=80=99: > ../../src/gdb/microblaze-linux-tdep.c:124:24: warning: unused variable = =E2=80=98tdep=E2=80=99 [-Wunused-variable] I'll clean up the MicroBlaze target files when I have a moment. --=20 Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077