Merge branch 'refs/heads/t/exit-hook'
[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(3,0)
6 # define __malloc       __attribute__ ((malloc))
7 #else
8 # define __malloc
9 #endif
10
11 /* 
12  * p is the number of the "format string" parameter, and q is 
13  * the number of the first variadic parameter 
14  */
15 #if HAVE_GNUC(2,3)
16 # define __printf(p,q) __attribute__ ((format (printf, p, q)))
17 #else
18 # define __printf(p,q)
19 #endif
20
21 #define  __printf_1_2 __printf(1,2)
22
23 #if HAVE_GNUC(3,3)
24 # define __must_check   __attribute__ ((warn_unused_result))
25 #else
26 # define __must_check   /* no warn_unused_result */
27 #endif