[binutils-gdb] [gdb/build] Fix unused var in corelow.c

Tom de Vries vries@sourceware.org
Tue Sep 10 08:08:16 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bc13da1980ceec05cff958d72a774b4373c9e00d

commit bc13da1980ceec05cff958d72a774b4373c9e00d
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Sep 10 10:08:29 2024 +0200

    [gdb/build] Fix unused var in corelow.c
    
    On x86_64-linux, with gcc 7.5.0 and CFLAGS/CXXFLAGS="-O0 -g -Wall" I ran into
    a build breaker:
    ...
    gdb/corelow.c: In member function ‘void mapped_file_info::add(const char*, const char*, const char*, std::vector<mem_range>&&, const bfd_build_id*)’:
    gdb/corelow.c:1822:27: error: unused variable ‘it’ [-Werror=unused-variable]
       const auto [it, inserted]
                               ^
    ...
    
    Fix this by dropping the variable it.
    
    Tested on x86_64-linux.
    
    Reviewed-By: Lancelot Six<lancelot.six@amd.com>

Diff:
---
 gdb/corelow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/corelow.c b/gdb/corelow.c
index 16f07c23faa..ab2fa746de8 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -1819,8 +1819,8 @@ mapped_file_info::add (const char *soname,
      parsed, we group the build-id information based on the file name.  As
      a consequence, we should see each EXPECTED_FILENAME value exactly
      once.  This means that each insertion should always succeed.  */
-  const auto [it, inserted]
-    = m_filename_to_build_id_map.emplace (expected_filename, build_id);
+  const auto inserted
+    = m_filename_to_build_id_map.emplace (expected_filename, build_id).second;
   gdb_assert (inserted);
 
   /* Setup the reverse build-id to file name map.  */


More information about the Gdb-cvs mailing list