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
AVRO-3616: C++ Fix compilation warnings #1836
Conversation
Replace <boost/test/included/unit_test_framework.hpp> include with <boost/test/included/unit_test.hpp> Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Fix the order of constructor parameters Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Those should prevent from introducing new warnings. -Wextra reports "unused method arguments" and those could not be fixed without API break. Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
lang/c++/impl/ValidSchema.cc
Outdated
@@ -70,7 +70,7 @@ static bool validate(const NodePtr &node, SymbolMap &symbolMap) { | |||
|
|||
node->lock(); | |||
auto leaves = node->leaves(); | |||
for (auto i = 0; i < leaves; ++i) { | |||
for (long unsigned int i = 0; i < leaves; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better use size_t, because Node::leaves returns size_t, and Node::leafAt takes a size_t parameter. Or perhaps decltype(leaves).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On 64-bit Microsoft Windows, size_t
is 64-bit, but long unsigned int
is 32-bit and would not be pedantically correct. In practice though, it's rather unlikely that a node would have billions of leaves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improved! Thanks!
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
In Validator, there seems to be some inconsistency with
Those could be fixed in a separate PR, though. |
How did you find those ? |
I worried that commit e632e65 changing the types of the local variables to size_t in might cause problems if any subsequent code tries to use negative values in those variables. I looked at the remaining parts of the modified methods and did not find any such problems, but found the |
Thanks, @KalleOlaviNiemitalo ! |
* AVRO-3616: [C++]: Fix compilation warnings Replace <boost/test/included/unit_test_framework.hpp> include with <boost/test/included/unit_test.hpp> Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org> * AVRO-3616: [C++]: Fix compilation warnings Fix the order of constructor parameters Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org> * AVRO-3616: Enable -pedantic and -Werror for compiler flags Those should prevent from introducing new warnings. -Wextra reports "unused method arguments" and those could not be fixed without API break. Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org> * AVRO-3616: Use size_t consistently for node->leaves() Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org> Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org> (cherry picked from commit d336c6c)
I filed those as AVRO-3617. |
Jira
Tests
Commits
Documentation