<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/134818>134818</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] misc-include-cleaner does not handle error codes in <errno.h>
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
abdelmaged
</td>
</tr>
</table>
<pre>
Source C File:
```c
#include <errno.h>
#include <stdio.h>
static void testErrno(void) {
if (errno == EEXIST) {
puts("Already Exists!");
}
}
```
Using clang-tidy misc-include-cleaner:
```
[source>:5:16: warning: no header providing "EEXIST" is directly included [misc-include-cleaner]](javascript:;)
1 | #include <errno.h>
2 | #include <stdio.h>
3 |
4 | static void testErrno(void) {
5 | if (errno == EEXIST) {
| ^
1 warning generated.
```
Issue also reproducible in this link:
https://godbolt.org/z/xMo84z8oz
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMU8GO4zYM_Rr6QiSwKXttH3xwJjGwh562BXqVJY6trWIFkpzuzNcXcjKY3XSwmECISelR5OOjZAhmWpg7qA5QHTO5xtn5To6a7VlOrLPR6Zfum1u9YnzCwVgG0UPew5f8tlRySJhF2VUzgnhi7xe3n0Gc_ncUojbvR3kfooxG4dUZjZFDPKVQoCZtALUI9QHyHtE8I1CzXYwgjiCOeDr9_fXbnz-DEC9rDEANEPXWs9QvePphQtorgAioBbFBoT6m_Lf_NyKQ938Fs0yorFymXTT6Bc8mqN29_p2yLBf2D_yTXR3C1qHES_QViL74AqLHf6VfzDIlc3E4s9Ts8eLd1eiUCIjeWBCagNp4VtG-4D2jRqgOH5ZQHdOi5ru8yqC8ucRUlTgkirdWFAj1E_5GmASiD0C_SJRA4ga6OeXmfFY2xGrDf1I-3MAPP6hSIcVbL3Hihb2MrPePKuT91xBWRmmDQ88X7_SqzGgZzYJxNgGtWf65yTfHeAnJpAFomJwenY175yeg4RVo-PGHa8rXxr1C3me6E7oVrcy4K-qyLPIyb9ps7uqyrqSo6bloVfMsC6Vr2Y6jKOuqySspMtNRTlWC5y0V1O7bkce6aEcqVMksFZQ5n6Wxe2uv55Q-M4lCV4iyKZrMypFt2B4n0ftYplmujpnvUtRuXKcAZW7ToL_fE02027P-Kaw6fjjQqB0HXFzEWS7aMrL3zqNymkNq3S-Tk63edg_dM3Fex71yZ6AhFXD_7C7efWcVgYaNVQAa7sSuHf0XAAD__70tVGs">