From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id E21843858D32; Thu, 1 Dec 2022 18:39:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E21843858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669919968; bh=NEnukJWndek0iJWQbf1GJMd1mbLWFGtxY9mgfvBiERk=; h=From:To:Subject:Date:From; b=LWEtJlIs37B+56De5AOlUjqVAK1etQ5EH9yciHg0vx6K5LeB9peD+gOBleqwKqSVg f9p4WsKUmlv072X5FOBIXYWWWVbC6ws+4SiTHO+F3IvpwuOa3kruXz3nvH4sun1iOR tA8iVcLKgisuf5bU5QiDU3dKIB4XV/egJQPP/lFE= 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 the_windows_nat_target global X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 77d2113f27eac3ad9b4dcaa7768b428dd7c59ae8 X-Git-Newrev: 5f8363d9248f1864b58d329a2c734527c3713055 Message-Id: <20221201183928.E21843858D32@sourceware.org> Date: Thu, 1 Dec 2022 18:39:28 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5f8363d9248f= 1864b58d329a2c734527c3713055 commit 5f8363d9248f1864b58d329a2c734527c3713055 Author: Tom Tromey Date: Wed Nov 30 08:51:09 2022 -0700 Remove the_windows_nat_target global =20 I belatedly realized that the "the_windows_nat_target" global isn't really necessary. It's only used in one place, where 'this' would be simpler and clearer. This patch removes the global entirely. =20 Approved-By: Simon Marchi Diff: --- gdb/windows-nat.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 17422e15f80..900d8c3d3c4 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -387,10 +387,6 @@ private: bool m_is_async =3D false; }; =20 -/* This is a pointer and not a global specifically to avoid a C++ - "static initializer fiasco" situation. */ -static windows_nat_target *the_windows_nat_target; - static void check (BOOL ok, const char *file, int line) { @@ -629,7 +625,7 @@ windows_nat_target::delete_thread (ptid_t ptid, DWORD e= xit_code, target_pid_to_str (ptid).c_str (), (unsigned) exit_code); =20 - ::delete_thread (find_thread_ptid (the_windows_nat_target, ptid)); + ::delete_thread (find_thread_ptid (this, ptid)); =20 auto iter =3D std::find_if (windows_process.thread_list.begin (), windows_process.thread_list.end (), @@ -3126,8 +3122,9 @@ _initialize_windows_nat () calling x86_set_debug_register_length function in processor windows specific native file. */ =20 - the_windows_nat_target =3D new windows_nat_target; - add_inf_child_target (the_windows_nat_target); + /* The target is not a global specifically to avoid a C++ "static + initializer fiasco" situation. */ + add_inf_child_target (new windows_nat_target); =20 #ifdef __CYGWIN__ cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);