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
CONFIG_USER_ONLY are special, so we have to filter these out.
I have the impression that CONFIG_USER_ONLY should be poisoned too.
A lot of the
#ifndef CONFIG_USER_ONLY
end up currently doing the wrong thing in common modules includes,
especially due to the inverted nature of the check.