Rely on std::uncaught_exceptions

Message ID 20240227172510.1754154-1-tromey@adacore.com
State New
Headers
Series Rely on std::uncaught_exceptions |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Tom Tromey Feb. 27, 2024, 5:25 p.m. UTC
  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(-)
  

Patch

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 ());
       }
   }