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

[PATCH 0.5/3] build: make cc-option properly deal with unrecognized sub-options


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 12 Jul 2023 16:25:23 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=actnbxdtcI+RA2YJzPiZ0LnEyvRXEVw+dZc506y8HFE=; b=jqg4Np3Se3XGomdJYKG1saVYBVQuN0ZdkkPAvsRISF82ZKojbCsQnFwByQUjGLp+yLXdhVj4Yw30/GvQ4gyXkO+H3LLBdCDUwiZTwWkylU3LCyDeiq3xmmNGTBXyHAA79EsU8Nt08cjVnorstlCiwRM3Vcvv6VS3CDlIlsHuhXAI0amD/oVCnIN1xowKjQhO/KMi9VweAeZsZSu7LGT8NV+ej8rxC2tIOKSLri7moyCVq0i4uDfen9rUukVyefe+TT2p6PWa9EpGT3mqidTwlOuQG0ypm7dPw8jqYFoZoIVE/nEpsnolRAhq48du0ZIWYhTYLvFv+F2RjBUa1erc5g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N+Whk3ZjwvGog9jqyDMsK572DTqQn41KB7pG6skssYZR3hiZ2sXBiqEu21yd+zSZ1s2uhWK8CxDeN36mjk4jBLzrf8ladfBFuf+lEPy7ZptyCJcmRFMssMRsm/a8tBv+T8SvEBpOazkMiOEouRXqZl//N3OEotm+qWyJO78mK7doAyTvtuwxaZ4+FKSJkIuR8xPnxkxBy3L1HpfAesW2d9UobTxcH1aWhxRP92ft2XKOtQwy6aLMcwaPk94QwxMU73/lLvh2suH4h5mie40MZ02/hpqQw/U703ujwJwmmuUWx5LQzVVCbJmbjQBP/qHdC2LmzdUrsExxmDhESG8oug==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 12 Jul 2023 14:25:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In options like -march=, it may be only the sub-option which is
unrecognized by the compiler. In such an event the error message often
splits option and argument, typically saying something like "bad value
'<argument>' for '<option>'. Extend the grep invocation to check for
any of the three resulting variants.

To keep things halfway readable, re-wrap and re-indent the entire
construct.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- 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" -`"; \
+                    then echo "$(2)"; \
+                    else echo "$(3)"; \
+                    fi;)
 
 # cc-option-add: Add an option to compilation flags, but only if supported.
 # Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)




 


Rackspace

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