aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-08-24 17:08:09 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-02 18:47:55 +0200
commit07d66672e7035dd24dbe8ee009847a8ceae1178d (patch)
treeabb41a1e7f7415694635c90e06893dc423b06d8d /include
parent2d1df8591022737b8ef19d681ff74eda389f5198 (diff)
qsp: hide indirect function calls from Coverity
Coverity does not see anymore that qemu_mutex_lock is taking a lock. Hide all the QSP magic so that static analysis works again. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/thread.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/qemu/thread.h b/include/qemu/thread.h
index dacebcfff0..b2661b6672 100644
--- a/include/qemu/thread.h
+++ b/include/qemu/thread.h
@@ -48,6 +48,22 @@ extern QemuCondWaitFunc qemu_cond_wait_func;
#define qemu_mutex_trylock__raw(m) \
qemu_mutex_trylock_impl(m, __FILE__, __LINE__)
+#ifdef __COVERITY__
+/*
+ * Coverity is severely confused by the indirect function calls,
+ * hide them.
+ */
+#define qemu_mutex_lock(m) \
+ qemu_mutex_lock_impl(m, __FILE__, __LINE__);
+#define qemu_mutex_trylock(m) \
+ qemu_mutex_trylock_impl(m, __FILE__, __LINE__);
+#define qemu_rec_mutex_lock(m) \
+ qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__);
+#define qemu_rec_mutex_trylock(m) \
+ qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__);
+#define qemu_cond_wait(c, m) \
+ qemu_cond_wait_impl(c, m, __FILE__, __LINE__);
+#else
#define qemu_mutex_lock(m) ({ \
QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \
_f(m, __FILE__, __LINE__); \
@@ -73,6 +89,7 @@ extern QemuCondWaitFunc qemu_cond_wait_func;
QemuCondWaitFunc _f = atomic_read(&qemu_cond_wait_func); \
_f(c, m, __FILE__, __LINE__); \
})
+#endif
#define qemu_mutex_unlock(mutex) \
qemu_mutex_unlock_impl(mutex, __FILE__, __LINE__)