Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Contexts: move asan support in separate header.
[simgrid.git] / src / kernel / context / ContextBoost.cpp
index 6655f4c..87b490e 100644 (file)
@@ -4,21 +4,8 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "ContextBoost.hpp"
-
-#include <utility>
-#include <xbt/log.h>
-
-#if HAVE_SANITIZE_ADDRESS_FIBER_SUPPORT
-#include <sanitizer/asan_interface.h>
-#define ASAN_EVAL(expr) (expr)
-#define ASAN_START_SWITCH(fake_stack_save, bottom, size) __sanitizer_start_switch_fiber(fake_stack_save, bottom, size)
-#define ASAN_FINISH_SWITCH(fake_stack_save, bottom_old, size_old)                                                      \
-  __sanitizer_finish_switch_fiber(fake_stack_save, bottom_old, size_old)
-#else
-#define ASAN_EVAL(expr) (void)0
-#define ASAN_START_SWITCH(fake_stack_save, bottom, size) (void)0
-#define ASAN_FINISH_SWITCH(fake_stack_save, bottom_old, size_old) (void)(fake_stack_save)
-#endif
+#include "context_private.hpp"
+#include "src/simix/smx_private.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
 
@@ -142,7 +129,7 @@ inline void BoostContext::swap(BoostContext* from, BoostContext* to)
   boost::context::jump_fcontext(&from->fc_, to->fc_, reinterpret_cast<intptr_t>(to));
 #else
   BoostContext* ctx[2] = {from, to};
-  void* fake_stack;
+  void* fake_stack     = nullptr;
   ASAN_START_SWITCH(from->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
   boost::context::detail::transfer_t arg = boost::context::detail::jump_fcontext(to->fc_, ctx);
   ASAN_FINISH_SWITCH(fake_stack, &static_cast<BoostContext**>(arg.data)[0]->asan_stack_,