build: make Travis catch unused variables#17486
Conversation
|
Concept ACK. If we can trust the compiler to be consistent on this. OTOH this warning was already enabled, and you're only promoting it to -Werror in the CI. I do agree that's the only good use of Werror. It should never be enabled by default by configure scripts. So it should be ok. |
|
ACK ce47c11 |
|
Are you sure this enabled by default? I couldn't find it here: https://clang.llvm.org/docs/DiagnosticsReference.html#wmost What would be the downside of explicitly enabling it? |
|
Also, would be nice to call |
|
Here's a Travis build that should fail: https://travis-ci.org/Sjors/bitcoin/builds/612381391 @MarcoFalke wrote:
Not sure I understand your question. I tested on my own machine with bitcoin/ci/test/00_setup_env_mac_host.sh Line 16 in 21ee676 |
|
Oh, I am wondering if |
|
@MarcoFalke I think it is enabled by |
|
I normally do get unused variable warnings on macOS. |
|
So to ask my previous question again: What would be the downside of explicitly enabling it instead of relying on clangs undocumented default, which even differs for different oses. |
|
Enabling |
|
I don't think it's entirely orthogonal. If you make a warning an error in the CI, I think it's reasonable to enable it by default (in non-WError mode) for normal builds. Otherwise people will realize it only when the CI fails and with the large turn-around cycle that's suboptimal. |
Yes, please. The worst travis problems to deal with are the ones that happen remotely but not locally. |
Turn corresponding warning on by default (not always covered by -Wall).
ce47c11 to
18b18f8
Compare
|
Good point. Added. New Travis build that should fail: https://travis-ci.org/Sjors/bitcoin/builds/612471016 |
|
ACK 18b18f8 |
|
ACK 18b18f8 -- nice! |
18b18f8 [build] ./configure --enable-werror: add unused-variable (Sjors Provoost) Pull request description: The two macOS Travis machines run with `--enable-werror`. This PR adds `-Werror=unused-variable` to the existing `vla`, `switch` and `thread-safety-analysis` checks. This should prevent the need for fixes like b07b07c, 26a93bc, dd777f3, 99be644, fa39f67, 16bcc1b, bb079a0, bdaed47 and ecf9b25 with minimal nuisance. Thoughts for followups: * Travis starts these macOS machines fairly late, so we should consider setting `--enable-werror` on earlier machines as well. * We should encourage the use of `--enable-werror` by developers. Maybe switch it on by default for `--enable-debug`? * See practicalswift's overview of other checks to consider in #17344 ACKs for top commit: MarcoFalke: ACK 18b18f8 practicalswift: ACK 18b18f8 -- nice! Tree-SHA512: 892b471ca5ea547f3c952ac88190cbebf8110cb7aec6f20466aeb312aeb0910bfe990f914e153c40ecb55709c03775ef30770412ad76f9d532ca77055596c582
|
Travis catches the issue as expected (had to restart a few times for timeouts): https://travis-ci.org/Sjors/bitcoin/jobs/612471028#L2333 |
18b18f8 [build] ./configure --enable-werror: add unused-variable (Sjors Provoost) Pull request description: The two macOS Travis machines run with `--enable-werror`. This PR adds `-Werror=unused-variable` to the existing `vla`, `switch` and `thread-safety-analysis` checks. This should prevent the need for fixes like b07b07c, 26a93bc, dd777f3, 99be644, fa39f67, 16bcc1b, bb079a0, bdaed47 and ecf9b25 with minimal nuisance. Thoughts for followups: * Travis starts these macOS machines fairly late, so we should consider setting `--enable-werror` on earlier machines as well. * We should encourage the use of `--enable-werror` by developers. Maybe switch it on by default for `--enable-debug`? * See practicalswift's overview of other checks to consider in bitcoin#17344 ACKs for top commit: MarcoFalke: ACK 18b18f8 practicalswift: ACK 18b18f8 -- nice! Tree-SHA512: 892b471ca5ea547f3c952ac88190cbebf8110cb7aec6f20466aeb312aeb0910bfe990f914e153c40ecb55709c03775ef30770412ad76f9d532ca77055596c582
This reverts commit 5fe89ff.
|
This turned out to be premature, reverting the error part in #17533 |
|
yup, a textbook example of why to be careful with making things Werror |
18b18f8 [build] ./configure --enable-werror: add unused-variable (Sjors Provoost) Pull request description: The two macOS Travis machines run with `--enable-werror`. This PR adds `-Werror=unused-variable` to the existing `vla`, `switch` and `thread-safety-analysis` checks. This should prevent the need for fixes like b07b07c, 26a93bc, dd777f3, 99be644, fa39f67, 16bcc1b, bb079a0, bdaed47 and ecf9b25 with minimal nuisance. Thoughts for followups: * Travis starts these macOS machines fairly late, so we should consider setting `--enable-werror` on earlier machines as well. * We should encourage the use of `--enable-werror` by developers. Maybe switch it on by default for `--enable-debug`? * See practicalswift's overview of other checks to consider in bitcoin#17344 ACKs for top commit: MarcoFalke: ACK 18b18f8 practicalswift: ACK 18b18f8 -- nice! Tree-SHA512: 892b471ca5ea547f3c952ac88190cbebf8110cb7aec6f20466aeb312aeb0910bfe990f914e153c40ecb55709c03775ef30770412ad76f9d532ca77055596c582
This reverts commit 5fe89ff.
merge bitcoin#18914, bitcoin#13306, bitcoin#16424, bitcoin#13899, bitcoin#17486, bitcoin#17880, bitcoin#18145, bitcoin#18843, bitcoin#16710: split warnings out of CXXFLAGS, add more flags
The two macOS Travis machines run with
--enable-werror. This PR adds-Werror=unused-variableto the existingvla,switchandthread-safety-analysischecks. This should prevent the need for fixes like b07b07c, 26a93bc, dd777f3, 99be644, fa39f67, 16bcc1b, bb079a0, bdaed47 and ecf9b25 with minimal nuisance.Thoughts for followups:
--enable-werroron earlier machines as well.--enable-werrorby developers. Maybe switch it on by default for--enable-debug?