This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 2e1ddf5069 GH-44788: [C++] Fix a couple of maybe-uninitialized
warnings (#44789)
2e1ddf5069 is described below
commit 2e1ddf5069731d2b908b18d851b2389973cc988c
Author: Raúl Cumplido <[email protected]>
AuthorDate: Fri Nov 22 02:07:15 2024 +0100
GH-44788: [C++] Fix a couple of maybe-uninitialized warnings (#44789)
### Rationale for this change
I was getting some `-Wmaybe-uninitialized` warnings locally when building,
see original issue for log.
### What changes are included in this PR?
A couple of minor changes to avoid the warnings, initializing a variable
and removing an unnecessary one.
### Are these changes tested?
Code will be tested via CI and I can confirm I can compile without warnings
now:
```
$ cmake --build arrow/cpp/build --target install -- -j 8
[411/412] Install the project...
-- Install configuration: "RELEASE"
```
### Are there any user-facing changes?
No
* GitHub Issue: #44788
Authored-by: Raúl Cumplido <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
cpp/src/arrow/compute/expression.cc | 2 +-
cpp/src/arrow/util/iterator.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpp/src/arrow/compute/expression.cc
b/cpp/src/arrow/compute/expression.cc
index 12fda5d58f..e2f3195db5 100644
--- a/cpp/src/arrow/compute/expression.cc
+++ b/cpp/src/arrow/compute/expression.cc
@@ -1263,7 +1263,7 @@ struct Inequality {
if (!lhs.field_ref()) return std::nullopt;
if (*lhs.field_ref() != guarantee.target) return std::nullopt;
- FilterOptions::NullSelectionBehavior null_selection;
+ FilterOptions::NullSelectionBehavior null_selection{};
switch (options->null_matching_behavior) {
case SetLookupOptions::MATCH:
null_selection =
diff --git a/cpp/src/arrow/util/iterator.h b/cpp/src/arrow/util/iterator.h
index 5025799b9a..3c72f6398e 100644
--- a/cpp/src/arrow/util/iterator.h
+++ b/cpp/src/arrow/util/iterator.h
@@ -292,7 +292,7 @@ class TransformIterator {
finished_ = true;
return next_res.status();
}
- auto next = *next_res;
+ auto next = std::move(*next_res);
if (next.ReadyForNext()) {
if (IsIterationEnd(*last_value_)) {
finished_ = true;