This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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]
-- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |