hw/arm/virt-acpi-build.c: Add missing header
PATCH 1/1 hw/arm/virt-acpi-build.c: Add missing header
virt-acpi-build.c uses warn_report. However, it doesn't include qemu/error-report.h directly, it include qemu/error-report.h via trace.h if we enable log trace backend. But if we disable the log trace backend (e.g., --enable-trace-backends=nop), then virt-acpi-build.c will not include qemu/error-report.h any more and it will lead to build errors. Include qemu/error-report.h directly in virt-acpi-build.c to avoid the errors.
--- hw/arm/virt-acpi-build.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/virt-acpi-build.c +1 -0
@@ -57,6 +57,7 @@#include "migration/vmstate.h" #include "hw/acpi/ghes.h" #include "hw/acpi/viot.h" +#include "qemu/error-report.h" #define ARM_SPI_BASE 32
Signature · 1 line
2.41.0
I'm not sure whether the error has already been fixed by others or not. If so, please just ignore this patch.
Quoted 25 lines · Peng Liang
virt-acpi-build.cuseswarn_report. However, it doesn't includeqemu/error-report.hdirectly, it includeqemu/error-report.hviatrace.hif we enable log trace backend. But if we disable the log trace backend (e.g., --enable-trace-backends=nop), thenvirt-acpi-build.cwill not includeqemu/error-report.hany more and it will lead to build errors. Includeqemu/error-report.hdirectly invirt-acpi-build.cto avoid the errors.Signed-off-by Peng Liang <[email protected]>--- hw/arm/virt-acpi-build.c | 1 + 1 file changed, 1 insertion(+)hw/arm/virt-acpi-build.c +1
-0@@ -57,6 +57,7 @@#include "migration/vmstate.h" #include "hw/acpi/ghes.h" #include "hw/acpi/viot.h" +#include "qemu/error-report.h" #define ARM_SPI_BASE 32
Quoted 11 lines · Peng Liang
virt-acpi-build.cuseswarn_report. However, it doesn't includeqemu/error-report.hdirectly, it includeqemu/error-report.hviatrace.hif we enable log trace backend. But if we disable the log trace backend (e.g., --enable-trace-backends=nop), thenvirt-acpi-build.cwill not includeqemu/error-report.hany more and it will lead to build errors. Includeqemu/error-report.hdirectly invirt-acpi-build.cto avoid the errors.
I am able to generate the following error on latest upstream QEMU:
../hw/arm/virt-acpi-build.c: In function ‘virt_acpi_build’:../hw/arm/virt-acpi-build.c:1045:9: error: implicit declaration of function ‘warn_report’ [-Werror=implicit-function-declaration]
1045 | warn_report("ACPI table size %u exceeds %d bytes,"
| ^~~~~~~~~~~
../hw/arm/virt-acpi-build.c:1045:9: error: nested extern declaration of ‘warn_report’ [-Werror=nested-externs]
../hw/arm/virt-acpi-build.c:1048:9: error: implicit declaration of function ‘error_printf’ [-Werror=implicit-function-declaration]
1048 | error_printf("Try removing CPUs, NUMA nodes, memory slots"
| ^~~~~~~~~~~~../hw/arm/virt-acpi-build.c:1048:9: error: nested extern declaration of ‘error_printf’ [-Werror=nested-externs]
Quoted 11 lines
Signed-off-by Peng Liang <[email protected]>---
hw/arm/virt-acpi-build.c| 1 +1 file changed, 1 insertion(+)hw/arm/virt-acpi-build.c +0
-0
hw/arm/virt-acpi-build.c line 60
Quoted 4 lines
hw/arm/virt-acpi-build.c +1
-0@@ -57,6 +57,7 @@#include "migration/vmstate.h" #include "hw/acpi/ghes.h" #include "hw/acpi/viot.h" +#include "qemu/error-report.h"
I would put this a little bit higher up right after “qemu/bitmap.h” , like :
hw/arm/virt-acpi-build.c +1 -0
@@ -29,6 +29,7 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/bitmap.h" +#include "qemu/error-report.h" #include "trace.h" #include "hw/core/cpu.h" #include "target/arm/cpu.h”
but other than that, your change does fix the build.
Hence, modulo the above,
Quoted 6 lines
hw/arm/virt-acpi-build.c +0
-0#define ARM_SPI_BASE 32Signature · 1 line
2.41.0
Quoted 8 lines · Peng Liang
virt-acpi-build.cuseswarn_report. However, it doesn't includeqemu/error-report.hdirectly, it includeqemu/error-report.hviatrace.hif we enable log trace backend. But if we disable the log trace backend (e.g., --enable-trace-backends=nop), thenvirt-acpi-build.cwill not includeqemu/error-report.hany more and it will lead to build errors. Includeqemu/error-report.hdirectly invirt-acpi-build.cto avoid the errors.
Quoted 4 lines
Signed-off-by Peng Liang <[email protected]>--- hw/arm/virt-acpi-build.c | 1 + 1 file changed, 1 insertion(+)
Michael Tokarev
AppliedQuoted 7 lines · Peng Liang
virt-acpi-build.cuseswarn_report. However, it doesn't includeqemu/error-report.hdirectly, it includeqemu/error-report.hviatrace.hif we enable log trace backend. But if we disable the log trace backend (e.g., --enable-trace-backends=nop), thenvirt-acpi-build.cwill not includeqemu/error-report.hany more and it will lead to build errors. Includeqemu/error-report.hdirectly invirt-acpi-build.cto avoid the errors.
Applied to my trivial-patches tree, moving it higher as suggested by Ani (to sort more alphabetically) and adding the Fixes: line as suggested by Philippe.
Thanks!
/mjt