Skip to content

Commit

Permalink
pc-bios/s390-ccw: Silence warning from Clang by marking panic() as no…
Browse files Browse the repository at this point in the history
…return

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.

Message-Id: <20210502174836.838816-2-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
huth committed May 9, 2021
1 parent b460a22 commit 679196a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pc-bios/s390-ccw/s390-ccw.h
Expand Up @@ -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);
Expand Down

0 comments on commit 679196a

Please sign in to comment.