Skip to content

Commit 5f8363d

Browse files
committed
Remove the_windows_nat_target global
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. Approved-By: Simon Marchi <[email protected]>
1 parent 77d2113 commit 5f8363d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

gdb/windows-nat.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,6 @@ struct windows_nat_target final : public x86_nat_target<inf_child_target>
387387
bool m_is_async = false;
388388
};
389389

390-
/* This is a pointer and not a global specifically to avoid a C++
391-
"static initializer fiasco" situation. */
392-
static windows_nat_target *the_windows_nat_target;
393-
394390
static void
395391
check (BOOL ok, const char *file, int line)
396392
{
@@ -629,7 +625,7 @@ windows_nat_target::delete_thread (ptid_t ptid, DWORD exit_code,
629625
target_pid_to_str (ptid).c_str (),
630626
(unsigned) exit_code);
631627

632-
::delete_thread (find_thread_ptid (the_windows_nat_target, ptid));
628+
::delete_thread (find_thread_ptid (this, ptid));
633629

634630
auto iter = std::find_if (windows_process.thread_list.begin (),
635631
windows_process.thread_list.end (),
@@ -3126,8 +3122,9 @@ _initialize_windows_nat ()
31263122
calling x86_set_debug_register_length function
31273123
in processor windows specific native file. */
31283124

3129-
the_windows_nat_target = new windows_nat_target;
3130-
add_inf_child_target (the_windows_nat_target);
3125+
/* The target is not a global specifically to avoid a C++ "static
3126+
initializer fiasco" situation. */
3127+
add_inf_child_target (new windows_nat_target);
31313128

31323129
#ifdef __CYGWIN__
31333130
cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);

0 commit comments

Comments
 (0)