]> AND Public Git Repository - simgrid.git/blobdiff - src/xbt/exception.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mention disk model in host model descriptions
[simgrid.git] / src / xbt / exception.cpp
index 6d6cc5f1a81f5857e2a56c68311564384f7dff25..28d1c349c9601274e8c6072562724a78a2e16b90 100644 (file)
@@ -4,7 +4,6 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simgrid/Exception.hpp"
-#include "src/kernel/context/Context.hpp"
 #include <xbt/config.hpp>
 #include <xbt/log.hpp>
 
@@ -25,8 +24,7 @@ void _xbt_throw(char* message, const char* file, int line, const char* func)
   throw e;
 }
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 
 ImpossibleError::~ImpossibleError()         = default;
 InitializationError::~InitializationError() = default;
@@ -82,8 +80,7 @@ static std::terminate_handler previous_terminate_handler = nullptr;
 XBT_ATTRIB_NORETURN static void handler()
 {
   // Avoid doing crazy things if we get an uncaught exception inside an uncaught exception
-  static std::atomic_flag lock = ATOMIC_FLAG_INIT;
-  if (lock.test_and_set()) {
+  if (static std::atomic_flag lock = ATOMIC_FLAG_INIT; lock.test_and_set()) {
     XBT_ERROR("Handling an exception raised an exception. Bailing out.");
     std::abort();
   }
@@ -131,8 +128,7 @@ void install_exception_handler()
   });
 }
 
-} // namespace xbt
-} // namespace simgrid
+} // namespace simgrid::xbt
 
 void xbt_throw_impossible(const char* file, int line, const char* func)
 {