How to reproduce it?
===
```
$ ./configure --disable-spice --disable-vte --disable-vnc \
--disable-vnc-jpeg --disable-vnc-png --disable-vnc-sasl
$ make
...
monitor/hmp-cmds.c: In function ‘hmp_change’:
monitor/hmp-cmds.c:1985:17: error: unused variable ‘hmp_mon’
[-Werror=unused-variable]
MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
```
Fix
===
Move `hmp_mon` variable within the `CONFIG_VNC` block
Signed-off-by: Julio Montes <[email protected]>
---
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 9de35387c3..5ed564683e 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1982,7 +1982,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");
@@ -1991,6 +1990,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.17.2