summaryrefslogtreecommitdiff
path: root/lib/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compiler.h')
-rw-r--r--lib/compiler.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compiler.h b/lib/compiler.h
index 29fcfbefbf..ce6727685f 100644
--- a/lib/compiler.h
+++ b/lib/compiler.h
@@ -122,6 +122,14 @@ extern "C" {
#define assume(x)
#endif
+#ifdef __COVERITY__
+/* __coverity_panic__() is named a bit poorly, it's essentially the same as
+ * __builtin_unreachable(). Used to eliminate false positives.
+ */
+#undef assume
+#define assume(x) do { if (!(x)) __coverity_panic__(); } while (0)
+#endif
+
/* for helper functions defined inside macros */
#define macro_inline static inline __attribute__((unused))
#define macro_pure static inline __attribute__((unused, pure))