Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[xbt] Fix 'control reaches end of non-void function' in Result::get()
[simgrid.git] / include / xbt / ex.h
index 8ca0a18..2113c3e 100644 (file)
@@ -45,6 +45,8 @@
 #ifndef __XBT_EX_H__
 #define __XBT_EX_H__
 
+#include <stdlib.h>
+
 #include "xbt/sysdep.h"
 #include "xbt/misc.h"
 #include "xbt/virtu.h"
@@ -403,8 +405,7 @@ XBT_PUBLIC( void )__xbt_ex_terminate_default(xbt_ex_t * e);
       __xbt_ex_terminate((xbt_ex_t*)&(ctx->exception)); /* not catched */ \
     else                                                                \
       __ex_mctx_restore(ctx->ctx_mctx); /* catched somewhere */         \
-    abort();  /* nope, stupid GCC, we won't survive a THROW */          \
-              /* (this won't be reached) */                             \
+    XBT_UNREACHABLE();                                                  \
   } while(0)
 
 /** @brief Helper macro for THROW and THROWF
@@ -435,7 +436,7 @@ XBT_PUBLIC( void )__xbt_ex_terminate_default(xbt_ex_t * e);
   _throw_ctx->exception.pid      = xbt_getpid();                        \
   _throw_ctx->exception.file     = (char*)__FILE__;                     \
   _throw_ctx->exception.line     = __LINE__;                            \
-  _throw_ctx->exception.func     = (char*)_XBT_FUNCTION;                \
+  _throw_ctx->exception.func     = (char*)__func__;                     \
   _throw_ctx->exception.bt_strings = NULL;                              \
   xbt_backtrace_current((xbt_ex_t *)&(_throw_ctx->exception));
 
@@ -457,9 +458,9 @@ XBT_PUBLIC( void )__xbt_ex_terminate_default(xbt_ex_t * e);
 #define THROW_IMPOSSIBLE \
   THROWF(unknown_error, 0, "The Impossible Did Happen (yet again)")
 #define THROW_UNIMPLEMENTED \
-  THROWF(unknown_error, 0, "Function %s unimplemented",_XBT_FUNCTION)
+  THROWF(unknown_error, 0, "Function %s unimplemented",__func__)
 #define THROW_DEADCODE \
-  THROWF(unknown_error, 0, "Function %s was supposed to be DEADCODE, but it's not",_XBT_FUNCTION)
+  THROWF(unknown_error, 0, "Function %s was supposed to be DEADCODE, but it's not",__func__)
 
 #define DIE_IMPOSSIBLE xbt_die("The Impossible Did Happen (yet again)")