<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57931>57931</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Unexpected interaction between "-Werror=nonportable-include-path" and "-Wno-system-headers"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fekir
</td>
</tr>
</table>
<pre>
Consider this minimal project
output of tree
````
.
├── external
│ └── external.hpp
├── internal.hpp
└── main.cpp
````
and
main.cpp
````
#include "Internal.hpp" // instead of internal.hpp
#include "External.hpp" // instead of external.hpp
int main(){}
````
the header files are empty.
Compile it with the windows port of clang with
````
clang.exe -isystem external -Werror=nonportable-include-path -Wno-system-headers main.cpp
````
The output is
````
error: non-portable path to file '"internal.hpp"'; specified path differs in case from file name on disk [-Werror,-Wnonportable-include-path]
#include "Internal.hpp"
^~~~~~~~~~~~~~
"internal.hpp"
````
Note that no diagnostic is generated for `#include "External.hpp"`(!)
A diagnostic is generated if the code is compiled with `clang.exe -I external -Werror=nonportable-include-path -Wno-system-headers main.cpp`:
````
main.cpp:1:10: error: non-portable path to file '"internal.hpp"'; specified path differs in case from file name on disk [-Werror,-Wnonportable-include-path]
#include "Internal.hpp"
^~~~~~~~~~~~~~
"internal.hpp"
main.cpp:2:10: error: non-portable path to file '"external.hpp"'; specified path differs in case from file name on disk [-Werror,-Wnonportable-include-path]
#include "External.hpp"
^~~~~~~~~~~~~~
"external.hpp"
2 errors generated.
````
The effect is unexpected because the error (wrong case for included file) is in `main.cpp`, `-Wno-system-headers` should disable warnings that are generated from a system header, which is not the case here.
Changing `-isystem` to `-I` would enable other diagnostic for system headers which is unwanted.
Thus, AFAIK, there are currently no workarounds (unless one can enable specific warnings for system haders, I did not see such option).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztVk2P4jgQ_TXhYhEFmwA55EBDt4RW2tOs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