Eli points out that we really must diagnose "void* > 0" as an extension.
Explicitly add it as an EXTENSION instead of an EXTWARN so that it only
comes out with -pedantic. Thanks Eli!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79791 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 2afaab5..6b64bac 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -5,7 +5,8 @@
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')}}
}
int equal(char *a, const char *b) {
@@ -18,7 +19,8 @@
}
int pointers(int *a) {
- return a > 0; // no warning. rdar://7163039
+ return a > 0; // expected-warning {{ordered comparison between pointer and zero ('int *' and 'int') is an extension}}
+ return a > 42; // expected-warning {{ordered comparison between pointer and integer ('int *' and 'int')}}
return a > (void *)0; // expected-warning {{comparison of distinct pointer types}}
}