From 2b204d043322cd1c21fa28a4e8b92e9406504f20 Mon Sep 17 00:00:00 2001 From: David Wendt <45795991+davidwendt@users.noreply.github.com> Date: Wed, 11 May 2022 11:39:45 -0400 Subject: [PATCH] Fix compile warning in search.cu (#10827) Compile warning introduced with merge of PR #10802 ``` 10 warnings like this: 12:43:23 $SRC_DIR/cpp/src/search/search.cu(108): warning #177-D: parameter "args" was declared but never referenced 12:43:23 detected during instantiation of function "lambda [](auto &&...)->auto [with = &, thrust::counting_iterator, const thrust::counting_iterator &, thrust::counting_iterator, cudf::size_type *const &, const cudf::row_lexicographic_comparator &>]" 12:43:23 (121): here ``` Line 108 has a lambda refactoring that seems to confuse the compiler. ``` auto const do_search = [find_first](auto&&... args) { if (find_first) { thrust::lower_bound(std::forward(args)...); } else { thrust::upper_bound(std::forward(args)...); } }; do_search(rmm::exec_policy(stream), count_it, count_it + haystack.num_rows(), count_it, count_it + needles.num_rows(), out_it, comp); ``` The warning is wrong and the compiler generates the correct code so this is likely a compiler bug. This PR fixes the warning by replacing the lambda with an if statement. Authors: - David Wendt (https://github.com/davidwendt) Approvers: - Nghia Truong (https://github.com/ttnghia) - Yunsong Wang (https://github.com/PointKernel) URL: https://github.com/rapidsai/cudf/pull/10827 --- cpp/src/search/search.cu | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/cpp/src/search/search.cu b/cpp/src/search/search.cu index 491ad49e020..49d0959ecc4 100644 --- a/cpp/src/search/search.cu +++ b/cpp/src/search/search.cu @@ -105,21 +105,23 @@ std::unique_ptr search_ordered(table_view const& haystack, column_order_dv.data(), null_precedence_dv.data()); - auto const do_search = [find_first](auto&&... args) { - if (find_first) { - thrust::lower_bound(std::forward(args)...); - } else { - thrust::upper_bound(std::forward(args)...); - } - }; - do_search(rmm::exec_policy(stream), - count_it, - count_it + haystack.num_rows(), - count_it, - count_it + needles.num_rows(), - out_it, - comp); - + if (find_first) { + thrust::lower_bound(rmm::exec_policy(stream), + count_it, + count_it + haystack.num_rows(), + count_it, + count_it + needles.num_rows(), + out_it, + comp); + } else { + thrust::upper_bound(rmm::exec_policy(stream), + count_it, + count_it + haystack.num_rows(), + count_it, + count_it + needles.num_rows(), + out_it, + comp); + } return result; }