[PATCH] bulk: Remove unnecessary 'qemu/typedefs.h' include

Philippe Mathieu-Daudé posted 1 patch 5 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250707170904.2908-1-philmd@linaro.org
Maintainers: Song Gao <gaosong@loongson.cn>, Bibo Mao <maobibo@loongson.cn>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Alex Williamson <alex.williamson@redhat.com>, "Cédric Le Goater" <clg@redhat.com>, Stefan Weil <sw@weilnetz.de>
hw/vfio/vfio-migration-internal.h | 1 -
include/system/os-win32.h         | 1 -
hw/intc/loongarch_extioi_kvm.c    | 1 -
3 files changed, 3 deletions(-)
[PATCH] bulk: Remove unnecessary 'qemu/typedefs.h' include
Posted by Philippe Mathieu-Daudé 5 months, 1 week ago
"qemu/typedefs.h" is already included by "qemu/osdep.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/vfio/vfio-migration-internal.h | 1 -
 include/system/os-win32.h         | 1 -
 hw/intc/loongarch_extioi_kvm.c    | 1 -
 3 files changed, 3 deletions(-)

diff --git a/hw/vfio/vfio-migration-internal.h b/hw/vfio/vfio-migration-internal.h
index a8b456b239d..00e2badd889 100644
--- a/hw/vfio/vfio-migration-internal.h
+++ b/hw/vfio/vfio-migration-internal.h
@@ -13,7 +13,6 @@
 #include <linux/vfio.h>
 #endif
 
-#include "qemu/typedefs.h"
 #include "qemu/notify.h"
 
 /*
diff --git a/include/system/os-win32.h b/include/system/os-win32.h
index 3aa6cee4c23..662cfabc5e7 100644
--- a/include/system/os-win32.h
+++ b/include/system/os-win32.h
@@ -29,7 +29,6 @@
 #include <winsock2.h>
 #include <windows.h>
 #include <ws2tcpip.h>
-#include "qemu/typedefs.h"
 
 #ifdef HAVE_AFUNIX_H
 #include <afunix.h>
diff --git a/hw/intc/loongarch_extioi_kvm.c b/hw/intc/loongarch_extioi_kvm.c
index 0133540c45d..aa2e8c753fb 100644
--- a/hw/intc/loongarch_extioi_kvm.c
+++ b/hw/intc/loongarch_extioi_kvm.c
@@ -6,7 +6,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu/typedefs.h"
 #include "hw/intc/loongarch_extioi.h"
 #include "linux/kvm.h"
 #include "qapi/error.h"
-- 
2.49.0


Re: [PATCH] bulk: Remove unnecessary 'qemu/typedefs.h' include
Posted by Philippe Mathieu-Daudé 5 months, 1 week ago
On 7/7/25 19:09, Philippe Mathieu-Daudé wrote:
> "qemu/typedefs.h" is already included by "qemu/osdep.h".
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/vfio/vfio-migration-internal.h | 1 -
>   include/system/os-win32.h         | 1 -
>   hw/intc/loongarch_extioi_kvm.c    | 1 -
>   3 files changed, 3 deletions(-)


> diff --git a/include/system/os-win32.h b/include/system/os-win32.h
> index 3aa6cee4c23..662cfabc5e7 100644
> --- a/include/system/os-win32.h
> +++ b/include/system/os-win32.h
> @@ -29,7 +29,6 @@
>   #include <winsock2.h>
>   #include <windows.h>
>   #include <ws2tcpip.h>
> -#include "qemu/typedefs.h"
This one was introduced in commit f5fd677ae7c ("win32/socket: introduce
qemu_socket_select() helper") for Error type, but files including this
header should already include "qemu/osdep.h".

Re: [PATCH] bulk: Remove unnecessary 'qemu/typedefs.h' include
Posted by Peter Maydell 5 months, 1 week ago
On Mon, 7 Jul 2025 at 18:14, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> "qemu/typedefs.h" is already included by "qemu/osdep.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/vfio/vfio-migration-internal.h | 1 -
>  include/system/os-win32.h         | 1 -
>  hw/intc/loongarch_extioi_kvm.c    | 1 -
>  3 files changed, 3 deletions(-)

> diff --git a/include/system/os-win32.h b/include/system/os-win32.h
> index 3aa6cee4c23..662cfabc5e7 100644
> --- a/include/system/os-win32.h
> +++ b/include/system/os-win32.h
> @@ -29,7 +29,6 @@
>  #include <winsock2.h>
>  #include <windows.h>
>  #include <ws2tcpip.h>
> -#include "qemu/typedefs.h"
>
>  #ifdef HAVE_AFUNIX_H
>  #include <afunix.h>

This one's tricky -- osdep.h includes system/os-win32.h
*before* it includes typedefs.h. If you want to remove this
include I think you need to move the include of typedefs.h
a bit further up in osdep.h (taking care that it's still
wrapped in an "extern C").

(Or we could declare the functions in os-win32.h which
use the Error type somewhere else. That header I think is
intended to be "Windows specifics and compatibility wrappers
that everywhere needs to have sorted out", not "this
function happens to only be needed on Windows": a lot
of the functions declared in it are only used in a
handful of files and don't need to be declared to every
source file in the project. But that's a bit more effort.)

The other two changes here are fine.

thanks
-- PMM