Skip to contentSkip to conversation

includes: Remove unnecessary 'qemu/typedefs.h' include

PATCH In review Philippe Mathieu-Daudé 2 participants 7 messages Jul 8, 2025 – Jul 15, 2025

lore
Share & tools
lore
#0 lore raw

v2 cover includes: Remove unnecessary 'qemu/typedefs.h' include

v2: Split as 1 patch per MAINTAINERS section.

Philippe Mathieu-Daudé (3):
hw/intc/loongarch_extioi: Remove unnecessary 'qemu/typedefs.h' include hw/vfio/vfio-migration: Remove unnecessary 'qemu/typedefs.h' include system/os-win32: Remove unnecessary 'qemu/typedefs.h' include

 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(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH v2 1/3 hw/intc/loongarch_extioi: Remove unnecessary 'qemu/typedefs.h' include

"qemu/typedefs.h" is already included by "qemu/osdep.h".

---
 hw/intc/loongarch_extioi_kvm.c | 1 -
 1 file changed, 1 deletion(-)
hw/intc/loongarch_extioi_kvm.c +0 -1
index 0133540c45d..aa2e8c753fb 100644
@@ -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"
Signature · 1 line
2.49.0
#2 lore raw

PATCH v2 2/3 hw/vfio/vfio-migration: Remove unnecessary 'qemu/typedefs.h' include

In reply to Philippe Mathieu-Daudé

"qemu/typedefs.h" is already included by "qemu/osdep.h".

---
 hw/vfio/vfio-migration-internal.h | 1 -
 1 file changed, 1 deletion(-)
hw/vfio/vfio-migration-internal.h +0 -1
index a8b456b239d..00e2badd889 100644
@@ -13,7 +13,6 @@
 #include <linux/vfio.h>
 #endif
 
-#include "qemu/typedefs.h"
 #include "qemu/notify.h"
 
 /*
Signature · 1 line
2.49.0
Reviewed-by on v2 2/3
#3 lore raw

Re: [PATCH v2 2/3] hw/vfio/vfio-migration: Remove unnecessary 'qemu/typedefs.h' include

Quoted 12 lines · Philippe Mathieu-Daudé

"qemu/typedefs.h" is already included by "qemu/osdep.h".

---
  hw/vfio/vfio-migration-internal.h | 1 -
  1 file changed, 1 deletion(-)
hw/vfio/vfio-migration-internal.h +0 -0
index a8b456b239d..00e2badd889 100644

hw/vfio/vfio-migration-internal.h line 18

Quoted 7 lines
hw/vfio/vfio-migration-internal.h +0 -1
@@ -13,7 +13,6 @@
  #include <linux/vfio.h>
  #endif
 
-#include "qemu/typedefs.h"
  #include "qemu/notify.h"
 
  /*

Thanks,

C.

#4 lore raw

PATCH v2 3/3 system/os-win32: Remove unnecessary 'qemu/typedefs.h' include

In reply to Philippe Mathieu-Daudé

Commit f5fd677ae7c ("win32/socket: introduce qemu_socket_select() helper") included the "qemu/typedefs.h" header for the Error type, but files including "system/os-win32.h" should already include "qemu/osdep.h", and thus "qemu/typedefs.h".

---
 include/system/os-win32.h | 1 -
 1 file changed, 1 deletion(-)
include/system/os-win32.h +0 -1
index 3aa6cee4c23..662cfabc5e7 100644
@@ -29,7 +29,6 @@
 #include <winsock2.h>
 #include <windows.h>
 #include <ws2tcpip.h>
-#include "qemu/typedefs.h"
 
 #ifdef HAVE_AFUNIX_H
 #include <afunix.h>
Signature · 1 line
2.49.0
#5 lore raw

Re: [PATCH v2 3/3] system/os-win32: Remove unnecessary 'qemu/typedefs.h' include

Quoted 15 lines · Philippe Mathieu-Daudé

Commit f5fd677ae7c ("win32/socket: introduce qemu_socket_select() helper") included the "qemu/typedefs.h" header for the Error type, but files including "system/os-win32.h" should already include "qemu/osdep.h", and thus "qemu/typedefs.h".

---
  include/system/os-win32.h | 1 -
  1 file changed, 1 deletion(-)
include/system/os-win32.h +0 -0
index 3aa6cee4c23..662cfabc5e7 100644

include/system/os-win32.h line 32

Quoted 4 lines
include/system/os-win32.h +0 -1
@@ -29,7 +29,6 @@
  #include <winsock2.h>
  #include <windows.h>
  #include <ws2tcpip.h>
-#include "qemu/typedefs.h"

FTR, copying Peter's comment on v1:
http://lore.kernel.org/qemu-devel/CAFEAcA9rcJHBaeAqCM1BszrhzkE4=gxJkx9h62BVhEz9hB7OMA@mail.gmail.com

Quoted 14 lines

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.)

#6 lore raw

Re: [PATCH v2 3/3] system/os-win32: Remove unnecessary 'qemu/typedefs.h' include

Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

Commit f5fd677ae7c ("win32/socket: introduce qemu_socket_select() helper") included the "qemu/typedefs.h" header for the Error type, but files including "system/os-win32.h" should already include "qemu/osdep.h", and thus "qemu/typedefs.h".

---
  include/system/os-win32.h | 1 -

  1 file changed, 1 deletion(-)
Quoted 27 lines

include/system/os-win32.h line 32

Quoted 9 lines
include/system/os-win32.h +0 -1
index 3aa6cee4c23..662cfabc5e7 100644
@@ -29,7 +29,6 @@
   #include <winsock2.h>
   #include <windows.h>
   #include <ws2tcpip.h>
-#include "qemu/typedefs.h"

FTR, copying Peter's comment on v1:
http://lore.kernel.org/qemu-devel/ CAFEAcA9rcJHBaeAqCM1BszrhzkE4=gxJkx9h62BVhEz9hB7OMA@mail.gmail.com

Quoted 14 lines

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.)

Amusingly qemu_socket_[un]select() are always called with Error=NULL.