diff options
Diffstat (limited to 'clang/test/Sema/exprs.c')
-rw-r--r-- | clang/test/Sema/exprs.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c index 460f72cb174..72cff65f483 100644 --- a/clang/test/Sema/exprs.c +++ b/clang/test/Sema/exprs.c @@ -183,7 +183,9 @@ void test19() { } int test20(int x) { - return x && 4; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + return x && 4; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} return x && sizeof(int) == 4; // no warning, RHS is logical op. @@ -192,20 +194,32 @@ int test20(int x) { return x || 0; return x || 1; - return x || -1; // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || 5; // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} + return x || -1; // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || 5; // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} return x && 0; return x && 1; - return x && -1; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && 5; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + return x && -1; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && 5; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} return x || (0); return x || (1); - return x || (-1); // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || (5); // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} + return x || (-1); // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || (5); // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} return x && (0); return x && (1); - return x && (-1); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && (5); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + return x && (-1); // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && (5); // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} } |