Import source code for dummynet innode emulation.
[ipfw.git] / dummynet / include / sys / cdefs.h
1 #ifndef _CDEFS_H_
2 #define _CDEFS_H_
3
4 /*
5  * various compiler macros and common functions
6  */
7
8 #ifndef __unused
9 #define __unused       __attribute__ ((__unused__))
10 #endif
11
12 #ifndef __packed
13 #define __packed       __attribute__ ((__packed__))
14 #endif
15
16 #ifndef __aligned
17 #define __aligned(x) __attribute__((__aligned__(x)))
18 #endif
19
20 /* defined as assert */
21 void panic(const char *fmt, ...);
22
23 #define KASSERT(exp,msg) do {                                           \
24         if (__predict_false(!(exp)))                                    \
25                 panic msg;                                              \
26 } while (0)
27
28 /* don't bother to optimize */
29 #ifndef __predict_false
30 #define __predict_false(x)   (x)        /* __builtin_expect((exp), 0) */
31 #endif
32
33 #endif /* !_CDEFS_H_ */