On 12.07.2023 16:26, Jan Beulich wrote:
> --- a/Config.mk
> +++ b/Config.mk
> @@ -90,9 +90,14 @@ PYTHON_PREFIX_ARG ?= --prefix="$(prefix)
> # of which would indicate an "unrecognized command-line option"
> warning/error.
> #
> # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
> -cc-option = $(shell if test -z "`echo 'void*p=1;' | \
> - $(1) $(2) -c -o /dev/null -x c - 2>&1 | grep --
> $(2:-Wa$(comma)%=%) -`"; \
> - then echo "$(2)"; else echo "$(3)"; fi ;)
> +cc-option = $(shell pat='$(2:-Wa$(comma)%=%)'; \
> + opt="$${pat%%=*}" arg="$${pat\#*=}"; \
> + if test -z "`echo 'void*p=1;' | \
> + $(1) $(2) -c -o /dev/null -x c - 2>&1 | \
> + grep -e "$$pat" -e "$$arg.*$$opt" -e
> "$$opt.*$$arg" -`"; \
Sigh. At least some versions of Clang (I'm looking at 7.0.1 right now)
don't quote "-march" in their resulting error message. So I guess all
we can do (without finding a different approach to the checking
altogether) is further relax the grep pattern, to
grep -e "$$pat" -e "$$opt" -e "$$arg" -
Of course this has the increasing risk of getting false positives (i.e.
false negatives for the overall check result).
Jan