aboutsummaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorGravatar Justus Winter <4winter@informatik.uni-hamburg.de>2012-09-24 17:21:16 +0200
committerGravatar David Bremner <bremner@debian.org>2012-09-27 12:50:22 -0300
commit25d97b97914e2bddc1b1d82ac5ebbe8608ad8e74 (patch)
tree06aa8feb57533ac964f819722576a2f79db1e0ec /compat
parentda12807734cc90d8bf78ce5814636aaf5a18827b (diff)
Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE
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>
Diffstat (limited to 'compat')
-rw-r--r--compat/function-attributes.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/compat/function-attributes.h b/compat/function-attributes.h
index 18f90903..8450a17d 100644
--- a/compat/function-attributes.h
+++ b/compat/function-attributes.h
@@ -28,4 +28,20 @@
#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