diff options
author | Richard Trieu <rtrieu@google.com> | 2011-07-21 02:46:28 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2011-07-21 02:46:28 +0000 |
commit | 5254161b269829b74e7a9379b1bdfa27de72d7cc (patch) | |
tree | db6652f5ee355e0fe69b0d84b1c47ca4d39c1527 /test/Sema/conditional-expr.c | |
parent | e081a61bb0dc546fd623bf259435d17c9a4ea0d5 (diff) |
Remove warning for conditional operands of differend signedness from -Wsign-compare. Cases that previously warn on this will have a different warning emitted from -Wsign-conversion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135664 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/conditional-expr.c')
-rw-r--r-- | test/Sema/conditional-expr.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c index 7a8c9e9f36..436ecdbebc 100644 --- a/test/Sema/conditional-expr.c +++ b/test/Sema/conditional-expr.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wsign-compare %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wsign-conversion %s void foo() { *(0 ? (double *)0 : (void *)0) = 0; // FIXME: GCC doesn't consider the the following two statements to be errors. @@ -36,12 +36,12 @@ void foo() { *(0 ? (asdf) 0 : &x) = 10; unsigned long test0 = 5; - test0 = test0 ? (long) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? (int) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? (short) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (long) test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (int) test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (short) test0; // expected-warning {{operands of ? are integers of different signs}} + test0 = test0 ? (long) test0 : test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} + test0 = test0 ? (int) test0 : test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? (short) test0 : test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} + test0 = test0 ? test0 : (long) test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} + test0 = test0 ? test0 : (int) test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? test0 : (short) test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} test0 = test0 ? test0 : (long) 10; test0 = test0 ? test0 : (int) 10; test0 = test0 ? test0 : (short) 10; @@ -49,12 +49,17 @@ void foo() { test0 = test0 ? (int) 10 : test0; test0 = test0 ? (short) 10 : test0; + int test1; enum Enum { EVal }; test0 = test0 ? EVal : test0; - test0 = test0 ? EVal : (int) test0; // okay: EVal is an int - test0 = test0 ? // expected-warning {{operands of ? are integers of different signs}} + test1 = test0 ? EVal : (int) test0; + test0 = test0 ? (unsigned) EVal - : (int) test0; + : (int) test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + + test0 = test0 ? EVal : test1; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? test1 : EVal; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + } int Postgresql() { |