Skip to content

Commit

Permalink
GH-44788: [C++] Fix a couple of maybe-uninitialized warnings (#44789)
Browse files Browse the repository at this point in the history
### 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]>
  • Loading branch information
raulcd authored Nov 22, 2024
1 parent 27bbd59 commit 2e1ddf5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cpp/src/arrow/compute/expression.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2e1ddf5

Please sign in to comment.