build: add Wreturn-type to Werror flags, check on more Travis machines#18145
build: add Wreturn-type to Werror flags, check on more Travis machines#18145maflcko merged 2 commits intobitcoin:masterfrom
Conversation
|
Proof that Travis indeed catches this: https://travis-ci.org/bitcoin/bitcoin/jobs/650359000#L2713 |
4294b2f to
c98c26e
Compare
|
https://releases.llvm.org/9.0.0/tools/clang/docs/DiagnosticsReference.html#wreturn-type The following code: enum Color {
RED,
BLUE
};
bool isWarm(Color c) {
switch (c) {
case RED:
return true;
case BLUE:
return false;
}
}
bool isCold(Color c) {
if (c == BLUE) {
return true;
}
}produces: Clang 7.0.1, 8.0.1, 9.0.1 with no options, with just GCC 9.2.0 with no options, with just Clang is staying silent about That said, adding explicitly |
|
Ah! But we are using ACK c98c26e. |
|
Thanks for working on this! I think we're currently somewhat underutilising the help we can get from compilers in the form of compiler diagnostics to prevent mistakes and this PR brings us in the right direction :) ACK c98c26e If you have time please consider submitting a PR enabling the subset of compiler diagnostics discussed in #17344 that you think make sense. I would be glad to review such PRs, so don't hesitate to ping me in for review. |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
…Travis machines c98c26e ci: use --enable-werror on more hosts (Sjors Provoost) 6ba617d build: add Wreturn-type to Werror flags (Sjors Provoost) Pull request description: I overlooked a missing `return false` in #17577 (comment) and the warning only showed up on one Travis machine (`warning: control reaches end of non-void function [-Wreturn-type]`). This PR promotes `Wreturn-type` to an error when configured with `--enable-werror`. I also added `--enable-werror` to the Travis machine that happened to catch this particular instance. ACKs for top commit: vasild: ACK c98c26e. practicalswift: ACK c98c26e Tree-SHA512: 64e86c67fef2c5048aab201a8400b7e4a6f27b93d626159ba0b2807b5f119d2b0a83e3372db88f692cb4b0d059722d6a642d130c74a4f991a27f3a6b21780b5f
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
I overlooked a missing
return falsein #17577 (comment) and the warning only showed up on one Travis machine (warning: control reaches end of non-void function [-Wreturn-type]).This PR promotes
Wreturn-typeto an error when configured with--enable-werror. I also added--enable-werrorto the Travis machine that happened to catch this particular instance.