Implement -Wsign-compare, or at least the actual comparison part of it.
Conditional operands are next.

Fixes part of rdar://problem/7289584.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86083 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Parser/if-scope-c90.c b/test/Parser/if-scope-c90.c
index fdc75e9..53987dc 100644
--- a/test/Parser/if-scope-c90.c
+++ b/test/Parser/if-scope-c90.c
@@ -2,7 +2,7 @@
 
 int f (int z)
 { 
-   if (z > sizeof (enum {a, b}))
+  if (z > (int) sizeof (enum {a, b}))
       return a;
    return b;
 } 
diff --git a/test/Parser/if-scope-c99.c b/test/Parser/if-scope-c99.c
index 37cd0e1..b4cb51c 100644
--- a/test/Parser/if-scope-c99.c
+++ b/test/Parser/if-scope-c99.c
@@ -2,7 +2,7 @@
 
 int f (int z)
 { 
-   if (z > sizeof (enum {a, b}))
+   if (z > (int) sizeof (enum {a, b}))
       return a;
    return b; // expected-error{{use of undeclared identifier}}
 }
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 87131bb..50b40e4 100644
--- a/test/Sema/compare.c
+++ b/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;
 }