yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-pc-bios-s390-ccw-Silence-warning-from-Clang-by-marki.patch

a83cc2
From 12acb42f2e6317a530fa01b5cf55a199231bfdce Mon Sep 17 00:00:00 2001
a83cc2
From: Thomas Huth <thuth@redhat.com>
a83cc2
Date: Sun, 2 May 2021 13:49:20 +0200
a83cc2
Subject: [PATCH 31/39] pc-bios/s390-ccw: Silence warning from Clang by marking
a83cc2
 panic() as noreturn
a83cc2
MIME-Version: 1.0
a83cc2
Content-Type: text/plain; charset=UTF-8
a83cc2
Content-Transfer-Encoding: 8bit
a83cc2
a83cc2
RH-Author: Jon Maloy <jmaloy@redhat.com>
a83cc2
RH-MergeRequest: 24: v7:  Add support for building qemu-kvm with clang and safe-stack
a83cc2
RH-Commit: [4/11] 806b776bf01b733e04664534641cf89d1cb48f1b (jmaloy/qemu-kvm-centos-jon)
a83cc2
RH-Bugzilla: 1939509 1940132
a83cc2
RH-Acked-by: Danilo Cesar Lemes de Paula <ddepaula@redhat.com>
a83cc2
RH-Acked-by: Thomas Huth <thuth@redhat.com>
a83cc2
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
a83cc2
a83cc2
When compiling the s390-ccw bios with Clang, the compiler emits a warning:
a83cc2
a83cc2
 pc-bios/s390-ccw/main.c:210:5: warning: variable 'found' is used uninitialized
a83cc2
  whenever switch default is taken [-Wsometimes-uninitialized]
a83cc2
     default:
a83cc2
     ^~~~~~~
a83cc2
 pc-bios/s390-ccw/main.c:214:16: note: uninitialized use occurs here
a83cc2
     IPL_assert(found, "Boot device not found\n");
a83cc2
                ^~~~~
a83cc2
a83cc2
It's a false positive, it only happens because Clang is not smart enough
a83cc2
to see that the panic() function in the "default:" case can never return.
a83cc2
a83cc2
Anyway, let's explicitely mark panic() with "noreturn" to shut up the
a83cc2
warning.
a83cc2
a83cc2
Message-Id: <20210502174836.838816-2-thuth@redhat.com>
a83cc2
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
a83cc2
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
a83cc2
Signed-off-by: Thomas Huth <thuth@redhat.com>
a83cc2
(cherry picked from commit 679196a646c91b8ce9a97b0aa81ffb3776cf8046)
a83cc2
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
a83cc2
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
a83cc2
---
a83cc2
 pc-bios/s390-ccw/s390-ccw.h | 1 +
a83cc2
 1 file changed, 1 insertion(+)
a83cc2
a83cc2
diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
a83cc2
index 6cd92669e9..79db69ff54 100644
a83cc2
--- a/pc-bios/s390-ccw/s390-ccw.h
a83cc2
+++ b/pc-bios/s390-ccw/s390-ccw.h
a83cc2
@@ -89,6 +89,7 @@ bool menu_is_enabled_enum(void);
a83cc2
 
a83cc2
 #define MAX_BOOT_ENTRIES  31
a83cc2
 
a83cc2
+__attribute__ ((__noreturn__))
a83cc2
 static inline void panic(const char *string)
a83cc2
 {
a83cc2
     sclp_print(string);
a83cc2
-- 
a83cc2
2.27.0
a83cc2