Re: [kvm-unit-tests PATCH 2/2] Makefile: add "cxx-option" for C++ builds

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

 



On 07/11/2019 02.08, Bill Wendling wrote:
> The C++ compiler may not support all of the same flags as the C
> compiler. Add a separate test for these flags.
> 
> Signed-off-by: Bill Wendling <morbo@xxxxxxxxxx>
> ---
>  Makefile | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 4c716da..9cb47e6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -48,6 +48,8 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile
>  
>  cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
>                > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
> +cxx-option = $(shell if $(CXX) -Werror $(1) -S -o /dev/null -xc++ /dev/null \
> +              > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
>  
>  COMMON_CFLAGS += -g $(autodepend-flags)
>  COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
> @@ -62,8 +64,6 @@ fno_pic := $(call cc-option, -fno-pic, "")
>  no_pie := $(call cc-option, -no-pie, "")
>  wclobbered := $(call cc-option, -Wclobbered, "")
>  wunused_but_set_parameter := $(call cc-option, -Wunused-but-set-parameter, "")
> -wmissing_parameter_type := $(call cc-option, -Wmissing-parameter-type, "")
> -wold_style_declaration := $(call cc-option, -Wold-style-declaration, "")
>  
>  COMMON_CFLAGS += $(fomit_frame_pointer)
>  COMMON_CFLAGS += $(fno_stack_protector)
> @@ -75,11 +75,19 @@ COMMON_CFLAGS += $(wclobbered)
>  COMMON_CFLAGS += $(wunused_but_set_parameter)
>  
>  CFLAGS += $(COMMON_CFLAGS)
> +CXXFLAGS += $(COMMON_CFLAGS)
> +
> +wmissing_parameter_type := $(call cc-option, -Wmissing-parameter-type, "")
> +wold_style_declaration := $(call cc-option, -Wold-style-declaration, "")
>  CFLAGS += $(wmissing_parameter_type)
>  CFLAGS += $(wold_style_declaration)
>  CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes
>  
> -CXXFLAGS += $(COMMON_CFLAGS)
> +# Clang's C++ compiler doesn't support some of the flags its C compiler does.
> +wmissing_parameter_type := $(call cxx-option, -Wmissing-parameter-type, "")
> +wold_style_declaration := $(call cxx-option, -Wold-style-declaration, "")
> +CXXFLAGS += $(wmissing_parameter_type)
> +CXXFLAGS += $(wold_style_declaration)

As mentioned in my mail to the previous version of this patch: I think
both options are not valid with g++ as well, so I think this patch
should simply be dropped.

 Thomas





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux