Implement -Wsign-compare, or at least the actual comparison part of it.
Conditional operands are next.
Fixes part of rdar://problem/7289584.
llvm-svn: 86083
diff --git a/clang/test/Sema/compare.c b/clang/test/Sema/compare.c
index 87131bb..50b40e4 100644
--- a/clang/test/Sema/compare.c
+++ b/clang/test/Sema/compare.c
@@ -7,6 +7,14 @@
return C != 1; // expected-warning {{comparison between pointer and integer ('char *' and 'int')}}
}
+int ints(long a, unsigned long b) {
+ return (a == b) + // expected-warning {{comparison of integers of different signs}}
+ ((int)a == b) + // expected-warning {{comparison of integers of different signs}}
+ ((short)a == b) + // expected-warning {{comparison of integers of different signs}}
+ (a == (unsigned int) b) + // expected-warning {{comparison of integers of different signs}}
+ (a == (unsigned short) b); // expected-warning {{comparison of integers of different signs}}
+}
+
int equal(char *a, const char *b) {
return a == b;
}