From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Thomas Huth <thuth@redhat.com>, Cornelia Huck <cohuck@redhat.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, 03 May 2021 06:56:24 +0200 [thread overview]
Message-ID: <87v980fm9z.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <04140977-282c-2579-3073-42b6bb4148ee@redhat.com> ("Philippe =?utf-8?Q?Mathieu-Daud=C3=A9=22's?= message of "Sun, 2 May 2021 20:57:02 +0200")
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> On 5/2/21 7:48 PM, Thomas Huth 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.
>
> Why not simply initialize the variable instead?
Because telling an optimizing compiler the truth is a good idea?
next prev parent reply other threads:[~2021-05-03 4:57 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 [this message]
2021-05-03 8:54 ` Cornelia Huck
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=87v980fm9z.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=philmd@redhat.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).