1 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -verify -Wsign-compare %s
2 // RUN: %clang_cc1 -triple=x86_64-pc-win32 -fsyntax-only -verify -Wsign-compare %s
3 // RUN: %clang_cc1 -x c++ -triple=x86_64-pc-linux-gnu -fsyntax-only -verify -Wsign-compare %s
4 // RUN: %clang_cc1 -x c++ -triple=x86_64-pc-win32 -fsyntax-only -verify -Wsign-compare %s
6 // Check that -Wsign-compare is off by default.
7 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -verify -DSILENCE %s
10 // expected-no-diagnostics
19 static const int message
[] = {0, 1};
21 int test_pos(enum PosEnum a
) {
25 // No warning, except in Windows C mode, where PosEnum is 'int' and it can
26 // take on any value according to the C standard.
27 #if !defined(SILENCE) && defined(_WIN32) && !defined(__cplusplus)
28 // expected-warning@+2 {{comparison of integers of different signs}}
34 #if !defined(SILENCE) && defined(_WIN32) && !defined(__cplusplus)
35 // expected-warning@+2 {{comparison of integers of different signs}}
40 #if !defined(SILENCE) && defined(_WIN32) && !defined(__cplusplus)
41 // expected-warning@+2 {{comparison of integers of different signs}}
43 if (a
< sizeof(message
)/sizeof(message
[0]))
54 int test_neg(enum NegEnum a
) {
59 // expected-warning@+2 {{comparison of integers of different signs}}
66 // expected-warning@+2 {{comparison of integers of different signs}}
72 // expected-warning@+2 {{comparison of integers of different signs}}
74 if (a
< sizeof(message
)/sizeof(message
[0]))