]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
util_bug.h: Coccinelle does not understand IF_BUG_ONCE or #nodef.
authorNick Mathewson <nickm@torproject.org>
Wed, 9 Oct 2019 17:07:15 +0000 (13:07 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 22 Oct 2019 13:32:13 +0000 (09:32 -0400)
src/lib/log/util_bug.h

index 546ae1e3ef127c32f5b866c9b4e6187a8c748faf..8c233da7356db3457c0283df377a56a806c2f1e8 100644 (file)
 #undef BUG
 // Coverity defines this in global headers; let's override it.  This is a
 // magic coverity-only preprocessor thing.
+#ifndef COCCI
 #nodef BUG(x) (x)
+#endif
 #endif /* defined(__COVERITY__) */
 
 #if defined(__COVERITY__) || defined(__clang_analyzer__)
    : 0)
 #endif /* defined(ALL_BUGS_ARE_FATAL) || ... */
 
+#ifndef COCCI
 #ifdef __GNUC__
 #define IF_BUG_ONCE__(cond,var)                                         \
   if (( {                                                               \
       if (bool_result && !var) {                                        \
         var = 1;                                                        \
         tor_bug_occurred_(SHORT_FILE__, __LINE__, __func__,             \
-                          "!("#cond")", 1, NULL);                       \
+                          ("!("#cond")"), 1, NULL);                     \
       }                                                                 \
       bool_result; } ))
 #else /* !(defined(__GNUC__)) */
       (var ? 1 :                                                        \
        (var=1,                                                          \
         tor_bug_occurred_(SHORT_FILE__, __LINE__, __func__,             \
-                           "!("#cond")", 1, NULL),                      \
+                          ("!("#cond")"), 1, NULL),                     \
         1))                                                             \
       : 0)
 #endif /* defined(__GNUC__) */
+#endif
+
 #define IF_BUG_ONCE_VARNAME_(a)               \
   warning_logged_on_ ## a ## __
 #define IF_BUG_ONCE_VARNAME__(a)              \