qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 1/4] pc-bios/s390-ccw: Silence warning from Clang by marking panic() as noreturn
Date: Mon, 3 May 2021 10:54:34 +0200	[thread overview]
Message-ID: <20210503105434.7168764d.cohuck@redhat.com> (raw)
In-Reply-To: <20210502174836.838816-2-thuth@redhat.com>

On Sun,  2 May 2021 19:48:33 +0200
Thomas Huth <thuth@redhat.com> wrote:

> When compiling the s390-ccw bios with Clang, the compiler emits a warning:
> 
>  pc-bios/s390-ccw/main.c:210:5: warning: variable 'found' is used uninitialized
>   whenever switch default is taken [-Wsometimes-uninitialized]
>      default:
>      ^~~~~~~
>  pc-bios/s390-ccw/main.c:214:16: note: uninitialized use occurs here
>      IPL_assert(found, "Boot device not found\n");
>                 ^~~~~
> 
> It's a false positive, it only happens because Clang is not smart enough
> to see that the panic() function in the "default:" case can never return.
> 
> Anyway, let's explicitely mark panic() with "noreturn" to shut up the
> warning.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  pc-bios/s390-ccw/s390-ccw.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
> index 6cd92669e9..79db69ff54 100644
> --- a/pc-bios/s390-ccw/s390-ccw.h
> +++ b/pc-bios/s390-ccw/s390-ccw.h
> @@ -89,6 +89,7 @@ bool menu_is_enabled_enum(void);
>  
>  #define MAX_BOOT_ENTRIES  31
>  
> +__attribute__ ((__noreturn__))
>  static inline void panic(const char *string)
>  {
>      sclp_print(string);

I'm surprised that the noreturn annotation of disabled_wait (called
right after the sclp_print()) is not enough. Anyway,

Reviewed-by: Cornelia Huck <cohuck@redhat.com>



  parent reply	other threads:[~2021-05-03  9:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-02 17:48 [PATCH 0/4] pc-bios/s390-ccw: Allow building with Clang, too Thomas Huth
2021-05-02 17:48 ` [PATCH 1/4] pc-bios/s390-ccw: Silence warning from Clang by marking panic() as noreturn Thomas Huth
2021-05-02 18:57   ` Philippe Mathieu-Daudé
2021-05-03  4:53     ` Thomas Huth
2021-05-03  7:40       ` Philippe Mathieu-Daudé
2021-05-03  4:56     ` Markus Armbruster
2021-05-03  8:54   ` Cornelia Huck [this message]
2021-05-02 17:48 ` [PATCH 2/4] pc-bios/s390-ccw: Fix the cc-option macro in the Makefile Thomas Huth
2021-05-02 17:48 ` [PATCH 3/4] pc-bios/s390-ccw: Silence GCC 11 stringop-overflow warning Thomas Huth
2021-05-03  9:00   ` Cornelia Huck
2021-05-03  9:30     ` Philippe Mathieu-Daudé
2021-05-03  9:31       ` Thomas Huth
2021-05-03  9:50         ` Philippe Mathieu-Daudé
2021-05-02 17:48 ` [PATCH 4/4] pc-bios/s390-ccw: Allow building with Clang, too Thomas Huth
2021-05-02 19:00   ` Philippe Mathieu-Daudé
2021-05-03  4:58   ` Markus Armbruster
2021-05-03  5:17     ` Thomas Huth
2021-05-03  8:10       ` David Hildenbrand
2021-05-03  8:23         ` Markus Armbruster
2021-05-03  9:14           ` Cornelia Huck
2021-05-03  9:17             ` David Hildenbrand
2021-05-03  9:23               ` Cornelia Huck
2021-05-03  9:31             ` Thomas Huth
2021-05-03  9:56               ` Cornelia Huck
2021-05-03 10:10               ` Christian Borntraeger
2021-05-03 10:00   ` Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210503105434.7168764d.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).