diff mbox series

[v3,06/12] gdbstub: fix compiler complaining

Message ID 20200403191150.863-7-alex.bennee@linaro.org
State Superseded
Headers show
Series a selection of random fixes | expand

Commit Message

Alex Bennée April 3, 2020, 7:11 p.m. UTC
From: Denis Plotnikov <dplotnikov@virtuozzo.com>


    ./gdbstub.c: In function ‘handle_query_thread_extra’:
        /usr/include/glib-2.0/glib/glib-autocleanups.h:28:10:
    error: ‘cpu_name’ may be used uninitialized in this function
    [-Werror=maybe-uninitialized]
        g_free (*pp);
               ^
    ./gdbstub.c:2063:26: note: ‘cpu_name’ was declared here
        g_autofree char *cpu_name;
                         ^
    cc1: all warnings being treated as errors

Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>

Message-Id: <20200326151407.25046-1-dplotnikov@virtuozzo.com>
Reported-by: Euler Robot <euler.robot@huawei.com>
Reported-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

---
 gdbstub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Chenqun (kuhn) April 6, 2020, 10:21 a.m. UTC | #1
>-----Original Message-----

>From: Alex Bennée [mailto:alex.bennee@linaro.org]

>Sent: Saturday, April 4, 2020 3:12 AM

>To: qemu-devel@nongnu.org

>Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>; Euler Robot

><euler.robot@huawei.com>; Chenqun (kuhn) <kuhn.chenqun@huawei.com>;

>Richard Henderson <richard.henderson@linaro.org>; Alex Bennée

><alex.bennee@linaro.org>; Philippe Mathieu-Daudé <philmd@redhat.com>

>Subject: [PATCH v3 06/12] gdbstub: fix compiler complaining

>

>From: Denis Plotnikov <dplotnikov@virtuozzo.com>

>

>    ./gdbstub.c: In function ‘handle_query_thread_extra’:

>        /usr/include/glib-2.0/glib/glib-autocleanups.h:28:10:

>    error: ‘cpu_name’ may be used uninitialized in this function

>    [-Werror=maybe-uninitialized]

>        g_free (*pp);

>               ^

>    ./gdbstub.c:2063:26: note: ‘cpu_name’ was declared here

>        g_autofree char *cpu_name;

>                         ^

>    cc1: all warnings being treated as errors

>

>Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>

>Message-Id: <20200326151407.25046-1-dplotnikov@virtuozzo.com>

>Reported-by: Euler Robot <euler.robot@huawei.com>

>Reported-by: Chen Qun <kuhn.chenqun@huawei.com>

>Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

>Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>---

Add Miroslav Rezanina's  "Reviewed-by" tag.
https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg07651.html

Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>


Thanks.
> gdbstub.c | 4 ++--

> 1 file changed, 2 insertions(+), 2 deletions(-)

>

>diff --git a/gdbstub.c b/gdbstub.c

>index 013fb1ac0f1..171e1509509 100644

>--- a/gdbstub.c

>+++ b/gdbstub.c

>@@ -2060,8 +2060,8 @@ static void

>handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx)

>         /* Print the CPU model and name in multiprocess mode */

>         ObjectClass *oc = object_get_class(OBJECT(cpu));

>         const char *cpu_model = object_class_get_name(oc);

>-        g_autofree char *cpu_name;

>-        cpu_name  = object_get_canonical_path_component(OBJECT(cpu));

>+        g_autofree char *cpu_name =

>+            object_get_canonical_path_component(OBJECT(cpu));

>         g_string_printf(rs, "%s %s [%s]", cpu_model, cpu_name,

>                         cpu->halted ? "halted " : "running");

>     } else {

>--

>2.20.1
diff mbox series

Patch

diff --git a/gdbstub.c b/gdbstub.c
index 013fb1ac0f1..171e1509509 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2060,8 +2060,8 @@  static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx)
         /* Print the CPU model and name in multiprocess mode */
         ObjectClass *oc = object_get_class(OBJECT(cpu));
         const char *cpu_model = object_class_get_name(oc);
-        g_autofree char *cpu_name;
-        cpu_name  = object_get_canonical_path_component(OBJECT(cpu));
+        g_autofree char *cpu_name =
+            object_get_canonical_path_component(OBJECT(cpu));
         g_string_printf(rs, "%s %s [%s]", cpu_model, cpu_name,
                         cpu->halted ? "halted " : "running");
     } else {