[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/4] pc-bios/s390-ccw: Silence warning from Clang by marking
From: |
Markus Armbruster |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
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?
- [PATCH 0/4] pc-bios/s390-ccw: Allow building with Clang, too, Thomas Huth, 2021/05/02
- [PATCH 2/4] pc-bios/s390-ccw: Fix the cc-option macro in the Makefile, Thomas Huth, 2021/05/02
- [PATCH 4/4] pc-bios/s390-ccw: Allow building with Clang, too, Thomas Huth, 2021/05/02
- Re: [PATCH 4/4] pc-bios/s390-ccw: Allow building with Clang, too, Philippe Mathieu-Daudé, 2021/05/02
- Re: [PATCH 4/4] pc-bios/s390-ccw: Allow building with Clang, too, Markus Armbruster, 2021/05/03
- Re: [PATCH 4/4] pc-bios/s390-ccw: Allow building with Clang, too, Thomas Huth, 2021/05/03
- Re: [PATCH 4/4] pc-bios/s390-ccw: Allow building with Clang, too, David Hildenbrand, 2021/05/03
- Re: [PATCH 4/4] pc-bios/s390-ccw: Allow building with Clang, too, Markus Armbruster, 2021/05/03
- Re: [PATCH 4/4] pc-bios/s390-ccw: Allow building with Clang, too, Cornelia Huck, 2021/05/03
- Re: [PATCH 4/4] pc-bios/s390-ccw: Allow building with Clang, too, David Hildenbrand, 2021/05/03