Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Drop unused 'value' argument from THROW/THROWF.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 23 Feb 2021 13:39:11 +0000 (14:39 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 23 Feb 2021 13:41:28 +0000 (14:41 +0100)
include/xbt/ex.h
src/xbt/exception.cpp
src/xbt/mmalloc/mfree.c

index 7c0fa96..cac4d3d 100644 (file)
 SG_BEGIN_DECL
 
 /** Helper function used to throw exceptions in C */
-XBT_ATTRIB_NORETURN XBT_PUBLIC void _xbt_throw(char* message, int value, const char* file, int line, const char* func);
-
-/** Builds and throws an exception
- *  @ingroup XBT_ex_c
- *  @hideinitializer
- */
-#define THROW(v) _xbt_throw(NULL, (v), __FILE__, __LINE__, __func__)
+XBT_ATTRIB_NORETURN XBT_PUBLIC void _xbt_throw(char* message, const char* file, int line, const char* func);
 
 /** Builds and throws an exception with a printf-like formatted message
  *  @ingroup XBT_ex_c
  *  @hideinitializer
  */
-#define THROWF(v, ...) _xbt_throw(bprintf(__VA_ARGS__), (v), __FILE__, __LINE__, __func__)
+#define THROW(...) _xbt_throw(bprintf(__VA_ARGS__), __FILE__, __LINE__, __func__)
 
 XBT_ATTRIB_NORETURN void xbt_throw_impossible(const char* file, int line, const char* func);
 /** Throw an exception because something impossible happened
index cf4801a..177b3f4 100644 (file)
 XBT_LOG_EXTERNAL_CATEGORY(xbt);
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_exception, xbt, "Exceptions");
 
-void _xbt_throw(char* message, int value, const char* file, int line, const char* func)
+void _xbt_throw(char* message, const char* file, int line, const char* func)
 {
   simgrid::Exception e(
       simgrid::xbt::ThrowPoint(file, line, func, simgrid::xbt::Backtrace(), xbt_procname(), xbt_getpid()),
       message ? message : "");
   xbt_free(message);
-  e.value    = value;
   throw e;
 }
 
index c4125dd..019b359 100644 (file)
@@ -39,12 +39,12 @@ void mfree(struct mdesc *mdp, void *ptr)
   switch (type) {
   case MMALLOC_TYPE_HEAPINFO:
     UNLOCK(mdp);
-    THROWF(0, "Asked to free a fragment in a heapinfo block. I'm confused.\n");
+    THROW("Asked to free a fragment in a heapinfo block. I'm confused.\n");
     break;
 
   case MMALLOC_TYPE_FREE: /* Already free */
     UNLOCK(mdp);
-    THROWF(0, "Asked to free a fragment in a block that is already free. I'm puzzled.\n");
+    THROW("Asked to free a fragment in a block that is already free. I'm puzzled.\n");
     break;
 
   case MMALLOC_TYPE_UNFRAGMENTED:
@@ -167,7 +167,7 @@ void mfree(struct mdesc *mdp, void *ptr)
 
     if( mdp->heapinfo[block].busy_frag.frag_size[frag_nb] == -1){
       UNLOCK(mdp);
-      THROWF(0, "Asked to free a fragment that is already free. I'm puzzled\n");
+      THROW("Asked to free a fragment that is already free. I'm puzzled\n");
     }
 
     if (MC_is_active() && mdp->heapinfo[block].busy_frag.ignore[frag_nb] > 0)