Issue 63315
Summary clang re-enables explicitly disabled diagnostics which are more specific members of a group when that group's diagnostics are enabled
Labels clang:driver
Assignees
Reporter nickdesaulniers
    Consider `-Wunused`, which itself is a group containing many sub-warnings, such as `-Wunused-but-set-variable`, and the following example code:
```c++
void foo (void) {
    int y;
    y = 0;
}
```
If you compile this with ` -Wno-unused-but-set-variable -Wunused` GCC does not warn, but clang does.  In fact, [GCC documents this behavior](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html):

> Some options, such as -Wall and -Wextra, turn on other options, such as -Wunused, which may turn on further options, such as -Wunused-value. The combined effect of positive and negative forms is that more specific options have priority over less specific ones, independently of their position in the command-line.

The end effect of this difference is that [it makes disabling warnings portably across toolchains more difficult](https://lore.kernel.org/llvm/[email protected]/).

IIRC, clang re-enables all of the subgroups of `-Wunused`, without first checking whether any of the subgroups were previously explicitly disabled.  Is this a known issue (I wasn't able to find a pre-existing bug report)?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to