On 11/16/21 13:00, Daniel P. Berrangé wrote:
I wonder if the problem is more fundamental than that. Passing
stuff in --extra-cflags is done to influence the flags used to
compile the QEMU end user binaries. Unfortunately --extra-cflags
is also getting applied to all the meson.build feature checks.
IMHO we would get a more reliable result if the meson.build
checks were fully isolated from the cflags we used for building
everything else, so the checks get a well understood, predictable
environment.
IIUC, this current behaviour is a result of us adding cflags
using add_global_arguments / add_project_arguments.
No, it's not using add_global_arguments/add_project_arguments for
--extra-cflags.
The --extra-cflags (aka the CFLAGS envvar, or "meson setup -Dc_args") is
messy: on one hand it's kinda legacy (we have configure flags to set
-O2, -g, -Werror, etc.), on the other hand not really possible to kill
it because it's how distros expect to set flags such as -O2.
But it's full of pitfalls, and the only good use of it seems to be for
-I and -L flags. We already saw issues with it last week with distros
adding "-Wall" to CFLAGS or --extra-cflags and that gives you bogus
warnings. Unfortunately you certainly want flags such as -g to override
earlier flags, and you might even want -Wall to override earlier -Wno-*
flags *unless -Werror is in use*.
Apart from this, the sizeof() issue (which by the way I didn't see with
GCC) has to be fixed in Meson and is probably visible also in e.g.
has_members.
Paolo