[PATCH 1/7] meson: Use stddef.h instead of unistd.h

Kostiantyn Kostiuk posted 7 patches 1 week ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Kevin Wolf <kwolf@redhat.com>
There is a newer version of this series
[PATCH 1/7] meson: Use stddef.h instead of unistd.h
Posted by Kostiantyn Kostiuk 1 week ago
This is more cross-platform way.

Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index d7c4095b39..711dafa9ce 100644
--- a/meson.build
+++ b/meson.build
@@ -1060,7 +1060,7 @@ endif
 
 if not cc.compiles('''
   #include <glib.h>
-  #include <unistd.h>
+  #include <stddef.h>
 
   #define QEMU_BUILD_BUG_ON(x) \
   typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
-- 
2.52.0
Re: [PATCH 1/7] meson: Use stddef.h instead of unistd.h
Posted by Peter Maydell 1 week ago
On Thu, 26 Mar 2026 at 16:03, Kostiantyn Kostiuk <kkostiuk@redhat.com> wrote:
>
> This is more cross-platform way.
>
> Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index d7c4095b39..711dafa9ce 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1060,7 +1060,7 @@ endif
>
>  if not cc.compiles('''
>    #include <glib.h>
> -  #include <unistd.h>
> +  #include <stddef.h>

POSIX says stddef.h provides size_t, which is the only thing
we care about here. (But it also says that unistd.h provides
it, so your platform is broken.)

This is the kind of detail that should be in the commit message:
you need to explain why it is OK to make the change and why
the previous code is wrong.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Re: [PATCH 1/7] meson: Use stddef.h instead of unistd.h
Posted by Paolo Bonzini 6 days, 14 hours ago
Il gio 26 mar 2026, 17:34 Peter Maydell <peter.maydell@linaro.org> ha
scritto:

> POSIX says stddef.h provides size_t, which is the only thing
> we care about here. (But it also says that unistd.h provides
> it, so your platform is broken.)
>

It's not POSIX to begin with. :) There are other small differences between
MSVC and Mingw runtimes but the main one is exactly that it doesn't have
unistd.h at all.

Having taken a peek at the full set of changes needed to build qemu-ga with
MSVC runtime, most of them are cleanups like these ones that (review
comments aside) make sense on their own anyway. In some cases... a bit less.

Paolo

This is the kind of detail that should be in the commit message:
> you need to explain why it is OK to make the change and why
> the previous code is wrong.
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> thanks
> -- PMM
>
>