diff --git a/CMakeLists.txt b/CMakeLists.txt index 03d270253c8f..1d4c854fe5af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1184,6 +1184,13 @@ endif() hpx_check_for_mm_prefetch( DEFINITIONS HPX_HAVE_MM_PREFETCH) +hpx_check_for_stable_inplace_merge( + DEFINITIONS HPX_HAVE_STABLE_INPLACE_MERGE) + +if(NOT HPX_WITH_STABLE_INPLACE_MERGE) + hpx_warn("The standard library you are using (libc++ version < 6) does not have a stable inplace_merge implementation.") +endif() + ################################################################################ # Check for misc system headers ################################################################################ diff --git a/cmake/HPX_AddConfigTest.cmake b/cmake/HPX_AddConfigTest.cmake index 44f37f42dc9c..510010386de5 100644 --- a/cmake/HPX_AddConfigTest.cmake +++ b/cmake/HPX_AddConfigTest.cmake @@ -656,3 +656,10 @@ macro(hpx_check_for_mm_prefetch) SOURCE cmake/tests/mm_prefetch.cpp FILE ${ARGN}) endmacro() + +############################################################################### +macro(hpx_check_for_stable_inplace_merge) + add_hpx_config_test(HPX_WITH_STABLE_INPLACE_MERGE + SOURCE cmake/tests/stable_inplace_merge.cpp + FILE ${ARGN}) +endmacro() diff --git a/cmake/tests/stable_inplace_merge.cpp b/cmake/tests/stable_inplace_merge.cpp new file mode 100644 index 000000000000..8b6e68e690b2 --- /dev/null +++ b/cmake/tests/stable_inplace_merge.cpp @@ -0,0 +1,15 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2017 Mikael Simberg +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +//////////////////////////////////////////////////////////////////////////////// + +#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 6) +# error "libc++ inplace_merge implementation is broken" +#endif + +int main() +{ + return 0; +} diff --git a/tests/unit/parallel/algorithms/inplace_merge_tests.hpp b/tests/unit/parallel/algorithms/inplace_merge_tests.hpp index 3aeb46ed0671..038ee69a4940 100644 --- a/tests/unit/parallel/algorithms/inplace_merge_tests.hpp +++ b/tests/unit/parallel/algorithms/inplace_merge_tests.hpp @@ -415,6 +415,7 @@ void test_inplace_merge_etc(ExPolicy policy, IteratorTag, // Test projection. { +#if defined(HPX_HAVE_STABLE_INPLACE_MERGE) typedef test::test_iterator iterator; sol = res = org; @@ -436,6 +437,7 @@ void test_inplace_merge_etc(ExPolicy policy, IteratorTag, sol_first, sol_last); HPX_TEST(equality); +#endif } } @@ -444,6 +446,7 @@ template void test_inplace_merge_stable(ExPolicy policy, IteratorTag, DataType, int rand_base) { +#if defined(HPX_HAVE_STABLE_INPLACE_MERGE) static_assert( hpx::parallel::execution::is_execution_policy::value, "hpx::parallel::execution::is_execution_policy::value"); @@ -501,6 +504,7 @@ void test_inplace_merge_stable(ExPolicy policy, IteratorTag, HPX_TEST(test_is_meaningful); HPX_TEST(stable); +#endif } ///////////////////////////////////////////////////////////////////////////////