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

Re: [Xen-devel] [PATCH] Config.mk: extend cc-option to consider exit status



>>> On 15.03.18 at 13:46, <wei.liu2@xxxxxxxxxx> wrote:
> Option like -Og produces something like
> 
>   cc1: error: argument to '-O' should be a non-negative integer
> 
> with a compiler that doesn't support it.
> 
> Grepping for the exact option wouldn't work. Extend cc-option to take
> into account the exit status of the test.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>

Taking on my reviewer's hat:

> --- a/Config.mk
> +++ b/Config.mk
> @@ -100,7 +100,7 @@ PYTHON_PREFIX_ARG ?= --prefix="$(prefix)"
>  #
>  # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
>  cc-option = $(shell if test -z "`echo 'void*p=1;' | \
> -              $(1) $(2) -S -o /dev/null -x c - 2>&1 | grep -- $(2) -`"; \
> +              { $(1) $(2) -S -o /dev/null -x c - 2>&1 || echo $(2); } | grep 
> -- $(2) -`"; \

I only now realize that compilers are permitted to actually error
on the construct being compiled (it just so happens that gcc as
an extension allows integral types be assigned to pointer type
variables). Hence at the very least you need to be certain (and
should say so in the description) that no compiler (version) we
support would error on that construct.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.