2 * transsip - the telephony toolkit
3 * By Daniel Borkmann <daniel@transsip.org>
4 * Copyright 2011, 2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>
5 * Subject to the GPL, version 2.
20 # define __aligned_16 __attribute__((aligned(16)))
24 # define likely(x) __builtin_expect(!!(x), 1)
28 # define unlikely(x) __builtin_expect(!!(x), 0)
32 # define __extension__
36 # define __deprecated /* unimplemented */
40 # define __read_mostly __attribute__((__section__(".data.read_mostly")))
43 #ifndef __always_inline
44 # define __always_inline inline
48 # define __hidden __attribute__((visibility("hidden")))
53 # define array_size(x) (sizeof(x) / sizeof((x)[0]) + __must_be_array(x))
56 #ifndef __must_be_array
57 # define __must_be_array(x) \
58 build_bug_on_zero(__builtin_types_compatible_p(typeof(x), typeof(&x[0])))
64 typeof (a) _a = (a); \
65 typeof (b) _b = (b); \
73 typeof (a) _a = (a); \
74 typeof (b) _b = (b); \
79 #define anon(return_type, body_and_args) \
81 return_type __fn__ body_and_args \
88 * qsort(&argv[1], argc - 1, sizeof(argv[1]),
89 * anon(int, (const void * a, const void * b) {
90 * return strcmp(*(char * const *) a, *(char * const *) b);
95 # define bug() assert(0)
99 # define bug_on(cond) assert(!(cond))
102 #ifndef build_bug_on_zero
103 # define build_bug_on_zero(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
106 #endif /* BUILT_IN_H */