[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fwd: [PATCH v5 01/18] ui: avoid compiler warnings from unused clipboard
From: |
Thomas Huth |
Subject: |
Fwd: [PATCH v5 01/18] ui: avoid compiler warnings from unused clipboard info variable |
Date: |
Fri, 21 Jan 2022 09:06:18 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 |
Hi,
I think this might be a good candiate for the 6.2.1 stable release later...
(people already ran into this issue and reported it in the bug tracker, see
https://gitlab.com/qemu-project/qemu/-/issues/831 ).
Thomas
-------- Forwarded Message --------
Subject: [PATCH v5 01/18] ui: avoid compiler warnings from unused clipboard
info variable
Date: Wed, 15 Dec 2021 14:19:32 +0000
From: Daniel P. Berrangé <berrange@redhat.com>
To: qemu-devel@nongnu.org
CC: Thomas Huth <thuth@redhat.com>, Fam Zheng <fam@euphon.net>, Willian
Rampazzo <willianr@redhat.com>, Peter Maydell <peter.maydell@linaro.org>,
Beraldo Leal <bleal@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Philippe
Mathieu-Daudé <philmd@redhat.com>, Alex Bennée <alex.bennee@linaro.org>,
Philippe Mathieu-Daudé <f4bug@amsat.org>, Wainer dos Santos Moschetta
<wainersm@redhat.com>, Daniel P. Berrangé <berrange@redhat.com>, Richard
Henderson <richard.henderson@linaro.org>
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.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Fwd: [PATCH v5 01/18] ui: avoid compiler warnings from unused clipboard info variable,
Thomas Huth <=