diff mbox series

[v2,3/6] thread.h: Remove trailing semicolons from Coverity qemu_mutex_lock() etc

Message ID 20200319193323.2038-4-peter.maydell@linaro.org
State New
Headers show
Series Automation of Coverity Scan uploads (via Docker) | expand

Commit Message

Peter Maydell March 19, 2020, 7:33 p.m. UTC
All the Coverity-specific definitions of qemu_mutex_lock() and friends
have a trailing semicolon. This works fine almost everywhere because
of QEMU's mandatory-braces coding style and because most callsites are
simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as
an if() statement, which makes the ';' a syntax error:
"../target/s390x/sigp.c", line 461: warning #18: expected a ")"
      if (qemu_mutex_trylock(&qemu_sigp_mutex)) {
          ^

Remove the bogus semicolons from the macro definitions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/qemu/thread.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Richard Henderson March 20, 2020, 5:18 p.m. UTC | #1
On 3/19/20 12:33 PM, Peter Maydell wrote:
> All the Coverity-specific definitions of qemu_mutex_lock() and friends
> have a trailing semicolon. This works fine almost everywhere because
> of QEMU's mandatory-braces coding style and because most callsites are
> simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as
> an if() statement, which makes the ';' a syntax error:
> "../target/s390x/sigp.c", line 461: warning #18: expected a ")"
>       if (qemu_mutex_trylock(&qemu_sigp_mutex)) {
>           ^
> 
> Remove the bogus semicolons from the macro definitions.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  include/qemu/thread.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Philippe Mathieu-Daudé March 22, 2020, 10:41 a.m. UTC | #2
On 3/19/20 8:33 PM, Peter Maydell wrote:
> All the Coverity-specific definitions of qemu_mutex_lock() and friends
> have a trailing semicolon. This works fine almost everywhere because
> of QEMU's mandatory-braces coding style and because most callsites are
> simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as
> an if() statement, which makes the ';' a syntax error:
> "../target/s390x/sigp.c", line 461: warning #18: expected a ")"
>        if (qemu_mutex_trylock(&qemu_sigp_mutex)) {
>            ^
> 
> Remove the bogus semicolons from the macro definitions.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   include/qemu/thread.h | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/include/qemu/thread.h b/include/qemu/thread.h
> index 10262c63f58..d22848138ea 100644
> --- a/include/qemu/thread.h
> +++ b/include/qemu/thread.h
> @@ -57,17 +57,17 @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func;
>    * hide them.
>    */
>   #define qemu_mutex_lock(m)                                              \
> -            qemu_mutex_lock_impl(m, __FILE__, __LINE__);
> +            qemu_mutex_lock_impl(m, __FILE__, __LINE__)
>   #define qemu_mutex_trylock(m)                                           \
> -            qemu_mutex_trylock_impl(m, __FILE__, __LINE__);
> +            qemu_mutex_trylock_impl(m, __FILE__, __LINE__)
>   #define qemu_rec_mutex_lock(m)                                          \
> -            qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__);
> +            qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__)
>   #define qemu_rec_mutex_trylock(m)                                       \
> -            qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__);
> +            qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__)
>   #define qemu_cond_wait(c, m)                                            \
> -            qemu_cond_wait_impl(c, m, __FILE__, __LINE__);
> +            qemu_cond_wait_impl(c, m, __FILE__, __LINE__)
>   #define qemu_cond_timedwait(c, m, ms)                                   \
> -            qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__);
> +            qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__)
>   #else
>   #define qemu_mutex_lock(m) ({                                           \
>               QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func);  \
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/include/qemu/thread.h b/include/qemu/thread.h
index 10262c63f58..d22848138ea 100644
--- a/include/qemu/thread.h
+++ b/include/qemu/thread.h
@@ -57,17 +57,17 @@  extern QemuCondTimedWaitFunc qemu_cond_timedwait_func;
  * hide them.
  */
 #define qemu_mutex_lock(m)                                              \
-            qemu_mutex_lock_impl(m, __FILE__, __LINE__);
+            qemu_mutex_lock_impl(m, __FILE__, __LINE__)
 #define qemu_mutex_trylock(m)                                           \
-            qemu_mutex_trylock_impl(m, __FILE__, __LINE__);
+            qemu_mutex_trylock_impl(m, __FILE__, __LINE__)
 #define qemu_rec_mutex_lock(m)                                          \
-            qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__);
+            qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__)
 #define qemu_rec_mutex_trylock(m)                                       \
-            qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__);
+            qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__)
 #define qemu_cond_wait(c, m)                                            \
-            qemu_cond_wait_impl(c, m, __FILE__, __LINE__);
+            qemu_cond_wait_impl(c, m, __FILE__, __LINE__)
 #define qemu_cond_timedwait(c, m, ms)                                   \
-            qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__);
+            qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__)
 #else
 #define qemu_mutex_lock(m) ({                                           \
             QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func);  \