This is a follow up to https://reviews.llvm.org/D78306
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I support this change and have elaborated on why in https://reviews.llvm.org/D78306.
This patch also shows why having Werror on by default can be an issue.
I don't think this is about not willing to remove warnings, it is about what is the right default config.
Right for example now our MLIR bot does not show warnings with gcc-5 nor with clang-8, but for example clang-5 still wants extra braces:
warning: suggest braces around initialization of subobject [-Wmissing-braces] std::array<StringRef, 2> silentAttrNames{getIndexingMapsAttrName(), ^~~~~~~~~~~~~~~~~~~~~~~~~~ {
Having default to Werror may lead to broken build for users because we can't test every possible combination all the time.
There is another example here of our BuildBots failing for very spurious warnings due to -Werror:
http://lab.llvm.org:8014/builders/flang-aarch64-ubuntu-clang/builds/229/steps/build-unified-tree/logs/stdio
The warning is not spurious, so this example shows -Werror in the best possible light:
On the positive side, it detected a real error that was immediately fixed and might not have been noticed so soon if it were just a warning.
On the negative side, it prevented the rest of the build from happening and tests from being run, as happens with any compilation error.
Since I'm just building with gcc-9 for some reason right now, here is a tough warning:
llvm-project/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h:1534:27: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move] 1534 | return std::move(Err);
Clang could warn if we remove the std::move...
Absolutely: this is why we should have bots with Werror enabled (but not with gcc-9 for example)
(This is separate to the default setting though)
@isuruf I believe per a discussion on the community call yesterday that we have consensus for this change now, so do you want to go ahead and commit it? Thanks!