On Thu, 22 Jan 2026 at 09:44, Daniel P. Berrangé <[email protected]> wrote:
>
> On Thu, Jan 22, 2026 at 09:37:37AM +0000, Peter Maydell wrote:
> > On Thu, 22 Jan 2026 at 09:30, Daniel P. Berrangé <[email protected]> 
> > wrote:
> > >
> > > On Thu, Jan 22, 2026 at 10:03:52AM +0100, Thomas Huth wrote:
> > > > From: Thomas Huth <[email protected]>
> > > >
> > > > We stopped supported 32-bit Windows hosts a while ago already, so
> > > > let's rename CONFIG_WIN32 to CONFIG_WIN64 now to make it clear
> > > > that this switch is not about 32-bit Windows anymore.
> > > >
> > > > The patch has been created with a simple sed statement:
> > > >
> > > >  sed -i s/CONFIG_WIN32/CONFIG_WIN64/g $(grep -rl CONFIG_WIN32 *)
> > > >
> > > > Signed-off-by: Thomas Huth <[email protected]>
> >
> > > > @@ -2422,7 +2422,7 @@ config_host_data.set('CONFIG_GCOV', 
> > > > get_option('b_coverage'))
> > > >  config_host_data.set('CONFIG_LIBUDEV', libudev.found())
> > > >  config_host_data.set('CONFIG_LINUX', host_os == 'linux')
> > > >  config_host_data.set('CONFIG_POSIX', host_os != 'windows')
> > > > -config_host_data.set('CONFIG_WIN32', host_os == 'windows')
> > > > +config_host_data.set('CONFIG_WIN64', host_os == 'windows')
> > >
> > > While relevant to qapi file conditions, from a C code pov all of these
> > > are redundant as the compiler has all these facts built-in
> > >
> > >   #ifdef CONFIG_LINUX =>    #ifdef __linux__
> > >   #ifdef CONFIG_POSIX =>    #if !defined(_WIN32)
> > >   #ifdef CONFIG_WIN32 =>    #ifdef _WIN32
> >
> > checkpatch will warn about use of __linux__, though, so
> > hopefully we don't get more of them in new code:
>
> I guess I'd ask why we consider __linux__ to be worse than CONFIG_LINUX ?
>
> Every contributor we know __linux__, but CONFIG_LINUX  needs QEMU specific
> knowledge. It feels like we should prefer the choice that everyone will know
> *provided* they're both functionally equivalent.

I guess my take would be that part of the reason for the warning
is to nudge people away from "just make it #ifdef linux" and
towards "make meson do a check for the existence of whatever
function or feature I care about, and then ifdef on that".

Also, I know that e.g. CONFIG_WIN32 is definitely going to be
checking the right thing and will have abstracted away any
odd complications in what to check. I don't know that and would
have to look it up for the things the compiler defines.
(For instance, can we just look at __APPLE__ for macos specific
code, or do we need to check __APPLE__ && __MACH__ ? Currently
we have examples of both in different places.)

thanks
-- PMM

Reply via email to