Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move declarations for xbt_abort and xbt_die to xbt/asserts.h.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 31 Mar 2021 20:22:32 +0000 (22:22 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 1 Apr 2021 12:14:34 +0000 (14:14 +0200)
Adjust some #include consequently.

26 files changed:
examples/c/actor-create/actor-create.c
examples/c/app-bittorrent/bittorrent-peer.c
examples/c/app-masterworker/app-masterworker.c
examples/c/cloud-masterworker/cloud-masterworker.c
examples/c/comm-pingpong/comm-pingpong.c
examples/c/comm-wait/comm-wait.c
examples/c/comm-waitall/comm-waitall.c
examples/c/comm-waitany/comm-waitany.c
examples/c/dht-pastry/dht-pastry.c
examples/c/energy-exec-ptask/energy-exec-ptask.c
examples/c/exec-waitany/exec-waitany.c
examples/c/platform-failures/platform-failures.c
include/xbt/asserts.h
include/xbt/log.h
include/xbt/sysdep.h
src/instr/jedule/jedule.cpp
src/instr/jedule/jedule_events.cpp
src/instr/jedule/jedule_platform.cpp
src/instr/jedule/jedule_sd_binding.cpp
src/kernel/lmm/maxmin.hpp
src/xbt/log.cpp
src/xbt/snprintf.c
src/xbt/xbt_log_appender_file.cpp
src/xbt/xbt_log_layout_format.cpp
src/xbt/xbt_log_layout_simple.cpp
teshsuite/smpi/coll-allreduce-with-leaks/coll-allreduce-with-leaks.tesh

index 8765e79..51cf4e3 100644 (file)
@@ -21,8 +21,8 @@
 #include <simgrid/engine.h>
 #include <simgrid/host.h>
 #include <simgrid/mailbox.h>
-#include <xbt/asserts.h>
 #include <xbt/log.h>
+#include <xbt/sysdep.h>
 
 // This declares a logging channel so that XBT_INFO can be used later
 XBT_LOG_NEW_DEFAULT_CATEGORY(actor_create, "The logging channel used in this example");
index b08b01d..9c0f6a0 100644 (file)
@@ -6,6 +6,7 @@
 #include "bittorrent-peer.h"
 #include "tracker.h"
 #include <simgrid/forward.h>
+#include <xbt/ex.h>
 
 #include <limits.h>
 #include <stdio.h> /* snprintf */
index f9121bf..33c727d 100644 (file)
@@ -7,9 +7,9 @@
 #include "simgrid/engine.h"
 #include "simgrid/forward.h"
 #include "simgrid/mailbox.h"
-#include "xbt/asserts.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
+#include "xbt/sysdep.h"
 
 #define FINALIZE 221297 /* a magic number to tell people to stop working */
 
index 28f8cc9..f3a4b03 100644 (file)
@@ -11,9 +11,9 @@
 #include "simgrid/plugins/live_migration.h"
 #include "simgrid/vm.h"
 
-#include "xbt/asserts.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
+#include "xbt/sysdep.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(cloud_masterworker, "Messages specific for this example");
 
index c68e4f0..d0d820c 100644 (file)
@@ -8,9 +8,9 @@
 #include "simgrid/engine.h"
 #include "simgrid/forward.h"
 #include "simgrid/mailbox.h"
-#include "xbt/asserts.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
+#include "xbt/sysdep.h"
 
 #include <stdio.h> /* snprintf */
 
index 48d9ef2..9e903db 100644 (file)
@@ -8,9 +8,9 @@
 #include "simgrid/engine.h"
 #include "simgrid/mailbox.h"
 
-#include "xbt/asserts.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
+#include "xbt/sysdep.h"
 
 #include <stdio.h>
 
index 5bec3c3..a7d67a8 100644 (file)
@@ -9,9 +9,9 @@
 #include "simgrid/host.h"
 #include "simgrid/mailbox.h"
 
-#include "xbt/asserts.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
+#include "xbt/sysdep.h"
 
 #include <stdio.h> /* snprintf */
 
index 9a6a02e..96a23ab 100644 (file)
@@ -8,9 +8,9 @@
 #include "simgrid/engine.h"
 #include "simgrid/forward.h"
 #include "simgrid/mailbox.h"
-#include "xbt/asserts.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
+#include "xbt/sysdep.h"
 
 #include <stdio.h> /* snprintf */
 
index 9436930..10f21ac 100644 (file)
@@ -9,6 +9,7 @@
 #include "simgrid/mailbox.h"
 
 #include "xbt/dynar.h"
+#include "xbt/ex.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
 #include "xbt/sysdep.h"
index 5bcccfe..a92b767 100644 (file)
@@ -8,9 +8,9 @@
 #include "simgrid/exec.h"
 #include "simgrid/host.h"
 #include "simgrid/plugins/energy.h"
-#include "xbt/asserts.h"
 #include "xbt/config.h"
 #include "xbt/log.h"
+#include "xbt/sysdep.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(energy_exec_ptask, "Messages specific for this example");
 
index ef353fe..b5caa0b 100644 (file)
@@ -8,8 +8,8 @@
 #include "simgrid/exec.h"
 #include "simgrid/host.h"
 
-#include "xbt/asserts.h"
 #include "xbt/log.h"
+#include "xbt/sysdep.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(exec_waitany, "Messages specific for this example");
 
index 527048a..e17fd2e 100644 (file)
@@ -10,9 +10,9 @@
 #include "simgrid/host.h"
 #include "simgrid/mailbox.h"
 
-#include "xbt/asserts.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
+#include "xbt/sysdep.h"
 
 #include <stdio.h> /* snprintf */
 
index 1357531..53660d3 100644 (file)
@@ -8,9 +8,9 @@
 #ifndef XBT_ASSERTS_H
 #define XBT_ASSERTS_H
 
-#include <xbt/ex.h>
+#include <stdlib.h>
+#include <xbt/base.h>
 #include <xbt/log.h>
-#include <xbt/misc.h>
 
 SG_BEGIN_DECL
 XBT_PUBLIC_DATA int xbt_log_no_loc; /* Do not show the backtrace on failed backtrace when doing our tests */
@@ -19,20 +19,39 @@ XBT_PUBLIC void xbt_backtrace_display_current();
 
 /**
  * @addtogroup XBT_error
+ *
+ * @{
+ */
+/** @brief Kill the program in silence */
+XBT_ATTRIB_NORETURN XBT_PUBLIC void xbt_abort(void);
+
+/**
+ * @brief Kill the program with an error message
+ * @param ... a format string and its arguments
+ *
+ * Things are so messed up that the only thing to do now, is to stop the program.
+ *
+ * The message is handled by a CRITICAL logging request, and may consist of a format string with arguments.
+ */
+#define xbt_die(...)                                                                                                   \
+  do {                                                                                                                 \
+    XBT_CCRITICAL(root, __VA_ARGS__);                                                                                  \
+    xbt_abort();                                                                                                       \
+  } while (0)
+
+/**
  * @brief Those are the SimGrid version of the good ol' assert macro.
  *
  * You can pass them a format message and arguments, just as if it where a printf.
  * It is converted to a XBT_CRITICAL logging request.
  * Be careful: the boolean expression that you want to test should not have side effects, because assertions are
  * disabled at compile time if NDEBUG is set.
- *
- * @{
  */
 #ifdef NDEBUG
 #define xbt_assert(...) ((void)0)
 #else
-   /** @brief The condition which failed will be displayed.
-   @hideinitializer  */
+/** @brief The condition which failed will be displayed.
+    @hideinitializer  */
 #define xbt_assert(...) \
   _XBT_IF_ONE_ARG(_xbt_assert_ARG1, _xbt_assert_ARGN, __VA_ARGS__)(__VA_ARGS__)
 #define _xbt_assert_ARG1(cond) _xbt_assert_ARGN((cond), "Assertion %s failed", #cond)
index 32215d2..50b99cf 100644 (file)
@@ -15,7 +15,7 @@
 #include <stdarg.h>
 #include <stddef.h> /* NULL */
 #include <stdio.h>  /* FILE */
-#include <xbt/misc.h>
+#include <xbt/base.h>
 SG_BEGIN_DECL
 /**@brief Log priorities
  * @ingroup XBT_log
index 63a4bbc..9640735 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <xbt/asserts.h>
 #include <xbt/log.h>
-#include <xbt/misc.h>
 
 #include <simgrid/config.h>
 
 
 SG_BEGIN_DECL
 
-/* They live in asserts.h, but need to be declared before this module.
-   double declaration to cut dependency cycle */
-/**
- * @addtogroup XBT_error
- *
- * @{
- */
-/** @brief Kill the program in silence */
-XBT_ATTRIB_NORETURN XBT_PUBLIC void xbt_abort(void);
-
-/**
- * @brief Kill the program with an error message
- * @param ... a format string and its arguments
- *
- * Things are so messed up that the only thing to do now, is to stop the program.
- *
- * The message is handled by a CRITICAL logging request, and may consist of a format string with arguments.
- */
-#define xbt_die(...)                                                                                                   \
-  do {                                                                                                                 \
-    XBT_CCRITICAL(root, __VA_ARGS__);                                                                                  \
-    xbt_abort();                                                                                                       \
-  } while (0)
-/** @} */
-
 #ifdef XBT_LOG_LOCALLY_DEFINE_XBT_CHANNEL
 XBT_LOG_NEW_CATEGORY(xbt, "All XBT categories (simgrid toolbox)");
 XBT_LOG_NEW_SUBCATEGORY(xbt_help, xbt, "Help messages");
index d32dcf2..d35a805 100644 (file)
@@ -4,8 +4,9 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "xbt/asserts.h"
 #include "simgrid/jedule/jedule.hpp"
+#include "simgrid/config.h"
+#include "xbt/asserts.h"
 
 #if SIMGRID_HAVE_JEDULE
 
index 2ad1c4d..eba1dea 100644 (file)
@@ -5,6 +5,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simgrid/jedule/jedule.hpp"
+#include "simgrid/config.h"
 #include "simgrid/s4u/NetZone.hpp"
 #include "xbt/asserts.h"
 
index 9e9b9db..05a7b40 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simgrid/jedule/jedule.hpp"
+#include "simgrid/config.h"
 #include "simgrid/host.h"
 #include "simgrid/s4u/NetZone.hpp"
 #include "xbt/asserts.h"
index dfa6701..a17eb43 100644 (file)
@@ -7,6 +7,7 @@
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/NetZone.hpp"
 #include "src/simdag/simdag_private.hpp"
+#include "xbt/virtu.h"
 
 #if SIMGRID_HAVE_JEDULE
 
index 605bc12..b820202 100644 (file)
@@ -10,6 +10,7 @@
 #include "simgrid/s4u/Link.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "xbt/asserts.h"
+#include "xbt/ex.h"
 #include "xbt/mallocator.h"
 
 #include <boost/intrusive/list.hpp>
index 1dab66e..61f476f 100644 (file)
@@ -6,13 +6,14 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/xbt/log_private.hpp"
-#include "xbt/asserts.h"
 #include "xbt/string.hpp"
+#include "xbt/sysdep.h"
 #include "xbt/xbt_modinter.h"
 
 #include <algorithm>
 #include <array>
 #include <boost/tokenizer.hpp>
+#include <cstring>
 #include <mutex>
 #include <string>
 #include <vector>
index 526fc95..0281701 100644 (file)
@@ -55,8 +55,9 @@
 #endif
 #include <stdio.h>
 
-#include "xbt/sysdep.h"           /* xbt_abort() */
 #include "src/internal_config.h"  /* Do we need vasprintf? */
+#include "xbt/asserts.h"          /* xbt_abort() */
+#include "xbt/misc.h"
 
 #if !HAVE_VASPRINTF
 #include <assert.h>
index fd5c34a..928ef18 100644 (file)
@@ -12,6 +12,7 @@
 #include <cerrno>
 #include <cstdio>
 #include <cstring>
+#include <string>
 
 static void append_file(const s_xbt_log_appender_t* this_, const char* str)
 {
index 3dedbd7..43345d4 100644 (file)
@@ -9,6 +9,7 @@
 #include "simgrid/host.h"
 #include "src/xbt/log_private.hpp"
 #include "xbt/sysdep.h"
+#include "xbt/virtu.h"
 #include <algorithm>
 #include <cstdio>
 
index 45f90ad..6b4aa2b 100644 (file)
@@ -5,8 +5,9 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "xbt/sysdep.h"
 #include "src/xbt/log_private.hpp"
+#include "xbt/sysdep.h"
+#include "xbt/virtu.h"
 
 #include "simgrid/engine.h" /* simgrid_get_clock */
 #include "simgrid/host.h"   /* sg_host_self_get_name */
index 98a99d9..db31cd0 100644 (file)
@@ -20,7 +20,7 @@ $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/../../../smpi_script/bin/smpirun -map -ho
 > [rank 14] -> Ginette
 > [rank 15] -> Ginette
 > If this is too much, consider sharing allocations for computation buffers.
-> Largest allocation at once from a single process was 64 bytes, at sysdep.h:87. It was called 32 times during the whole simulation.
+> Largest allocation at once from a single process was 64 bytes, at sysdep.h:61. It was called 32 times during the whole simulation.
 > Running smpirun with -wrapper "valgrind --leak-check=full" can provide more information
 > This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
 > [0.023768] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 31 unfreed MPI handles : display types and addresses (n max) with --cfg=smpi/list-leaks:n.