]> git.cworth.org Git - notmuch/commitdiff
Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Mon, 24 Sep 2012 15:21:16 +0000 (17:21 +0200)
committerDavid Bremner <bremner@debian.org>
Thu, 27 Sep 2012 15:50:22 +0000 (12:50 -0300)
This attribute is understood by gcc since version 2.5. clang provides
support for testing for function attributes using __has_attribute. For
other compilers this macro evaluates to the empty string.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
compat/function-attributes.h

index 18f90903905ef17ff8a97a30577b6f4aafd195c0..8450a17df90b9a656f0b438a3ccc0216cb56e4a3 100644 (file)
 #define __has_attribute(x) 0
 #endif
 
+/* Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE from
+ * talloc.
+ *
+ * This attribute is understood by gcc since version 2.5. clang
+ * provides support for testing for function attributes.
+ */
+#ifndef NORETURN_ATTRIBUTE
+#if (__GNUC__ >= 3 ||                          \
+     (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) || \
+     __has_attribute (noreturn))
+#define NORETURN_ATTRIBUTE __attribute__ ((noreturn))
+#else
+#define NORETURN_ATTRIBUTE
+#endif
+#endif
+
 #endif