On Tue, Nov 16, 2021 at 11:51:16AM +0000, Peter Maydell wrote: > On Tue, 16 Nov 2021 at 09:38, Paolo Bonzini <pbonz...@redhat.com> wrote: > > > > Fix a bunch of incorrect conversions from configure to Meson, which result > > in different outcomes with --extra-cflags=-Werror. > > FWIW this still won't give the right answer for the 'struct iovec' > test if you include -Werror via --extra-cflags, because the > generated code trips over an "expression result unused" warning: > > > Running compile: > Working directory: > /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/meson-private/tmpeiz36t2n > Command line: clang-7 -m64 -mcx16 > /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/meson-private/tmpeiz36t2n/testfile.c > -o /mnt/nvmedis > k/linaro/qemu-from-laptop/qemu/build/arm-clang/meson-private/tmpeiz36t2n/output.obj > -c -fsanitize=undefined -fno-sanitize=shift-base -Werror -D_FI > LE_OFFSET_BITS=64 -O0 -Werror=implicit-function-declaration > -Werror=unknown-warning-option -Werror=unused-command-line-argument > -Werror=ignored-op > timization-argument -std=gnu11 > > Code: > #include <sys/uio.h> > void bar(void) { > sizeof(struct iovec); > }; > Compiler stdout: > > Compiler stderr: > > /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/meson-private/tmpeiz36t2n/testfile.c:3:13: > error: expression result unused [-Werror,-Wunused-value] > sizeof(struct iovec); > ^~~~~~~~~~~~~~~~~~~~ > 1 error generated. > > Checking for type "struct iovec" : NO > > > But maybe we should just explicitly reject -Werror in --extra-cflags...
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. I wonder if we need to exclusively use the 'c_args' parameter to library()/executable() and friends ? The downside is of course would be extra work to make sure we pass c_args in all the right places. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|