[PATCH] D118737: [CMake] Disable LLVM_ENABLE_PEDANTIC by default for GCC

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 3 01:31:10 PST 2022


mstorsjo added a comment.

In D118737#3288812 <https://reviews.llvm.org/D118737#3288812>, @MaskRay wrote:

> It seems to me that genuine issues detected by gcc -pedantic but not clang -pedantic are rare enough that we probably should just not bother with gcc -pedantic if it is not suppressable by a pragma.

I tried to look into the actual total number of warnings when building with GCC (a pretty much default build of LLVM with cmake on Ubuntu 18.04 and 20.04); while it's not warning free, the numbers of warnings with a recent distro isn't that bad. Building LLVM 13 (clang, lld, lldb enabled) with GCC 9.3 (Ubuntu 20.04) produces 16 warnings - building the current LLVM 14 branch produces 20 warnings. So it's not all that horrible - I just reacted to the fact that there were new warnings I hadn't seen before. (If building with GCC 7.5 from Ubuntu 18.04, LLVM 13 produces 64 warnings though, and LLVM 14 produces 72 warnings, so that's not quite as clean - but that's also a much older compiler.)

If disabling `LLVM_ENABLE_PEDANTIC` when building LLVM 14, the total number of warnings produced by GCC only drops by 7 (to 13 warnings with GCC 9.3) - only those 7 new warnings in lld are removed.

So I'm a little undecided about this patch - do we risk losing other useful warnings? Maybe not, if the only thing we currently lose are these new ones in ldd - as we've fixed everything else.

But we do occasionally run into cases where the GCC build warns about small syntax issues that apparently don't warn in clang builds (that often are fixed by me/someone else within a couple hours or so), not sure if we'd lose those too. At least one recent such case that I checked wasn't affected by `LLVM_ENABLE_PEDANTIC`.

In the end, I think I'm leaning towards wanting this patch though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118737/new/

https://reviews.llvm.org/D118737



More information about the llvm-commits mailing list