From f26539089727fe664cf94354492fc0654497f964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 11 Aug 2021 11:05:31 +0100 Subject: [PATCH] Fix build with newer glib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- ...nings-from-use-of-G_GNUC_FALLTHROUGH.patch | 72 +++++++++++++++++++ virt-viewer.spec | 8 ++- 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 0001-src-avoid-warnings-from-use-of-G_GNUC_FALLTHROUGH.patch diff --git a/0001-src-avoid-warnings-from-use-of-G_GNUC_FALLTHROUGH.patch b/0001-src-avoid-warnings-from-use-of-G_GNUC_FALLTHROUGH.patch new file mode 100644 index 0000000..8494406 --- /dev/null +++ b/0001-src-avoid-warnings-from-use-of-G_GNUC_FALLTHROUGH.patch @@ -0,0 +1,72 @@ +From 2e6adf9b85cee3b85a9f7da8d976f3dd022afaa3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Tue, 27 Jul 2021 16:25:12 +0100 +Subject: [PATCH] src: avoid warnings from use of G_GNUC_FALLTHROUGH +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since glib >= 2.69 we get warnings: + +../src/ovirt-foreign-menu.c: In function 'ovirt_foreign_menu_next_async_step': +../src/ovirt-foreign-menu.c:319:13: error: Not available before 2.60 [-Werror] + 319 | G_GNUC_FALLTHROUGH; + | ^~~~~~~~~~~~~~~ +../src/ovirt-foreign-menu.c:345:13: error: Not available before 2.60 [-Werror] + 345 | G_GNUC_FALLTHROUGH; + | ^~~~~~~~~~~~~~~ +../src/ovirt-foreign-menu.c:351:13: error: Not available before 2.60 [-Werror] + 351 | G_GNUC_FALLTHROUGH; + | ^~~~~~~~~~~~~~~ +../src/ovirt-foreign-menu.c:357:13: error: Not available before 2.60 [-Werror] + 357 | G_GNUC_FALLTHROUGH; + | ^~~~~~~~~~~~~~~ +cc1: all warnings being treated as errors + +GLib is right to warn about this, since it does not know that we +provided our own back-compat definition of the macro. For now we have to +temporarily purge glib's macro entirely in order to get rid of the +warning that is bogus for our usage. + +Signed-off-by: Daniel P. Berrangé +--- + src/ovirt-foreign-menu.c | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c +index c19e913..91b6824 100644 +--- a/src/ovirt-foreign-menu.c ++++ b/src/ovirt-foreign-menu.c +@@ -31,12 +31,23 @@ + #include "virt-viewer-util.h" + #include "glib-compat.h" + +-#if !GLIB_CHECK_VERSION(2, 60, 0) +-# if __GNUC_PREREQ (7, 0) +-# define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) +-# else +-# define G_GNUC_FALLTHROUGH do {} while(0) +-# endif ++/* GLib 2.69 annotated macros with version tags, and ++ * since we set GLIB_VERSION_MAX_ALLOWED to 2.48 ++ * it complains if we use G_GNUC_FALLTHROUGH at ++ * all. We temporarily purge the GLib definition ++ * of G_GNUC_FALLTHROUGH and define it ourselves. ++ * When we set min glib >= 2.60, we can delete ++ * all this ++ */ ++#ifndef __GNUC_PREREQ ++# define __GNUC_PREREQ(maj, min) \ ++ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) ++#endif ++#undef G_GNUC_FALLTHROUGH ++#if __GNUC_PREREQ (7, 0) ++# define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) ++#else ++# define G_GNUC_FALLTHROUGH do {} while(0) + #endif + + typedef enum { +-- +2.31.1 + diff --git a/virt-viewer.spec b/virt-viewer.spec index 9885675..cdc7425 100644 --- a/virt-viewer.spec +++ b/virt-viewer.spec @@ -10,11 +10,12 @@ Name: virt-viewer Version: 10.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Virtual Machine Viewer License: GPLv2+ URL: https://gitlab.com/virt-viewer/virt-viewer Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.xz +Patch1: 0001-src-avoid-warnings-from-use-of-G_GNUC_FALLTHROUGH.patch Requires: openssh-clients BuildRequires: gcc @@ -45,7 +46,7 @@ to virtual machines. It uses the GTK-VNC or SPICE-GTK widgets to provide the display, and libvirt for looking up VNC/SPICE server details. %prep -%setup -q +%autosetup -p1 %build %if !%{with_govirt} @@ -77,6 +78,9 @@ the display, and libvirt for looking up VNC/SPICE server details. %{_datadir}/bash-completion/completions/virt-viewer %changelog +* Wed Aug 11 2021 Daniel P. Berrangé - 10.0-4 +- Fix build with newer glib (rhbz#1988037) + * Fri Jul 23 2021 Fedora Release Engineering - 10.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild