aboutsummaryrefslogtreecommitdiff
path: root/pstl
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2020-07-08 14:38:59 -0400
committerLouis Dionne <ldionne@apple.com>2020-07-08 14:39:16 -0400
commit26b0a23084f049f4084fc9f1d599ade66e4af185 (patch)
tree66cc2a6323f8cefdd088ed0e1ff390e53b6c6dee /pstl
parent47788b97a9eb1215d0ac01826f51fbe286f56c0b (diff)
downloadllvm-26b0a23084f049f4084fc9f1d599ade66e4af185.zip
llvm-26b0a23084f049f4084fc9f1d599ade66e4af185.tar.gz
llvm-26b0a23084f049f4084fc9f1d599ade66e4af185.tar.bz2
[pstl] Fix a few errors when running PSTL tests through the libc++ test suite
Diffstat (limited to 'pstl')
-rw-r--r--pstl/include/pstl/internal/algorithm_impl.h6
-rw-r--r--pstl/test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp11
-rw-r--r--pstl/test/std/numerics/numeric.ops/transform_reduce.pass.cpp20
3 files changed, 14 insertions, 23 deletions
diff --git a/pstl/include/pstl/internal/algorithm_impl.h b/pstl/include/pstl/internal/algorithm_impl.h
index 01a9405..b4e1c14 100644
--- a/pstl/include/pstl/internal/algorithm_impl.h
+++ b/pstl/include/pstl/internal/algorithm_impl.h
@@ -3057,11 +3057,11 @@ __pattern_set_union(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forw
if (__n1 + __n2 <= __set_algo_cut_off)
return std::set_union(__first1, __last1, __first2, __last2, __result, __comp);
- typedef typename std::iterator_traits<_OutputIterator>::value_type _T;
+ typedef typename std::iterator_traits<_OutputIterator>::value_type _Tp;
return __parallel_set_union_op(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result, __comp,
[](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- _T* __result, _Compare __comp) {
+ _Tp* __result, _Compare __comp) {
return __pstl::__utils::__set_union_construct(__first1, __last1, __first2, __last2, __result, __comp,
__BrickCopyConstruct<_IsVector>());
},
@@ -3248,7 +3248,7 @@ __pattern_set_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1,
if (__n1 + __n2 > __set_algo_cut_off)
return __parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
- __comp, [](_DifferenceType __n, _DifferenceType __m) { return __n; },
+ __comp, [](_DifferenceType __n, _DifferenceType) { return __n; },
[](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
_ForwardIterator2 __last2, _Tp* __result, _Compare __comp) {
return __pstl::__utils::__set_difference_construct(
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 c85d0e9..4b2b93d 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
@@ -76,8 +76,7 @@ struct test_set_union
template <typename Policy, typename InputIterator1, typename InputIterator2, typename Compare>
typename std::enable_if<TestUtils::isReverse<InputIterator1>::value, void>::type
- operator()(Policy&& exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2,
- Compare comp)
+ operator()(Policy&&, InputIterator1, InputIterator1, InputIterator2, InputIterator2, Compare)
{
}
};
@@ -107,8 +106,7 @@ struct test_set_intersection
template <typename Policy, typename InputIterator1, typename InputIterator2, typename Compare>
typename std::enable_if<TestUtils::isReverse<InputIterator1>::value, void>::type
- operator()(Policy&& exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2,
- Compare comp)
+ operator()(Policy&&, InputIterator1, InputIterator1, InputIterator2, InputIterator2, Compare)
{
}
};
@@ -138,8 +136,7 @@ struct test_set_difference
template <typename Policy, typename InputIterator1, typename InputIterator2, typename Compare>
typename std::enable_if<TestUtils::isReverse<InputIterator1>::value, void>::type
- operator()(Policy&& exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2,
- Compare comp)
+ operator()(Policy&&, InputIterator1, InputIterator1, InputIterator2, InputIterator2, Compare)
{
}
};
@@ -190,7 +187,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/numerics/numeric.ops/transform_reduce.pass.cpp b/pstl/test/std/numerics/numeric.ops/transform_reduce.pass.cpp
index 7341ed5..dd8bb87 100644
--- a/pstl/test/std/numerics/numeric.ops/transform_reduce.pass.cpp
+++ b/pstl/test/std/numerics/numeric.ops/transform_reduce.pass.cpp
@@ -18,14 +18,6 @@
using namespace TestUtils;
-// Equal for all types
-template <typename T>
-static bool
-Equal(T x, T y)
-{
- return x == y;
-}
-
// Functor for xor-operation for modeling binary operations in inner_product
class XOR
{
@@ -57,11 +49,13 @@ class MyClass
{
return MyClass(-x.my_field);
}
- friend MyClass operator*(const MyClass& x, const MyClass& y) { return MyClass(x.my_field * y.my_field); }
- bool
- operator==(const MyClass& in)
+ friend MyClass operator*(const MyClass& x, const MyClass& y)
+ {
+ return MyClass(x.my_field * y.my_field);
+ }
+ friend bool operator==(const MyClass& x, const MyClass& y)
{
- return my_field == in.my_field;
+ return x.my_field == y.my_field;
}
};
@@ -69,7 +63,7 @@ template <typename T>
void
CheckResults(const T& expected, const T& in)
{
- EXPECT_TRUE(Equal(expected, in), "wrong result of transform_reduce");
+ EXPECT_TRUE(expected == in, "wrong result of transform_reduce");
}
// We need to check correctness only for "int" (for example) except cases