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