* [PATCH 0/2 for 6.2] Fix compiler warnings on Fedora 35 / CLang @ 2021-11-23 13:43 Daniel P. Berrangé 2021-11-23 13:43 ` [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable Daniel P. Berrangé 2021-11-23 13:43 ` [PATCH 2/2] spice: Update QXLInterface for spice >= 0.15.0 Daniel P. Berrangé 0 siblings, 2 replies; 8+ messages in thread From: Daniel P. Berrangé @ 2021-11-23 13:43 UTC (permalink / raw) To: qemu-devel; +Cc: Daniel P. Berrangé, Gerd Hoffmann Current QEMU git master caused compiler warnings on Fedora 35 when using CLang. It is expected to affect any distro with CLang >= 13.0.0 Since QEMU builds with -Werror by default we should fix these warnings before release, as this version of QEMU will increasing trigger the warnings as more distros pull in CLang >= 13.0.0 The spice patch was from John's series at https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg01056.html I pulled out this patch on its own as the above series isn't likely suitable for merging as a whole during freeze. The clipboard patch is an alternative impl to what John posted. Daniel P. Berrangé (1): ui: avoid compiler warnings from unused clipboard info variable John Snow (1): spice: Update QXLInterface for spice >= 0.15.0 hw/display/qxl.c | 14 +++++++++++++- include/ui/qemu-spice.h | 6 ++++++ ui/clipboard.c | 3 +-- ui/spice-display.c | 11 +++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) -- 2.33.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable 2021-11-23 13:43 [PATCH 0/2 for 6.2] Fix compiler warnings on Fedora 35 / CLang Daniel P. Berrangé @ 2021-11-23 13:43 ` Daniel P. Berrangé 2021-11-23 13:50 ` Richard Henderson ` (2 more replies) 2021-11-23 13:43 ` [PATCH 2/2] spice: Update QXLInterface for spice >= 0.15.0 Daniel P. Berrangé 1 sibling, 3 replies; 8+ messages in thread From: Daniel P. Berrangé @ 2021-11-23 13:43 UTC (permalink / raw) To: qemu-devel; +Cc: Daniel P. Berrangé, Gerd Hoffmann With latest clang 13.0.0 we get ../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable] g_autoptr(QemuClipboardInfo) old = NULL; ^ The compiler can't tell that we only declared this variable in order to get the side effect of free'ing it when out of scope. This pattern is a little dubious for a use of g_autoptr, so rewrite the code to avoid it. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- ui/clipboard.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ui/clipboard.c b/ui/clipboard.c index d7b008d62a..7672058e84 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -44,12 +44,11 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer, void qemu_clipboard_update(QemuClipboardInfo *info) { - g_autoptr(QemuClipboardInfo) old = NULL; assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT); notifier_list_notify(&clipboard_notifiers, info); - old = cbinfo[info->selection]; + qemu_clipboard_info_unref(cbinfo[info->selection]); cbinfo[info->selection] = qemu_clipboard_info_ref(info); } -- 2.33.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable 2021-11-23 13:43 ` [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable Daniel P. Berrangé @ 2021-11-23 13:50 ` Richard Henderson 2021-11-23 13:59 ` Philippe Mathieu-Daudé 2021-11-24 13:04 ` Philippe Mathieu-Daudé 2 siblings, 0 replies; 8+ messages in thread From: Richard Henderson @ 2021-11-23 13:50 UTC (permalink / raw) To: Daniel P. Berrangé, qemu-devel; +Cc: Gerd Hoffmann On 11/23/21 2:43 PM, Daniel P. Berrangé wrote: > With latest clang 13.0.0 we get > > ../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable] > g_autoptr(QemuClipboardInfo) old = NULL; > ^ > > The compiler can't tell that we only declared this variable in > order to get the side effect of free'ing it when out of scope. > > This pattern is a little dubious for a use of g_autoptr, so > rewrite the code to avoid it. > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> > --- > ui/clipboard.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~ > > diff --git a/ui/clipboard.c b/ui/clipboard.c > index d7b008d62a..7672058e84 100644 > --- a/ui/clipboard.c > +++ b/ui/clipboard.c > @@ -44,12 +44,11 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer, > > void qemu_clipboard_update(QemuClipboardInfo *info) > { > - g_autoptr(QemuClipboardInfo) old = NULL; > assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT); > > notifier_list_notify(&clipboard_notifiers, info); > > - old = cbinfo[info->selection]; > + qemu_clipboard_info_unref(cbinfo[info->selection]); > cbinfo[info->selection] = qemu_clipboard_info_ref(info); > } > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable 2021-11-23 13:43 ` [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable Daniel P. Berrangé 2021-11-23 13:50 ` Richard Henderson @ 2021-11-23 13:59 ` Philippe Mathieu-Daudé 2021-11-24 13:04 ` Philippe Mathieu-Daudé 2 siblings, 0 replies; 8+ messages in thread From: Philippe Mathieu-Daudé @ 2021-11-23 13:59 UTC (permalink / raw) To: Daniel P. Berrangé, qemu-devel; +Cc: Gerd Hoffmann On 11/23/21 14:43, Daniel P. Berrangé wrote: > With latest clang 13.0.0 we get > > ../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable] > g_autoptr(QemuClipboardInfo) old = NULL; > ^ > > The compiler can't tell that we only declared this variable in > order to get the side effect of free'ing it when out of scope. > > This pattern is a little dubious for a use of g_autoptr, so > rewrite the code to avoid it. > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> > --- > ui/clipboard.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable 2021-11-23 13:43 ` [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable Daniel P. Berrangé 2021-11-23 13:50 ` Richard Henderson 2021-11-23 13:59 ` Philippe Mathieu-Daudé @ 2021-11-24 13:04 ` Philippe Mathieu-Daudé 2 siblings, 0 replies; 8+ messages in thread From: Philippe Mathieu-Daudé @ 2021-11-24 13:04 UTC (permalink / raw) To: Daniel P. Berrangé, qemu-devel; +Cc: Gerd Hoffmann On 11/23/21 14:43, Daniel P. Berrangé wrote: > With latest clang 13.0.0 we get > > ../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable] > g_autoptr(QemuClipboardInfo) old = NULL; > ^ > > The compiler can't tell that we only declared this variable in > order to get the side effect of free'ing it when out of scope. > > This pattern is a little dubious for a use of g_autoptr, so > rewrite the code to avoid it. > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> > --- > ui/clipboard.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] spice: Update QXLInterface for spice >= 0.15.0 2021-11-23 13:43 [PATCH 0/2 for 6.2] Fix compiler warnings on Fedora 35 / CLang Daniel P. Berrangé 2021-11-23 13:43 ` [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable Daniel P. Berrangé @ 2021-11-23 13:43 ` Daniel P. Berrangé 2021-11-23 13:49 ` Richard Henderson 2021-11-24 13:07 ` Philippe Mathieu-Daudé 1 sibling, 2 replies; 8+ messages in thread From: Daniel P. Berrangé @ 2021-11-23 13:43 UTC (permalink / raw) To: qemu-devel; +Cc: John Snow, Gerd Hoffmann From: John Snow <jsnow@redhat.com> spice updated the spelling (and arguments) of "attache_worker" in 0.15.0. Update QEMU to match, preventing -Wdeprecated-declarations compilations from reporting build errors. See also: https://gitlab.freedesktop.org/spice/spice/-/commit/974692bda1e77af92b71ed43b022439448492cb9 Signed-off-by: John Snow <jsnow@redhat.com> --- hw/display/qxl.c | 14 +++++++++++++- include/ui/qemu-spice.h | 6 ++++++ ui/spice-display.c | 11 +++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 29c80b4289..1da6703e44 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -517,13 +517,20 @@ static int qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext) /* spice display interface callbacks */ -static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker) +static void interface_attached_worker(QXLInstance *sin) { PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl); trace_qxl_interface_attach_worker(qxl->id); } +#if !(SPICE_HAS_ATTACHED_WORKER) +static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker) +{ + interface_attached_worker(sin); +} +#endif + static void interface_set_compression_level(QXLInstance *sin, int level) { PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl); @@ -1131,7 +1138,12 @@ static const QXLInterface qxl_interface = { .base.major_version = SPICE_INTERFACE_QXL_MAJOR, .base.minor_version = SPICE_INTERFACE_QXL_MINOR, +#if SPICE_HAS_ATTACHED_WORKER + .attached_worker = interface_attached_worker, +#else .attache_worker = interface_attach_worker, +#endif + .set_compression_level = interface_set_compression_level, #if SPICE_NEEDS_SET_MM_TIME .set_mm_time = interface_set_mm_time, diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h index 71ecd6cfd1..21fe195e18 100644 --- a/include/ui/qemu-spice.h +++ b/include/ui/qemu-spice.h @@ -40,6 +40,12 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port, #define SPICE_NEEDS_SET_MM_TIME 0 #endif +#if defined(SPICE_SERVER_VERSION) && (SPICE_SERVER_VERSION >= 0x000f00) +#define SPICE_HAS_ATTACHED_WORKER 1 +#else +#define SPICE_HAS_ATTACHED_WORKER 0 +#endif + #else /* CONFIG_SPICE */ #include "qemu/error-report.h" diff --git a/ui/spice-display.c b/ui/spice-display.c index f59c69882d..1a60cebb7d 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -500,10 +500,17 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd) /* spice display interface callbacks */ +#if SPICE_HAS_ATTACHED_WORKER +static void interface_attached_worker(QXLInstance *sin) +{ + /* nothing to do */ +} +#else static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker) { /* nothing to do */ } +#endif static void interface_set_compression_level(QXLInstance *sin, int level) { @@ -702,7 +709,11 @@ static const QXLInterface dpy_interface = { .base.major_version = SPICE_INTERFACE_QXL_MAJOR, .base.minor_version = SPICE_INTERFACE_QXL_MINOR, +#if SPICE_HAS_ATTACHED_WORKER + .attached_worker = interface_attached_worker, +#else .attache_worker = interface_attach_worker, +#endif .set_compression_level = interface_set_compression_level, #if SPICE_NEEDS_SET_MM_TIME .set_mm_time = interface_set_mm_time, -- 2.33.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] spice: Update QXLInterface for spice >= 0.15.0 2021-11-23 13:43 ` [PATCH 2/2] spice: Update QXLInterface for spice >= 0.15.0 Daniel P. Berrangé @ 2021-11-23 13:49 ` Richard Henderson 2021-11-24 13:07 ` Philippe Mathieu-Daudé 1 sibling, 0 replies; 8+ messages in thread From: Richard Henderson @ 2021-11-23 13:49 UTC (permalink / raw) To: Daniel P. Berrangé, qemu-devel; +Cc: John Snow, Gerd Hoffmann On 11/23/21 2:43 PM, Daniel P. Berrangé wrote: > From: John Snow <jsnow@redhat.com> > > spice updated the spelling (and arguments) of "attache_worker" in > 0.15.0. Update QEMU to match, preventing -Wdeprecated-declarations > compilations from reporting build errors. > > See also: > https://gitlab.freedesktop.org/spice/spice/-/commit/974692bda1e77af92b71ed43b022439448492cb9 > > Signed-off-by: John Snow <jsnow@redhat.com> > --- > hw/display/qxl.c | 14 +++++++++++++- > include/ui/qemu-spice.h | 6 ++++++ > ui/spice-display.c | 11 +++++++++++ > 3 files changed, 30 insertions(+), 1 deletion(-) Acked-by: Richard Henderson <richard.henderson@linaro.org> r~ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] spice: Update QXLInterface for spice >= 0.15.0 2021-11-23 13:43 ` [PATCH 2/2] spice: Update QXLInterface for spice >= 0.15.0 Daniel P. Berrangé 2021-11-23 13:49 ` Richard Henderson @ 2021-11-24 13:07 ` Philippe Mathieu-Daudé 1 sibling, 0 replies; 8+ messages in thread From: Philippe Mathieu-Daudé @ 2021-11-24 13:07 UTC (permalink / raw) To: Daniel P. Berrangé, qemu-devel; +Cc: John Snow, Gerd Hoffmann On 11/23/21 14:43, Daniel P. Berrangé wrote: > From: John Snow <jsnow@redhat.com> > > spice updated the spelling (and arguments) of "attache_worker" in > 0.15.0. Update QEMU to match, preventing -Wdeprecated-declarations > compilations from reporting build errors. > > See also: > https://gitlab.freedesktop.org/spice/spice/-/commit/974692bda1e77af92b71ed43b022439448492cb9 > > Signed-off-by: John Snow <jsnow@redhat.com> ?Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>? > --- > hw/display/qxl.c | 14 +++++++++++++- > include/ui/qemu-spice.h | 6 ++++++ > ui/spice-display.c | 11 +++++++++++ > 3 files changed, 30 insertions(+), 1 deletion(-) Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-11-24 13:43 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-11-23 13:43 [PATCH 0/2 for 6.2] Fix compiler warnings on Fedora 35 / CLang Daniel P. Berrangé 2021-11-23 13:43 ` [PATCH 1/2] ui: avoid compiler warnings from unused clipboard info variable Daniel P. Berrangé 2021-11-23 13:50 ` Richard Henderson 2021-11-23 13:59 ` Philippe Mathieu-Daudé 2021-11-24 13:04 ` Philippe Mathieu-Daudé 2021-11-23 13:43 ` [PATCH 2/2] spice: Update QXLInterface for spice >= 0.15.0 Daniel P. Berrangé 2021-11-23 13:49 ` Richard Henderson 2021-11-24 13:07 ` Philippe Mathieu-Daudé
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).