aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnze Li <enze.li@hotmail.com>2023-09-11 22:40:43 +0800
committerJohn Baldwin <jhb@FreeBSD.org>2023-09-22 12:23:44 -0700
commit2da39de8dfb3f8dbb364cd414bdd6bee9d5f18bf (patch)
treee75af7259cfe991840613dc0a3ba830ab6391318
parente7bb5090cb094ab9d9d13c1852a7cd7e65128b66 (diff)
downloadbinutils-2da39de8dfb3f8dbb364cd414bdd6bee9d5f18bf.zip
binutils-2da39de8dfb3f8dbb364cd414bdd6bee9d5f18bf.tar.gz
binutils-2da39de8dfb3f8dbb364cd414bdd6bee9d5f18bf.tar.bz2
fbsd-nat: Pacify gcc with no functional changes
I see these errors on FreeBSD/aarch64 when using gcc 12 without passing --disable-werror. ===================================================================== CXX fbsd-nat.o fbsd-nat.c: In member function 'void fbsd_nat_target::resume_one_process(ptid_t, int, gdb_signal)': fbsd-nat.c:1208:11: error: unused variable 'request' [-Werror=unused-variable] 1208 | int request; | ^~~~~~~ fbsd-nat.c: In member function 'virtual ptid_t fbsd_nat_target::wait(ptid_t, target_waitstatus*, target_wait_flags)': fbsd-nat.c:1726:22: error: declaration of 'inf' shadows a previous local [-Werror=shadow=compatible-local] 1726 | for (inferior *inf : all_non_exited_inferiors (this)) | ^~~ fbsd-nat.c:1697:17: note: shadowed declaration is here 1697 | inferior *inf = find_inferior_ptid (this, wptid); | ^~~ fbsd-nat.c: In member function 'virtual void fbsd_nat_target::detach(inferior*, int)': fbsd-nat.c:2044:18: error: variable 'wptid' set but not used [-Werror=unused-but-set-variable] 2044 | ptid_t wptid = wait_1 (ptid, &ws, 0); | ^~~~~ cc1plus: all warnings being treated as errors ===================================================================== This patch includes the following non-functional changes, 1. Remove unused variable "request". 2. Rename inf to inf_p to avoid shadowed declaration warnings. 3. Mark wptid as used when USE_SIGTRAP_SIGINFO is defined. Tested on FreeBSD/aarch64 by rebuilding. Approved-By: John Baldwin <jhb@FreeBSD.org>
-rw-r--r--gdb/fbsd-nat.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 0ee3bcc..81a77b3 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1205,8 +1205,6 @@ fbsd_nat_target::resume_one_process (ptid_t ptid, int step,
for (thread_info *tp : inf->non_exited_threads ())
{
- int request;
-
/* If ptid is a specific LWP, suspend all other LWPs in the
process, otherwise resume all LWPs in the process.. */
if (!ptid.lwp_p() || tp->ptid.lwp () == ptid.lwp ())
@@ -1694,9 +1692,9 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
|| ourstatus->kind () == TARGET_WAITKIND_NO_RESUMED)
break;
- inferior *inf = find_inferior_ptid (this, wptid);
- gdb_assert (inf != nullptr);
- fbsd_inferior *fbsd_inf = get_fbsd_inferior (inf);
+ inferior *winf = find_inferior_ptid (this, wptid);
+ gdb_assert (winf != nullptr);
+ fbsd_inferior *fbsd_inf = get_fbsd_inferior (winf);
gdb_assert (fbsd_inf != nullptr);
gdb_assert (fbsd_inf->resumed_lwps != null_ptid);
gdb_assert (fbsd_inf->running_lwps > 0);
@@ -2094,6 +2092,9 @@ fbsd_nat_target::detach (inferior *inf, int from_tty)
}
}
}
+#else
+ /* pacify gcc */
+ wptid = (void) null_ptid;
#endif
sig = 0;
break;