From: Arnaud Giersch Date: Sat, 9 Jun 2018 20:10:48 +0000 (+0200) Subject: Contexts: move asan support in separate header. X-Git-Tag: v3.20~125 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/94ba3e61c1cf68520a2ddc8706aad9da7f54f37e?hp=6f1b0ef8689a9f9f47c12ea61b6aef187a8b6192 Contexts: move asan support in separate header. --- diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index 2b7be09f90..87b490ea80 100644 --- a/src/kernel/context/ContextBoost.cpp +++ b/src/kernel/context/ContextBoost.cpp @@ -4,20 +4,9 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "ContextBoost.hpp" +#include "context_private.hpp" #include "src/simix/smx_private.hpp" -#if HAVE_SANITIZE_ADDRESS_FIBER_SUPPORT -#include -#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 - XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context); namespace simgrid { diff --git a/src/kernel/context/context_private.hpp b/src/kernel/context/context_private.hpp new file mode 100644 index 0000000000..c2b809ac33 --- /dev/null +++ b/src/kernel/context/context_private.hpp @@ -0,0 +1,23 @@ +/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */ + +/* 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. */ + +#ifndef SIMGRID_KERNEL_CONTEXT_PRIVATE_HPP +#define SIMGRID_KERNEL_CONTEXT_PRIVATE_HPP + +#include "src/internal_config.h" + +#if HAVE_SANITIZE_ADDRESS_FIBER_SUPPORT +#include +#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 + +#endif diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index cb2889f281..e6ecdf5fb5 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -369,6 +369,7 @@ set(SIMIX_SRC src/kernel/future.cpp src/simix/libsmx.cpp src/simix/smx_context.cpp + src/kernel/context/context_private.hpp src/kernel/context/Context.cpp src/kernel/context/Context.hpp src/kernel/context/ContextRaw.cpp