[PATCH] Rely on std::uncaught_exceptions

Tom Tromey tromey@adacore.com
Tue Feb 27 17:25:10 GMT 2024


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



More information about the Gdb-patches mailing list