summaryrefslogtreecommitdiffstats
path: root/pstl/test
diff options
context:
space:
mode:
Diffstat (limited to 'pstl/test')
-rw-r--r--pstl/test/CMakeLists.txt2
-rw-r--r--pstl/test/std/algorithms/alg.modifying.operations/generate.pass.cpp6
-rw-r--r--pstl/test/std/algorithms/alg.nonmodifying/adjacent_find.pass.cpp10
-rw-r--r--pstl/test/std/algorithms/alg.nonmodifying/equal.pass.cpp2
-rw-r--r--pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp4
-rw-r--r--pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp2
-rw-r--r--pstl/test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp2
-rw-r--r--pstl/test/std/algorithms/alg.sorting/sort.pass.cpp2
-rw-r--r--pstl/test/support/utils.h14
9 files changed, 24 insertions, 20 deletions
diff --git a/pstl/test/CMakeLists.txt b/pstl/test/CMakeLists.txt
index dae99e129be..bc027c30d08 100644
--- a/pstl/test/CMakeLists.txt
+++ b/pstl/test/CMakeLists.txt
@@ -21,6 +21,7 @@ add_custom_target(check-pstl
add_library(test_stdlib INTERFACE)
target_include_directories(test_stdlib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/support/stdlib")
target_link_libraries(test_stdlib INTERFACE pstl::ParallelSTL)
+target_compile_options(test_stdlib INTERFACE -Wno-gnu-include-next)
file(GLOB_RECURSE UNIT_TESTS "*.pass.cpp")
foreach(_file IN LISTS UNIT_TESTS)
@@ -31,6 +32,7 @@ foreach(_file IN LISTS UNIT_TESTS)
add_executable(${_target} EXCLUDE_FROM_ALL "${_file}")
target_include_directories(${_target} PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
+ target_compile_options(${_target} PRIVATE -Wno-unused-local-typedef -Wno-unused-variable)
target_link_libraries(${_target} PRIVATE test_stdlib)
set_target_properties(${_target} PROPERTIES CXX_EXTENSIONS NO
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
diff --git a/pstl/test/std/algorithms/alg.modifying.operations/generate.pass.cpp b/pstl/test/std/algorithms/alg.modifying.operations/generate.pass.cpp
index 9b423df2933..185e98c86d2 100644
--- a/pstl/test/std/algorithms/alg.modifying.operations/generate.pass.cpp
+++ b/pstl/test/std/algorithms/alg.modifying.operations/generate.pass.cpp
@@ -46,7 +46,8 @@ struct test_generate
{
Generator_count<T> g;
generate(exec, first, last, g);
- EXPECT_TRUE(std::count(first, last, g.default_value()) == n, "generate wrong result for generate");
+ Size count = std::count(first, last, g.default_value());
+ EXPECT_TRUE(count == n, "generate wrong result for generate");
std::fill(first, last, T(0));
}
@@ -54,7 +55,8 @@ struct test_generate
Generator_count<T> g;
const auto m = n / 2;
auto last = generate_n(exec, first, m, g);
- EXPECT_TRUE(std::count(first, last, g.default_value()) == m && last == std::next(first, m),
+ Size count = std::count(first, last, g.default_value());
+ EXPECT_TRUE(count == m && last == std::next(first, m),
"generate_n wrong result for generate_n");
std::fill(first, last, T(0));
}
diff --git a/pstl/test/std/algorithms/alg.nonmodifying/adjacent_find.pass.cpp b/pstl/test/std/algorithms/alg.nonmodifying/adjacent_find.pass.cpp
index 1bccb530254..b2ae5416497 100644
--- a/pstl/test/std/algorithms/alg.nonmodifying/adjacent_find.pass.cpp
+++ b/pstl/test/std/algorithms/alg.nonmodifying/adjacent_find.pass.cpp
@@ -39,12 +39,12 @@ test_adjacent_find_by_type()
{
size_t counts[] = {2, 3, 500};
- for (int32_t c = 0; c < const_size(counts); ++c)
+ for (size_t c = 0; c < const_size(counts); ++c)
{
- for (int32_t e = 0; e < (counts[c] >= 64 ? 64 : (counts[c] == 2 ? 1 : 2)); ++e)
+ for (size_t e = 0; e < (counts[c] >= 64 ? 64 : (counts[c] == 2 ? 1 : 2)); ++e)
{
- Sequence<T> in(counts[c], [](int32_t v) -> T { return T(v); }); //fill 0...n
+ Sequence<T> in(counts[c], [](size_t v) -> T { return T(v); }); //fill 0...n
in[e] = in[e + 1] = -1; //make an adjacent pair
auto i = std::adjacent_find(in.cbegin(), in.cend(), std::equal_to<T>());
@@ -56,9 +56,9 @@ test_adjacent_find_by_type()
}
//special cases: size=0, size=1;
- for (int32_t expect = 0; expect < 1; ++expect)
+ for (size_t expect = 0; expect < 1; ++expect)
{
- Sequence<T> in(expect, [](int32_t v) -> T { return T(v); }); //fill 0...n
+ Sequence<T> in(expect, [](size_t v) -> T { return T(v); }); //fill 0...n
auto i = std::adjacent_find(in.cbegin(), in.cend(), std::equal_to<T>());
EXPECT_TRUE(i == in.cbegin() + expect, "std::adjacent_find returned wrong result");
diff --git a/pstl/test/std/algorithms/alg.nonmodifying/equal.pass.cpp b/pstl/test/std/algorithms/alg.nonmodifying/equal.pass.cpp
index ea4c09ec18d..192babb29e0 100644
--- a/pstl/test/std/algorithms/alg.nonmodifying/equal.pass.cpp
+++ b/pstl/test/std/algorithms/alg.nonmodifying/equal.pass.cpp
@@ -20,10 +20,10 @@ using namespace TestUtils;
struct UserType
{
+ size_t key;
float32_t f;
float64_t d;
int32_t i;
- size_t key;
bool
operator()(UserType a, UserType b)
diff --git a/pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp b/pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp
index dfe499c3d1e..466314e643d 100644
--- a/pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp
+++ b/pstl/test/std/algorithms/alg.nonmodifying/find_end.pass.cpp
@@ -68,8 +68,8 @@ test(const std::size_t bits)
const std::size_t max_n1 = 1000;
const std::size_t max_n2 = (max_n1 * 10) / 8;
- Sequence<T> in(max_n1, [max_n1, bits](std::size_t k) { return T(2 * HashBits(max_n1, bits - 1) ^ 1); });
- Sequence<T> sub(max_n2, [max_n1, bits](std::size_t k) { return T(2 * HashBits(max_n1, bits - 1)); });
+ Sequence<T> in(max_n1, [bits](std::size_t k) { return T(2 * HashBits(max_n1, bits - 1) ^ 1); });
+ Sequence<T> sub(max_n2, [bits](std::size_t k) { return T(2 * HashBits(max_n1, bits - 1)); });
for (std::size_t n1 = 0; n1 <= max_n1; n1 = n1 <= 16 ? n1 + 1 : size_t(3.1415 * n1))
{
std::size_t sub_n[] = {0, 1, 3, n1, (n1 * 10) / 8};
diff --git a/pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp b/pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp
index 28fcb36ad80..ac8a422698c 100644
--- a/pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp
+++ b/pstl/test/std/algorithms/alg.nonmodifying/search_n.pass.cpp
@@ -67,7 +67,7 @@ test()
}
for (auto r : res)
{
- Sequence<T> in(n1, [n1](std::size_t k) { return T(0); });
+ Sequence<T> in(n1, [](std::size_t k) { return T(0); });
std::size_t i = r, isub = 0;
for (; i < n1 & isub < n2; ++i, ++isub)
in[i] = value;
diff --git a/pstl/test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp b/pstl/test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp
index dbe59d02adf..27e83a1129b 100644
--- a/pstl/test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp
+++ b/pstl/test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp
@@ -116,7 +116,7 @@ test_set(Compare compare)
for (std::size_t m = 0; m < n_max; m = m <= 16 ? m + 1 : size_t(2.71828 * m))
{
//prepare the input ranges
- Sequence<T1> in1(n, [n](std::size_t k) { return rand() % (2 * k + 1); });
+ Sequence<T1> in1(n, [](std::size_t k) { return rand() % (2 * k + 1); });
Sequence<T2> in2(m, [m](std::size_t k) { return (m % 2) * rand() + rand() % (k + 1); });
std::sort(in1.begin(), in1.end(), compare);
diff --git a/pstl/test/std/algorithms/alg.sorting/sort.pass.cpp b/pstl/test/std/algorithms/alg.sorting/sort.pass.cpp
index 1997ec56c8b..2cdb24fbcaa 100644
--- a/pstl/test/std/algorithms/alg.sorting/sort.pass.cpp
+++ b/pstl/test/std/algorithms/alg.sorting/sort.pass.cpp
@@ -83,7 +83,7 @@ class ParanoidKey
index = k.index;
return *this;
}
- ParanoidKey(int32_t index, int32_t value, OddTag) : index(index), value(value) {}
+ ParanoidKey(int32_t index, int32_t value, OddTag) : value(value), index(index) {}
ParanoidKey(ParanoidKey&& k) : value(k.value), index(k.index)
{
EXPECT_TRUE(k.isConstructed(), "source for move-construction is dead");
diff --git a/pstl/test/support/utils.h b/pstl/test/support/utils.h
index 6547d931c29..541dc8c3f75 100644
--- a/pstl/test/support/utils.h
+++ b/pstl/test/support/utils.h
@@ -30,7 +30,7 @@ typedef float float32_t;
template <class T, std::size_t N>
constexpr size_t
-const_size(const T (&array)[N]) noexcept
+const_size(const T (&)[N]) noexcept
{
return N;
}
@@ -119,7 +119,7 @@ expect_equal(Iterator1 expected_first, Iterator2 actual_first, Size n, const cha
const char* message)
{
size_t error_count = 0;
- for (size_t k = 0; k < n && error_count < 10; ++k, ++expected_first, ++actual_first)
+ for (Size k = 0; k < n && error_count < 10; ++k, ++expected_first, ++actual_first)
{
if (!(*expected_first == *actual_first))
{
@@ -752,7 +752,7 @@ struct invoke_if_<std::false_type, std::false_type>
{
template <typename Op, typename... Rest>
void
- operator()(bool is_allow, Op op, Rest&&... rest)
+ operator()(bool, Op op, Rest&&... rest)
{
op(std::forward<Rest>(rest)...);
}
@@ -787,14 +787,14 @@ struct non_const_wrapper_tagged : non_const_wrapper
template <typename Policy, typename Iterator>
typename std::enable_if<IsPositiveCondition != is_same_iterator_category<Iterator, IteratorTag>::value, void>::type
- operator()(Policy&& exec, Iterator iter)
+ operator()(Policy&&, Iterator)
{
}
template <typename Policy, typename InputIterator, typename OutputIterator>
typename std::enable_if<IsPositiveCondition != is_same_iterator_category<OutputIterator, IteratorTag>::value,
void>::type
- operator()(Policy&& exec, InputIterator input_iter, OutputIterator out_iter)
+ operator()(Policy&&, InputIterator, OutputIterator)
{
}
};
@@ -999,7 +999,7 @@ struct iterator_invoker<std::forward_iterator_tag, /*isReverse=*/std::true_type>
{
template <typename... Rest>
void
- operator()(Rest&&... rest)
+ operator()(Rest&&...)
{
}
};
@@ -1226,7 +1226,7 @@ test_algo_basic_double(F&& f)
template <typename Policy, typename F>
static void
-invoke_if(Policy&& p, F f)
+invoke_if(Policy&&, F f)
{
#if _PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN || _PSTL_ICC_17_VC141_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN
__pstl::__internal::invoke_if_not(__pstl::__internal::allow_unsequenced<Policy>(), f);
OpenPOWER on IntegriCloud