summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/parentheses.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Sema/parentheses.c')
-rw-r--r--clang/test/Sema/parentheses.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/test/Sema/parentheses.c b/clang/test/Sema/parentheses.c
index f7a7fbd37db..69c91cb15f4 100644
--- a/clang/test/Sema/parentheses.c
+++ b/clang/test/Sema/parentheses.c
@@ -4,14 +4,18 @@
// Test the various warnings under -Wparentheses
void if_assign(void) {
int i;
- if (i = 4) {} // expected-warning {{assignment as a condition}}
+ if (i = 4) {} // expected-warning {{assignment as a condition}} \
+ // expected-note{{use '==' to turn this assignment into an equality comparison}}
if ((i = 4)) {}
}
void bitwise_rel(unsigned i) {
- (void)(i & 0x2 == 0); // expected-warning {{& has lower precedence than ==}}
- (void)(0 == i & 0x2); // expected-warning {{& has lower precedence than ==}}
- (void)(i & 0xff < 30); // expected-warning {{& has lower precedence than <}}
+ (void)(i & 0x2 == 0); // expected-warning {{& has lower precedence than ==}} \
+ // expected-note{{place parentheses around the & expression to evaluate it first}}
+ (void)(0 == i & 0x2); // expected-warning {{& has lower precedence than ==}} \
+ // expected-note{{place parentheses around the & expression to evaluate it first}}
+ (void)(i & 0xff < 30); // expected-warning {{& has lower precedence than <}} \
+ // expected-note{{place parentheses around the & expression to evaluate it first}}
(void)((i & 0x2) == 0);
(void)(i & (0x2 == 0));
// Eager logical op
OpenPOWER on IntegriCloud