Convert dss to lopsub.
[dss.git] / gcc-compat.h
1 #define HAVE_GNUC(maj, min) \
2 defined(__GNUC__) && \
3 (__GNUC__ > maj || (__GNUC__ == maj && __GNUC_MINOR__ >= min))
4
5 #if HAVE_GNUC(2,5)
6 # define __noreturn __attribute__ ((noreturn))
7 #else
8 # define __noreturn
9 #endif
10
11 #if HAVE_GNUC(3,0)
12 # define __malloc __attribute__ ((malloc))
13 #else
14 # define __malloc
15 #endif
16
17 #if HAVE_GNUC(2,7)
18 # define __a_unused __attribute__ ((unused))
19 #else
20 # define __a_unused
21 #endif
22
23 /*
24 * p is the number of the "format string" parameter, and q is
25 * the number of the first variadic parameter
26 */
27 #if HAVE_GNUC(2,3)
28 # define __printf(p,q) __attribute__ ((format (printf, p, q)))
29 #else
30 # define __printf(p,q)
31 #endif
32
33 /*
34 * as direct use of __printf(p,q) confuses doxygen, here are two extra macros
35 * for those values p,q that are actually used by paraslash.
36 */
37 #define __printf_1_2 __printf(1,2)
38 #define __printf_2_3 __printf(2,3)
39
40 #if HAVE_GNUC(3,3)
41 # define __must_check __attribute__ ((warn_unused_result))
42 #else
43 # define __must_check /* no warn_unused_result */
44 #endif
45
46 #define _static_inline_ static inline