X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=blobdiff_plain;f=gcc-compat.h;h=2622fd3dbabd3b5e570c7f706b02537e178316ca;hp=4451980678907b4e2dcb76b9cda8c0e365d2a6f7;hb=3afe51391bf1ea546fc0fcf35c866e9ed8ba8d28;hpb=cd6eefcdadce948bf503a32bc33cf69d8243684b diff --git a/gcc-compat.h b/gcc-compat.h index 4451980..2622fd3 100644 --- a/gcc-compat.h +++ b/gcc-compat.h @@ -1,22 +1,29 @@ -# define __noreturn __attribute__ ((noreturn)) +#define HAVE_GNUC(maj, min) \ + defined(__GNUC__) && \ + (__GNUC__ > maj || (__GNUC__ == maj && __GNUC_MINOR__ >= min)) + +#if HAVE_GNUC(3,0) # define __malloc __attribute__ ((malloc)) -# define __a_unused __attribute__ ((unused)) +#else +# define __malloc +#endif + /* * p is the number of the "format string" parameter, and q is * the number of the first variadic parameter */ +#if HAVE_GNUC(2,3) # define __printf(p,q) __attribute__ ((format (printf, p, q))) -/* - * as direct use of __printf(p,q) confuses doxygen, here are two extra macros - * for those values p,q that are actually used by paraslash. - */ +#else +# define __printf(p,q) +#endif + #define __printf_1_2 __printf(1,2) -#define __printf_2_3 __printf(2,3) -# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3) +#if HAVE_GNUC(3,3) # define __must_check __attribute__ ((warn_unused_result)) -# else +#else # define __must_check /* no warn_unused_result */ -# endif +#endif #define _static_inline_ static inline