summaryrefslogtreecommitdiffstats
path: root/test/Sema/parentheses.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-07-17 15:40:56 +0000
committerdim <dim@FreeBSD.org>2011-07-17 15:40:56 +0000
commit611ba3ea3300b71eb95dc4e45f20eee5dddd32e1 (patch)
tree2097d084eb235c0b12c0bff3445f4ec7bbaa8a12 /test/Sema/parentheses.c
parentc49018d9cce52d8c9f34b44865ec3ba8e89a1488 (diff)
downloadFreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.zip
FreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.tar.gz
Vendor import of clang trunk r135360:
http://llvm.org/svn/llvm-project/cfe/trunk@135360
Diffstat (limited to 'test/Sema/parentheses.c')
-rw-r--r--test/Sema/parentheses.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/test/Sema/parentheses.c b/test/Sema/parentheses.c
index fa3c3c2..13ea3ec 100644
--- a/test/Sema/parentheses.c
+++ b/test/Sema/parentheses.c
@@ -26,6 +26,12 @@ void bitwise_rel(unsigned i) {
(void)(i == 1 | i == 2 | i == 3);
(void)(i != 1 & i != 2 & i != 3);
+ (void)(i & i | i); // expected-warning {{'&' within '|'}} \
+ // expected-note {{place parentheses around the '&' expression to silence this warning}}
+
+ (void)(i | i & i); // expected-warning {{'&' within '|'}} \
+ // expected-note {{place parentheses around the '&' expression to silence this warning}}
+
(void)(i ||
i && i); // expected-warning {{'&&' within '||'}} \
// expected-note {{place parentheses around the '&&' expression to silence this warning}}
@@ -42,21 +48,21 @@ void bitwise_rel(unsigned i) {
_Bool someConditionFunc();
void conditional_op(int x, int y, _Bool b) {
- (void)(x + someConditionFunc() ? 1 : 2); // expected-warning {{?: has lower precedence than +}} \
- // expected-note {{place parentheses around the ?: expression to evaluate it first}} \
- // expected-note {{place parentheses around the + expression to silence this warning}}
+ (void)(x + someConditionFunc() ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '+'}} \
+ // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \
+ // expected-note {{place parentheses around the '+' expression to silence this warning}}
- (void)(x - b ? 1 : 2); // expected-warning {{?: has lower precedence than -}} \
- // expected-note {{place parentheses around the ?: expression to evaluate it first}} \
- // expected-note {{place parentheses around the - expression to silence this warning}}
+ (void)(x - b ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '-'}} \
+ // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \
+ // expected-note {{place parentheses around the '-' expression to silence this warning}}
- (void)(x * (x == y) ? 1 : 2); // expected-warning {{?: has lower precedence than *}} \
- // expected-note {{place parentheses around the ?: expression to evaluate it first}} \
- // expected-note {{place parentheses around the * expression to silence this warning}}
+ (void)(x * (x == y) ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '*'}} \
+ // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \
+ // expected-note {{place parentheses around the '*' expression to silence this warning}}
- (void)(x / !x ? 1 : 2); // expected-warning {{?: has lower precedence than /}} \
- // expected-note {{place parentheses around the ?: expression to evaluate it first}} \
- // expected-note {{place parentheses around the / expression to silence this warning}}
+ (void)(x / !x ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '/'}} \
+ // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \
+ // expected-note {{place parentheses around the '/' expression to silence this warning}}
(void)(x % 2 ? 1 : 2); // no warning
OpenPOWER on IntegriCloud