All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/plugin/syscall.c: fix compiler warnings
@ 2021-11-28  1:15 Juro Bystricky
  2021-11-29 12:58 ` Alex Bennée
  0 siblings, 1 reply; 5+ messages in thread
From: Juro Bystricky @ 2021-11-28  1:15 UTC (permalink / raw)
  To: qemu-trivial; +Cc: jurobystricky, erdnaxe, ma.mandourr, alex.bennee, qemu-devel

Fix compiler warnings. The warnings can result in a broken build.
This patch fixes warnings such as:

In file included from /usr/include/glib-2.0/glib.h:111,
                 from ../tests/plugin/syscall.c:13:
../tests/plugin/syscall.c: In function ‘print_entry’:
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘out’ may be
       used uninitialized in this function [-Werror=maybe-uninitialized]
   g_free (*pp);
   ^~~~~~~~~~~~
../tests/plugin/syscall.c:82:23: note: ‘out’ was declared here
     g_autofree gchar *out;
                       ^~~
In file included from /usr/include/glib-2.0/glib.h:111,
                 from ../tests/plugin/syscall.c:13:
../tests/plugin/syscall.c: In function ‘vcpu_syscall_ret’:
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘out’ may be
        used uninitialized in this function [-Werror=maybe-uninitialized]
   g_free (*pp);
   ^~~~~~~~~~~~
../tests/plugin/syscall.c:73:27: note: ‘out’ was declared here
         g_autofree gchar *out;
                           ^~~
cc1: all warnings being treated as errors

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
---
 tests/plugin/syscall.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/plugin/syscall.c b/tests/plugin/syscall.c
index 484b48de49..96040c578f 100644
--- a/tests/plugin/syscall.c
+++ b/tests/plugin/syscall.c
@@ -70,19 +70,17 @@ static void vcpu_syscall_ret(qemu_plugin_id_t id, unsigned int vcpu_idx,
         }
         g_mutex_unlock(&lock);
     } else {
-        g_autofree gchar *out;
-        out = g_strdup_printf("syscall #%" PRIi64 " returned -> %" PRIi64 "\n",
-                num, ret);
+        g_autofree gchar *out = g_strdup_printf(
+             "syscall #%" PRIi64 " returned -> %" PRIi64 "\n", num, ret);
         qemu_plugin_outs(out);
     }
 }
 
 static void print_entry(gpointer val, gpointer user_data)
 {
-    g_autofree gchar *out;
     SyscallStats *entry = (SyscallStats *) val;
     int64_t syscall_num = entry->num;
-    out = g_strdup_printf(
+    g_autofree gchar *out = g_strdup_printf(
         "%-13" PRIi64 "%-6" PRIi64 " %" PRIi64 "\n",
         syscall_num, entry->calls, entry->errors);
     qemu_plugin_outs(out);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tests/plugin/syscall.c: fix compiler warnings
  2021-11-28  1:15 [PATCH] tests/plugin/syscall.c: fix compiler warnings Juro Bystricky
@ 2021-11-29 12:58 ` Alex Bennée
  2021-12-02 10:39   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Bennée @ 2021-11-29 12:58 UTC (permalink / raw)
  To: Juro Bystricky
  Cc: qemu-trivial, erdnaxe, ma.mandourr, qemu-devel, jurobystricky


Juro Bystricky <juro.bystricky@intel.com> writes:

> Fix compiler warnings. The warnings can result in a broken build.
> This patch fixes warnings such as:

Queued to for-6.2/more-misc-fixes, thanks.

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tests/plugin/syscall.c: fix compiler warnings
  2021-11-29 12:58 ` Alex Bennée
@ 2021-12-02 10:39   ` Philippe Mathieu-Daudé
  2021-12-02 11:08     ` Alex Bennée
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-02 10:39 UTC (permalink / raw)
  To: Alex Bennée, Juro Bystricky
  Cc: qemu-trivial, erdnaxe, ma.mandourr, qemu-devel, jurobystricky

On 11/29/21 13:58, Alex Bennée wrote:
> 
> Juro Bystricky <juro.bystricky@intel.com> writes:
> 
>> Fix compiler warnings. The warnings can result in a broken build.
>> This patch fixes warnings such as:
> 
> Queued to for-6.2/more-misc-fixes, thanks.

I wondered if this single patch would justify delaying the 6.2
release by one week, but then I noticed the IDE pull request,
so let it be...

Note, -Werror=maybe-uninitialized forces an ugly alignment style
to the g_autofree + g_strdup_printf() combination.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tests/plugin/syscall.c: fix compiler warnings
  2021-12-02 10:39   ` Philippe Mathieu-Daudé
@ 2021-12-02 11:08     ` Alex Bennée
  2021-12-02 17:42       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Bennée @ 2021-12-02 11:08 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Juro Bystricky, qemu-trivial, qemu-devel, erdnaxe, ma.mandourr,
	jurobystricky


Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> On 11/29/21 13:58, Alex Bennée wrote:
>> 
>> Juro Bystricky <juro.bystricky@intel.com> writes:
>> 
>>> Fix compiler warnings. The warnings can result in a broken build.
>>> This patch fixes warnings such as:
>> 
>> Queued to for-6.2/more-misc-fixes, thanks.
>
> I wondered if this single patch would justify delaying the 6.2
> release by one week, but then I noticed the IDE pull request,
> so let it be...

Already in - as I had a PR in flight ;-)

>
> Note, -Werror=maybe-uninitialized forces an ugly alignment style
> to the g_autofree + g_strdup_printf() combination.
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Thanks anyway.


-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tests/plugin/syscall.c: fix compiler warnings
  2021-12-02 11:08     ` Alex Bennée
@ 2021-12-02 17:42       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-02 17:42 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Juro Bystricky, qemu-trivial, qemu-devel, erdnaxe, ma.mandourr,
	jurobystricky

On 12/2/21 12:08, Alex Bennée wrote:
> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
>> On 11/29/21 13:58, Alex Bennée wrote:
>>>
>>> Juro Bystricky <juro.bystricky@intel.com> writes:
>>>
>>>> Fix compiler warnings. The warnings can result in a broken build.
>>>> This patch fixes warnings such as:
>>>
>>> Queued to for-6.2/more-misc-fixes, thanks.
>>
>> I wondered if this single patch would justify delaying the 6.2
>> release by one week, but then I noticed the IDE pull request,
>> so let it be...
> 
> Already in - as I had a PR in flight ;-)

Oops, mails out of sync...


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-02 17:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-28  1:15 [PATCH] tests/plugin/syscall.c: fix compiler warnings Juro Bystricky
2021-11-29 12:58 ` Alex Bennée
2021-12-02 10:39   ` Philippe Mathieu-Daudé
2021-12-02 11:08     ` Alex Bennée
2021-12-02 17:42       ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.