From: Michael Eager <eager@eagerm.com>
To: Pedro Alves <palves@redhat.com>
Cc: Sergio Durigan Junior <sergiodj@redhat.com>,
Tom Tromey <tromey@redhat.com>,
Jan Kratochvil <jan.kratochvil@redhat.com>,
gdb@sourceware.org
Subject: Re: Switch -Wunused-variable on?
Date: Mon, 23 Apr 2012 18:39:00 -0000 [thread overview]
Message-ID: <4F95A1C0.6010805@eagerm.com> (raw)
In-Reply-To: <4F95907B.9060807@redhat.com>
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=all
> $ make -j8
> $ cd gdb
> $ make clean
> $ make WERROR_CFLAGS="-Wunused-variable" -j8 2>&1 1>/dev/null | tee warnings.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 ‘microblaze_alloc_frame_cache’:
> ../../src/gdb/microblaze-tdep.c:176:7: warning: unused variable ‘i’ [-Wunused-variable]
> ../../src/gdb/microblaze-tdep.c: In function ‘microblaze_analyze_prologue’:
> ../../src/gdb/microblaze-tdep.c:234:7: warning: unused variable ‘rn’ [-Wunused-variable]
> ../../src/gdb/microblaze-tdep.c: In function ‘microblaze_frame_cache’:
> ../../src/gdb/microblaze-tdep.c:464:23: warning: unused variable ‘fp’ [-Wunused-variable]
> ../../src/gdb/microblaze-tdep.c:464:19: warning: unused variable ‘pc’ [-Wunused-variable]
> ../../src/gdb/microblaze-linux-tdep.c: In function ‘microblaze_linux_sigtramp_cache’:
> ../../src/gdb/microblaze-linux-tdep.c:76:24: warning: unused variable ‘tdep’ [-Wunused-variable]
> ../../src/gdb/microblaze-linux-tdep.c: In function ‘microblaze_linux_init_abi’:
> ../../src/gdb/microblaze-linux-tdep.c:124:24: warning: unused variable ‘tdep’ [-Wunused-variable]
I'll clean up the MicroBlaze target files when I have a moment.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
next prev parent reply other threads:[~2012-04-23 18:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-22 8:06 Sergio Durigan Junior
2012-04-22 8:23 ` Jan Kratochvil
2012-04-22 20:25 ` Sergio Durigan Junior
2012-04-22 22:25 ` Jeffrey Walton
2012-04-23 8:55 ` Jan Kratochvil
2012-04-23 14:30 ` Tom Tromey
2012-04-23 15:49 ` Sergio Durigan Junior
2012-04-23 18:02 ` Pedro Alves
2012-04-23 18:39 ` Michael Eager [this message]
2012-04-24 22:11 ` Maciej W. Rozycki
2012-04-25 7:51 ` Andreas Schwab
2012-04-25 15:57 ` Maciej W. Rozycki
2012-04-25 16:50 ` Andreas Schwab
2012-04-25 17:22 ` Maciej W. Rozycki
2012-04-25 18:13 ` Andreas Schwab
2012-04-25 18:20 ` Sterling Augustine
2012-04-25 18:52 ` Maciej W. Rozycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F95A1C0.6010805@eagerm.com \
--to=eager@eagerm.com \
--cc=gdb@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=palves@redhat.com \
--cc=sergiodj@redhat.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox