public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Rely on std::uncaught_exceptions
@ 2024-02-27 17:25 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2024-02-27 17:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

std::uncaught_exceptions is a C++17 feature, so I think we can remove
this conditional code from inferior.h.
---
 gdb/inferior.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/gdb/inferior.h b/gdb/inferior.h
index 7be28423aeb..e8729658b38 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -86,13 +86,7 @@ struct infcall_suspend_state_deleter
 	/* If we are restoring the inferior state due to an exception,
 	   some error message will be printed.  So, only warn the user
 	   when we cannot restore during normal execution.  */
-	bool unwinding;
-#if __cpp_lib_uncaught_exceptions
-	unwinding = std::uncaught_exceptions () > 0;
-#else
-	unwinding = std::uncaught_exception ();
-#endif
-	if (!unwinding)
+	if (std::uncaught_exceptions () == 0)
 	  warning (_("Failed to restore inferior state: %s"), e.what ());
       }
   }
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-27 17:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 17:25 [PATCH] Rely on std::uncaught_exceptions Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).