gdbsupport: add some -Wunused-* warning flags

Add a few -Wunused-* diagnostic flags that look useful.  Some are known
to gcc, some to clang, some to both.  Fix the fallouts.

-Wunused-const-variable=1 is understood by gcc, but not clang.
-Wunused-const-variable would be undertsood by both, but for gcc at
least it would flag the unused const variables in headers.  This doesn't
make sense to me, because as soon as one source file includes a header
but doesn't use a const variable defined in that header, it's an error.
With `=1`, gcc only warns about unused const variable in the main source
file.  It's not a big deal that clang doesn't understand it though: any
instance of that problem will be flagged by any gcc build.

Change-Id: Ie20d99524b3054693f1ac5b53115bb46c89a5156
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Simon Marchi
2025-03-15 18:13:41 -04:00
committed by Simon Marchi
parent df3eb64a53
commit 6fca4d9694
13 changed files with 27 additions and 34 deletions

View File

@@ -887,8 +887,7 @@ private:
/* Object constructor to be called for current DWARF2_PER_BFD. */
debug_str_lookup (dwarf2_per_bfd *per_bfd)
: m_abfd (per_bfd->obfd),
m_per_bfd (per_bfd)
: m_per_bfd (per_bfd)
{
}
@@ -922,7 +921,6 @@ private:
private:
gdb::unordered_map<c_str_view, size_t, c_str_view_hasher> m_str_table;
bfd *const m_abfd;
dwarf2_per_bfd *m_per_bfd;
/* Data to add at the end of .debug_str for new needed symbol names. */