]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Remove over-cleverness from our coverity BUG() definition.
authorNick Mathewson <nickm@torproject.org>
Fri, 20 Jul 2018 15:18:11 +0000 (11:18 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 20 Jul 2018 15:19:54 +0000 (11:19 -0400)
Our previous definition implied that code would never keep running
if a BUG occurred (which it does), and that BUG(x) might be true
even if x was false (which it can't be).

Closes ticket 26890. Bugfix on 0.3.1.4-alpha.

src/lib/log/util_bug.c
src/lib/log/util_bug.h

index 42b3670a712833f5ad42da8caf93367bf1ca8b81..b23f4edc97cc2b304e67747c749ebaa23d565e74 100644 (file)
 
 #include <string.h>
 
-#ifdef __COVERITY__
-int bug_macro_deadcode_dummy__ = 0;
-#endif
-
 #ifdef TOR_UNIT_TESTS
 static void (*failed_assertion_cb)(void) = NULL;
 static int n_bugs_to_capture = 0;
index 61ee60f72957df03af926b336f5124a1418e881a..2ef5be8d3fc0d6c9e0a69c6818ffd56681566552 100644 (file)
  */
 
 #ifdef __COVERITY__
-extern int bug_macro_deadcode_dummy__;
 #undef BUG
 // Coverity defines this in global headers; let's override it.  This is a
 // magic coverity-only preprocessor thing.
 // We use this "deadcode_dummy__" trick to prevent coverity from
 // complaining about unreachable bug cases.
-#nodef BUG(x) ((x)?(__coverity_panic__(),1):(0+bug_macro_deadcode_dummy__))
+#nodef BUG(x) (x)
 #endif /* defined(__COVERITY__) */
 
 #if defined(__COVERITY__) || defined(__clang_analyzer__)