diff options
author | Emanuele Giuseppe Esposito <eesposit@redhat.com> | 2023-01-17 08:52:01 -0500 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-02-17 11:22:19 +0100 |
commit | deb9c2ad0b81ac25fa02935f28cabb9c6155f377 (patch) | |
tree | ce53d354617030913642842573d3ed1993ce2553 /util | |
parent | 6dffbe36af79e26a4d23f94a9a1c1201de99c261 (diff) | |
download | qemu-deb9c2ad0b81ac25fa02935f28cabb9c6155f377.zip qemu-deb9c2ad0b81ac25fa02935f28cabb9c6155f377.tar.gz qemu-deb9c2ad0b81ac25fa02935f28cabb9c6155f377.tar.bz2 |
util/qemu-thread-posix: use TSA_NO_TSA to suppress clang TSA warnings in FreeBSD
FreeBSD implements pthread headers using TSA (thread safety analysis)
annotations, therefore when an application is compiled with
-Wthread-safety there are some locking/annotation requirements that the
user of the pthread API has to follow.
This will also be the case in QEMU, since util/qemu-thread-posix.c uses
the pthread API. Therefore when building it with -Wthread-safety, the
compiler will throw warnings because the functions are not properly
annotated. We need TSA to be enabled because it ensures that the
critical sections of an annotated variable are properly locked.
In order to make the compiler happy and avoid adding all the necessary
macros to all callers (lock functions should use TSA_ACQUIRE, while
unlock TSA_RELEASE, and this applies to all users of pthread_mutex_lock
and pthread_mutex_unlock), simply use TSA_NO_TSA to supppress such
warnings.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Message-Id: <20230117135203.3049709-2-eesposit@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/qemu-thread-posix.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index bae938c..2dd1069 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -223,7 +223,7 @@ void qemu_cond_wait_impl(QemuCond *cond, QemuMutex *mutex, const char *file, con error_exit(err, __func__); } -static bool +static bool TSA_NO_TSA qemu_cond_timedwait_ts(QemuCond *cond, QemuMutex *mutex, struct timespec *ts, const char *file, const int line) { |