qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] configure: Poison (almost) all target-specific #defines


From: Peter Maydell
Subject: Re: [RFC PATCH] configure: Poison (almost) all target-specific #defines
Date: Mon, 15 Mar 2021 15:37:40 +0000

On Mon, 15 Mar 2021 at 15:26, Thomas Huth <thuth@redhat.com> wrote:
>
> On 15/03/2021 15.52, Philippe Mathieu-Daudé wrote:
> > On 3/15/21 2:54 PM, Thomas Huth wrote:
> >> We are generating a lot of target-specific defines in the 
> >> *-config-devices.h
> >> and *-config-target.h files. Using them in common code is wrong and leads
> >> to very subtle bugs since a "#ifdef CONFIG_SOMETHING" is not working there
> >> as expected. To avoid these issues, we are already poisoning some of the
> >> macros in include/exec/poison.h - but maintaining this list manually is
> >> cumbersome. Thus let's generate the list of poisoned macros automatically
> >> instead.
> >> Note that CONFIG_TCG (which is also defined in config-host.h) and
> >
> > IIRC we can't poison CONFIG_XEN / CONFIG_HAX because they are
> > pulled in via "sysemu/hw_accel.h".
>
> That's a good hint ... but I think it can be fixed with a patch like this:
>
> diff a/include/sysemu/hw_accel.h b/include/sysemu/hw_accel.h
> --- a/include/sysemu/hw_accel.h
> +++ b/include/sysemu/hw_accel.h
> @@ -12,19 +12,24 @@
>   #define QEMU_HW_ACCEL_H
>
>   #include "hw/core/cpu.h"
> +
> +#ifdef NEED_CPU_H
> +
>   #include "sysemu/hax.h"
>   #include "sysemu/kvm.h"
>   #include "sysemu/hvf.h"
>   #include "sysemu/whpx.h"

This doesn't look right, because sysemu/kvm.h itself contains
a NEED_CPU_H check, which implies that there are situations where
NEED_CPU_H is not defined and we need to pull in the header.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]