[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:26:53 +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=BBlY3/LJPEqXfh4o+2erDcxetpKZgO/+Av51FujHwls=; b=EJN6Pf3nM2Z7Jp58t653I1u31TDpa/EmRlf2y/ZmpU+3gqq0uPDtWpQ0nxAuV1xtIZ/UekeRPamd/u0dg2FRzbPDqfIfFpX6e4ocq23C7mGfEVy5KKiNYvTTy36VSn1frrnCbTv/hIiKpzTPFHNLUgXKJkoJtXEKtsMQR2zqUZ68WW9H1ixrD0IEUluPF/1neFUq3h4q++/+0nZ6lP0kltEE2RLmeVFLKlO8hPJMnKLrcaj/5jSFWE5K+axQaOg4u6IAQvlulMvu5WZa11PBlkhHdsgJY0K5iIHmsQlIVsM/30GciZ5IvZ7euREAj/gmpllWqvzTAKRDNgzODYMuDA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hAGWCsZALSHL0R9kmsY4T7duC/8KjX5PqfarCf4CZxe09EnqBtYt9wpCdpilpjkSyDwDFf01O63aQaf69MJ6oqUK29xJP04xLsHMc9hDxnjhV/G6x47YZL4ocjxih+R5J0w4FwgRJZnsVFg0C3WtdWROLkCylqnVo4YxWkAWgd1vOt1cod45Uzk+a7mhePMTlNQ2lCd8BuP+iDRIHwB3HF7TwS6lMwpA/GzG9qffuqXYFOrMjEtWKvDDHnbgdCljdDl8OFjaUBQeGH8i8qpjqIFl1tjxQKatCpPu0jojFMU5C1VF+oVjvbr/B3dkKyuLOYmtCdxxgh7VbIyTdUPiZg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 12 Jul 2023 14:27:10 +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>
---
I'm sorry, re-sending with wider Cc list (as was intended originally).

--- 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®.