Debian Codegraph @

src/drivers/intel/fsp2_0/header_util/fspupdvpd.spatch

raw
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /* Semantic patch for fspupdvpd_sanitize.sh. Please call the script directly. */
4
5 @ kill_pragma_pack @
6 @@
7 - #pragma pack(...)
8
9 /*
10 * Convert named typedef'd structs
11 * Example : typedef struct name {} name_t; -> struct name {};
12 */
13 @ named_struct @
14 identifier i;
15 type t;
16 @@
17 typedef struct i { ... } t;
18
19 /* Make typename usable as identifier */
20 @ script:python named_struct_type @
21 t << named_struct.t;
22 i;
23 @@
24 coccinelle.i = t.rstrip('_t')
25
26 @ convert_FSP_UPD_HEADER @
27 typedef FSP_UPD_HEADER;
28 @@
29 - FSP_UPD_HEADER
30 + struct FSP_UPD_HEADER
31
32 @ convert_FSPM_ARCH_UPD @
33 typedef FSPM_ARCH_UPD;
34 @@
35 - FSPM_ARCH_UPD
36 + struct FSPM_ARCH_UPD
37
38 @ convert_named_struct_decls @
39 type named_struct.t;
40 identifier named_struct_type.i;
41 identifier g;
42 @@
43 - typedef struct g {
44 + struct i {
45 ...
46 }
47 - t
48 ;
49
50 /* Replace type with struct */
51 @ named_typedef_to_struct @
52 type named_struct.t;
53 identifier named_struct_type.i;
54 @@
55 - t
56 + struct i
57
58
59 /*
60 * Convert unnamed typedef'd structs
61 * Example : typedef struct {} name_t; -> struct name {};
62 */
63 @ unnamed_struct @
64 type t;
65 @@
66 typedef struct { ... } t;
67
68 /* Make typename usable as identifier */
69 @ script:python unnamed_struct_type @
70 t << unnamed_struct.t;
71 i;
72 @@
73 coccinelle.i = t.rstrip('_t')
74
75 @ convert_unnamed_struct_decls @
76 type unnamed_struct.t;
77 identifier unnamed_struct_type.i;
78 @@
79 -typedef struct {
80 +struct i {
81 ...
82 }
83 - t
84 ;
85
86 /*
87 * Convert unnamed typedef'd enums
88 */
89 @ unnamed_enum @
90 type t;
91 @@
92 typedef enum { ... } t;
93
94 /* Make typename usable as identifier */
95 @ script:python unnamed_enum_type @
96 t << unnamed_enum.t;
97 i;
98 @@
99 coccinelle.i = t.rstrip('_t')
100
101 @ convert_unnamed_enum_decls @
102 type unnamed_enum.t;
103 identifier unnamed_enum_type.i;
104 @@
105 -typedef enum {
106 +enum i {
107 ...
108 }
109 - t
110 ;
111
112 /* Replace type with struct */
113 @ unnamed_typedef_to_struct @
114 type unnamed_struct.t;
115 identifier unnamed_struct_type.i;
116 @@
117 -t
118 +struct i
119
120 /*
121 * Pack _ALL_ structs
122 */
123 @ pack_structs @
124 identifier s;
125 @@
126
127 struct s {
128 ...
129 }
130 + __attribute__((packed))
131 ;
132
133 /*
134 * BIGINT to stdint
135 */
136 @ uint8_t @
137 typedef UINT8;
138 typedef uint8_t;
139 @@
140 - UINT8
141 + uint8_t
142
143 @ uint16_t @
144 typedef UINT16;
145 typedef uint16_t;
146 @@
147 - UINT16
148 + uint16_t
149
150 @ uint32_t @
151 typedef UINT32;
152 typedef uint32_t;
153 @@
154 - UINT32
155 + uint32_t
156
157 @ uint64_t @
158 typedef UINT64;
159 typedef uint64_t;
160 @@
161 - UINT64
162 + uint64_t
163
164 @ bool @
165 typedef BOOLEAN;
166 typedef bool;
167 @@
168 - BOOLEAN
169 + bool
170
171 @ wchar_t @
172 typedef CHAR16;
173 typedef wchar_t;
174 @@
175 - CHAR16
176 + wchar_t
177
178 /* This rule can't be named "void" */
179 @ replace_uppercase_void @
180 typedef VOID;
181 @@
182 - VOID
183 + void