Skip to contentSkip to conversation

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

PATCH Superseded Philippe Mathieu-Daudé 2 participants 3 messages Jul 7, 2025 – Jul 8, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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

---
 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(-)
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"
 
 /*
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>
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
#1 lore raw
Quoted 15 lines · Philippe Mathieu-Daudé

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

---
 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(-)
include/system/os-win32.h +0 -0
index 3aa6cee4c23..662cfabc5e7 100644

include/system/os-win32.h line 34

Quoted 7 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"
 
 #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

#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 15 lines · Philippe Mathieu-Daudé

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

---
  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(-)
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"

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