[RFA,6/6] Add -Wunused-but-set-* to build
Commit Message
This adds -Wunused-but-set-variable and -Wunused-but-set-parameter to
configure.
2016-06-06 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* warning.m4 (AM_GDB_WARNINGS) <build_warnings>: Add
-Wunused-but-set-parameter, -Wunused-but-set-variable.
2016-06-06 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
---
gdb/ChangeLog | 6 ++++++
gdb/configure | 2 +-
gdb/gdbserver/ChangeLog | 4 ++++
gdb/gdbserver/configure | 2 +-
gdb/warning.m4 | 2 +-
5 files changed, 13 insertions(+), 3 deletions(-)
Comments
On Mon, Jun 06, 2016 at 03:33:32PM -0600, Tom Tromey wrote:
> This adds -Wunused-but-set-variable and -Wunused-but-set-parameter to
> configure.
great, I started on that a little while ago but didn't get to pushing
these bits upstream.
> +++ b/gdb/warning.m4
> @@ -39,7 +39,7 @@ fi
> build_warnings="-Wall -Wpointer-arith \
> -Wno-unused -Wunused-value -Wunused-function \
> -Wno-switch -Wno-char-subscripts \
> --Wempty-body"
> +-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable"
isn't everything in -Wunused enabled now? can we just delete -Wno-unused
and use -Wall to get us -Wunused?
Trev
>>>>> "Trevor" == Trevor Saunders <tbsaunde@tbsaunde.org> writes:
Trevor> isn't everything in -Wunused enabled now? can we just delete
Trevor> -Wno-unused and use -Wall to get us -Wunused?
I didn't think of that -- thanks. From the gcc docs I see
-Wunused-label, -Wunused-local-typedefs, and -Wunused-parameter. That
final one seems difficult for gdb given the many functions that are
called via function pointers but which do not use all their arguments.
Once the switch to C++ is complete, such parameters could be nameless.
To me that seems better than sticking ATTRIBUTE_UNUSED in many places.
Tom
On Tue, Jun 07, 2016 at 08:46:35PM -0600, Tom Tromey wrote:
> >>>>> "Trevor" == Trevor Saunders <tbsaunde@tbsaunde.org> writes:
>
> Trevor> isn't everything in -Wunused enabled now? can we just delete
> Trevor> -Wno-unused and use -Wall to get us -Wunused?
>
> I didn't think of that -- thanks. From the gcc docs I see
> -Wunused-label, -Wunused-local-typedefs, and -Wunused-parameter. That
> final one seems difficult for gdb given the many functions that are
> called via function pointers but which do not use all their arguments.
the docs for -Wunused-parameter are... tricky, but I believe what they
say is -Wall -Wunused does not enable -Wunused-parameter, to enable
-Wunused-parameter you either need to pass it explicitly, or pass
-Wextra -Wunused.
> Once the switch to C++ is complete, such parameters could be nameless.
> To me that seems better than sticking ATTRIBUTE_UNUSED in many places.
I'd agree, and at that point it might make sense to enable
-Wunused-parameter.
Trev
>
> Tom
Trevor> the docs for -Wunused-parameter are... tricky, but I believe what they
Trevor> say is -Wall -Wunused does not enable -Wunused-parameter, to enable
Trevor> -Wunused-parameter you either need to pass it explicitly, or pass
Trevor> -Wextra -Wunused.
Yes, I see. I think I misread them. They say:
'-Wunused'
All the above '-Wunused' options combined.
In order to get a warning about an unused function parameter, you
must either specify '-Wextra -Wunused' (note that '-Wall' implies
'-Wunused'), or separately specify '-Wunused-parameter'.
The first line implies that -Wunused-parameter is part of this, but then
subsequent text says not.
I'll give it a try and see what happens.
Tom
Tom> I'll give it a try and see what happens.
It turns out that -Wunused-variable causes a number of errors (104 in my
build). So, I think that while this change would be worthwhile, it's a
bit too much for me at present.
Tom
On Tue, Jun 07, 2016 at 10:15:59PM -0600, Tom Tromey wrote:
> Tom> I'll give it a try and see what happens.
>
> It turns out that -Wunused-variable causes a number of errors (104 in my
> build). So, I think that while this change would be worthwhile, it's a
> bit too much for me at present.
Sure, I'll probably get to it in a couple weeks if you don't get there
first (I eventually want to merge bfd/warnings.m4 and gdb/warnings.m4)
Trev
>
> Tom
@@ -1,5 +1,11 @@
2016-06-06 Tom Tromey <tom@tromey.com>
+ * configure: Rebuild.
+ * warning.m4 (AM_GDB_WARNINGS) <build_warnings>: Add
+ -Wunused-but-set-parameter, -Wunused-but-set-variable.
+
+2016-06-06 Tom Tromey <tom@tromey.com>
+
* mips-tdep.c (micromips_scan_prologue): Remove "frame_addr".
(mips_o32_push_dummy_call): Remove "stack_used_p".
* aarch64-tdep.c (aarch64_record_data_proc_imm): Remove
@@ -14242,7 +14242,7 @@ fi
build_warnings="-Wall -Wpointer-arith \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts \
--Wempty-body"
+-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable"
# Now add in C and C++ specific options, depending on mode.
if test "$enable_build_with_cxx" = "yes"; then
@@ -1,3 +1,7 @@
+2016-06-06 Tom Tromey <tom@tromey.com>
+
+ * configure: Rebuild.
+
2016-06-02 Jon Turney <jon.turney@dronecode.org.uk>
* win32-low.c (win32_create_inferior): Add pointer casts for C++.
@@ -6291,7 +6291,7 @@ fi
build_warnings="-Wall -Wpointer-arith \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts \
--Wempty-body"
+-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable"
# Now add in C and C++ specific options, depending on mode.
if test "$enable_build_with_cxx" = "yes"; then
@@ -39,7 +39,7 @@ fi
build_warnings="-Wall -Wpointer-arith \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts \
--Wempty-body"
+-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable"
# Now add in C and C++ specific options, depending on mode.
if test "$enable_build_with_cxx" = "yes"; then