lib.h: Disable magic attributes if the compiler doesn't understand them.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 25 Mar 2022 19:01:15 +0000 (19:01 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 25 Mar 2022 19:01:15 +0000 (19:01 +0000)
lib.h

diff --git a/lib.h b/lib.h
index 5507f12..ebb13ac 100644 (file)
--- a/lib.h
+++ b/lib.h
 /* 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 ------------------------------*/