diff options
author | Adrian Reber <areber@redhat.com> | 2020-10-13 09:17:32 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2021-09-03 20:31:00 +0300 |
commit | ee048e14898b41afeec8710e40283e5b4d32ee2f (patch) | |
tree | 4e5194002e0c77f0c18435ddfc26e7b51e31e67c /include | |
parent | 70c8c12c6406e5d63c3441edc7ffe47a4a3867fc (diff) |
lock: disable clang_analyzer for the LOCK_BUG_ON() macro
The clang analyzer, scan-build, cannot correctly handle the
LOCK_BUG_ON() macro. At multiple places there is the following warning:
Error: CLANG_WARNING:
criu/pie/restorer.c:1221:4: warning: Dereference of null pointer
include/common/lock.h:14:35: note: expanded from macro 'LOCK_BUG_ON'
*(volatile unsigned long *)NULL = 0xdead0000 + __LINE__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
This just disable the clang analyzer for the LOCK_BUG_ON() macro.
Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/common/lock.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/common/lock.h b/include/common/lock.h index 4782b638f..6baece25f 100644 --- a/include/common/lock.h +++ b/include/common/lock.h @@ -9,10 +9,13 @@ #include "common/asm/atomic.h" #include "common/compiler.h" +/* scan-build complains about derefencing a NULL pointer here. */ +#ifndef __clang_analyzer__ #define LOCK_BUG_ON(condition) \ if ((condition)) \ *(volatile unsigned long *)NULL = 0xdead0000 + __LINE__ #define LOCK_BUG() LOCK_BUG_ON(1) +#endif /* __clang_analyzer__ */ #ifdef CR_NOGLIBC # include <compel/plugins/std/syscall.h> |