[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)
Wentao Zhang via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 24 15:01:06 PDT 2024
whentojump wrote:
> Hello,
>
> I noticed that before this patch `clang empty.c -fsanitize=undefined -ffine-grained-bitfield-accesses -c -Werror` (on empty file empty.c) resulted in `warning: option '-ffine-grained-bitfield-accesses' cannot be enabled together with a sanitizer; flag ignored` but with the patch it results in `error: option '-ffine-grained-bitfield-accesses' cannot be enabled together with a sanitizer; flag ignored [-Werror]`
>
> Is this on purpose?
>
> (I originally asked this in [#108453 (comment)](https://github.com/llvm/llvm-project/pull/108453#issuecomment-2352155766) but I suppose this PR has a bit wider audience.)
We are seeing similar changes in MC/DC-related warnings. Steps to reproduce:
```shell
cat > test.c << 'EOF'
int foo(int x) { return x; }
int main(void) {
int a, b, c, d, e, f, g, h;
a && b && c && d && e && f && g;
a && foo( b && c );
return 0;
}
EOF
clang -Xclang -fmcdc-max-conditions=6 -Werror -Wno-unused-value -fprofile-instr-generate -fcoverage-mapping -fcoverage-mcdc test.c -o test
```
https://github.com/llvm/llvm-project/pull/70976
More information about the cfe-commits
mailing list