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

Philippe Mathieu-Daudé posted 3 patches 4 months, 1 week ago
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>
[PATCH v2 3/3] system/os-win32: Remove unnecessary 'qemu/typedefs.h' include
Posted by Philippe Mathieu-Daudé 4 months, 1 week ago
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".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/system/os-win32.h | 1 -
 1 file changed, 1 deletion(-)

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>
-- 
2.49.0


Re: [PATCH v2 3/3] system/os-win32: Remove unnecessary 'qemu/typedefs.h' include
Posted by Philippe Mathieu-Daudé 4 months, 1 week ago
On 8/7/25 10:58, Philippe Mathieu-Daudé wrote:
> 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".
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/system/os-win32.h | 1 -
>   1 file changed, 1 deletion(-)
> 
> 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"

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

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


Re: [PATCH v2 3/3] system/os-win32: Remove unnecessary 'qemu/typedefs.h' include
Posted by Philippe Mathieu-Daudé 4 months, 1 week ago
On 8/7/25 22:53, Philippe Mathieu-Daudé wrote:
> On 8/7/25 10:58, Philippe Mathieu-Daudé wrote:
>> 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".
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   include/system/os-win32.h | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> 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"
> 
> FTR, copying Peter's comment on v1:
> http://lore.kernel.org/qemu-devel/ 
> CAFEAcA9rcJHBaeAqCM1BszrhzkE4=gxJkx9h62BVhEz9hB7OMA@mail.gmail.com
> 
>  > 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.