Fix warning in symtab.c
authorTom Tromey <tom@tromey.com>
Mon, 5 Jul 2021 17:44:54 +0000 (11:44 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 5 Jul 2021 17:54:03 +0000 (11:54 -0600)
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

index 6a9c3dce6af074a682dc37e3b384b6aeeb688a5e..fa3f42207ecd763bcd5cefc41132c125398fe117 100644 (file)
@@ -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)