]> Git Repo - qemu.git/blob - scripts/coccinelle/inplace-byteswaps.cocci
trace: avoid "is" with a literal Python 3.8 warnings
[qemu.git] / scripts / coccinelle / inplace-byteswaps.cocci
1 // Replace uses of in-place byteswapping functions with calls to the
2 // equivalent not-in-place functions.  This is necessary to avoid
3 // undefined behaviour if the expression being swapped is a field in a
4 // packed struct.
5
6 @@
7 expression E;
8 @@
9 -be16_to_cpus(&E);
10 +E = be16_to_cpu(E);
11 @@
12 expression E;
13 @@
14 -be32_to_cpus(&E);
15 +E = be32_to_cpu(E);
16 @@
17 expression E;
18 @@
19 -be64_to_cpus(&E);
20 +E = be64_to_cpu(E);
21 @@
22 expression E;
23 @@
24 -cpu_to_be16s(&E);
25 +E = cpu_to_be16(E);
26 @@
27 expression E;
28 @@
29 -cpu_to_be32s(&E);
30 +E = cpu_to_be32(E);
31 @@
32 expression E;
33 @@
34 -cpu_to_be64s(&E);
35 +E = cpu_to_be64(E);
36 @@
37 expression E;
38 @@
39 -le16_to_cpus(&E);
40 +E = le16_to_cpu(E);
41 @@
42 expression E;
43 @@
44 -le32_to_cpus(&E);
45 +E = le32_to_cpu(E);
46 @@
47 expression E;
48 @@
49 -le64_to_cpus(&E);
50 +E = le64_to_cpu(E);
51 @@
52 expression E;
53 @@
54 -cpu_to_le16s(&E);
55 +E = cpu_to_le16(E);
56 @@
57 expression E;
58 @@
59 -cpu_to_le32s(&E);
60 +E = cpu_to_le32(E);
61 @@
62 expression E;
63 @@
64 -cpu_to_le64s(&E);
65 +E = cpu_to_le64(E);
This page took 0.02563 seconds and 4 git commands to generate.