40 lines · plain
1// RUN: %clang_cc1 -fsyntax-only \2// RUN: -fno-signed-char \3// RUN: -Wtautological-unsigned-zero-compare \4// RUN: -Wtautological-unsigned-char-zero-compare \5// RUN: -verify=unsigned %s6// RUN: %clang_cc1 -fsyntax-only \7// RUN: -Wtautological-unsigned-zero-compare \8// RUN: -Wtautological-unsigned-char-zero-compare \9// RUN: -verify=signed %s10 11void f(char c, unsigned char uc, signed char cc) {12 if (c < 0)13 return;14 // unsigned-warning@-2 {{comparison of char expression < 0 is always false, since char is interpreted as unsigned}}15 if (uc < 0)16 return;17 // unsigned-warning@-2 {{comparison of unsigned expression < 0 is always false}}18 // signed-warning@-3 {{comparison of unsigned expression < 0 is always false}}19 if (cc < 0)20 return;21 // Promoted to integer expressions should not warn.22 if (c - 4 < 0)23 return;24}25 26void ref(char &c, unsigned char &uc, signed char &cc) {27 if (c < 0)28 return;29 // unsigned-warning@-2 {{comparison of char expression < 0 is always false, since char is interpreted as unsigned}}30 if (uc < 0)31 return;32 // unsigned-warning@-2 {{comparison of unsigned expression < 0 is always false}}33 // signed-warning@-3 {{comparison of unsigned expression < 0 is always false}}34 if (cc < 0)35 return;36 // Promoted to integer expressions should not warn.37 if (c - 4 < 0)38 return;39}40