Warn about comparisons between arrays and improve self-comparison
warnings, from Troy Straszheim! Fixes PR6163.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105631 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index f997dc1..b2c3563 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -3,7 +3,7 @@
int test(char *C) { // nothing here should warn.
return C != ((void*)0);
return C != (void*)0;
- return C != 0;
+ return C != 0;
return C != 1; // expected-warning {{comparison between pointer and integer ('char *' and 'int')}}
}
@@ -218,7 +218,7 @@
int function_pointers(int (*a)(int), int (*b)(int), void (*c)(int)) {
return a > b; // expected-warning {{ordered comparison of function pointers}}
- return function_pointers > function_pointers; // expected-warning {{ordered comparison of function pointers}}
+ return function_pointers > function_pointers; // expected-warning {{self-comparison always evaluates to false}} expected-warning{{ordered comparison of function pointers}}
return a > c; // expected-warning {{comparison of distinct pointer types}}
return a == (void *) 0;
return a == (void *) 1; // expected-warning {{equality comparison between function pointer and void pointer}}
@@ -229,6 +229,7 @@
return foo == (void*) 1;
}
+
int test1(int i) {
enum en { zero };
return i > zero;