1 | // RUN: %check_clang_tidy %s cert-str34-c %t |
2 | |
3 | // Check whether alias is actually working. |
4 | int SimpleVarDeclaration() { |
5 | signed char CCharacter = -5; |
6 | int NCharacter = CCharacter; |
7 | // CHECK-MESSAGES: [[@LINE-1]]:20: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [cert-str34-c] |
8 | |
9 | return NCharacter; |
10 | } |
11 | |
12 | // Check whether bugprone-signed-char-misuse.DiagnoseSignedUnsignedCharComparisons option is set correctly. |
13 | int SignedUnsignedCharEquality(signed char SCharacter) { |
14 | unsigned char USCharacter = 'a'; |
15 | if (SCharacter == USCharacter) // no warning |
16 | return 1; |
17 | return 0; |
18 | } |
19 | |