5 * this allows us to take advantage of special gcc features while still
6 * allowing other compilers to compile:
8 * example taken from: http://rlove.org/log/2005102601
11 #if defined(__GNUC__) && (__GNUC__ >= 3)
12 # define CONST __attribute__ ((const))
13 # define DEPRECATED __attribute__ ((deprecated))
14 # define MUST_CHECK __attribute__ ((warn_unused_result))
15 # define NORETURN __attribute__ ((noreturn))
16 # define PACKED __attribute__ ((packed))
17 /* these are very useful for type checking */
18 # define PRINTF __attribute__ ((format(printf,1,2)))
19 # define DPRINTF __attribute__ ((format(printf,2,3)))
20 # define PURE __attribute__ ((pure))
21 # define UNUSED __attribute__ ((unused))
22 # define USED __attribute__ ((used))
23 /* # define inline inline __attribute__ ((always_inline)) */
24 # define NOINLINE __attribute__ ((noinline))
25 # define likely(x) __builtin_expect (!!(x), 1)
26 # define unlikely(x) __builtin_expect (!!(x), 0)
27 #else /* __GNUC__ || __GNUC__ < 3 */
40 # define likely(x) (x)
41 # define unlikely(x) (x)
42 #endif /* __GNUC__ && __GNUC__ >= 3 */
44 #endif /* COMPAT__CC_H */