From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id C275D3875A3D; Mon, 25 Jul 2022 13:30:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C275D3875A3D Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Remove dead code from windows_nat_target::detach X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 90ed15932111ce37c4187163dd9279ef1798f24e X-Git-Newrev: eea2d83593428d2ac18f6b3fc43cff5472521579 Message-Id: <20220725133021.C275D3875A3D@sourceware.org> Date: Mon, 25 Jul 2022 13:30:21 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2022 13:30:21 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Deea2d8359342= 8d2ac18f6b3fc43cff5472521579 commit eea2d83593428d2ac18f6b3fc43cff5472521579 Author: Tom Tromey Date: Fri Jul 22 12:55:27 2022 -0600 Remove dead code from windows_nat_target::detach =20 windows_nat_target::detach has a variable 'detached' that is only set after a call to 'error'. However, this can't happen because 'error' throws an exception. =20 This patch removes the dead code. Diff: --- gdb/windows-nat.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 43a2c112db5..9265ed9e632 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1912,22 +1912,16 @@ windows_nat_target::attach (const char *args, int f= rom_tty) void windows_nat_target::detach (inferior *inf, int from_tty) { - int detached =3D 1; - ptid_t ptid =3D minus_one_ptid; resume (ptid, 0, GDB_SIGNAL_0); =20 if (!DebugActiveProcessStop (windows_process.current_event.dwProcessId)) - { - error (_("Can't detach process %u (error %u)"), - (unsigned) windows_process.current_event.dwProcessId, - (unsigned) GetLastError ()); - detached =3D 0; - } + error (_("Can't detach process %u (error %u)"), + (unsigned) windows_process.current_event.dwProcessId, + (unsigned) GetLastError ()); DebugSetProcessKillOnExit (FALSE); =20 - if (detached) - target_announce_detach (from_tty); + target_announce_detach (from_tty); =20 x86_cleanup_dregs (); switch_to_no_thread ();