summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/compat.h13
-rw-r--r--common/debug.h3
2 files changed, 15 insertions, 1 deletions
diff --git a/common/compat.h b/common/compat.h
index 7f848d2..5bcdfe2 100644
--- a/common/compat.h
+++ b/common/compat.h
@@ -51,6 +51,19 @@
#define GNUC_NULL_TERMINATED
#endif
+/* For detecting clang features */
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+
+#ifndef CLANG_ANALYZER_NORETURN
+#if __has_feature(attribute_analyzer_noreturn)
+#define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
+#else
+#define CLANG_ANALYZER_NORETURN
+#endif
+#endif
+
#ifndef HAVE_GETPROGNAME
const char * getprogname (void);
#endif
diff --git a/common/debug.h b/common/debug.h
index ff2af0f..eb2afa9 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -55,7 +55,8 @@ void p11_debug_message (int flag,
...) GNUC_PRINTF (2, 3);
void p11_debug_precond (const char *format,
- ...) GNUC_PRINTF (1, 2);
+ ...) GNUC_PRINTF (1, 2)
+ CLANG_ANALYZER_NORETURN;
#define assert_not_reached() \
(assert (false && "this code should not be reached"))