public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix warning in symtab.c
@ 2021-07-05 17:45 Tom Tromey
  2021-07-05 17:48 ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2021-07-05 17:45 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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/symtab.c | 2 ++
 1 file changed, 2 insertions(+)

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.26.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-11 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 17:45 [PATCH] Fix warning in symtab.c Tom Tromey
2021-07-05 17:48 ` Simon Marchi
2021-07-08 19:26   ` Simon Marchi
2021-07-11 14:36     ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).