From 33d287563815f1b50edd1ebf1855702192efddf6 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 25 Mar 2022 19:01:15 +0000 Subject: [PATCH] lib.h: Disable magic attributes if the compiler doesn't understand them. --- lib.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib.h b/lib.h index 5507f12..ebb13ac 100644 --- a/lib.h +++ b/lib.h @@ -97,8 +97,16 @@ /* Function attributes. If you're not using GCC to build then you'll need to * say something different here. */ -#define PRINTF_LIKE(fmt, dots) __attribute__((format(printf, fmt, dots))) -#define NORETURN __attribute__((noreturn)) +#if (defined(__GNUC__) && (__GNUC__ > 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))) || \ + (defined(__clang__) && (__clang_major__ > 3 || \ + (__clang_major__ == 3 && __clang_minor__ >= 3))) +# define PRINTF_LIKE(fmt, dots) __attribute__((format(printf, fmt, dots))) +# define NORETURN __attribute__((noreturn)) +#else +# define PRINTF_LIKE(fmt, dots) +# define NORETURN +#endif /*----- Definitions for low-level DVD access ------------------------------*/ -- 2.11.0