<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/129746>129746</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`-isystem` does not suppress warnings from macros
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
elbeno
</td>
</tr>
</table>
<pre>
Given a header `provoke_warning.hpp`:
```cpp
enum struct E { A, B, C };
namespace N {
using enum E;
}
#define PROVOKE_WARNING using enum E;
```
And a source file `main.cpp`:
```cpp
#include <provoke_warning.hpp>
struct S {
PROVOKE_WARNING;
};
```
When compile with:
`clang -std=c++17 -isystem . -c main.cpp`
We get:
```console
main.cpp:4:3: warning: using enum declaration is a C++20 extension [-Wc++20-extensions]
4 | PROVOKE_WARNING;
| ^
./provoke_warning.hpp:7:31: note: expanded from macro 'PROVOKE_WARNING'
7 | #define PROVOKE_WARNING using enum E;
| ^
```
Notice that the warning we _would_ get from the `using enum` inside the namespace is not emitted (because of `-isystem`). However the use of the macro still gives a warning despite the fact that the macro came from a header included under `-isystem`.
--
I see why this could be difficult to remedy, and I already see the counterarguments: "it's a macro! It's in your code, not the library code!" So it's understandable why this happens, but that doesn't make it correct or expected.
This comes up in real code: https://github.com/catchorg/Catch2/issues/2910
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVUGPozgT_TWVSykRmCQkBw4k3Zmv9Uk9q5nV9rFl7AK8Y2xkm2Ty71cG0p3t7R1pURRblOvVe89lw71XjSEqYHOAzcOCD6G1riBdkbGLyspr8UWdySDHlrgkh7BNemfP9ge9XrgzyjSrtu9hm0BWQlLGyfgTfQ9JSWbo0Ac3iICPCPkBS2BHPMS_I0L-ANkhZiWl4R35ngvC57gOkhIHr0yDI8TjvC5_mFYDyyTVyhD-9u3rH1____j6Un57fnr-8lnSjdKUWhqJHL0dnCCslaYoqePKrMS_6wCWKSP0I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