xref: /aosp_15_r20/external/ltp/scripts/coccinelle/fix-if-assignment.cocci (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker@@
2*49cdfc7eSAndroid Build Coastguard Workerexpression V, E;
3*49cdfc7eSAndroid Build Coastguard Worker@@
4*49cdfc7eSAndroid Build Coastguard Worker
5*49cdfc7eSAndroid Build Coastguard Worker+ V = E;
6*49cdfc7eSAndroid Build Coastguard Worker  if (
7*49cdfc7eSAndroid Build Coastguard Worker-	(V = E)
8*49cdfc7eSAndroid Build Coastguard Worker+ 	V
9*49cdfc7eSAndroid Build Coastguard Worker  ) { ... }
10*49cdfc7eSAndroid Build Coastguard Worker
11*49cdfc7eSAndroid Build Coastguard Worker@@
12*49cdfc7eSAndroid Build Coastguard Workerexpression V, E;
13*49cdfc7eSAndroid Build Coastguard Worker@@
14*49cdfc7eSAndroid Build Coastguard Worker
15*49cdfc7eSAndroid Build Coastguard Worker+ V = E;
16*49cdfc7eSAndroid Build Coastguard Worker  if (!
17*49cdfc7eSAndroid Build Coastguard Worker-	(V = E)
18*49cdfc7eSAndroid Build Coastguard Worker+ 	V
19*49cdfc7eSAndroid Build Coastguard Worker  ) { ... }
20*49cdfc7eSAndroid Build Coastguard Worker
21*49cdfc7eSAndroid Build Coastguard Worker@@
22*49cdfc7eSAndroid Build Coastguard Workerexpression V, E;
23*49cdfc7eSAndroid Build Coastguard Workerbinary operator B;
24*49cdfc7eSAndroid Build Coastguard Worker@@
25*49cdfc7eSAndroid Build Coastguard Worker
26*49cdfc7eSAndroid Build Coastguard Worker+ V = E;
27*49cdfc7eSAndroid Build Coastguard Worker  if (
28*49cdfc7eSAndroid Build Coastguard Worker-	(V = E)
29*49cdfc7eSAndroid Build Coastguard Worker+ 	V
30*49cdfc7eSAndroid Build Coastguard Worker  B ...) { ... }
31