qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix build error when VNC is configured out
@ 2019-06-25  9:24 Christophe de Dinechin
  2019-06-25 10:41 ` Markus Armbruster
  2019-06-25 11:00 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe de Dinechin @ 2019-06-25  9:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

In hmp_change(), the variable hmp_mon is only used
by code under #ifdef CONFIG_VNC. This results in a build
error when VNC is configured out with the default of
treating warnings as errors:

monitor/hmp-cmds.c: In function ‘hmp_change’:
monitor/hmp-cmds.c:1946:17: error: unused variable ‘hmp_mon’ [-Werror=unused-variable]
1946 |     MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
     |                 ^~~~~~~

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index c283dde0e9..038614da8e 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1943,7 +1943,6 @@ static void hmp_change_read_arg(void *opaque, const char *password,
 
 void hmp_change(Monitor *mon, const QDict *qdict)
 {
-    MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
     const char *device = qdict_get_str(qdict, "device");
     const char *target = qdict_get_str(qdict, "target");
     const char *arg = qdict_get_try_str(qdict, "arg");
@@ -1952,6 +1951,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
     Error *err = NULL;
 
 #ifdef CONFIG_VNC
+    MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
     if (strcmp(device, "vnc") == 0) {
         if (read_only) {
             monitor_printf(mon,
-- 
2.20.1 



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

* Re: [Qemu-devel] [PATCH] Fix build error when VNC is configured out
  2019-06-25  9:24 [Qemu-devel] [PATCH] Fix build error when VNC is configured out Christophe de Dinechin
@ 2019-06-25 10:41 ` Markus Armbruster
  2019-06-25 11:00 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2019-06-25 10:41 UTC (permalink / raw)
  To: Christophe de Dinechin; +Cc: Paolo Bonzini, qemu-devel, David Alan Gilbert

Cc: David Gilbert

Christophe de Dinechin <dinechin@redhat.com> writes:

> In hmp_change(), the variable hmp_mon is only used
> by code under #ifdef CONFIG_VNC. This results in a build
> error when VNC is configured out with the default of
> treating warnings as errors:
>
> monitor/hmp-cmds.c: In function ‘hmp_change’:
> monitor/hmp-cmds.c:1946:17: error: unused variable ‘hmp_mon’ [-Werror=unused-variable]
> 1946 |     MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
>      |                 ^~~~~~~
>
> Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
> ---
>  monitor/hmp-cmds.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index c283dde0e9..038614da8e 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -1943,7 +1943,6 @@ static void hmp_change_read_arg(void *opaque, const char *password,
>  
>  void hmp_change(Monitor *mon, const QDict *qdict)
>  {
> -    MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
>      const char *device = qdict_get_str(qdict, "device");
>      const char *target = qdict_get_str(qdict, "target");
>      const char *arg = qdict_get_try_str(qdict, "arg");
> @@ -1952,6 +1951,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
>      Error *err = NULL;
>  
>  #ifdef CONFIG_VNC
> +    MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
>      if (strcmp(device, "vnc") == 0) {
>          if (read_only) {
>              monitor_printf(mon,


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

* Re: [Qemu-devel] [PATCH] Fix build error when VNC is configured out
  2019-06-25  9:24 [Qemu-devel] [PATCH] Fix build error when VNC is configured out Christophe de Dinechin
  2019-06-25 10:41 ` Markus Armbruster
@ 2019-06-25 11:00 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-06-25 11:00 UTC (permalink / raw)
  To: Christophe de Dinechin, qemu-devel; +Cc: Paolo Bonzini

Hi Christophe,

On 6/25/19 11:24 AM, Christophe de Dinechin wrote:
> In hmp_change(), the variable hmp_mon is only used
> by code under #ifdef CONFIG_VNC. This results in a build
> error when VNC is configured out with the default of
> treating warnings as errors:
> 
> monitor/hmp-cmds.c: In function ‘hmp_change’:
> monitor/hmp-cmds.c:1946:17: error: unused variable ‘hmp_mon’ [-Werror=unused-variable]
> 1946 |     MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
>      |                 ^~~~~~~
> 
> Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
> ---
>  monitor/hmp-cmds.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index c283dde0e9..038614da8e 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -1943,7 +1943,6 @@ static void hmp_change_read_arg(void *opaque, const char *password,
>  
>  void hmp_change(Monitor *mon, const QDict *qdict)
>  {
> -    MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
>      const char *device = qdict_get_str(qdict, "device");
>      const char *target = qdict_get_str(qdict, "target");
>      const char *arg = qdict_get_try_str(qdict, "arg");
> @@ -1952,6 +1951,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
>      Error *err = NULL;
>  
>  #ifdef CONFIG_VNC
> +    MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);

Can you move it after 'if (!arg) {', the sole place where it is used?

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

>      if (strcmp(device, "vnc") == 0) {
>          if (read_only) {
>              monitor_printf(mon,
> 


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

end of thread, other threads:[~2019-06-25 11:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25  9:24 [Qemu-devel] [PATCH] Fix build error when VNC is configured out Christophe de Dinechin
2019-06-25 10:41 ` Markus Armbruster
2019-06-25 11:00 ` 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).