Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-4364: [C++] Fix CHECKIN warnings #3478

Conversation

fsaintjacques
Copy link
Contributor

No description provided.

Copy link
Member

@xhochy xhochy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused that the std::move statements were necessary. What was the warning that pointed you in this direction?

@@ -73,7 +73,7 @@ std::shared_ptr<Buffer> CompressDataOneShot(Codec* codec,
ABORT_NOT_OK(codec->Compress(data.size(), data.data(), max_compressed_len,
compressed->mutable_data(), &compressed_len));
ABORT_NOT_OK(compressed->Resize(compressed_len));
return compressed;
return std::move(compressed);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused that this is needed. I would normally think that we should not std::move here as return-value-optimization should kick in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With clang++-7

../src/arrow/io/compressed-test.cc:76:10: error: prior to the resolution of a defect report against ISO C++11, local variable 'compressed' would have been copied despite being returned by name, due to its not matching the function return type ('shared_ptr<arrow::Buffer>' vs 'shared_ptr<arrow::ResizableBuffer>') [-Werror,-Wreturn-std-move-in-c++11]
  return compressed;
         ^~~~~~~~~~

Copy link
Member

@wesm wesm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. Thanks @fsaintjacques!

Seems like we should upgrade our clang bits to 7.0 soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants