]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix warning in symtab.c
authorTom Tromey <tom@tromey.com>
Sun, 11 Jul 2021 13:59:33 +0000 (06:59 -0700)
committerJoel Brobecker <brobecker@adacore.com>
Sun, 11 Jul 2021 13:59:33 +0000 (06:59 -0700)
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
gdb/symtab.c

index f37f61de0306fc2222e72592d974d2b1e3bd5d7f..087796b8b197041a45f5ba87c605f938a5997103 100644 (file)
@@ -1,3 +1,9 @@
+2021-07-11  Tom Tromey  <tom@tromey.com>
+
+       Committed by Joel Brobecker  <brobecker@adacore.com>:
+       * gdb/symtab.c (info_sources_filter::matches): Add default
+       case hander in switch statement.
+
 2021-07-08  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * s390-linux-tdep.c (s390_linux_init_abi_any): Pass 1 (number
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)