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