]> git.notmuchmail.org Git - notmuch/blobdiff - compat/function-attributes.h
Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE
[notmuch] / 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