summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-02-06 14:54:53 +0100
committerStef Walter <stefw@gnome.org>2013-02-06 14:54:53 +0100
commit2e8ce8c5ecb6d1f1c8f0af244d9f9b75dc6050ea (patch)
treed2845092b66331b9bdc54dd619bb6291fb4cea75 /common
parent0c6517104d1306228c31e596b0df6a4fb5af4dd1 (diff)
Fix various clang analyzer warnings
* Add annotations to our precondition functions so that they don't make the analyzer complain
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"))