summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-07-26 12:58:17 -0400
committerNick Mathewson <nickm@torproject.org>2017-07-26 12:58:17 -0400
commit0117e2ea0dc09408e2fbc7224e335968af009874 (patch)
treec5c862b812f6d91116159101de9eabd8e79bee21
parent6d3c5b8fb5784240232a9265049b9e1660270df7 (diff)
parent32b9edeb91a7d9b9752083622d1ce400f45e42ea (diff)
downloadtor-0117e2ea0dc09408e2fbc7224e335968af009874.tar.gz
tor-0117e2ea0dc09408e2fbc7224e335968af009874.zip
Merge branch 'bug23030_029_v2' into maint-0.2.9
-rw-r--r--changes/bug23030_0297
-rw-r--r--src/common/util_bug.h13
2 files changed, 20 insertions, 0 deletions
diff --git a/changes/bug23030_029 b/changes/bug23030_029
new file mode 100644
index 0000000000..89a1b507d7
--- /dev/null
+++ b/changes/bug23030_029
@@ -0,0 +1,7 @@
+ o Minor bugfixes (coverity builds):
+ - Avoid Coverity build warnings related to our BUG() macro. By
+ default, Coverity treats BUG() as the Linux kernel does: an
+ instant abort(). We need to override that so our BUG() macro
+ doesn't prevent Coverity from analyzing functions that use it.
+ Fixes bug 23030; bugfix on 0.2.9.1-alpha.
+
diff --git a/src/common/util_bug.h b/src/common/util_bug.h
index e02778110b..0695806911 100644
--- a/src/common/util_bug.h
+++ b/src/common/util_bug.h
@@ -58,6 +58,19 @@
* return -1;
*/
+#ifdef __COVERITY__
+#undef BUG
+// Coverity defines this in global headers; let's override it. This is a
+// magic coverity-only preprocessor thing.
+#nodef BUG(x) ((x)?(__coverity_panic__(),1):0)
+#endif
+
+#if defined(__COVERITY__) || defined(__clang_analyzer__)
+// We're running with a static analysis tool: let's treat even nonfatal
+// assertion failures as something that we need to avoid.
+#define ALL_BUGS_ARE_FATAL
+#endif
+
#ifdef ALL_BUGS_ARE_FATAL
#define tor_assert_nonfatal_unreached() tor_assert(0)
#define tor_assert_nonfatal(cond) tor_assert((cond))