update README
[paraslash.git] / gcc-compat.h
1 #if __GNUC__ >= 3
2 # define inline inline __attribute__ ((always_inline))
3 # define __pure __attribute__ ((pure))
4 # define __noreturn __attribute__ ((noreturn))
5 # define __malloc __attribute__ ((malloc))
6 # define __used __attribute__ ((used))
7 # define __unused __attribute__ ((unused))
8 # define __packed __attribute__ ((packed))
9 # define likely(x) __builtin_expect (!!(x), 1)
10 # define unlikely(x) __builtin_expect (!!(x), 0)
11 /*
12 * p is the number of the "format string" parameter, and q is
13 * the number of the first variadic parameter
14 */
15 # define __printf(p,q) __attribute__ ((format (printf, p, q)))
16 /*
17 * as direct use of __printf(p,q) confuses doxygen, here are two extra macros
18 * for those values p,q that are actually used by paraslash.
19 */
20 #define __printf_1_2 __printf(1,2)
21 #define __printf_2_3 __printf(2,3)
22
23 #else
24
25 # define inline /* no inline */
26 # define __pure /* no pure */
27 # define __noreturn /* no noreturn */
28 # define __malloc /* no malloc */
29 # define __used /* no used */
30 # define __unused /* no unused */
31 # define __packed /* no packed */
32 # define likely(x) (x)
33 # define unlikely(x) (x)
34 # define __printf(p,q) /* no format */
35 #define __printf_1_2
36 #define __printf_2_3
37 #endif
38
39 # if __GNUC__ >=3 && __GNUC_MINOR__ > 3
40 # define __must_check __attribute__ ((warn_unused_result))
41 # else
42 # define __must_check /* no warn_unused_result */
43 # endif