[libcxx-commits] [pstl] r354148 - [pstl] Remove some warnings when compiling with a recent Clang
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 15 09:30:35 PST 2019
Author: ldionne
Date: Fri Feb 15 09:30:35 2019
New Revision: 354148
URL: http://llvm.org/viewvc/llvm-project?rev=354148&view=rev
Log:
[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.
Modified:
pstl/trunk/include/pstl/internal/algorithm_impl.h
pstl/trunk/include/pstl/internal/numeric_impl.h
pstl/trunk/include/pstl/internal/parallel_backend_tbb.h
pstl/trunk/test/test_includes.cpp
pstl/trunk/test/utils.h
Modified: pstl/trunk/include/pstl/internal/algorithm_impl.h
URL: http://llvm.org/viewvc/llvm-project/pstl/trunk/include/pstl/internal/algorithm_impl.h?rev=354148&r1=354147&r2=354148&view=diff
==============================================================================
--- pstl/trunk/include/pstl/internal/algorithm_impl.h (original)
+++ pstl/trunk/include/pstl/internal/algorithm_impl.h Fri Feb 15 09:30:35 2019
@@ -638,8 +638,8 @@ pattern_find_end(_ExecutionPolicy&& __ex
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&& __exe
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
_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
_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&
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&
__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&& __e
_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&& __e
_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(_ExecutionPolic
_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(_ExecutionPolic
_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&
{
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(_ExecutionPoli
{
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&&
_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&&
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);
Modified: pstl/trunk/include/pstl/internal/numeric_impl.h
URL: http://llvm.org/viewvc/llvm-project/pstl/trunk/include/pstl/internal/numeric_impl.h?rev=354148&r1=354147&r2=354148&view=diff
==============================================================================
--- pstl/trunk/include/pstl/internal/numeric_impl.h (original)
+++ pstl/trunk/include/pstl/internal/numeric_impl.h Fri Feb 15 09:30:35 2019
@@ -243,7 +243,7 @@ pattern_transform_scan(_ExecutionPolicy&
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());
Modified: pstl/trunk/include/pstl/internal/parallel_backend_tbb.h
URL: http://llvm.org/viewvc/llvm-project/pstl/trunk/include/pstl/internal/parallel_backend_tbb.h?rev=354148&r1=354147&r2=354148&view=diff
==============================================================================
--- pstl/trunk/include/pstl/internal/parallel_backend_tbb.h (original)
+++ pstl/trunk/include/pstl/internal/parallel_backend_tbb.h Fri Feb 15 09:30:35 2019
@@ -497,7 +497,7 @@ class stable_sort_task : public tbb::tas
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)
{
}
Modified: pstl/trunk/test/test_includes.cpp
URL: http://llvm.org/viewvc/llvm-project/pstl/trunk/test/test_includes.cpp?rev=354148&r1=354147&r2=354148&view=diff
==============================================================================
--- pstl/trunk/test/test_includes.cpp (original)
+++ pstl/trunk/test/test_includes.cpp Fri Feb 15 09:30:35 2019
@@ -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);
Modified: pstl/trunk/test/utils.h
URL: http://llvm.org/viewvc/llvm-project/pstl/trunk/test/utils.h?rev=354148&r1=354147&r2=354148&view=diff
==============================================================================
--- pstl/trunk/test/utils.h (original)
+++ pstl/trunk/test/utils.h Fri Feb 15 09:30:35 2019
@@ -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_
More information about the libcxx-commits
mailing list