Skip to content

Commit df8d5d6

Browse files
committed
Remove memory sanitizer support and related configurations
1 parent 8e62a89 commit df8d5d6

6 files changed

Lines changed: 3 additions & 64 deletions

File tree

.github/workflows/sanitizers.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
os: [ubuntu-24.04]
2121
sys:
2222
- {compiler: clang, version: '21', name: asan, sanitizer: address}
23-
- {compiler: clang, version: '21', name: msan, sanitizer: memory}
2423
- {compiler: clang, version: '21', name: lsan, sanitizer: leak}
2524
- {compiler: clang, version: '21', name: ubsan, sanitizer: undefined}
2625
config:
@@ -77,9 +76,6 @@ jobs:
7776
export ASAN_OPTIONS=log_path=asan_log_:alloc_dealloc_mismatch=0:halt_on_error=0:handle_abort=0
7877
export ASAN_SAVE_DUMPS=AsanDump.dmp
7978
;;
80-
memory)
81-
export MSAN_OPTIONS=log_path=msan_log_:halt_on_error=0:suppressions=${GITHUB_WORKSPACE}/test/msan_suppressions.txt
82-
;;
8379
leak)
8480
export LSAN_OPTIONS=log_path=lsan_log_:halt_on_error=0
8581
;;

include/xtensor/core/xoperation.hpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@
2020
#include "../core/xstrides.hpp"
2121
#include "../views/xstrided_view.hpp"
2222

23-
// Suppress MSan false positives triggered by deeply nested
24-
// std::apply + tuple unpacking in xfunction_stepper::operator*().
25-
// The arithmetic functors below (plus, multiplies, etc.) are trivial
26-
// and read values that originate from properly initialized arrays.
27-
#if defined(__has_feature)
28-
#if __has_feature(memory_sanitizer)
29-
#define XT_MSAN_NO_SANITIZE __attribute__((no_sanitize("memory")))
30-
#endif
31-
#endif
32-
#ifndef XT_MSAN_NO_SANITIZE
33-
#define XT_MSAN_NO_SANITIZE
34-
#endif
35-
3623
namespace xt
3724
{
3825

@@ -45,7 +32,6 @@ namespace xt
4532
{ \
4633
template <class A1> \
4734
constexpr auto operator()(const A1& arg) const \
48-
XT_MSAN_NO_SANITIZE \
4935
{ \
5036
return OP arg; \
5137
} \
@@ -83,7 +69,6 @@ namespace xt
8369
{ \
8470
template <class T1, class T2> \
8571
constexpr auto operator()(T1&& arg1, T2&& arg2) const \
86-
XT_MSAN_NO_SANITIZE \
8772
{ \
8873
using xt::detail::operator OP; \
8974
return (std::forward<T1>(arg1) OP std::forward<T2>(arg2)); \
@@ -146,7 +131,6 @@ namespace xt
146131

147132
template <class B, class A1, class A2>
148133
constexpr auto operator()(const B& cond, const A1& v1, const A2& v2) const noexcept
149-
XT_MSAN_NO_SANITIZE
150134
{
151135
return xtl::select(cond, v1, v2);
152136
}
@@ -226,7 +210,6 @@ namespace xt
226210

227211
#undef UNARY_OPERATOR_FUNCTOR
228212
#undef BINARY_OPERATOR_FUNCTOR
229-
#undef XT_MSAN_NO_SANITIZE
230213

231214
/*************
232215
* operators *

test/CMakeLists.txt

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,6 @@ file(GLOB XTENSOR_PREPROCESS_FILES files/cppy_source/*.cppy)
234234
# Sanitizer support
235235
include(${CMAKE_SOURCE_DIR}/cmake/sanitizers.cmake)
236236

237-
if(USE_SANITIZER MATCHES "memory" AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
238-
# doctest's String union triggers MSan false positives during
239-
# static-init reporter registration. Fixed in main.cpp with
240-
# __attribute__((no_sanitize("memory"))) on doctest functions.
241-
endif()
242-
243237
# This target should only be run when the test source files have been changed.
244238
add_custom_target(
245239
preprocess_cppy
@@ -312,21 +306,12 @@ endif()
312306
target_include_directories(test_xtensor_lib PRIVATE ${XTENSOR_INCLUDE_DIR})
313307
target_link_libraries(test_xtensor_lib PRIVATE xtensor doctest::doctest ${CMAKE_THREAD_LIBS_INIT})
314308

315-
set(XTENSOR_TEST_ENV)
316-
if(USE_SANITIZER MATCHES "memory")
317-
set(XTENSOR_MSAN_SUPPRESSIONS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/msan_suppressions.txt")
318-
set(XTENSOR_TEST_ENV "MSAN_OPTIONS=halt_on_error=0:suppressions=${XTENSOR_MSAN_SUPPRESSIONS_FILE}")
319-
endif()
320-
321309
add_custom_target(
322310
xtest
323-
COMMAND ${CMAKE_COMMAND} -E env ${XTENSOR_TEST_ENV} $<TARGET_FILE:test_xtensor_lib>
311+
COMMAND $<TARGET_FILE:test_xtensor_lib>
324312
DEPENDS test_xtensor_lib
325313
)
326314
add_test(NAME xtest COMMAND test_xtensor_lib)
327-
if(XTENSOR_TEST_ENV)
328-
set_tests_properties(xtest PROPERTIES ENVIRONMENT "${XTENSOR_TEST_ENV}")
329-
endif()
330315

331316
# Some files will be compiled twice, however compiling common files in a static
332317
# library and linking test_xtensor_lib with it removes half of the tests at

test/doctest_wrapper.hpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

test/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#if defined(XTENSOR_DISABLE_EXCEPTIONS)
33
#define DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS
44
#endif
5-
#include "doctest_wrapper.hpp"
5+
#include "doctest/doctest.h"

test/test_common_macros.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "xtensor/core/xtensor_config.hpp"
99

10-
#include "doctest_wrapper.hpp"
10+
#include "doctest/doctest.h"
1111
#include "test_utils.hpp"
1212

1313
#if defined(XTENSOR_DISABLE_EXCEPTIONS)

0 commit comments

Comments
 (0)