From 7aae524cb1f4e13f11a0622ea59c894c53c75ae0 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Mon, 29 Jan 2018 00:36:08 +0100 Subject: [PATCH] Remove the alignment tests * Don't fail the sanitizers when testing with coroutines --- include/continuable/detail/expected.hpp | 35 ++----------------------- tools/travis-ci.sh | 14 +++++++--- 2 files changed, 13 insertions(+), 36 deletions(-) diff --git a/include/continuable/detail/expected.hpp b/include/continuable/detail/expected.hpp index ac363c1..3454001 100644 --- a/include/continuable/detail/expected.hpp +++ b/include/continuable/detail/expected.hpp @@ -43,13 +43,6 @@ namespace cti { namespace detail { -#ifndef _NDEBUG -template -bool is_aligned(T const* p) { - return !(reinterpret_cast(p) % std::alignment_of::value); -} -#endif // _NDEBUG - namespace util { namespace detail { enum class slot_t { empty, value, error }; @@ -306,36 +299,12 @@ private: template V& cast() noexcept { assert(!is_empty()); - -#ifndef _NDEBUG - { - void* ptr = &this->storage_; - auto space = sizeof(this->storage_); - void* aligned = std::align(alignof(V), sizeof(V), ptr, space); - assert(aligned && "Bad alignment!"); - } -#endif // _NDEBUG - - auto ptr = reinterpret_cast(&this->storage_); - assert(is_aligned(ptr) && "ptr not aligned!"); - return *ptr; + return *reinterpret_cast(&this->storage_); } template V const& cast() const noexcept { assert(!is_empty()); - -#ifndef _NDEBUG - { - void* ptr = const_cast(static_cast(&this->storage_)); - auto space = sizeof(this->storage_); - void* aligned = std::align(alignof(V), sizeof(V), ptr, space); - assert(aligned && "Bad alignment!"); - } -#endif // _NDEBUG - - auto ptr = reinterpret_cast(&this->storage_); - assert(is_aligned(ptr) && "ptr not aligned!"); - return *ptr; + return *reinterpret_cast(&this->storage_); } template diff --git a/tools/travis-ci.sh b/tools/travis-ci.sh index 7fbcfc6..937dd50 100644 --- a/tools/travis-ci.sh +++ b/tools/travis-ci.sh @@ -47,9 +47,17 @@ function renew_build { } if [[ $CXX == *"clang"* ]]; then - LSAN_OPTIONS=verbosity=1:log_threads=1:abort_on_error=1 - ASAN_OPTIONS=verbosity=1:log_threads=1:abort_on_error=1 - UBSAN_OPTIONS=print_stacktrace=1:symbolize=1:halt_on_error=1:print_summary=1 + if [ $WITH_AWAIT != "ON" ]; then + # Abort when the sanitizers detect an error + LSAN_OPTIONS=verbosity=1:log_threads=1:abort_on_error=1 + ASAN_OPTIONS=verbosity=1:log_threads=1:abort_on_error=1 + UBSAN_OPTIONS=print_stacktrace=1:symbolize=1:halt_on_error=1:print_summary=1 + else + # Continue when the sanitizers detect an error (when using await) + LSAN_OPTIONS=verbosity=1:log_threads=1 + ASAN_OPTIONS=verbosity=1:log_threads=1 + UBSAN_OPTIONS=print_stacktrace=1:symbolize=1:print_summary=1 + fi # Build the test suite with various sanitizers: if [ $WITH_AWAIT != "ON" ]; then