Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
attempt to replace internal dynar by std::vector
[simgrid.git] / src / xbt / config.cpp
index 6fc4d00..6041903 100644 (file)
@@ -15,6 +15,7 @@
 #include <typeinfo>
 #include <type_traits>
 
+#include <xbt/ex.hpp>
 #include <xbt/config.h>
 #include <xbt/config.hpp>
 #include "xbt/misc.h"
@@ -33,7 +34,7 @@ XBT_EXPORT_NO_IMPORT(xbt_cfg_t) simgrid_config = nullptr;
 namespace simgrid {
 namespace config {
 
-missing_key_error::~missing_key_error() noexcept {}
+missing_key_error::~missing_key_error() {}
 
 class Config;
 
@@ -605,10 +606,8 @@ on_exception:
 // Exit from the catch blog (and do the correct exceptio cleaning)
 // before attempting to THROWF.
 #define TRANSLATE_EXCEPTIONS(...) \
-  catch(simgrid::config::missing_key_error& e) { goto on_exception; } \
-  catch(...) { goto on_missing_key; } \
-  on_missing_key: THROWF(not_found_error, 0, __VA_ARGS__); \
-  on_exception: THROWF(not_found_error, 0, __VA_ARGS__);
+  catch(simgrid::config::missing_key_error& e) { THROWF(not_found_error, 0, __VA_ARGS__); abort(); } \
+  catch(...) { THROWF(not_found_error, 0, __VA_ARGS__); abort(); }
 
 /** @brief Set the value of a variable, using the string representation of that value
  *
@@ -824,6 +823,7 @@ int xbt_cfg_get_boolean(const char *key)
 
 #include "xbt.h"
 #include "xbt/ex.h"
+#include <xbt/ex.hpp>
 
 #include <xbt/config.hpp>
 
@@ -869,14 +869,11 @@ XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests")
 
   xbt_test_add("Access to a non-existant entry");
   {
-    xbt_ex_t e;
-
-    TRY {
+    try {
       xbt_cfg_set_parse("color:blue");
-    } CATCH(e) {
+    } catch(xbt_ex& e) {
       if (e.category != not_found_error)
         xbt_test_exception(e);
-      xbt_ex_free(e);
     }
   }
   xbt_cfg_free(&simgrid_config);