]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/build] Fix unused var in linux-fork.c
authorTom de Vries <tdevries@suse.de>
Thu, 6 Feb 2025 06:35:09 +0000 (07:35 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 6 Feb 2025 06:35:09 +0000 (07:35 +0100)
On x86_64-linux, with gcc 7.5.0 I ran into a build breaker:
...
linux-fork.c: In function ‘void detach_checkpoint_command(const char*, int)’:
linux-fork.c:744:16: error: unused variable ‘inf’ [-Werror=unused-variable]
   auto [fi, inf] = parse_checkpoint_id (args);
                ^
linux-fork.c: In function ‘void linux_fork_context(fork_info*, int, inferior*)’:
linux-fork.c:1020:22: error: unused variable ‘oldinf’ [-Werror=unused-variable]
   auto [oldfp, oldinf] = find_fork_ptid (inferior_ptid);
                      ^
...

Fix this by dropping the unused variables, similar how that was done in commit
bc13da1980c ("[gdb/build] Fix unused var in corelow.c").

Tested on x86_64-linux, by completing a build.

gdb/linux-fork.c

index 7ca456f9a2c54da14b596057afff9dff11c1b127..f31c777edffd47f0ea6806ff06ff4b1b8088de0e 100644 (file)
@@ -741,7 +741,7 @@ detach_checkpoint_command (const char *args, int from_tty)
   if (!args || !*args)
     error (_("Requires argument (checkpoint id to detach)"));
 
-  auto [fi, inf] = parse_checkpoint_id (args);
+  auto fi = parse_checkpoint_id (args).first;
   ptid = fi->ptid;
 
   if (ptid == inferior_ptid)
@@ -1017,7 +1017,7 @@ linux_fork_context (struct fork_info *newfp, int from_tty, inferior *newinf)
       inferior_changed = true;
     }
 
-  auto [oldfp, oldinf] = find_fork_ptid (inferior_ptid);
+  auto oldfp = find_fork_ptid (inferior_ptid).first;
   gdb_assert (oldfp != NULL);
 
   if (oldfp != newfp)