annotate clang/test/Sema/bitwise-op-parentheses.c @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -DSILENCE
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wbitwise-op-parentheses
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wparentheses
anatofuz
parents:
diff changeset
4 // RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -Wbitwise-op-parentheses 2>&1 | FileCheck %s
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 #ifdef SILENCE
anatofuz
parents:
diff changeset
7 // expected-no-diagnostics
anatofuz
parents:
diff changeset
8 #endif
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 void bitwise_op_parentheses(unsigned i) {
anatofuz
parents:
diff changeset
11 (void)(i & i | i);
anatofuz
parents:
diff changeset
12 #ifndef SILENCE
anatofuz
parents:
diff changeset
13 // expected-warning@-2 {{'&' within '|'}}
anatofuz
parents:
diff changeset
14 // expected-note@-3 {{place parentheses around the '&' expression to silence this warning}}
anatofuz
parents:
diff changeset
15 #endif
anatofuz
parents:
diff changeset
16 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("
anatofuz
parents:
diff changeset
17 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:15-[[@LINE-6]]:15}:")"
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 (void)(i | i & i);
anatofuz
parents:
diff changeset
20 #ifndef SILENCE
anatofuz
parents:
diff changeset
21 // expected-warning@-2 {{'&' within '|'}}
anatofuz
parents:
diff changeset
22 // expected-note@-3 {{place parentheses around the '&' expression to silence this warning}}
anatofuz
parents:
diff changeset
23 #endif
anatofuz
parents:
diff changeset
24 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:14-[[@LINE-5]]:14}:"("
anatofuz
parents:
diff changeset
25 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:19-[[@LINE-6]]:19}:")"
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 (void)(i ^ i | i);
anatofuz
parents:
diff changeset
28 #ifndef SILENCE
anatofuz
parents:
diff changeset
29 // expected-warning@-2 {{'^' within '|'}}
anatofuz
parents:
diff changeset
30 // expected-note@-3 {{place parentheses around the '^' expression to silence this warning}}
anatofuz
parents:
diff changeset
31 #endif
anatofuz
parents:
diff changeset
32 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("
anatofuz
parents:
diff changeset
33 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:15-[[@LINE-6]]:15}:")"
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 (void)(i | i ^ i);
anatofuz
parents:
diff changeset
36 #ifndef SILENCE
anatofuz
parents:
diff changeset
37 // expected-warning@-2 {{'^' within '|'}}
anatofuz
parents:
diff changeset
38 // expected-note@-3 {{place parentheses around the '^' expression to silence this warning}}
anatofuz
parents:
diff changeset
39 #endif
anatofuz
parents:
diff changeset
40 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:14-[[@LINE-5]]:14}:"("
anatofuz
parents:
diff changeset
41 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:19-[[@LINE-6]]:19}:")"
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 (void)(i & i ^ i);
anatofuz
parents:
diff changeset
44 #ifndef SILENCE
anatofuz
parents:
diff changeset
45 // expected-warning@-2 {{'&' within '^'}}
anatofuz
parents:
diff changeset
46 // expected-note@-3 {{place parentheses around the '&' expression to silence this warning}}
anatofuz
parents:
diff changeset
47 #endif
anatofuz
parents:
diff changeset
48 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("
anatofuz
parents:
diff changeset
49 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:15-[[@LINE-6]]:15}:")"
anatofuz
parents:
diff changeset
50
anatofuz
parents:
diff changeset
51 (void)(i ^ i & i);
anatofuz
parents:
diff changeset
52 #ifndef SILENCE
anatofuz
parents:
diff changeset
53 // expected-warning@-2 {{'&' within '^'}}
anatofuz
parents:
diff changeset
54 // expected-note@-3 {{place parentheses around the '&' expression to silence this warning}}
anatofuz
parents:
diff changeset
55 #endif
anatofuz
parents:
diff changeset
56 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:14-[[@LINE-5]]:14}:"("
anatofuz
parents:
diff changeset
57 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:19-[[@LINE-6]]:19}:")"
anatofuz
parents:
diff changeset
58 }