From 2814ff838841c24a71b5cfbb982785fc95d424f8 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 11 Jul 2021 06:59:33 -0700 Subject: [PATCH] Fix warning in symtab.c The compiler gives this warning when building symtab.c: ../../binutils-gdb/gdb/symtab.c:4247:28: warning: 'to_match' may be used uninitialized in this function [-Wmaybe-uninitialized] This patch fixes the warning by adding a gdb_assert_not_reached. gdb/ChangeLog: * gdb/symtab.c (info_sources_filter::matches): Add default case hander in switch statement. (cherry picked from commit b6aeb717a8bdaa9cc348ec88a5fdf059e1337580) --- gdb/ChangeLog | 6 ++++++ gdb/symtab.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f37f61de030..087796b8b19 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-07-11 Tom Tromey + + Committed by Joel Brobecker : + * gdb/symtab.c (info_sources_filter::matches): Add default + case hander in switch statement. + 2021-07-08 Simon Marchi * s390-linux-tdep.c (s390_linux_init_abi_any): Pass 1 (number diff --git a/gdb/symtab.c b/gdb/symtab.c index 6a9c3dce6af..fa3f42207ec 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4242,6 +4242,8 @@ info_sources_filter::matches (const char *fullname) const case match_on::FULLNAME: to_match = fullname; break; + default: + gdb_assert_not_reached ("bad m_match_type"); } if (m_c_regexp->exec (to_match, 0, NULL, 0) != 0) -- 2.47.3