Patchwork [04/23] exceptions.c:print_flush: Remove obsolete check

login
register
mail settings
Submitter Pedro Alves
Date Sept. 6, 2019, 11:27 p.m.
Message ID <20190906232807.6191-5-palves@redhat.com>
Download mbox | patch
Permalink /patch/34433/
State New
Headers show

Comments

Pedro Alves - Sept. 6, 2019, 11:27 p.m.
Commit 20f0d60db4fb ("Avoid crash when calling warning too early"),
added a "current_top_target () != NULL" check to
target_supports_terminal_ours, so this check in exceptions.c is now
obsolete.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

	* exceptions.c (print_flush): Remove current_top_target() check.
---
 gdb/exceptions.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
Tom Tromey - Sept. 9, 2019, 6:07 p.m.
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Commit 20f0d60db4fb ("Avoid crash when calling warning too early"),
Pedro> added a "current_top_target () != NULL" check to
Pedro> target_supports_terminal_ours, so this check in exceptions.c is now
Pedro> obsolete.

Nice find.  This looks good to me.

Tom

Patch

diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index a405947257..3dccda78e2 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -39,11 +39,7 @@  print_flush (void)
     deprecated_error_begin_hook ();
 
   gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
-  /* While normally there's always something pushed on the target
-     stack, the NULL check is needed here because we can get here very
-     early during startup, before the target stack is first
-     initialized.  */
-  if (current_top_target () != NULL && target_supports_terminal_ours ())
+  if (target_supports_terminal_ours ())
     {
       term_state.emplace ();
       target_terminal::ours_for_output ();