summaryrefslogtreecommitdiff
path: root/test/Sema/exprs.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/exprs.c')
-rw-r--r--test/Sema/exprs.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c
index 9ce1481f16c50..72cff65f4837c 100644
--- a/test/Sema/exprs.c
+++ b/test/Sema/exprs.c
@@ -163,7 +163,7 @@ void test17(int x) {
}
// PR6501
-void test18_a(int a); // expected-note {{'test18_a' declared here}}
+void test18_a(int a); // expected-note 2 {{'test18_a' declared here}}
void test18(int b) {
test18_a(b, b); // expected-error {{too many arguments to function call, expected 1, have 2}}
test18_a(); // expected-error {{too few arguments to function call, expected 1, have 0}}
@@ -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}}
}