[PATCH 1/2] hw/core/machine: Add missing 'units.h' and 'error-report.h' headers

Philippe Mathieu-Daudé posted 2 patches 1 month, 3 weeks ago
[PATCH 1/2] hw/core/machine: Add missing 'units.h' and 'error-report.h' headers
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
Include the missing "qemu/units.h" to fix when refactoring code:

  ../hw/core/machine.c:743:34: error: use of undeclared identifier 'MiB'
  743 |     mc->default_ram_size = 128 * MiB;
      |                                  ^
  ../hw/core/machine.c:750:44: error: use of undeclared identifier 'TiB'
  750 |     mc->smbios_memory_device_size = 2047 * TiB;
      |                                            ^

and "qemu/error-report.h" to fix:

  ../hw/core/machine.c:1029:13: error: call to undeclared function 'error_report' [-Wimplicit-function-declaration]
 1029 |             error_report("NUMA node %" PRIu16 " is missing, use "
      |             ^
  ../hw/core/machine.c:1240:9: error: call to undeclared function 'warn_report' [-Wimplicit-function-declaration]
 1240 |         warn_report("CPU model %s is deprecated -- %s",
      |         ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/core/machine.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index adaba17eba..94d3b11a53 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -11,10 +11,12 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "qemu/accel.h"
 #include "sysemu/replay.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
+#include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "qapi/qapi-visit-machine.h"
 #include "qemu/madvise.h"
-- 
2.45.2


Re: [PATCH 1/2] hw/core/machine: Add missing 'units.h' and 'error-report.h' headers
Posted by Zhao Liu 1 month, 2 weeks ago
On Tue, Oct 01, 2024 at 12:18:59AM +0200, Philippe Mathieu-Daudé wrote:
> Date: Tue,  1 Oct 2024 00:18:59 +0200
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 1/2] hw/core/machine: Add missing 'units.h' and
>  'error-report.h' headers
> X-Mailer: git-send-email 2.45.2
> 
> Include the missing "qemu/units.h" to fix when refactoring code:
> 
>   ../hw/core/machine.c:743:34: error: use of undeclared identifier 'MiB'
>   743 |     mc->default_ram_size = 128 * MiB;
>       |                                  ^
>   ../hw/core/machine.c:750:44: error: use of undeclared identifier 'TiB'
>   750 |     mc->smbios_memory_device_size = 2047 * TiB;
>       |                                            ^
> 
> and "qemu/error-report.h" to fix:
> 
>   ../hw/core/machine.c:1029:13: error: call to undeclared function 'error_report' [-Wimplicit-function-declaration]
>  1029 |             error_report("NUMA node %" PRIu16 " is missing, use "
>       |             ^
>   ../hw/core/machine.c:1240:9: error: call to undeclared function 'warn_report' [-Wimplicit-function-declaration]
>  1240 |         warn_report("CPU model %s is deprecated -- %s",
>       |         ^
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/core/machine.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>