Issue |
130499
|
Summary |
[clang-tidy] spurious `warning: #includes are not sorted properly [llvm-include-order]` and `warning: no header providing "std::streampos" is directly included`
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
SwuduSusuwu
|
https://www.google.com/search?q=%22no+header+providing+std%3A%3Astreampos+is+directly+included%22 returns "No results found".
**Steps to reproduce**:
_Assistant_ says to include `ios` or `iostream`, but https://github.com/SwuduSusuwu/SubStack/blob/912d2b25d6b77bc77aed59d95f2732cc63834e76/cxx/ClassIo.hxx#L5-L14 has
```
#include "Macros.hxx" /* SUSUWU_IF_CPLUSPLUS SUSUWU_NOEXCEPT SUSUWU_SH_DEFAULT SUSUWU_SH_ERROR SUSUWU_SH_GREEN SUSUWU_SH_RED SUSUWU_UNIT_TESTS */ #include <iomanip> /* std::setw */ #include <ios> /* std::hex */ #include <iostream> /* std::cin */ #include <istream> /* std::basic_istream */ #include <sstream> /* std::stringstream */ #include <stdexcept> /* std::runtime_error */ #include SUSUWU_IF_CPLUSPLUS(<cstdio>, <stdio.h>) /* FILE */ #include <string> /* std::string std::to_string */ #include <type_traits> /* std::enable_if */
```
.
```
~/SubStack $ clang-tidy cxx/ClassIo.hxx
```
**Actual result:**
```
76410 warnings generated.
/data/data/com.termux/files/home/SubStack/cxx/ClassIo.hxx:6:1: warning: #includes are not sorted properly [llvm-include-order]
6 | #include <iomanip> /* std::setw */
| ^
/data/data/com.termux/files/home/SubStack/cxx/ClassIo.hxx:120:13: warning: no header providing "std::streampos" is directly included [misc-include-cleaner]
3 | const std::streampos pos = is.tellg();
| ^
/data/data/com.termux/files/home/SubStack/cxx/ClassIo.hxx:179:15: warning: narrowing conversion from 'streamoff' (aka 'long long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
179 | for(int i = ((newPos - pos) >> 1) - (SUSUWU_HEX_DOES_PREFIX ? 1 : 0); i--; ) {
| ^
```
**Expected result:**
```
76408 warnings generated.
/data/data/com.termux/files/home/SubStack/cxx/ClassIo.hxx:179:15: warning: narrowing conversion from 'streamoff' (aka 'long long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
179 | for(int i = ((newPos - pos) >> 1) - (SUSUWU_HEX_DOES_PREFIX ? 1 : 0); i--; ) {
| ^
```
.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs