diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-03-15 21:50:10 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-03-15 21:50:10 +0000 |
commit | 7adf3a9f84688f334a1cd977317bb42f9e06c9f4 (patch) | |
tree | 9a694bf3657f9dca27924f16b402a19b768a61a6 /test/SemaCXX | |
parent | 2f13eb116e62161c5e4d198f7831f226e5cea9da (diff) |
Enhance -Wtautological-constant-out-of-range-compare to include the name of the enum constant.
This is QoI. Fixes <rdar://problem/13076064>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177190 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/compare.cpp | 16 | ||||
-rw-r--r-- | test/SemaCXX/warn-enum-compare.cpp | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp index 5771912590..feb1ccb9a2 100644 --- a/test/SemaCXX/compare.cpp +++ b/test/SemaCXX/compare.cpp @@ -89,8 +89,8 @@ int test0(long a, unsigned long b) { // (C,b) (C == (unsigned long) b) + (C == (unsigned int) b) + - (C == (unsigned short) b) + // expected-warning {{comparison of constant 65536 with expression of type 'unsigned short' is always false}} - (C == (unsigned char) b) + // expected-warning {{comparison of constant 65536 with expression of type 'unsigned char' is always false}} + (C == (unsigned short) b) + // expected-warning {{comparison of constant 'C' (65536) with expression of type 'unsigned short' is always false}} + (C == (unsigned char) b) + // expected-warning {{comparison of constant 'C' (65536) with expression of type 'unsigned char' is always false}} ((long) C == b) + ((int) C == b) + ((short) C == b) + @@ -101,8 +101,8 @@ int test0(long a, unsigned long b) { ((signed char) C == (unsigned char) b) + (C < (unsigned long) b) + (C < (unsigned int) b) + - (C < (unsigned short) b) + // expected-warning {{comparison of constant 65536 with expression of type 'unsigned short' is always false}} - (C < (unsigned char) b) + // expected-warning {{comparison of constant 65536 with expression of type 'unsigned char' is always false}} + (C < (unsigned short) b) + // expected-warning {{comparison of constant 'C' (65536) with expression of type 'unsigned short' is always false}} + (C < (unsigned char) b) + // expected-warning {{comparison of constant 'C' (65536) with expression of type 'unsigned char' is always false}} ((long) C < b) + ((int) C < b) + ((short) C < b) + @@ -119,8 +119,8 @@ int test0(long a, unsigned long b) { (a == (unsigned char) C) + ((long) a == C) + ((int) a == C) + - ((short) a == C) + // expected-warning {{comparison of constant 65536 with expression of type 'short' is always false}} - ((signed char) a == C) + // expected-warning {{comparison of constant 65536 with expression of type 'signed char' is always false}} + ((short) a == C) + // expected-warning {{comparison of constant 'C' (65536) with expression of type 'short' is always false}} + ((signed char) a == C) + // expected-warning {{comparison of constant 'C' (65536) with expression of type 'signed char' is always false}} ((long) a == (unsigned long) C) + ((int) a == (unsigned int) C) + ((short) a == (unsigned short) C) + @@ -131,8 +131,8 @@ int test0(long a, unsigned long b) { (a < (unsigned char) C) + ((long) a < C) + ((int) a < C) + - ((short) a < C) + // expected-warning {{comparison of constant 65536 with expression of type 'short' is always true}} - ((signed char) a < C) + // expected-warning {{comparison of constant 65536 with expression of type 'signed char' is always true}} + ((short) a < C) + // expected-warning {{comparison of constant 'C' (65536) with expression of type 'short' is always true}} + ((signed char) a < C) + // expected-warning {{comparison of constant 'C' (65536) with expression of type 'signed char' is always true}} ((long) a < (unsigned long) C) + // expected-warning {{comparison of integers of different signs}} ((int) a < (unsigned int) C) + // expected-warning {{comparison of integers of different signs}} ((short) a < (unsigned short) C) + diff --git a/test/SemaCXX/warn-enum-compare.cpp b/test/SemaCXX/warn-enum-compare.cpp index c68275e1a7..0c287948cd 100644 --- a/test/SemaCXX/warn-enum-compare.cpp +++ b/test/SemaCXX/warn-enum-compare.cpp @@ -39,8 +39,8 @@ void test () { while (b == c); while (B1 == name1::B2); while (B2 == name2::B1); - while (x == AnonAA); // expected-warning {{comparison of constant 42 with expression of type 'Foo' is always false}} - while (AnonBB == y); // expected-warning {{comparison of constant 45 with expression of type 'Bar' is always false}} + while (x == AnonAA); // expected-warning {{comparison of constant 'AnonAA' (42) with expression of type 'Foo' is always false}} + while (AnonBB == y); // expected-warning {{comparison of constant 'AnonBB' (45) with expression of type 'Bar' is always false}} while (AnonAA == AnonAB); while (AnonAB == AnonBA); while (AnonBB == AnonAA); |