On 01/12/20 13:48, Philippe Mathieu-Daudé wrote:
Hi,
I rebased an old series I started more than 1 year ago and tried
to build it using '../configure --extra-cflags=-Wint-conversion'
but got:
cc1plus: error: command-line option ‘-Wint-conversion’ is valid for
C/ObjC but not for C++ [-Werror]
QEMU_CXXFLAGS are sanitized in update_cxxflags() but when linking
with the C++ linker the C specific flags are propagated via
QEMU_LDFLAGS:
--extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg"
;;
--extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
;;
--extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg"
EXTRA_LDFLAGS="$optarg"
Maybe the change comes from commit db5adeaa84d:
("build-sys: clean up flags included in the linker command line").
Any suggestion where to filter EXTRA_LDFLAGS for C++?
Should I add a filtered EXTRA_LDXXFLAGS (similar to QEMU_CXXFLAGS)?
EXTRA_LDFLAGS is only used in a special case for Xen, so you can ignore it.
configure already specifies $QEMU_CFLAGS or $QEMU_CXXFLAGS on the linker
command line. Therefore, you can remove the assignment to QEMU_LDFLAGS
from --extra-cflags=*.
Instead, in meson.build, you can use the link_language variable to add
one of QEMU_CFLAGS or QEMU_CXXFLAGS to the linker, just before the
existing call to add_project_link_arguments. It's assigned a bit later
but it's not an issue to pull the assignment earlier.
Paolo