kou commented on code in PR #44789:
URL: https://github.com/apache/arrow/pull/44789#discussion_r1849349802
##########
cpp/src/arrow/util/iterator.h:
##########
@@ -292,18 +292,17 @@ class TransformIterator {
finished_ = true;
return next_res.status();
}
- auto next = *next_res;
Review Comment:
Hmm. I feel that this is strange...
@pitrou Do you have any idea how to suppress this warning?
```text
[47/311] Building CXX object
src/arrow/CMakeFiles/arrow_csv.dir/csv/reader.cc.o
In file included from /usr/include/c++/13/bits/shared_ptr.h:53,
from /usr/include/c++/13/memory:80,
from /home/raulcd/code/arrow/cpp/src/arrow/csv/reader.h:20,
from /home/raulcd/code/arrow/cpp/src/arrow/csv/reader.cc:18:
In constructor ‘std::__shared_ptr<_Tp,
_Lp>::__shared_ptr(std::__shared_ptr<_Tp, _Lp>&&) [with _Tp = arrow::Buffer;
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’,
inlined from ‘std::shared_ptr<_Tp>::shared_ptr(std::shared_ptr<_Tp>&&)
[with _Tp = arrow::Buffer]’ at /usr/include/c++/13/bits/shared_ptr.h:360:41,
inlined from ‘constexpr std::_Optional_payload_base<_Tp>::_Storage<_Up,
false>::_Storage(std::in_place_t, _Args&& ...) [with _Args =
{std::shared_ptr<arrow::Buffer>}; _Up = std::shared_ptr<arrow::Buffer>; _Tp =
std::shared_ptr<arrow::Buffer>]’ at /usr/include/c++/13/optional:244:8,
inlined from ‘constexpr
std::_Optional_payload_base<_Tp>::_Optional_payload_base(std::in_place_t,
_Args&& ...) [with _Args = {std::shared_ptr<arrow::Buffer>}; _Tp =
std::shared_ptr<arrow::Buffer>]’ at /usr/include/c++/13/optional:126:4,
inlined from ‘constexpr
std::_Optional_payload<std::shared_ptr<arrow::Buffer>, true, false,
false>::_Optional_payload(std::in_place_t, _Args&& ...) [with _Args =
{std::shared_ptr<arrow::Buffer>}][inherited from
std::_Optional_payload_base<std::shared_ptr<arrow::Buffer> >]’ at
/usr/include/c++/13/optional:399:42,
inlined from ‘constexpr
std::_Optional_payload<std::shared_ptr<arrow::Buffer>, false, false,
false>::_Optional_payload(std::in_place_t, _Args&& ...) [with _Args =
{std::shared_ptr<arrow::Buffer>}][inherited from
std::_Optional_payload_base<std::shared_ptr<arrow::Buffer> >]’ at
/usr/include/c++/13/optional:433:57,
inlined from ‘constexpr std::_Optional_base<_Tp, <anonymous>,
<anonymous> >::_Optional_base(std::in_place_t, _Args&& ...) [with _Args =
{std::shared_ptr<arrow::Buffer>}; typename
std::enable_if<is_constructible_v<_Tp, _Args ...>, bool>::type <anonymous> =
false; _Tp = std::shared_ptr<arrow::Buffer>; bool <anonymous> = false; bool
<anonymous> = false]’ at /usr/include/c++/13/optional:523:4,
inlined from ‘constexpr std::optional<_Tp>::optional(_Up&&) [with _Up =
std::shared_ptr<arrow::Buffer>; typename
std::enable_if<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename
std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >,
std::__not_<std::is_same<std::in_place_t, typename std::remove_cv<typename
std::remove_reference<_Tuple>::type>::type> >, std::is_constructible<_T1, _U1>,
std::is_convertible<_U1, _T1> >, bool>::type <anonymous> = true; _Tp =
std::shared_ptr<arrow::Buffer>]’ at /usr/include/c++/13/optional:751:47,
inlined from ‘void arrow::internal::AlignedStorage<T>::construct(A&&
...) [with A = {std::shared_ptr<arrow::Buffer>}; T =
std::optional<std::shared_ptr<arrow::Buffer> >]’ at
/home/raulcd/code/arrow/cpp/src/arrow/util/aligned_storage.h:52:5,
inlined from ‘void arrow::Result<T>::ConstructValue(U&&) [with U =
std::shared_ptr<arrow::Buffer>; T =
std::optional<std::shared_ptr<arrow::Buffer> >]’ at
/home/raulcd/code/arrow/cpp/src/arrow/result.h:448:23,
inlined from ‘arrow::Result<T>::Result(U&&) [with U =
std::shared_ptr<arrow::Buffer>; E = void; T =
std::optional<std::shared_ptr<arrow::Buffer> >]’ at
/home/raulcd/code/arrow/cpp/src/arrow/result.h:165:19,
inlined from ‘arrow::Result<std::optional<_Up> >
arrow::TransformIterator<T, V>::Pump() [with T =
std::shared_ptr<arrow::Buffer>; V = std::shared_ptr<arrow::Buffer>]’ at
/home/raulcd/code/arrow/cpp/src/arrow/util/iterator.h:306:27:
/usr/include/c++/13/bits/shared_ptr_base.h:1532:9: warning:
‘*(std::__shared_ptr<arrow::Buffer, __gnu_cxx::_S_atomic>*)((char*)&next +
offsetof(arrow::TransformFlow<std::shared_ptr<arrow::Buffer>
>,arrow::TransformFlow<std::shared_ptr<arrow::Buffer>
>::yield_value_.std::optional<std::shared_ptr<arrow::Buffer>
>::<unnamed>.std::_Optional_base<std::shared_ptr<arrow::Buffer>, false,
false>::<unnamed>)).std::__shared_ptr<arrow::Buffer,
__gnu_cxx::_S_atomic>::_M_ptr’ may be used uninitialized [-Wmaybe-uninitialized]
1532 | : _M_ptr(__r._M_ptr), _M_refcount()
| ^~~~~~~~~~~~~~~~~~
In file included from
/home/raulcd/code/arrow/cpp/src/arrow/record_batch.h:30,
from /home/raulcd/code/arrow/cpp/src/arrow/csv/reader.h:24:
/home/raulcd/code/arrow/cpp/src/arrow/util/iterator.h: In member function
‘arrow::Result<std::optional<_Up> > arrow::TransformIterator<T, V>::Pump()
[with T = std::shared_ptr<arrow::Buffer>; V = std::shared_ptr<arrow::Buffer>]’:
/home/raulcd/code/arrow/cpp/src/arrow/util/iterator.h:295:12: note:
‘*(std::__shared_ptr<arrow::Buffer, __gnu_cxx::_S_atomic>*)((char*)&next +
offsetof(arrow::TransformFlow<std::shared_ptr<arrow::Buffer>
>,arrow::TransformFlow<std::shared_ptr<arrow::Buffer>
>::yield_value_.std::optional<std::shared_ptr<arrow::Buffer>
>::<unnamed>.std::_Optional_base<std::shared_ptr<arrow::Buffer>, false,
false>::<unnamed>)).std::__shared_ptr<arrow::Buffer,
__gnu_cxx::_S_atomic>::_M_ptr’ was declared here
295 | auto next = *next_res;
| ^~~~
```
See also: https://github.com/apache/arrow/issues/44788
`auto next = std::move(*next_res)`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]