1 // RUN: %clang_cc1 -fsyntax-only -verify %s -DSILENCE
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wlogical-op-parentheses
3 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wparentheses
4 // RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -Wlogical-op-parentheses 2>&1 | FileCheck %s
7 // expected-no-diagnostics
10 void logical_op_parentheses(unsigned i
) {
15 // expected-warning@-2 {{'&&' within '||'}}
16 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
18 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:14-[[@LINE-5]]:14}:"("
19 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:20-[[@LINE-6]]:20}:")"
24 // expected-warning@-2 {{'&&' within '||'}}
25 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
27 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:14-[[@LINE-5]]:14}:"("
28 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:20-[[@LINE-6]]:20}:")"
33 // expected-warning@-3 {{'&&' within '||'}}
34 // expected-note@-4 {{place parentheses around the '&&' expression to silence this warning}}
36 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:10-[[@LINE-6]]:10}:"("
37 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:15-[[@LINE-6]]:15}:")"
39 (void)(i
|| i
&& "w00t");
40 (void)("w00t" && i
|| i
);
41 (void)("w00t" && t
|| t
);
44 // expected-warning@-2 {{'&&' within '||'}}
45 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
47 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("
48 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:16-[[@LINE-6]]:16}:")"
51 // expected-warning@-2 {{'&&' within '||'}}
52 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
54 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("
55 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:16-[[@LINE-6]]:16}:")"
58 // expected-warning@-2 {{'&&' within '||'}}
59 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
61 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:15-[[@LINE-5]]:15}:"("
62 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:21-[[@LINE-6]]:21}:")"
65 // expected-warning@-2 {{'&&' within '||'}}
66 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
68 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:15-[[@LINE-5]]:15}:"("
69 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:21-[[@LINE-6]]:21}:")"
71 (void)(i
|| i
&& "w00t" || i
);
73 // expected-warning@-2 {{'&&' within '||'}}
74 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
76 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:15-[[@LINE-5]]:15}:"("
77 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:26-[[@LINE-6]]:26}:")"
79 (void)(i
|| "w00t" && i
|| i
);
81 // expected-warning@-2 {{'&&' within '||'}}
82 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
84 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:15-[[@LINE-5]]:15}:"("
85 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:26-[[@LINE-6]]:26}:")"
89 // expected-warning@-2 {{'&&' within '||'}}
90 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
92 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("
93 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:16-[[@LINE-6]]:16}:")"
96 // expected-warning@-2 {{'&&' within '||'}}
97 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
99 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:15-[[@LINE-5]]:15}:"("
100 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:21-[[@LINE-6]]:21}:")"