Skip to content

Commit d5041e4

Browse files
committed
Optimize noexception testing
1 parent 4b951fc commit d5041e4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

tests/beman/inplace_vector/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ add_gtest(size_n_data)
4343
add_gtest(erasure)
4444
add_gtest(modifiers)
4545

46+
# only add noexception tests if NO_EXCEPTIONS option is set and compiler supports -fno-exceptions
4647
if(
47-
CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
48-
OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
48+
BEMAN_INPLACE_VECTOR_NO_EXCEPTIONS
49+
AND (
50+
CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
51+
OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
52+
)
4953
)
5054
add_gtest(noexceptions)
5155
target_compile_options(

tests/beman/inplace_vector/gtest_setup.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,9 @@ template <typename Param>
394394
std::size_t IVBasicTest<Param>::InputIterator::num_deref;
395395

396396
#if BEMAN_INPLACE_VECTOR_NO_EXCEPTIONS()
397-
#define SAFE_EXPECT_THROW(x, y) EXPECT_DEATH(x, ".*")
397+
#define SAFE_EXPECT_THROW(x, y) \
398+
do { \
399+
} while (0)
398400
#else
399401
#define SAFE_EXPECT_THROW(x, y) EXPECT_THROW(x, y)
400402
#endif

0 commit comments

Comments
 (0)