1444
by Yoann Padioleau
improve parser |
1 |
// ****************************************************************************
|
2478
by Yoann Padioleau
update standard.h |
2 |
// Prelude, this file is used with -macro_file_builtins option of the C parser
|
1444
by Yoann Padioleau
improve parser |
3 |
// ****************************************************************************
|
4 |
||
1556
by Yoann Padioleau
inloop |
5 |
/* This file contains:
|
1436
by Yoann Padioleau
fix -test |
6 |
* - macros found in <.h>
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
7 |
* - macros found in ".h"
|
3736
by julia
Thu, 8 Aug 2013 08:50:34 +0200 |
8 |
* but where we cannot detect that it will be a "bad macro"
|
2478
by Yoann Padioleau
update standard.h |
9 |
* - hints, cf below.
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
10 |
*
|
2478
by Yoann Padioleau
update standard.h |
11 |
* A "bad macro" is a macro using free variables or when expanded
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
12 |
* that influence the control-flow of the code. In those cases it
|
2478
by Yoann Padioleau
update standard.h |
13 |
* is preferable to expand the macro so that the coccinelle engine
|
14 |
* has a more accurate representation of what is going on.
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
15 |
*
|
16 |
*
|
|
17 |
*
|
|
18 |
*
|
|
19 |
* old: this file was also containing what is below but now we
|
|
2478
by Yoann Padioleau
update standard.h |
20 |
* try to expand on demand the macro found in the c file, so those cases
|
21 |
* are not needed any more:
|
|
1704
by Yoann Padioleau
fix foreach mis |
22 |
* - macros found in .c; macros that cannot be parsed.
|
23 |
* In the future should be autodetected
|
|
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
24 |
* (not so easy to do same for macros in .h cos require to access .h file)
|
1704
by Yoann Padioleau
fix foreach mis |
25 |
* - macros found in .c; macros correctly parsed
|
3736
by julia
Thu, 8 Aug 2013 08:50:34 +0200 |
26 |
* but where we cannot detect that it will be a "bad macro"
|
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
27 |
*
|
28 |
* Some of those macros could be deleted and the C code rewritten because
|
|
29 |
* they are "bad" macros.
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
30 |
*
|
1996
by Yoann Padioleau
misc |
31 |
* todo? perhaps better if could enable/disable some of those expansions
|
32 |
* as different software may use conflicting macros.
|
|
33 |
*
|
|
34 |
*
|
|
35 |
* can maybe have a look in sparse/lib.c to see a list of default #define
|
|
36 |
* handled builtin apparently by gcc.
|
|
1436
by Yoann Padioleau
fix -test |
37 |
*/
|
1444
by Yoann Padioleau
improve parser |
38 |
|
39 |
// ****************************************************************************
|
|
2418
by Yoann Padioleau
handling of CppIdentBuilder |
40 |
// Hints
|
41 |
// ****************************************************************************
|
|
42 |
||
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
43 |
/* Cooperation with parsing_hack.ml: some body of macros in this file, such
|
2418
by Yoann Padioleau
handling of CppIdentBuilder |
44 |
* as MACROSTATEMENT, are considered as magic strings.
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
45 |
* I can't just expand those macros into some 'whatever();' because I need
|
2418
by Yoann Padioleau
handling of CppIdentBuilder |
46 |
* to generate a TMacroStmt for solving some ambiguities in the grammar
|
47 |
* for the toplevel stuff I think.
|
|
48 |
* Right now a set of special strings are used as "hints" to the parser
|
|
49 |
* to help it parse code. Those hints are specified in parsing_hack.ml:
|
|
50 |
*
|
|
51 |
* - YACFE_ITERATOR
|
|
52 |
* - YACFE_DECLARATOR
|
|
53 |
* - YACFE_STRING
|
|
54 |
* - YACFE_STATEMENT, or MACROSTATEMENT
|
|
55 |
* - YACFE_ATTRIBUTE
|
|
56 |
* - YACFE_IDENT_BUILDER
|
|
57 |
*/
|
|
58 |
||
59 |
// ****************************************************************************
|
|
1444
by Yoann Padioleau
improve parser |
60 |
// Test macros
|
61 |
// ****************************************************************************
|
|
62 |
||
1436
by Yoann Padioleau
fix -test |
63 |
// #define FOO(a, OP, b) a OP b
|
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
64 |
// #define FOO(a,b) fn(a,b)
|
2418
by Yoann Padioleau
handling of CppIdentBuilder |
65 |
#define FOO_METH_TEST(a) YACFE_IDENT_BUILDER
|
1436
by Yoann Padioleau
fix -test |
66 |
|
2458
by Yoann Padioleau
start of support for expand on demand |
67 |
//#define FOO YACFE_DECLARATOR
|
68 |
||
1444
by Yoann Padioleau
improve parser |
69 |
// ****************************************************************************
|
70 |
// Generic macros
|
|
71 |
// ****************************************************************************
|
|
72 |
||
2490
by Yoann Padioleau
remove macros from apache |
73 |
// this is defined by windows compiler, and so can not be found via a macro
|
74 |
// after a -extract_macros
|
|
2627
by Yoann Padioleau
remove stuff in standard.h now in lexer, also add tarzan/ocamlsexp in configure and co |
75 |
// update: now handled in lexer, simplify stuff
|
76 |
//#define __stdcall /*could: YACFE_ATTRIBUTE*/
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
77 |
//#define __declspec(a)
|
2490
by Yoann Padioleau
remove macros from apache |
78 |
|
2627
by Yoann Padioleau
remove stuff in standard.h now in lexer, also add tarzan/ocamlsexp in configure and co |
79 |
//#define WINAPI
|
80 |
//#define CALLBACK
|
|
1996
by Yoann Padioleau
misc |
81 |
|
82 |
||
1444
by Yoann Padioleau
improve parser |
83 |
// ****************************************************************************
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
84 |
// Linux macros
|
1444
by Yoann Padioleau
improve parser |
85 |
// ****************************************************************************
|
86 |
||
1456
by Yoann Padioleau
159/195 |
87 |
// ----------------------------------------------------------------------------
|
88 |
// Attributes. could perhaps generalize via "__.*"
|
|
89 |
// ----------------------------------------------------------------------------
|
|
90 |
#define __init
|
|
3817
by julia
more attributes |
91 |
#define __initconst
|
92 |
#define __page_aligned_data
|
|
93 |
#define __page_aligned_bss
|
|
94 |
#define __always_unused
|
|
95 |
#define __visible
|
|
1456
by Yoann Padioleau
159/195 |
96 |
#define __exit
|
97 |
#define __user
|
|
98 |
#define __iomem
|
|
99 |
#define __initdata
|
|
100 |
#define __exitdata
|
|
101 |
#define __devinit
|
|
102 |
#define __devexit
|
|
103 |
#define __devinitdata
|
|
104 |
#define __cpuinit
|
|
105 |
#define __cpuinitdata
|
|
106 |
#define __init_or_module
|
|
107 |
#define __initdata_or_module
|
|
108 |
#define __pminit
|
|
109 |
#define __pminitdata
|
|
3670
by julia
new attribute |
110 |
#define __irq_entry
|
1456
by Yoann Padioleau
159/195 |
111 |
|
112 |
#define __cacheline_aligned
|
|
113 |
#define ____cacheline_aligned
|
|
114 |
#define __cacheline_aligned_in_smp
|
|
115 |
#define ____cacheline_aligned_in_smp
|
|
116 |
#define ____cacheline_internodealigned_in_smp
|
|
117 |
||
118 |
#define __ALIGNED__
|
|
119 |
#define __3xp_aligned
|
|
120 |
||
121 |
#define __pmac
|
|
122 |
#define __force
|
|
123 |
#define __nocast
|
|
124 |
#define __read_mostly
|
|
125 |
||
126 |
#define __must_check
|
|
127 |
// pb
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
128 |
#define __unused
|
1456
by Yoann Padioleau
159/195 |
129 |
#define __maybe_unused
|
130 |
||
131 |
||
132 |
#define __attribute_used__
|
|
133 |
#define __attribute_pure__
|
|
134 |
#define __attribute_const__
|
|
135 |
// #define _attribute__const __attribute__((const))
|
|
136 |
||
137 |
#define __always_inline
|
|
138 |
||
139 |
#define __xipram
|
|
140 |
||
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
141 |
// in the other part of the kernel, in arch/, mm/, etc
|
1456
by Yoann Padioleau
159/195 |
142 |
#define __sched
|
143 |
#define __initmv
|
|
144 |
#define __exception
|
|
145 |
#define __cpuexit
|
|
146 |
#define __kprobes
|
|
147 |
#define __meminit
|
|
148 |
#define __meminitdata
|
|
149 |
#define __nosavedata
|
|
150 |
#define __kernel
|
|
151 |
#define __nomods_init
|
|
152 |
#define __apicdebuginit
|
|
153 |
#define __ipc_init
|
|
154 |
#define __modinit
|
|
155 |
#define __lockfunc
|
|
156 |
#define __weak
|
|
157 |
#define __tlb_handler_align
|
|
158 |
#define __lock_aligned
|
|
159 |
#define __force_data
|
|
160 |
#define __nongprelbss
|
|
161 |
#define __nongpreldata
|
|
162 |
#define __noreturn
|
|
163 |
||
164 |
#define __section_jiffies
|
|
165 |
#define __vsyscall_fn
|
|
166 |
#define __section_vgetcpu_mode
|
|
167 |
#define __section_vsyscall_gtod_data
|
|
168 |
||
169 |
// in header files
|
|
170 |
#define __bitwise
|
|
171 |
#define __bitwise__
|
|
172 |
#define __deprecated
|
|
173 |
||
174 |
||
175 |
// last found
|
|
1436
by Yoann Padioleau
fix -test |
176 |
#define __init_refok
|
177 |
||
1456
by Yoann Padioleau
159/195 |
178 |
|
179 |
// maybe only in old kernel
|
|
180 |
#define __openfirmware
|
|
181 |
||
2627
by Yoann Padioleau
remove stuff in standard.h now in lexer, also add tarzan/ocamlsexp in configure and co |
182 |
// now in lexer
|
183 |
//#define __extension__
|
|
1996
by Yoann Padioleau
misc |
184 |
|
185 |
#define __thread
|
|
186 |
#define __used
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
187 |
#define __pure
|
1996
by Yoann Padioleau
misc |
188 |
|
189 |
#define __ref
|
|
190 |
#define __refdata
|
|
191 |
||
192 |
#define __uses_jump_to_uncached
|
|
193 |
||
2478
by Yoann Padioleau
update standard.h |
194 |
|
195 |
// last last
|
|
196 |
#define __net_init
|
|
197 |
#define __net_exit
|
|
198 |
#define __net_initdata
|
|
199 |
||
200 |
#define __paginginit // in mm |
|
201 |
||
1456
by Yoann Padioleau
159/195 |
202 |
// ----------------------------------------------------------------------------
|
1556
by Yoann Padioleau
inloop |
203 |
// String macros
|
1456
by Yoann Padioleau
159/195 |
204 |
// ----------------------------------------------------------------------------
|
205 |
||
206 |
/* string macro. normally handle quite well by mu lalr(k), but
|
|
207 |
* sometimes not enough, if have for instance the XX YY case, could
|
|
208 |
* be considered as a declaration with XX being a typedef, so would
|
|
209 |
* Have ambiguity. So at least by adding this special case, we can
|
|
210 |
* catch more correct string-macro, no more a XX YY but now a good
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
211 |
* "XX" YY
|
212 |
*
|
|
1456
by Yoann Padioleau
159/195 |
213 |
* cf include/linux/kernel.h
|
214 |
*
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
215 |
* For stringification I need to have at least a witness, a string,
|
1456
by Yoann Padioleau
159/195 |
216 |
* and sometimes have just printk(KERN_WARNING MYSTR) and it could
|
217 |
* be transformed in a typedef later, so better to at least
|
|
218 |
* transform in string already the string-macro we know.
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
219 |
*
|
220 |
* Perhaps better to apply also as soon as possible the
|
|
1456
by Yoann Padioleau
159/195 |
221 |
* correct macro-annotation tagging (__init & co) to be able to
|
222 |
* filter them as soon as possible so that they will not polluate
|
|
223 |
* our pattern-matching that come later.
|
|
224 |
*/
|
|
4116.2.59
by Sébastien Hinderer
stanard.h: remove trailing whitespaces. |
225 |
|
1456
by Yoann Padioleau
159/195 |
226 |
#define KERN_EMERG "KERN_EMERG"
|
227 |
#define KERN_ALERT "KERN_ALERT"
|
|
228 |
#define KERN_CRIT "KERN_CRIT"
|
|
229 |
#define KERN_ERR "KERN_ERR"
|
|
230 |
#define KERN_WARNING "KERN_WARNING"
|
|
231 |
#define KERN_NOTICE "KERN_NOTICE"
|
|
232 |
#define KERN_INFO "KERN_INFO"
|
|
233 |
#define KERN_DEBUG "KERN_DEBUG"
|
|
234 |
||
235 |
||
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
236 |
/* EX_TABLE & co.
|
1456
by Yoann Padioleau
159/195 |
237 |
*
|
238 |
* Replaced by a string. We can't put everything as comment
|
|
239 |
* because it can be part of an expression where we wait for
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
240 |
* something, where we wait for a string. So at least we
|
1456
by Yoann Padioleau
159/195 |
241 |
* must keep the EX_TABLE token and transform it as a string.
|
242 |
*
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
243 |
* normally not needed if have good stringification of macro
|
244 |
* but those macros are sometimes used multiple times
|
|
1456
by Yoann Padioleau
159/195 |
245 |
* as in EX_TABLE(0b) EX_TABLE(1b) and we don't detect
|
246 |
* it well yet.
|
|
247 |
*/
|
|
248 |
||
249 |
// TODO don't use x :(
|
|
250 |
#define EX_TABLE(x) "TOTO"
|
|
251 |
#define ASM_EXCEPTIONTABLE_ENTRY(x) "TOTO"
|
|
252 |
#define DCACHE_CLEAR(x) "TOTO"
|
|
253 |
#define PPC405_ERR77(x) "TOTO"
|
|
254 |
||
255 |
||
256 |
||
257 |
||
258 |
// ----------------------------------------------------------------------------
|
|
1556
by Yoann Padioleau
inloop |
259 |
// Alias keywords
|
1456
by Yoann Padioleau
159/195 |
260 |
// ----------------------------------------------------------------------------
|
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
261 |
// pb, false positive, can also be a #define cst and use as 'case CONST:'
|
262 |
//#define CONST const
|
|
1456
by Yoann Padioleau
159/195 |
263 |
|
264 |
||
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
265 |
#define STATIC static
|
266 |
#define _static static
|
|
267 |
||
1456
by Yoann Padioleau
159/195 |
268 |
#define noinline
|
269 |
||
270 |
#define __CS4231_INLINE__ inline
|
|
271 |
#define CCIO_INLINE inline
|
|
272 |
#define SBA_INLINE inline
|
|
273 |
||
274 |
#define STATIC_INLINE static inline
|
|
275 |
#define __EXTERN_INLINE extern inline
|
|
276 |
||
277 |
#define AGPEXTERN extern
|
|
278 |
||
279 |
#define PNMI_STATIC static
|
|
280 |
#define RLMT_STATIC static
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
281 |
#define SISINITSTATIC static
|
1456
by Yoann Padioleau
159/195 |
282 |
#define SCTP_STATIC static
|
283 |
||
284 |
#define BUGLVL if
|
|
285 |
#define IFDEBUG if
|
|
286 |
||
287 |
#define TRACE_EXIT return
|
|
288 |
||
2478
by Yoann Padioleau
update standard.h |
289 |
#define notrace
|
290 |
||
291 |
#define noinline_for_stack // in fs |
|
292 |
#define debug_noinline // in net |
|
1456
by Yoann Padioleau
159/195 |
293 |
|
1996
by Yoann Padioleau
misc |
294 |
// ----------------------------------------------------------------------------
|
295 |
// linkage
|
|
296 |
// ----------------------------------------------------------------------------
|
|
1456
by Yoann Padioleau
159/195 |
297 |
|
298 |
#define fastcall
|
|
299 |
#define asmlinkage
|
|
300 |
||
301 |
#define far
|
|
302 |
#define SK_FAR
|
|
303 |
||
304 |
// pb
|
|
305 |
//#define near
|
|
306 |
||
1996
by Yoann Padioleau
misc |
307 |
|
308 |
// ----------------------------------------------------------------------------
|
|
309 |
// ----------------------------------------------------------------------------
|
|
310 |
||
311 |
#define INITSECTION
|
|
312 |
||
313 |
#define NORET_TYPE
|
|
314 |
||
315 |
#define compat_init_data
|
|
316 |
||
1456
by Yoann Padioleau
159/195 |
317 |
#define DIVA_EXIT_FUNCTION
|
318 |
#define DIVA_INIT_FUNCTION
|
|
319 |
#define ACPI_SYSTEM_XFACE
|
|
320 |
||
321 |
#define ASC_INITDATA
|
|
322 |
#define in2000__INITDATA
|
|
323 |
#define PACKED
|
|
3805
by julia
adding __packed as a word to ignore |
324 |
#define __packed
|
3809
by julia
add a few macros to improve parsing of some key structures |
325 |
#define __rcu
|
326 |
#define __percpu
|
|
1456
by Yoann Padioleau
159/195 |
327 |
|
328 |
#define WPMINFO
|
|
329 |
#define CPMINFO
|
|
330 |
#define PMINFO
|
|
331 |
||
332 |
#define ACPI_INTERNAL_VAR_XFACE
|
|
333 |
||
334 |
#define SISIOMEMTYPE
|
|
335 |
||
336 |
#define ACPI_STATE_COMMON
|
|
337 |
#define ACPI_PARSE_COMMON
|
|
338 |
#define ACPI_COMMON_DEBUG_MEM_HEADER
|
|
339 |
||
340 |
||
341 |
#define nabi_no_regargs
|
|
342 |
||
343 |
||
344 |
#define ATTRIB_NORET
|
|
345 |
#define ATTRIBUTE_UNUSED
|
|
346 |
#define BTEXT
|
|
347 |
#define BTDATA
|
|
348 |
#define PAGE_ALIGNED
|
|
349 |
||
350 |
#define EARLY_INIT_SECTION_ATTR
|
|
351 |
||
352 |
// pb
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
353 |
//#define INIT
|
1456
by Yoann Padioleau
159/195 |
354 |
|
355 |
#define IDI_CALL_ENTITY_T
|
|
356 |
#define IDI_CALL_LINK_T
|
|
357 |
||
1996
by Yoann Padioleau
misc |
358 |
/* cf gcc-linux.h
|
359 |
* A trick to suppress uninitialized variable warning without generating any
|
|
360 |
* code
|
|
361 |
*/
|
|
362 |
#define uninitialized_var(x) x = x
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
363 |
// as in u16 uninitialized_var(ioboard_type); /* GCC be quiet */
|
364 |
||
365 |
// ----------------------------------------------------------------------------
|
|
366 |
// ----------------------------------------------------------------------------
|
|
367 |
||
368 |
#define __releases(x)
|
|
369 |
#define __acquires(x)
|
|
2627
by Yoann Padioleau
remove stuff in standard.h now in lexer, also add tarzan/ocamlsexp in configure and co |
370 |
|
4758
by Jérôme Glisse
add __printf and __must_hold macro |
371 |
#define __must_hold(x)
|
372 |
#define __printf(a,b)
|
|
373 |
||
2627
by Yoann Padioleau
remove stuff in standard.h now in lexer, also add tarzan/ocamlsexp in configure and co |
374 |
//now in lexer
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
375 |
//#define __declspec(x)
|
2627
by Yoann Padioleau
remove stuff in standard.h now in lexer, also add tarzan/ocamlsexp in configure and co |
376 |
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
377 |
#define __page_aligned(x)
|
378 |
#define __aligned(x)
|
|
379 |
#define __vsyscall(x)
|
|
1456
by Yoann Padioleau
159/195 |
380 |
|
381 |
// ----------------------------------------------------------------------------
|
|
382 |
// ----------------------------------------------------------------------------
|
|
383 |
||
384 |
||
1996
by Yoann Padioleau
misc |
385 |
//conflict with a macro of firefox
|
386 |
//#define FASTCALL(x) x
|
|
1456
by Yoann Padioleau
159/195 |
387 |
#define PARAMS(x) x
|
388 |
||
389 |
||
390 |
||
391 |
// ----------------------------------------------------------------------------
|
|
392 |
// ----------------------------------------------------------------------------
|
|
1436
by Yoann Padioleau
fix -test |
393 |
|
394 |
// include/asm-arm/mach/arch.h
|
|
395 |
// #define MACHINE_START(x) struct foo { x }
|
|
396 |
#define MACHINE_START(_type,_name) \
|
|
397 |
static const struct machine_desc __mach_desc_##_type \
|
|
398 |
/* __used*/ \ |
|
399 |
__attribute__((__section__(".arch.info.init"))) = { \
|
|
400 |
.nr = MACH_TYPE_##_type, \
|
|
401 |
.name = _name,
|
|
402 |
||
403 |
#define MACHINE_END \
|
|
404 |
};
|
|
405 |
||
406 |
// include/asm-powerpc/machdep.h
|
|
407 |
#define define_machine(name) \
|
|
408 |
extern struct machdep_calls mach_##name; \
|
|
409 |
EXPORT_SYMBOL(mach_##name); \
|
|
410 |
struct machdep_calls mach_##name /*__machine_desc*/ = |
|
411 |
||
1456
by Yoann Padioleau
159/195 |
412 |
|
413 |
// ----------------------------------------------------------------------------
|
|
1556
by Yoann Padioleau
inloop |
414 |
// Declare like macros (in structure def), or tricky Declare macros
|
1456
by Yoann Padioleau
159/195 |
415 |
// ----------------------------------------------------------------------------
|
416 |
||
1444
by Yoann Padioleau
improve parser |
417 |
// include/asm-i386/pci.h
|
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
418 |
// the DECLARE are detected by parsing_hack but not when they are
|
419 |
// inside a struct def.
|
|
4613
by Julia Lawall
drop some declares that are no longer useful |
420 |
//#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
|
421 |
//#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
|
|
1444
by Yoann Padioleau
improve parser |
422 |
|
1500
by Julia Lawall
*** empty log message *** |
423 |
// defined in drivers/infiniband/hw/mthca/mthca_doorbell.h
|
4613
by Julia Lawall
drop some declares that are no longer useful |
424 |
//#define MTHCA_DECLARE_DOORBELL_LOCK(doorbell_lock)
|
1500
by Julia Lawall
*** empty log message *** |
425 |
|
1444
by Yoann Padioleau
improve parser |
426 |
// include/linux/types.h
|
427 |
//#define BITS_TO_LONGS(bits) \
|
|
428 |
// (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
|
|
4777
by Julia Lawall
uncomment DECLARE_BITMAP definition |
429 |
#define DECLARE_BITMAP(name,bits)
|
430 |
/*unsigned*/ long name[BITS_TO_LONGS(bits)] |
|
1436
by Yoann Padioleau
fix -test |
431 |
|
432 |
||
1456
by Yoann Padioleau
159/195 |
433 |
// include/asm-i386/percpu.h
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
434 |
// interesting macro where we see the need of __typeof__(type) with
|
1456
by Yoann Padioleau
159/195 |
435 |
// for example DECLARE_PER_CPU(char[256], iucv_dbf_txt_buf);
|
436 |
#define DEFINE_PER_CPU(type, name) \
|
|
437 |
__attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
|
|
438 |
#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
|
|
439 |
||
440 |
||
441 |
||
442 |
// include/linux/kobject.h
|
|
443 |
#define decl_subsys(_name,_type,_uevent_ops) \
|
|
444 |
struct subsystem _name##_subsys = { \
|
|
445 |
.kset = { \
|
|
446 |
.kobj = { .name = __stringify(_name) }, \
|
|
447 |
.ktype = _type, \
|
|
448 |
.uevent_ops =_uevent_ops, \
|
|
449 |
} \
|
|
450 |
}
|
|
451 |
||
452 |
// ----------------------------------------------------------------------------
|
|
453 |
// ----------------------------------------------------------------------------
|
|
1436
by Yoann Padioleau
fix -test |
454 |
|
1627
by Yoann Padioleau
fix |
455 |
// pb: if use this macro then we will not transform the argument of CS_CHECK
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
456 |
// in some rules.
|
1547
by Julia Lawall
*** empty log message *** |
457 |
//#define CS_CHECK(fn, ret) \
|
458 |
// do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|
1436
by Yoann Padioleau
fix -test |
459 |
|
460 |
||
1595
by Yoann Padioleau
another special case |
461 |
// bt2/hci_bcsp.c
|
462 |
#define BCSP_CRC_INIT(x) x = 0xffff
|
|
1436
by Yoann Padioleau
fix -test |
463 |
|
464 |
||
465 |
// sound/oss/cs46xx_wrapper-24.h
|
|
466 |
#define CS_OWNER .owner =
|
|
467 |
#define CS_THIS_MODULE THIS_MODULE,
|
|
468 |
||
469 |
||
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
470 |
// sound/sparc/dbri.c
|
1456
by Yoann Padioleau
159/195 |
471 |
// "bad macro", have a ',' at the end
|
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
472 |
#define CS4215_SINGLE(xname, entry, shift, mask, invert) \
|
473 |
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
|
474 |
.info = snd_cs4215_info_single, \
|
|
475 |
.get = snd_cs4215_get_single, .put = snd_cs4215_put_single, \
|
|
476 |
.private_value = entry | (shift << 8) | (mask << 16) | (invert << 24) },
|
|
1436
by Yoann Padioleau
fix -test |
477 |
|
478 |
// drivers/media/video/sn9c102/sn9c102_sensor.h
|
|
479 |
//#define sn9c102_write_const_regs(sn9c102_device, data...) \
|
|
480 |
// ({ const static u8 _valreg[][2] = {data}; \
|
|
481 |
// sn9c102_write_regs(sn9c102_device, _valreg, ARRAY_SIZE(_valreg)); })
|
|
482 |
||
483 |
||
484 |
||
485 |
||
486 |
||
487 |
// drivers/s390/cio/qdio.h
|
|
488 |
#define SYNC_MEMORY if (unlikely(q->siga_sync)) qdio_siga_sync_q(q)
|
|
489 |
#define SYNC_MEMORY_ALL if (unlikely(q->siga_sync)) \
|
|
490 |
qdio_siga_sync(q,~0U,~0U)
|
|
491 |
#define SYNC_MEMORY_ALL_OUTB if (unlikely(q->siga_sync)) \
|
|
492 |
qdio_siga_sync(q,~0U,0)
|
|
493 |
||
494 |
// drivers/scsi/g_NCR5380.c
|
|
495 |
#define ANDP ,
|
|
496 |
||
497 |
||
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
498 |
// drivers/scsi/ncr53c8xx.c
|
499 |
// generate lots of errors because error en cascade car dans l'initialiseur
|
|
500 |
// il y'a des '}' dans la premiere colonne
|
|
501 |
#define PREFETCH_FLUSH SCR_CALL, PADDRH (wait_dma),
|
|
502 |
||
503 |
// drivers/net/e100.c
|
|
504 |
// pbs false positive, defined in another manner in some files
|
|
505 |
//#define X(a,b) a,b
|
|
506 |
||
507 |
||
1456
by Yoann Padioleau
159/195 |
508 |
// net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
509 |
// also used in other.c that don't do any include :(
|
510 |
// but locally redefined in drivers/net/bnx2.c :( with a
|
|
1456
by Yoann Padioleau
159/195 |
511 |
// #define FNAME 0x8
|
512 |
#define FNAME(name) name,
|
|
513 |
||
514 |
||
515 |
// drivers/net/tulip/de4x5.c
|
|
516 |
#define DESC_ALIGN
|
|
517 |
||
518 |
||
1473
by Yoann Padioleau
clean memoisation and cocci.ml |
519 |
// in .h
|
520 |
#define MPI_POINTER *
|
|
1456
by Yoann Padioleau
159/195 |
521 |
|
1631
by Yoann Padioleau
parsing fix |
522 |
// mega4/soc.c mega4/socal.c
|
523 |
// cause false typedef inference if let soc_printk
|
|
524 |
#define soc_printk printk
|
|
525 |
#define socal_printk printk
|
|
526 |
||
527 |
||
1456
by Yoann Padioleau
159/195 |
528 |
// ----------------------------------------------------------------------------
|
1556
by Yoann Padioleau
inloop |
529 |
// Initializer array macros
|
1456
by Yoann Padioleau
159/195 |
530 |
// ----------------------------------------------------------------------------
|
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
531 |
|
532 |
// drivers/net/wireless/bcm43xx/bcm43xx_wx.c
|
|
533 |
// defined in similar way multiple times, in the same file and in another one
|
|
534 |
#define WX(ioctl) [(ioctl) - SIOCSIWCOMMIT]
|
|
535 |
// #define WX(x) [(x)-SIOCIWFIRST]
|
|
536 |
||
537 |
// drivers/net/wireless/ipw2200.c
|
|
538 |
#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT]
|
|
539 |
||
540 |
// drivers/net/wireless/zd1211rw/zd_netdev.c
|
|
541 |
#define PRIV_OFFSET(x) [(x)-SIOCIWFIRSTPRIV]
|
|
542 |
||
543 |
// drivers/net/wireless/zd1211rw/zd_rf.h
|
|
544 |
#define RF_CHANNEL(ch) [(ch)-1]
|
|
545 |
||
546 |
// drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
|
|
547 |
#define RF_CHANPAIR(a,b) [CHAN_TO_PAIRIDX(a)]
|
|
548 |
||
549 |
// drivers/net/wireless/arlan-proc.c
|
|
550 |
// incomplete macro, the real macro is quite complex and use other macros
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
551 |
#define ARLAN_SYSCTL_TABLE_TOTAL(x)
|
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
552 |
|
553 |
||
1456
by Yoann Padioleau
159/195 |
554 |
// ----------------------------------------------------------------------------
|
555 |
// ----------------------------------------------------------------------------
|
|
1452
by Yoann Padioleau
handling -test bad_typedef (before merge) |
556 |
|
557 |
// drivers/net/cxgb3/t3_hw.c
|
|
558 |
#define VPD_ENTRY(name, len) \
|
|
559 |
u8 name##_kword[2]; u8 name##_len; u8 name##_data[len]
|
|
560 |
||
561 |
||
562 |
// #define rtrc(i) {}
|
|
563 |
||
1456
by Yoann Padioleau
159/195 |
564 |
// ----------------------------------------------------------------------------
|
565 |
// ----------------------------------------------------------------------------
|
|
1436
by Yoann Padioleau
fix -test |
566 |
|
567 |
// drivers/video/nvidia/nv_type.h
|
|
568 |
// use: SetBitField(h_blank_e, 5: 5, 7:7)
|
|
569 |
//#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b))
|
|
570 |
//#define MASKEXPAND(mask) BITMASK(1?mask,0?mask)
|
|
571 |
//#define SetBF(mask,value) ((value) << (0?mask))
|
|
572 |
//#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) )
|
|
573 |
//#define SetBitField(value,from,to) SetBF(to, GetBF(value,from))
|
|
574 |
//#define SetBit(n) (1<<(n))
|
|
575 |
//#define Set8Bits(value) ((value)&0xff)
|
|
576 |
||
577 |
||
578 |
// drivers/video/sis/init.c
|
|
579 |
// use: GETBITSTR((SiS_Pr->CVTotal -2), 10:10, 0:0)
|
|
580 |
//#define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l))
|
|
581 |
//#define GENMASK(mask) BITMASK(1?mask,0?mask)
|
|
582 |
//#define GETBITS(var,mask) (((var) & GENMASK(mask)) >> (0?mask))
|
|
583 |
//#define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to))
|
|
584 |
||
585 |
||
586 |
// fs/afs/internal.h
|
|
587 |
#define ASSERTCMP(X, OP, Y) \
|
|
588 |
do { \
|
|
589 |
if (unlikely(!((X) OP (Y)))) { \
|
|
590 |
printk(KERN_ERR "\n"); \
|
|
591 |
printk(KERN_ERR "AFS: Assertion failed\n"); \
|
|
592 |
printk(KERN_ERR "%lu " /*#OP*/ " %lu is false\n", \ |
|
593 |
(unsigned long)(X), (unsigned long)(Y)); \
|
|
594 |
printk(KERN_ERR "0x%lx " /*#OP*/ " 0x%lx is false\n", \ |
|
595 |
(unsigned long)(X), (unsigned long)(Y)); \
|
|
596 |
BUG(); \
|
|
597 |
} \
|
|
598 |
} while(0)
|
|
599 |
||
600 |
#define ASSERTIFCMP(C, X, OP, Y) \
|
|
601 |
do { \
|
|
602 |
if (unlikely((C) && !((X) OP (Y)))) { \
|
|
603 |
printk(KERN_ERR "\n"); \
|
|
604 |
printk(KERN_ERR "AFS: Assertion failed\n"); \
|
|
605 |
printk(KERN_ERR "%lu " /*#OP*/ " %lu is false\n", \ |
|
606 |
(unsigned long)(X), (unsigned long)(Y)); \
|
|
607 |
printk(KERN_ERR "0x%lx " /*#OP*/ " 0x%lx is false\n", \ |
|
608 |
(unsigned long)(X), (unsigned long)(Y)); \
|
|
609 |
BUG(); \
|
|
610 |
} \
|
|
611 |
} while(0)
|
|
612 |
||
613 |
||
614 |
#define ASSERTRANGE(L, OP1, N, OP2, H) \
|
|
615 |
do { \
|
|
616 |
if (unlikely(!((L) OP1 (N)) || !((N) OP2 (H)))) { \
|
|
617 |
printk(KERN_ERR "\n"); \
|
|
618 |
printk(KERN_ERR "AFS: Assertion failed\n"); \
|
|
619 |
printk(KERN_ERR "%lu "/*#OP1*/" %lu "/*#OP2*/" %lu is false\n", \ |
|
620 |
(unsigned long)(L), (unsigned long)(N), \
|
|
621 |
(unsigned long)(H)); \
|
|
622 |
printk(KERN_ERR "0x%lx "/*#OP1*/" 0x%lx "/*#OP2*/" 0x%lx is false\n", \ |
|
623 |
(unsigned long)(L), (unsigned long)(N), \
|
|
624 |
(unsigned long)(H)); \
|
|
625 |
BUG(); \
|
|
626 |
} \
|
|
627 |
} while(0)
|
|
628 |
||
629 |
||
630 |
||
631 |
||
1456
by Yoann Padioleau
159/195 |
632 |
// loop, macro without ';', single macro. ex: DEBUG()
|
633 |
||
634 |
// TODO should find the definition because we don't use 'x' and so
|
|
635 |
// may lose code sites with coccinelle. If expand correctly, will
|
|
636 |
// still don't transform correctly but at least will detect the place.
|
|
637 |
||
1875
by Yoann Padioleau
fix -test dbg |
638 |
|
639 |
||
640 |
||
1456
by Yoann Padioleau
159/195 |
641 |
#define ASSERT(x) MACROSTATEMENT
|
642 |
#define IRDA_ASSERT(x) MACROSTATEMENT
|
|
643 |
||
644 |
#define CHECK_NULL(x) MACROSTATEMENT
|
|
645 |
||
1626
by Yoann Padioleau
constty |
646 |
//#define DEBUG(x) MACROSTATEMENT
|
1456
by Yoann Padioleau
159/195 |
647 |
#define DEBUG0(x) MACROSTATEMENT
|
648 |
#define DEBUG1(x) MACROSTATEMENT
|
|
649 |
#define DEBUG2(x) MACROSTATEMENT
|
|
650 |
#define DEBUG3(x) MACROSTATEMENT
|
|
651 |
||
652 |
||
653 |
#define DBG(x) MACROSTATEMENT
|
|
654 |
#define DEB(x) MACROSTATEMENT
|
|
655 |
#define PARSEDEBUG(x) MACROSTATEMENT
|
|
656 |
#define DEBC(x) MACROSTATEMENT
|
|
657 |
#define DBG_TRC(x) MACROSTATEMENT
|
|
658 |
#define DBG_ERR(x) MACROSTATEMENT
|
|
659 |
#define DBG_FTL(x) MACROSTATEMENT
|
|
660 |
||
661 |
#define DBGINFO(x) MACROSTATEMENT
|
|
662 |
#define DFLOW(x) MACROSTATEMENT
|
|
663 |
#define DFLIP(x) MACROSTATEMENT
|
|
664 |
#define DLOG_INT_TRIG(x) MACROSTATEMENT
|
|
665 |
||
666 |
#define D3(x) MACROSTATEMENT
|
|
667 |
#define D1(x) MACROSTATEMENT
|
|
668 |
#define DB(x) MACROSTATEMENT
|
|
669 |
#define DCBDEBUG(x) MACROSTATEMENT
|
|
670 |
#define SCSI_LOG_MLQUEUE(x) MACROSTATEMENT
|
|
671 |
||
672 |
#define PLND(x) MACROSTATEMENT
|
|
673 |
#define FCALND(x) MACROSTATEMENT
|
|
674 |
#define FCALD(x) MACROSTATEMENT
|
|
675 |
||
676 |
#define DEBUGRECURSION(x) MACROSTATEMENT
|
|
677 |
||
678 |
#define DEBUGPIO(x) MACROSTATEMENT
|
|
679 |
#define VDEB(x) MACROSTATEMENT
|
|
680 |
||
681 |
#define READ_UNLOCK_IRQRESTORE(x) MACROSTATEMENT
|
|
682 |
||
683 |
#define TRACE_CATCH(x) MACROSTATEMENT
|
|
684 |
||
685 |
#define PDBGG(x) MACROSTATEMENT
|
|
686 |
||
687 |
#define IF_ABR(x) MACROSTATEMENT
|
|
688 |
#define IF_EVENT(x) MACROSTATEMENT
|
|
689 |
#define IF_ERR(x) MACROSTATEMENT
|
|
690 |
#define IF_CBR(x) MACROSTATEMENT
|
|
691 |
#define IF_INIT(x) MACROSTATEMENT
|
|
692 |
#define IF_RX(x) MACROSTATEMENT
|
|
693 |
||
694 |
#define SOD(x) MACROSTATEMENT
|
|
695 |
||
696 |
#define KDBG(x) MACROSTATEMENT
|
|
697 |
||
698 |
#define IRDA_ASSERT_LABEL(x) MACROSTATEMENT
|
|
699 |
||
700 |
||
701 |
||
702 |
||
703 |
||
704 |
// ----------------------------------------------------------------------------
|
|
705 |
// Difficult foreach
|
|
706 |
// ----------------------------------------------------------------------------
|
|
1436
by Yoann Padioleau
fix -test |
707 |
|
708 |
// include/linux/sched.h
|
|
709 |
#define while_each_thread(g, t) \
|
|
710 |
while ((t = next_thread(t)) != g)
|
|
711 |
||
712 |
||
713 |
||
714 |
// net/decnet/dn_fib.c
|
|
715 |
#define for_fib_info() { struct dn_fib_info *fi;\
|
|
716 |
for(fi = dn_fib_info_list; fi; fi = fi->fib_next)
|
|
717 |
#define endfor_fib_info() }
|
|
718 |
||
719 |
#define for_nexthops(fi) { int nhsel; const struct dn_fib_nh *nh;\
|
|
720 |
for(nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++)
|
|
721 |
||
722 |
#define change_nexthops(fi) { int nhsel; struct dn_fib_nh *nh;\
|
|
723 |
for(nhsel = 0, nh = (struct dn_fib_nh *)((fi)->fib_nh); nhsel < (fi)->fib_nhs; nh++, nhsel++)
|
|
724 |
||
725 |
#define endfor_nexthops(fi) }
|
|
726 |
||
727 |
||
1456
by Yoann Padioleau
159/195 |
728 |
// ----------------------------------------------------------------------------
|
729 |
// Macros around function prototype
|
|
730 |
// ----------------------------------------------------------------------------
|
|
1436
by Yoann Padioleau
fix -test |
731 |
|
732 |
||
733 |
// net/sched/em_meta.c
|
|
734 |
#define META_COLLECTOR(FUNC) static void meta_##FUNC(struct sk_buff *skb, \
|
|
735 |
struct tcf_pkt_info *info, struct meta_value *v, \
|
|
736 |
struct meta_obj *dst, int *err)
|
|
737 |
||
738 |
||
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
739 |
#define GDTH_INITFUNC(x,y) x y
|
740 |
#define ASC_INITFUNC(x,y) x y
|
|
1456
by Yoann Padioleau
159/195 |
741 |
|
742 |
||
743 |
// ----------------------------------------------------------------------------
|
|
1556
by Yoann Padioleau
inloop |
744 |
// If-like macros
|
1456
by Yoann Padioleau
159/195 |
745 |
// ----------------------------------------------------------------------------
|
1436
by Yoann Padioleau
fix -test |
746 |
|
747 |
// include/linux/lockd/debug.h
|
|
748 |
// include/linux/nfs_fs.h
|
|
749 |
// include/linux/nfsd/debug.h
|
|
750 |
// include/linux/sunrpc/debug.h
|
|
751 |
//#define ifdebug(flag) if (unlikely(nlm_debug & NLMDBG_##flag))
|
|
752 |
#define ifdebug(flag) if (0)
|
|
753 |
||
754 |
||
1996
by Yoann Padioleau
misc |
755 |
|
756 |
// ----------------------------------------------------------------------------
|
|
757 |
//#define __PROM_O32
|
|
758 |
||
759 |
// ----------------------------------------------------------------------------
|
|
4116.2.67
by Sébastien Hinderer
Remove a bunch of trailing whitespaces and blank lines at end of files. |
760 |
// for tests-big/ macros, may be obsolete now cos fixed in latest kernel
|
1996
by Yoann Padioleau
misc |
761 |
// ----------------------------------------------------------------------------
|
1704
by Yoann Padioleau
fix foreach mis |
762 |
|
763 |
// rule10
|
|
764 |
//#define ACPI_MODULE_NAME(x)
|
|
4156
by julia
SYSCALL_DEFINE macros |
765 |
|
766 |
// ----------------------------------------------------------------------------
|
|
767 |
// system calls
|
|
768 |
// ----------------------------------------------------------------------------
|
|
769 |
||
770 |
#define SYSCALL_DEFINE1(func, t1, a1) \
|
|
771 |
asmlinkage unsigned long func(t1 a1)
|
|
772 |
#define SYSCALL_DEFINE2(func, t1, a1, t2, a2) \
|
|
773 |
asmlinkage unsigned long func(t1 a1, t2 a2)
|
|
774 |
#define SYSCALL_DEFINE3(func, t1, a1, t2, a2, t3, a3) \
|
|
775 |
asmlinkage unsigned long func(t1 a1, t2 a2, t3 a3)
|
|
776 |
#define SYSCALL_DEFINE4(func, t1, a1, t2, a2, t3, a3, t4, a4) \
|
|
777 |
asmlinkage unsigned long func(t1 a1, t2 a2, t3 a3, t4 a4)
|
|
778 |
#define SYSCALL_DEFINE5(func, t1, a1, t2, a2, t3, a3, t4, a4, t5, a5) \
|
|
779 |
asmlinkage unsigned long func(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5)
|
|
780 |
#define SYSCALL_DEFINE6(func, t1, a1, t2, a2, t3, a3, t4, a4, t5, a5, t6, a6) \
|
|
781 |
asmlinkage unsigned long func(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6)
|
|
4414.1.12
by julia
identifier list metavariables for #define |
782 |
|
783 |
#define KBUILD_MODNAME YACFE_STRING
|