2 * transsip - the telephony network
3 * By Daniel Borkmann <daniel@transsip.org>
4 * Copyright 2011 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
6 * Subject to the GPL, version 2.
13 # define __aligned_16 __attribute__((aligned(16)))
16 # define likely(x) __builtin_expect(!!(x), 1)
19 # define unlikely(x) __builtin_expect(!!(x), 0)
22 # define __deprecated /* unimplemented */
25 # define unreachable() do { } while (1)
28 # define barrier() __sync_synchronize()
31 # define bug() __builtin_trap()
33 #ifndef mark_unreachable
34 # define mark_unreachable() __builtin_unreachable()
37 # define is_type(x, type) __builtin_types_compatible_p(typeof(x), (type))
40 # define same_type(x, y) __builtin_types_compatible_p(typeof(x), typeof(y))
43 # define __read_mostly __attribute__((__section__(".data.read_mostly")))
46 # define __must_check /* unimplemented */
49 # define __used /* unimplemented */
51 #ifndef __maybe_unused
52 # define __maybe_unused /* unimplemented */
54 #ifndef __always_unused
55 # define __always_unused /* unimplemented */
58 # define noinline __attribute__((noinline))
60 #ifndef __always_inline
61 # define __always_inline inline
64 * Protected visibility is like default visibility except that it indicates
65 * that references within the defining module will bind to the definition
66 * in that module. That is, the declared entity cannot be overridden by
70 # define __protected __attribute__((visibility("protected")))
73 * Hidden visibility indicates that the entity declared will have a new form
74 * of linkage, which we'll call "hidden linkage". Two declarations of an
75 * object with hidden linkage refer to the same object if they are in the
79 # define __hidden __attribute__((visibility("hidden")))
82 * Internal visibility is like hidden visibility, but with additional
83 * processor specific semantics. Unless otherwise specified by the psABI,
84 * GCC defines internal visibility to mean that a function is never called
85 * from another module. Compare this with hidden functions which, while they
86 * cannot be referenced directly by other modules, can be referenced
87 * indirectly via function pointers. By indicating that a function cannot be
88 * called from outside the module, GCC may for instance omit the load of a
89 * PIC register since it is known that the calling function loaded the
93 # define __internal __attribute__((visibility("internal")))
98 typeof (a) _a = (a); \
99 typeof (b) _b = (b); \
106 typeof (a) _a = (a); \
107 typeof (b) _b = (b); \
112 # define offsetof(type, member) ((size_t) &((type *) 0)->member)
115 * Casts a member of a structure out to the containing structure.
118 # define container_of(ptr, type, member) \
120 const typeof(((type *) 0)->member) * __mptr = (ptr); \
121 (type *) ((char *) __mptr - offsetof(type, member)); \
125 #endif /* COMPILER_H */