Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
snake_case include/xbt/log.hpp
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 15 Jun 2018 07:41:32 +0000 (09:41 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 15 Jun 2018 07:42:02 +0000 (09:42 +0200)
include/xbt/log.hpp
src/xbt/ex.cpp
src/xbt/exception.cpp
src/xbt/xbt_main.cpp

index d2503b9..1c49502 100644 (file)
@@ -16,8 +16,13 @@ namespace xbt {
  *
  *  @ingroup XBT_ex
  */
  *
  *  @ingroup XBT_ex
  */
-XBT_PUBLIC void logException(e_xbt_log_priority_t priority, const char* context, std::exception const& exception);
+XBT_PUBLIC void log_exception(e_xbt_log_priority_t priority, const char* context, std::exception const& exception);
 
 
-XBT_PUBLIC void installExceptionHandler();
+XBT_PUBLIC void install_exception_handler();
+
+// deprecated
+XBT_ATTRIB_DEPRECATED_v323("xbt::log_exception()") XBT_PUBLIC
+    void logException(e_xbt_log_priority_t priority, const char* context, std::exception const& exception);
+XBT_ATTRIB_DEPRECATED_v323("xbt::install_exception_handler()") XBT_PUBLIC void installExceptionHandler();
 }
 }
 }
 }
index add5c21..ac0b6de 100644 (file)
@@ -40,7 +40,7 @@ void _xbt_throw(char* message, xbt_errcat_t errcat, int value, const char* file,
 /** @brief shows an exception content and the associated stack if available */
 void xbt_ex_display(xbt_ex_t * e)
 {
 /** @brief shows an exception content and the associated stack if available */
 void xbt_ex_display(xbt_ex_t * e)
 {
-  simgrid::xbt::logException(xbt_log_priority_critical, "UNCAUGHT EXCEPTION", *e);
+  simgrid::xbt::log_exception(xbt_log_priority_critical, "UNCAUGHT EXCEPTION", *e);
 }
 
 /** \brief returns a short name for the given exception category */
 }
 
 /** \brief returns a short name for the given exception category */
index dd91449..e57759d 100644 (file)
@@ -28,9 +28,7 @@ namespace xbt {
 
 WithContextException::~WithContextException() = default;
 
 
 WithContextException::~WithContextException() = default;
 
-void logException(
-  e_xbt_log_priority_t prio,
-  const char* context, std::exception const& exception)
+void log_exception(e_xbt_log_priority_t prio, const char* context, std::exception const& exception)
 {
   try {
     auto name = simgrid::xbt::demangle(typeid(exception).name());
 {
   try {
     auto name = simgrid::xbt::demangle(typeid(exception).name());
@@ -60,7 +58,7 @@ void logException(
       with_nested->rethrow_nested();
     }
     catch (std::exception& nested_exception) {
       with_nested->rethrow_nested();
     }
     catch (std::exception& nested_exception) {
-      logException(prio, "Caused by", nested_exception);
+      log_exception(prio, "Caused by", nested_exception);
     }
     // We could catch nested_exception or WithContextException but we don't bother:
     catch (...) {
     }
     // We could catch nested_exception or WithContextException but we don't bother:
     catch (...) {
@@ -105,7 +103,7 @@ static void handler()
 
   // We manage C++ exception ourselves
   catch (std::exception& e) {
 
   // We manage C++ exception ourselves
   catch (std::exception& e) {
-    logException(xbt_log_priority_critical, "Uncaught exception", e);
+    log_exception(xbt_log_priority_critical, "Uncaught exception", e);
     showBacktrace(bt);
     std::abort();
   }
     showBacktrace(bt);
     std::abort();
   }
@@ -124,13 +122,22 @@ static void handler()
 
 }
 
 
 }
 
-void installExceptionHandler()
+void install_exception_handler()
 {
   static std::once_flag handler_flag;
   std::call_once(handler_flag, [] {
     previous_terminate_handler = std::set_terminate(handler);
   });
 }
 {
   static std::once_flag handler_flag;
   std::call_once(handler_flag, [] {
     previous_terminate_handler = std::set_terminate(handler);
   });
 }
-
+// deprecated
+void logException(e_xbt_log_priority_t priority, const char* context, std::exception const& exception)
+{
+  log_exception(priority, context, exception);
 }
 }
+void installExceptionHandler()
+{
+  install_exception_handler();
+}
+
+} // namespace xbt
 }
 }
index 3faed87..ef2b60f 100644 (file)
@@ -122,7 +122,7 @@ static void xbt_postexit()
 /** @brief Initialize the xbt mechanisms. */
 void xbt_init(int *argc, char **argv)
 {
 /** @brief Initialize the xbt mechanisms. */
 void xbt_init(int *argc, char **argv)
 {
-  simgrid::xbt::installExceptionHandler();
+  simgrid::xbt::install_exception_handler();
 
   xbt_initialized++;
   if (xbt_initialized > 1) {
 
   xbt_initialized++;
   if (xbt_initialized > 1) {