-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
GH-41112: [C++] Clean up unused parameter warnings #41111
Conversation
I hate to be the one bringing boring news, but if a change touches code it can't be considered |
Good to know and not a problem at all. See #41112 |
cpp/src/arrow/util/decimal.h
Outdated
@@ -80,7 +80,7 @@ class ARROW_EXPORT Decimal128 : public BasicDecimal128 { | |||
std::pair<Decimal128, Decimal128> result; | |||
auto dstatus = BasicDecimal128::Divide(divisor, &result.first, &result.second); | |||
ARROW_RETURN_NOT_OK(ToArrowStatus(dstatus)); | |||
return std::move(result); | |||
return result; |
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.
Please don't mix unrelated changes.
These changes are for #41107 , right?
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.
Ah yes sorry about that. Was working off of one branch to try and get a clean nanoarrow build so this slipped in. Will revert
|
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.
Could you use our PR template instead of removing it entirely next time?
cpp/src/arrow/array/builder_base.h
Outdated
virtual Status AppendArraySlice(const ArraySpan& array, int64_t offset, | ||
int64_t length) { | ||
ARROW_UNUSED(array); | ||
ARROW_UNUSED(offset); | ||
ARROW_UNUSED(length); |
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.
How about using ARROW_ARG_UNUSED()
instead?
virtual Status AppendArraySlice(const ArraySpan& array, int64_t offset, | |
int64_t length) { | |
ARROW_UNUSED(array); | |
ARROW_UNUSED(offset); | |
ARROW_UNUSED(length); | |
virtual Status AppendArraySlice(const ArraySpan& ARROW_ARG_UNUSED(array), int64_t ARROW_ARG_UNUSED(offset), | |
int64_t ARROW_ARG_UNUSED(length)) { |
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.
Sure that works. Out of curiosity now that we are on C++17 any reason not to use [[maybe_unused]]
?
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.
I think that we can use [[maybe_unused]]
.
Could you open a new issue for this? Let's discuss this on the issue.
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.
Can you just try to use [[maybe_unused]]
in this PR?
Hmm, is this necessary? This is making the source code more annoying to read without any tangible benefit. (we would be bound to add such annotations everywhere a stub function implementation returns |
Its a fair question. It looks like gcc adds -Wunused-parameter only when both Wextra and Wall are enabled. I have no strong opinion either way - if we think this is too much noise in the code then I don't think its the end of the world for downstream libraries to have to ignore this warning |
Then we should add |
@felipecrv This happens in the Arrow headers, so changing our own build flags wouldn't change anything here, AFAICT. That said, if other people think these warnings do need to be fixed, then why not. |
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.
+1
That said, if other people think these warnings do need to be fixed, then why not.
Yes, we should help people that build their own software with -Werror
.
After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 933ee7e. There were 5 benchmark results indicating a performance regression:
The full Conbench report has more details. It also includes information about 6 possible false positives for unstable benchmarks that are known to sometimes produce them. |
Hmm.
|
Unfortunate...so I guess back to the macros? Unless I am reading this wrong I am surprised by that lack of support - this says gcc 7 started support for maybe_unused? |
Yes, please. |
It seems that $ docker run -it --rm almalinux:8
$ dnf install -y gcc-c++ vim
$ vim a.cc
$ cat a.cc
class A {
explicit A([[maybe_unused]] int x) {}
void a([[maybe_unused]] int x) {}
};
int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) {
return 0;
}
$ LANG=C g++ -std=c++17 a.cc
a.cc:2:14: error: expected unqualified-id before '[' token
explicit A([[maybe_unused]] int x) {}
^
a.cc:2:14: error: expected ')' before '[' token
explicit A([[maybe_unused]] int x) {}
~^
) |
Thanks for catching and raising that, Kou! I came here to say that I found similar failures in some of our extended tests for the R implementation (which relies on the C++) implementation and for historical reasons is tested across a bunch of operating systems, including some that while old are still not yet EOL. Which is causing out nightly builds for test-r-rstudio-r-base-4.1-opensuse153 and test-r-rstudio-r-base-4.2-centos7-devtoolset-8 as well as our r-binary packaging to fail. |
### Rationale for this change This is a follow up to #41111 which was created as an issue in #41367 ### What changes are included in this PR? Replace [[maybe_unused]] with Arrow macro ### Are these changes tested? Builds cleanly ### Are there any user-facing changes? No * GitHub Issue: #41367 Authored-by: Will Ayd <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
I've merged WillAyd's fix. Could you try it on your PR? |
Will do! I also ran one of them on his PR too and it was good there. |
Noticed these when compiling the nanoarrow test suite with -Wextra * GitHub Issue: apache#41112 ### Rationale for this change Helps clean up build warnings when compiling with -Wextra ### What changes are included in this PR? Used Arrow macros to mark some parameters as unused ### Are these changes tested? N/A - just ensured program compiles cleanly ### Are there any user-facing changes? No Authored-by: Will Ayd <[email protected]> Signed-off-by: Felipe Oliveira Carvalho <[email protected]>
…he#41359) ### Rationale for this change This is a follow up to apache#41111 which was created as an issue in apache#41367 ### What changes are included in this PR? Replace [[maybe_unused]] with Arrow macro ### Are these changes tested? Builds cleanly ### Are there any user-facing changes? No * GitHub Issue: apache#41367 Authored-by: Will Ayd <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
Noticed these when compiling the nanoarrow test suite with -Wextra * GitHub Issue: apache#41112 ### Rationale for this change Helps clean up build warnings when compiling with -Wextra ### What changes are included in this PR? Used Arrow macros to mark some parameters as unused ### Are these changes tested? N/A - just ensured program compiles cleanly ### Are there any user-facing changes? No Authored-by: Will Ayd <[email protected]> Signed-off-by: Felipe Oliveira Carvalho <[email protected]>
…he#41359) ### Rationale for this change This is a follow up to apache#41111 which was created as an issue in apache#41367 ### What changes are included in this PR? Replace [[maybe_unused]] with Arrow macro ### Are these changes tested? Builds cleanly ### Are there any user-facing changes? No * GitHub Issue: apache#41367 Authored-by: Will Ayd <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
Noticed these when compiling the nanoarrow test suite with -Wextra * GitHub Issue: apache#41112 ### Rationale for this change Helps clean up build warnings when compiling with -Wextra ### What changes are included in this PR? Used Arrow macros to mark some parameters as unused ### Are these changes tested? N/A - just ensured program compiles cleanly ### Are there any user-facing changes? No Authored-by: Will Ayd <[email protected]> Signed-off-by: Felipe Oliveira Carvalho <[email protected]>
…he#41359) ### Rationale for this change This is a follow up to apache#41111 which was created as an issue in apache#41367 ### What changes are included in this PR? Replace [[maybe_unused]] with Arrow macro ### Are these changes tested? Builds cleanly ### Are there any user-facing changes? No * GitHub Issue: apache#41367 Authored-by: Will Ayd <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
Noticed these when compiling the nanoarrow test suite with -Wextra * GitHub Issue: apache#41112 ### Rationale for this change Helps clean up build warnings when compiling with -Wextra ### What changes are included in this PR? Used Arrow macros to mark some parameters as unused ### Are these changes tested? N/A - just ensured program compiles cleanly ### Are there any user-facing changes? No Authored-by: Will Ayd <[email protected]> Signed-off-by: Felipe Oliveira Carvalho <[email protected]>
…he#41359) ### Rationale for this change This is a follow up to apache#41111 which was created as an issue in apache#41367 ### What changes are included in this PR? Replace [[maybe_unused]] with Arrow macro ### Are these changes tested? Builds cleanly ### Are there any user-facing changes? No * GitHub Issue: apache#41367 Authored-by: Will Ayd <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
Noticed these when compiling the nanoarrow test suite with -Wextra * GitHub Issue: apache#41112 ### Rationale for this change Helps clean up build warnings when compiling with -Wextra ### What changes are included in this PR? Used Arrow macros to mark some parameters as unused ### Are these changes tested? N/A - just ensured program compiles cleanly ### Are there any user-facing changes? No Authored-by: Will Ayd <[email protected]> Signed-off-by: Felipe Oliveira Carvalho <[email protected]>
…he#41359) ### Rationale for this change This is a follow up to apache#41111 which was created as an issue in apache#41367 ### What changes are included in this PR? Replace [[maybe_unused]] with Arrow macro ### Are these changes tested? Builds cleanly ### Are there any user-facing changes? No * GitHub Issue: apache#41367 Authored-by: Will Ayd <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
Noticed these when compiling the nanoarrow test suite with -Wextra
Rationale for this change
Helps clean up build warnings when compiling with -Wextra
What changes are included in this PR?
Used Arrow macros to mark some parameters as unused
Are these changes tested?
N/A - just ensured program compiles cleanly
Are there any user-facing changes?
No