Implement PR4175, catching some questionable comparisons. Patch by
David Majnemer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74513 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 4b44bf5..51f7731 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -15,3 +15,17 @@
int d = (a == c);
return a == b; // expected-warning {{comparison of distinct pointer types}}
}
+
+int pointers(int *a)
+{
+ return a > 0; // expected-warning {{ordered comparison between pointer and integer}}
+ return a > (void *)0; // expected-warning {{comparison of distinct pointer types}}
+}
+
+int function_pointers(int (*a)(int), int (*b)(int))
+{
+ return a > b; // expected-warning {{ordered comparison of function pointers}}
+ return function_pointers > function_pointers; // expected-warning {{ordered comparison of function pointers}}
+ return a == (void *) 0;
+ return a == (void *) 1; // expected-warning {{comparison of distinct pointer types}}
+}