<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63315>63315</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang re-enables explicitly disabled diagnostics which are more specific members of a group when that group's diagnostics are enabled
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:driver
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          nickdesaulniers
      </td>
    </tr>
</table>

<pre>
    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/5fd58e1e-9e5f-4bd7-2153-aa0055a3f6c5@csgroup.eu/).

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)?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVctu6zYQ_Rp6M5AhUy97ocVNUhdZFWgLZE2RI2saihT4sOO_L0g5iW9uigJCEHI4rzPnjIX3dDKIPWseWPO0ETFM1vWG5KtCL6I2hM5vBquu_aM1nhQ6YG1ZvEQTPSrWlow_wmUiOQEFj3oE8iDg5GxcQFoTBBkyJ5iFuYKPQ3ERLl345OejnED4-4jFEEPhMRRn4UgMGm8phFEQJoTRam0vKSK-iXnRCNIqZNUPVj6x8kd6nT_J-EP68u3ZkoLRWmB8n_5n_ACsux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