virtio-gpu: fix missing log.h include file
PATCH 1/1 virtio-gpu: fix missing log.h include file
The virtio-gpu.h file defines a macro VIRTIO_GPU_FILL_CMD which includes a call to qemu_log_mask, but does not include qemu/log.h. In a default configure, it is lucky and gets qemu/log.h indirectly due to the 'log' trace backend being enabled. If that trace backend is disabled though, eg
./configure --enable-trace-backends=nop
Then the build will fail:
In file included from /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:19:0:/home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c: In function ‘virgl_cmd_create_resource_2d’:/home/berrange/src/virt/qemu/include/hw/virtio/virtio-gpu.h:138:13: error: implicit declaration of function ‘qemu_log_mask’ [-Werror=implicit-function-declaration]
qemu_log_mask(LOG_GUEST_ERROR, \
^
/home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:34:5: note: in expansion of macro ‘VIRTIO_GPU_FILL_CMD’
VIRTIO_GPU_FILL_CMD(c2d);
^~~~~~~~~~~~~~~~~~~
/home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:34:5: error: nested extern declaration of ‘qemu_log_mask’ [-Werror=nested-externs]
In file included from /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:19:0:
/home/berrange/src/virt/qemu/include/hw/virtio/virtio-gpu.h:138:27: error: ‘LOG_GUEST_ERROR’ undeclared (first use in this function)
qemu_log_mask(LOG_GUEST_ERROR, \[snip many more errors]
--- include/hw/virtio/virtio-gpu.h | 1 + 1 file changed, 1 insertion(+)
include/hw/virtio/virtio-gpu.h +1 -0
@@ -19,6 +19,7 @@#include "ui/console.h" #include "hw/virtio/virtio.h" #include "hw/pci/pci.h" +#include "qemu/log.h" #include "standard-headers/linux/virtio_gpu.h" #define TYPE_VIRTIO_GPU "virtio-gpu-device"
Signature · 1 line
2.7.4
Peter Maydell
AppliedQuoted 24 lines · Daniel P. Berrange
The
virtio-gpu.hfile defines a macroVIRTIO_GPU_FILL_CMDwhich includes a call toqemu_log_mask, but does not includeqemu/log.h. In a default configure, it is lucky and getsqemu/log.hindirectly due to the 'log' trace backend being enabled. If that trace backend is disabled though, eg./configure --enable-trace-backends=nop
Then the build will fail:
In file included from
/home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:19:0:/home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c: In function ‘virgl_cmd_create_resource_2d’:/home/berrange/src/virt/qemu/include/hw/virtio/virtio-gpu.h:138:13: error: implicit declaration of function ‘qemu_log_mask’ [-Werror=implicit-function-declaration]qemu_log_mask(LOG_GUEST_ERROR, \ ^ /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:34:5: note: in expansion of macro ‘VIRTIO_GPU_FILL_CMD’ VIRTIO_GPU_FILL_CMD(c2d); ^~~~~~~~~~~~~~~~~~~ /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:34:5: error: nested extern declaration of ‘qemu_log_mask’ [-Werror=nested-externs] In file included from /home/berrange/src/virt/qemu/hw/display/virtio-gpu-3d.c:19:0: /home/berrange/src/virt/qemu/include/hw/virtio/virtio-gpu.h:138:27: error: ‘LOG_GUEST_ERROR’ undeclared (first use in this function) qemu_log_mask(LOG_GUEST_ERROR, \
Quoted 3 lines
[snip many more errors]
Signed-off-by Daniel P. Berrange <[email protected]>
Applied, thanks.
-- PMM