aboutsummaryrefslogtreecommitdiff
path: root/pstl
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2019-02-15 17:30:35 +0000
committerLouis Dionne <ldionne@apple.com>2019-02-15 17:30:35 +0000
commit28dc566701a556921fb6820b67cfb2a70b0baf52 (patch)
treee3b43581615eaa5ec8d1c050ffe5f59d42bfdfc2 /pstl
parent0bae08ae7698869f17b7341f8378cf2de0502be8 (diff)
downloadllvm-28dc566701a556921fb6820b67cfb2a70b0baf52.zip
llvm-28dc566701a556921fb6820b67cfb2a70b0baf52.tar.gz
llvm-28dc566701a556921fb6820b67cfb2a70b0baf52.tar.bz2
[pstl] Remove some warnings when compiling with a recent Clang
There were multiple warnings for lambda captures that are unused, so I removed those captures. I also fixed a couple of -Wsign-compare warnings. Note that some warnings still remain, this change is not exhaustive. llvm-svn: 354148
Diffstat (limited to 'pstl')
-rw-r--r--pstl/include/pstl/internal/algorithm_impl.h46
-rw-r--r--pstl/include/pstl/internal/numeric_impl.h2
-rw-r--r--pstl/include/pstl/internal/parallel_backend_tbb.h2
-rw-r--r--pstl/test/test_includes.cpp4
-rw-r--r--pstl/test/utils.h2
5 files changed, 26 insertions, 30 deletions
diff --git a/pstl/include/pstl/internal/algorithm_impl.h b/pstl/include/pstl/internal/algorithm_impl.h
index 9074ab5..ca3fa82 100644
--- a/pstl/include/pstl/internal/algorithm_impl.h
+++ b/pstl/include/pstl/internal/algorithm_impl.h
@@ -638,8 +638,8 @@ pattern_find_end(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardI
return except_handler([&]() {
return internal::parallel_find(
std::forward<_ExecutionPolicy>(__exec), __first, __last,
- [__first, __last, __s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i,
- _ForwardIterator1 __j) {
+ [__last, __s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i,
+ _ForwardIterator1 __j) {
return internal::find_subrange(__i, __j, __last, __s_first, __s_last, __pred, false, __is_vector);
},
std::greater<typename std::iterator_traits<_ForwardIterator1>::difference_type>(), /*is_first=*/false);
@@ -1028,7 +1028,7 @@ pattern_copy_if(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Rando
if (_DifferenceType(1) < __n)
{
par_backend::buffer<bool> __mask_buf(__n);
- return except_handler([&__exec, __n, __first, __last, __result, __is_vector, __pred, &__mask_buf]() {
+ return except_handler([&__exec, __n, __first, __result, __is_vector, __pred, &__mask_buf]() {
bool* __mask = __mask_buf.get();
_DifferenceType __m{};
par_backend::parallel_strict_scan(
@@ -1544,13 +1544,13 @@ pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIter
_Tp* __result = __buf.get();
par_backend::parallel_for(
std::forward<_ExecutionPolicy>(__exec), __middle, __last,
- [__first, __last, __middle, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
+ [__middle, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
brick_uninitialized_move(__b, __e, __result + (__b - __middle), __is_vector);
});
par_backend::parallel_for(
std::forward<_ExecutionPolicy>(__exec), __first, __middle,
- [__first, __last, __middle, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
+ [__last, __middle, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
brick_move(__b, __e, __b + (__last - __middle), __is_vector);
});
@@ -1569,13 +1569,13 @@ pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIter
_Tp* __result = __buf.get();
par_backend::parallel_for(
std::forward<_ExecutionPolicy>(__exec), __first, __middle,
- [__m, __first, __last, __middle, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
+ [__first, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
brick_uninitialized_move(__b, __e, __result + (__b - __first), __is_vector);
});
par_backend::parallel_for(
std::forward<_ExecutionPolicy>(__exec), __middle, __last,
- [__first, __last, __middle, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
+ [__first, __middle, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
brick_move(__b, __e, __first + (__b - __middle), __is_vector);
});
@@ -1711,8 +1711,6 @@ pattern_is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _For
else
{
return except_handler([&]() {
- typedef typename std::iterator_traits<_ForwardIterator>::difference_type _SizeType;
-
// State of current range:
// broken - current range is not partitioned by pred
// all_true - all elements in current range satisfy pred
@@ -1736,8 +1734,8 @@ pattern_is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _For
__init = par_backend::parallel_reduce(
std::forward<_ExecutionPolicy>(__exec), __first, __last, __init,
- [__first, &__pred, &__table, __is_vector](_ForwardIterator __i, _ForwardIterator __j,
- _ReduceType __value) -> _ReduceType {
+ [&__pred, &__table, __is_vector](_ForwardIterator __i, _ForwardIterator __j,
+ _ReduceType __value) -> _ReduceType {
if (__value == __broken)
{
return __broken;
@@ -1848,8 +1846,8 @@ pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardI
_PartitionRange __init{__last, __last, __last};
// lambda for merging two partitioned ranges to one partitioned range
- auto __reductor = [&__exec, __first, __is_vector](_PartitionRange __val1,
- _PartitionRange __val2) -> _PartitionRange {
+ auto __reductor = [&__exec, __is_vector](_PartitionRange __val1,
+ _PartitionRange __val2) -> _PartitionRange {
auto __size1 = __val1.__end - __val1.__pivot;
auto __size2 = __val2.__pivot - __val2.__begin;
auto __new_begin = __val2.__begin - (__val1.__end - __val1.__begin);
@@ -1884,8 +1882,8 @@ pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardI
_PartitionRange __result = par_backend::parallel_reduce(
std::forward<_ExecutionPolicy>(__exec), __first, __last, __init,
- [__first, __pred, __is_vector, __reductor](_ForwardIterator __i, _ForwardIterator __j,
- _PartitionRange __value) -> _PartitionRange {
+ [__pred, __is_vector, __reductor](_ForwardIterator __i, _ForwardIterator __j,
+ _PartitionRange __value) -> _PartitionRange {
//1. serial partition
_ForwardIterator __pivot = brick_partition(__i, __j, __pred, __is_vector);
@@ -1941,14 +1939,13 @@ pattern_stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __fir
_BidirectionalIterator __pivot;
_BidirectionalIterator __end;
};
- typedef typename std::iterator_traits<_BidirectionalIterator>::value_type T;
return except_handler([&]() {
_PartitionRange __init{__last, __last, __last};
// lambda for merging two partitioned ranges to one partitioned range
- auto __reductor = [__first, __is_vector, __pred](_PartitionRange __val1,
- _PartitionRange __val2) -> _PartitionRange {
+ auto __reductor = [__is_vector](_PartitionRange __val1,
+ _PartitionRange __val2) -> _PartitionRange {
auto __size1 = __val1.__end - __val1.__pivot;
auto __new_begin = __val2.__begin - (__val1.__end - __val1.__begin);
@@ -1968,8 +1965,8 @@ pattern_stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __fir
_PartitionRange __result = par_backend::parallel_reduce(
std::forward<_ExecutionPolicy>(__exec), __first, __last, __init,
- [__first, &__pred, __is_vector, __reductor](_BidirectionalIterator __i, _BidirectionalIterator __j,
- _PartitionRange __value) -> _PartitionRange {
+ [&__pred, __is_vector, __reductor](_BidirectionalIterator __i, _BidirectionalIterator __j,
+ _PartitionRange __value) -> _PartitionRange {
//1. serial stable_partition
_BidirectionalIterator __pivot = brick_stable_partition(__i, __j, __pred, __is_vector);
@@ -2031,7 +2028,7 @@ pattern_partition_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
{
par_backend::buffer<bool> __mask_buf(__n);
return internal::except_handler(
- [&__exec, __n, __first, __last, __out_true, __out_false, __is_vector, __pred, &__mask_buf]() {
+ [&__exec, __n, __first, __out_true, __out_false, __is_vector, __pred, &__mask_buf]() {
bool* __mask = __mask_buf.get();
_ReturnType __m{};
par_backend::parallel_strict_scan(
@@ -2175,8 +2172,8 @@ pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _
{
par_backend::parallel_stable_sort(
std::forward<_ExecutionPolicy>(__exec), __d_first, __d_first + __n1, __comp,
- [__n1, __first, __d_first, __is_vector](_RandomAccessIterator __i, _RandomAccessIterator __j,
- _Compare __comp) {
+ [__first, __d_first, __is_vector](_RandomAccessIterator __i, _RandomAccessIterator __j,
+ _Compare __comp) {
_ForwardIterator __i1 = __first + (__i - __d_first);
_ForwardIterator __j1 = __first + (__j - __d_first);
@@ -2862,7 +2859,6 @@ parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Fo
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _OutputIterator __result, _Compare __comp,
_SetUnionOp __set_union_op, _IsVector __is_vector)
{
- typedef typename std::iterator_traits<_OutputIterator>::value_type _T;
typedef typename std::iterator_traits<_ForwardIterator1>::difference_type _DifferenceType;
const auto __n1 = __last1 - __first1;
@@ -3355,7 +3351,7 @@ pattern_is_heap_until(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
return internal::except_handler([&]() {
return internal::parallel_find(
std::forward<_ExecutionPolicy>(__exec), __first, __last,
- [__first, __last, __comp, __is_vector](_RandomAccessIterator __i, _RandomAccessIterator __j) {
+ [__first, __comp, __is_vector](_RandomAccessIterator __i, _RandomAccessIterator __j) {
return internal::is_heap_until_local(__first, __i - __first, __j - __first, __comp, __is_vector);
},
std::less<typename std::iterator_traits<_RandomAccessIterator>::difference_type>(), /*is_first=*/true);
diff --git a/pstl/include/pstl/internal/numeric_impl.h b/pstl/include/pstl/internal/numeric_impl.h
index dd09228..cbb5fd8 100644
--- a/pstl/include/pstl/internal/numeric_impl.h
+++ b/pstl/include/pstl/internal/numeric_impl.h
@@ -243,7 +243,7 @@ pattern_transform_scan(_ExecutionPolicy&& __exec, _RandomAccessIterator __first,
std::forward<_ExecutionPolicy>(__exec), __last - __first,
[__first, __unary_op](_DifferenceType __i) mutable { return __unary_op(__first[__i]); }, __init,
__binary_op,
- [__first, __unary_op, __binary_op, __is_vector](_DifferenceType __i, _DifferenceType __j, _Tp __init) {
+ [__first, __unary_op, __binary_op](_DifferenceType __i, _DifferenceType __j, _Tp __init) {
// Execute serial brick_transform_reduce, due to the explicit SIMD vectorization (reduction) requires a commutative operation for the guarantee of correct scan.
return internal::brick_transform_reduce(__first + __i, __first + __j, __init, __binary_op, __unary_op,
/*__is_vector*/ std::false_type());
diff --git a/pstl/include/pstl/internal/parallel_backend_tbb.h b/pstl/include/pstl/internal/parallel_backend_tbb.h
index 532bbb7..fb621f2 100644
--- a/pstl/include/pstl/internal/parallel_backend_tbb.h
+++ b/pstl/include/pstl/internal/parallel_backend_tbb.h
@@ -497,7 +497,7 @@ class stable_sort_task : public tbb::task
public:
stable_sort_task(_RandomAccessIterator1 __xs, _RandomAccessIterator1 __xe, _RandomAccessIterator2 __zs,
int32_t __inplace, _Compare __comp, _LeafSort __leaf_sort, _SizeType __n)
- : _M_xs(__xs), _M_xe(__xe), _M_zs(__zs), _M_inplace(__inplace), _M_comp(__comp), _M_leaf_sort(__leaf_sort),
+ : _M_xs(__xs), _M_xe(__xe), _M_zs(__zs), _M_comp(__comp), _M_leaf_sort(__leaf_sort), _M_inplace(__inplace),
_M_nsort(__n)
{
}
diff --git a/pstl/test/test_includes.cpp b/pstl/test/test_includes.cpp
index 53b8a60..5a2b51e 100644
--- a/pstl/test/test_includes.cpp
+++ b/pstl/test/test_includes.cpp
@@ -76,8 +76,8 @@ test_includes(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<T2> in2(m, [m](std::size_t k) { return rand() % (k + 1); });
+ Sequence<T1> in1(n, [](std::size_t k) { return rand() % (2 * k + 1); });
+ Sequence<T2> in2(m, [](std::size_t k) { return rand() % (k + 1); });
std::sort(in1.begin(), in1.end(), compare);
std::sort(in2.begin(), in2.end(), compare);
diff --git a/pstl/test/utils.h b/pstl/test/utils.h
index 0c0cfa1..8645ee3 100644
--- a/pstl/test/utils.h
+++ b/pstl/test/utils.h
@@ -719,7 +719,7 @@ struct MakeIterator
// Useful constant variables
constexpr std::size_t GuardSize = 5;
-constexpr std::size_t sizeLimit = 1000;
+constexpr std::ptrdiff_t sizeLimit = 1000;
template <typename Iter, typename Void = void> // local iterator_traits for non-iterators
struct iterator_traits_