All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] qemu/thread: Mark qemu_thread_exit() with 'noreturn' attribute
@ 2020-06-01  9:38 Philippe Mathieu-Daudé
  2020-06-01 16:28 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-01  9:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Richard Henderson, Philippe Mathieu-Daudé

After upgrading to Ubuntu 20.04 LTS, GCC 9.3 complains:

  util/qemu-thread-posix.c: In function ‘qemu_thread_exit’:
  util/qemu-thread-posix.c:577:6: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
    577 | void qemu_thread_exit(void *retval)
        |      ^~~~~~~~~~~~~~~~

Fix by marking the qemu_thread_exit function with QEMU_NORETURN
to set the 'noreturn' attribute.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
RFC because I'm not sure the error is correct, or we should
simply ignore it by default with -Wno-suggest-attribute=noreturn.
---
 include/qemu/thread.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/qemu/thread.h b/include/qemu/thread.h
index d22848138e..06c058fb58 100644
--- a/include/qemu/thread.h
+++ b/include/qemu/thread.h
@@ -177,7 +177,7 @@ void qemu_thread_create(QemuThread *thread, const char *name,
 void *qemu_thread_join(QemuThread *thread);
 void qemu_thread_get_self(QemuThread *thread);
 bool qemu_thread_is_self(QemuThread *thread);
-void qemu_thread_exit(void *retval);
+void qemu_thread_exit(void *retval) QEMU_NORETURN;
 void qemu_thread_naming(bool enable);
 
 struct Notifier;
-- 
2.21.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] qemu/thread: Mark qemu_thread_exit() with 'noreturn' attribute
  2020-06-01  9:38 [RFC PATCH] qemu/thread: Mark qemu_thread_exit() with 'noreturn' attribute Philippe Mathieu-Daudé
@ 2020-06-01 16:28 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-06-01 16:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Richard Henderson

On 01/06/20 11:38, Philippe Mathieu-Daudé wrote:
> After upgrading to Ubuntu 20.04 LTS, GCC 9.3 complains:
> 
>   util/qemu-thread-posix.c: In function ‘qemu_thread_exit’:
>   util/qemu-thread-posix.c:577:6: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
>     577 | void qemu_thread_exit(void *retval)
>         |      ^~~~~~~~~~~~~~~~
> 
> Fix by marking the qemu_thread_exit function with QEMU_NORETURN
> to set the 'noreturn' attribute.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> RFC because I'm not sure the error is correct, or we should
> simply ignore it by default with -Wno-suggest-attribute=noreturn.
> ---
>  include/qemu/thread.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/qemu/thread.h b/include/qemu/thread.h
> index d22848138e..06c058fb58 100644
> --- a/include/qemu/thread.h
> +++ b/include/qemu/thread.h
> @@ -177,7 +177,7 @@ void qemu_thread_create(QemuThread *thread, const char *name,
>  void *qemu_thread_join(QemuThread *thread);
>  void qemu_thread_get_self(QemuThread *thread);
>  bool qemu_thread_is_self(QemuThread *thread);
> -void qemu_thread_exit(void *retval);
> +void qemu_thread_exit(void *retval) QEMU_NORETURN;
>  void qemu_thread_naming(bool enable);
>  
>  struct Notifier;
> 

Yes, it's correct.  Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-01 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01  9:38 [RFC PATCH] qemu/thread: Mark qemu_thread_exit() with 'noreturn' attribute Philippe Mathieu-Daudé
2020-06-01 16:28 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.