For following code (online at https://godbolt.org/z/evGzzTdb7), I'd like the checker emits no warnings for foo1 and foo2 (the narrow y implicitly promoted to int), also bar1 missed the warning even with -fsigned-char.
bool foo1(int x, unsigned char y) {
return x == y;
}
bool foo2(int x, unsigned short y) {
return x == y;
}
bool bar1(unsigned int x, char y) {
return x == y;
}
bool bar2(unsigned int x, short y) {
return x == y;
}
current output:
[<source>:2:12: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]](javascript:;)
1 | bool foo1(int x, unsigned char y) {
2 | return x == y;
| ^ ~~
| std::cmp_equal( , )
[<source>:5:12: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]](javascript:;)
5 | return x == y;
| ^ ~~
| std::cmp_equal( , )
[<source>:11:12: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]](javascript:;)
11 | return x == y;
| ^ ~~
| std::cmp_equal( , )
3 warnings generated.
CC @qt-tatiana as author of the checker (PR #113144).