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