From patchwork Mon Nov 21 11:59:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 23698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1545256wrr; Mon, 21 Nov 2022 04:10:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf530dWCF6egpnQzRHAaIGXeRGccUT7r1DsiDVtF7n/au21skyV3JMuj2y8MVahOccPFSmRO X-Received: by 2002:a05:6402:6c6:b0:469:590d:ae9a with SMTP id n6-20020a05640206c600b00469590dae9amr2210031edy.277.1669032630716; Mon, 21 Nov 2022 04:10:30 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ia19-20020a170907a07300b007ae754729d1si7003718ejc.883.2022.11.21.04.10.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Nov 2022 04:10:30 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=tWVrra5v; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B84FA384F497 for ; Mon, 21 Nov 2022 12:10:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B84FA384F497 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669032628; bh=7y34isIpUG6ysKQh0Dhp+FR6n8g0RzKiBFAwNjVvRp0=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=tWVrra5vYKD/92b+3zBIS+oIwtXJ8IuA1mXe+xVTLzB5Fs3LkMkfdNQKPhCigoO/K 39UTyiWqT1twCmhIHPtYV7OKwVpLgnUA/unV7hq7Va03zRKL6vd4LnLV3NZ+NdJsW4 uT7/OviSQP9eWaz9BIqxJAirDo1mbxm9tGMv3h0k= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150078.outbound.protection.outlook.com [40.107.15.78]) by sourceware.org (Postfix) with ESMTPS id BAB2B385782B for ; Mon, 21 Nov 2022 12:09:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BAB2B385782B Received: from FR3P281CA0100.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a1::18) by AS4PR08MB8192.eurprd08.prod.outlook.com (2603:10a6:20b:58f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.8; Mon, 21 Nov 2022 12:09:34 +0000 Received: from VI1EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:a1:cafe::f2) by FR3P281CA0100.outlook.office365.com (2603:10a6:d10:a1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17 via Frontend Transport; Mon, 21 Nov 2022 12:09:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VI1EUR03FT037.mail.protection.outlook.com (100.127.145.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.8 via Frontend Transport; Mon, 21 Nov 2022 12:09:33 +0000 Received: ("Tessian outbound f394866f3f2b:v130"); Mon, 21 Nov 2022 12:09:33 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 69405233c136b3de X-CR-MTA-TID: 64aa7808 Received: from ac4aab3abcca.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A169F0FB-7A54-48BB-BA45-8F19F9FD0B25.1; Mon, 21 Nov 2022 11:59:33 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ac4aab3abcca.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 21 Nov 2022 11:59:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AOKWPdKrpni1xJvUnbh4K3o17EXOuScTeH4pxZiWYkRJerC/4JGhTzpMObG5um5+H1Oj4hgnrGKT+QrR4P1exZEn5RurzVvVfpiuU81q3qm0J0PcExKokqegaYpBM1PMAO2AHgZA5F0txgQzPzDuZp7X7AAwXPigQSvfcE6jSNv3SBipyBW7K35ffiR/L09pmIPF1gqG5hjEwFSEHOyGA/rdwpQQW2RRVEicxUvqn5reA8HvXA1XYEEKvn4nFTqrUtg2mqT2np5Y3iVMT74RPbg2xftSDot5ieXc+VqEaKMHKJGekbdXZ2E+sLtG3/ERXIeiv/3HdXukfLDxlB8HUQ== 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=7y34isIpUG6ysKQh0Dhp+FR6n8g0RzKiBFAwNjVvRp0=; b=lNAK2Prilo7dXLeD0V/FLIoXh1wuUs8PsuBTj80ONNHYqczBZeK8BbY3p0UI1kFR2PLEo2bT5zrHOGzvgTXff2U+SZu8t8Xob+DbIjT8H5CNxhZS5dPgbhm8K+xBZXq8/70cNejOT5ZemUf2TdnBB08dmJnn2KBtPyBhduW1jzHvShtnSidCSriklFy6TKW3u0TfiHIZ/n1tYM07OEUBZZTSwt8q0QW2tP4ei4NJGlUIWXDIdyppQG5L6m+0KuOv3yecDpJycMwI+Jat41p3/mZI2BHhu6bx/teNtx/4BlHQrGPawYYlg72oVN2y2MSb2mk4zB32exhYQZJDNYY7ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AS9PR06CA0600.eurprd06.prod.outlook.com (2603:10a6:20b:486::35) by PA4PR08MB6142.eurprd08.prod.outlook.com (2603:10a6:102:ee::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17; Mon, 21 Nov 2022 11:59:28 +0000 Received: from VI1EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:486:cafe::13) by AS9PR06CA0600.outlook.office365.com (2603:10a6:20b:486::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15 via Frontend Transport; Mon, 21 Nov 2022 11:59:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by VI1EUR03FT053.mail.protection.outlook.com (100.127.144.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5834.8 via Frontend Transport; Mon, 21 Nov 2022 11:59:27 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 21 Nov 2022 11:59:26 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 21 Nov 2022 11:59:26 +0000 Received: from e129018.arm.com (10.57.70.148) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 21 Nov 2022 11:59:26 +0000 To: CC: , Christophe Lyon Subject: [PATCH] genmultilib: Fix sanity check Date: Mon, 21 Nov 2022 12:59:15 +0100 Message-ID: <20221121115915.374247-1-christophe.lyon@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: VI1EUR03FT053:EE_|PA4PR08MB6142:EE_|VI1EUR03FT037:EE_|AS4PR08MB8192:EE_ X-MS-Office365-Filtering-Correlation-Id: 67ab4101-d981-4e2d-eeca-08dacbb94095 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: /oftrXB3VHW9+Z+Ysx1B7RhaIXbMXcJ9rMhOcZDkckE1XlJL+VgjEFIitL4+Mt0ZUA6AFJRBbB3kvyQuZkQ96cRRVGPFKg03g85HYdO37L8xnSop3sshFxrrpRwlmuIFOUrs9HSGLKLiWkij1OZTOnd+eljj1KTwG1PymZ3ZEMiJozhmRGSawmMAa/nUp3a5MmpZllqtfuwQ1E8T1mlmusFkKfRdCqJnMfFZbeizSbZnj2u7taz52PMqrdkBCWTqsZdAsBzpp7SA4pNxNYxIWepSnnWc1b5GFvfyNTIOe//Cg7HqTuUCv7QaVhCm5rZIrAJvdj+XLISPzX/lrkFVcndjZO+5J20hPOlENGVk9/h8OB7mxelWSRfFNL4pqAp9ksHUcbBFtsMbjxkAzUBWhHKrSILNLWa/JHIaOyoQSBKqmkQDgPgGxUKkF/Ipdx7XxxdJGtK4PTCf4qoSZAUQe8U4vJsmcMRB8Cn3yEoIZpq28OP55FK+ckA39FfedM8HUfFIi9UGDpFusf0DgjUydylzyoNhjf5cnVfkobgagdeUvipidOQtcOPC9HoO/YjTMXa8w6jHs6+Dm1IJ4hZ9DKRPAX13h00+ko03yyljthafbwoPtnvwVuU0XPkxfRczpmgeT2tctTiuTzqG4NgTJ1fkLJ08n6aqtCASQsvIqZGiqyr+8r2oXntvPUmRP7qHlStjDdaVK6GhHw7GOc8QiVX9F9W0q+M9CEB/cloN25c= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(376002)(136003)(396003)(39850400004)(451199015)(46966006)(40470700004)(36840700001)(2906002)(2616005)(186003)(47076005)(426003)(1076003)(478600001)(26005)(36756003)(7696005)(6666004)(336012)(40460700003)(40480700001)(356005)(86362001)(81166007)(82740400003)(83380400001)(36860700001)(82310400005)(8936002)(41300700001)(70586007)(44832011)(70206006)(8676002)(4326008)(54906003)(5660300002)(6916009)(316002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6142 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 7c9ef9ba-5671-4b97-2b27-08dacbb7d714 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wZaXAQbIkZh1bGom3YzXjlM/ss1VXTx5J0of4kC2BgGFxMOWzhD6lvjgzAuk8CBJzKbXB+0xcHh4VFk+TEH3mRxwbaEcX5SS3Jm+VbQtC4hG6mUoxYpaHyqrd+zUIpfRQCKYdTA2yomq+ye/YWVpAtZMTjXzB8MC13/BqsRSPnv4EXXRGa0BBWV48VGONOaePXcnlo0P8mUgTqOg90cs30MzkLbx6c1iMRRFhlis5HWYVSuNImhwFVNwB33nVBP2YKQy+A4Qf2MOxQYuUGEJMCVXbfsQZtIUe0L+02VqhQEM00CWkq86WHzIRUG1PiHj6/v30KmupIp5lisFIAjkmkGIYVDJfOavWwW1x76LDXuJoqABh2fwI0maSR/xL7olUXR3RZGqN2rDeRXG0rqbZnQBQ1/v1sshfzLDfPPnZfoSMK6Edqix4tqwxaTvxkqAn9AOBAFyU8LjaEIMjkhlnMd+jHuM2ktvSK7MUsmPC4zX8fJIzP3BWDk92PcQgyXESh/13ROGCkzw47efBycpukOkK/gPk6K9aPUBu+n+vvqkHETMaUHN+0I+No6Vne+XQgtkMfoP1mXONQQnvqGcivcr6VT0B/5HzZTmi4nF+fw5tqiO1IkTLnQWXtROur4D0ibl8HfN/vfdMH13f1+hz0MAciXr4JwYJcVrYRNloViFPPU+pCvNCnEpedx6uEuSHl62HMXI5jfyq0m2aGbNJg== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230022)(4636009)(396003)(346002)(376002)(136003)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(186003)(426003)(70206006)(41300700001)(5660300002)(4326008)(83380400001)(47076005)(86362001)(336012)(2616005)(70586007)(44832011)(8676002)(8936002)(1076003)(81166007)(36756003)(82740400003)(2906002)(82310400005)(40460700003)(36860700001)(26005)(6666004)(7696005)(478600001)(40480700001)(316002)(54906003)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 12:09:33.8208 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67ab4101-d981-4e2d-eeca-08dacbb94095 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB8192 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christophe Lyon via Gcc-patches From: Christophe Lyon Reply-To: Christophe Lyon Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750107559761643092?= X-GMAIL-MSGID: =?utf-8?q?1750107559761643092?= My previous patch to add a sanity check to genmultilib actually checked the number of dirnames with the number of "sets of options" rather than the number of options, thus breaking the build on some targets. To avoid duplicating once more the loop that constructs the sed patterns, this patch checks that the current dirname/osdirname is not empty in the existing loops. Are there targets where: if [ "$1" != "${opt}" ]; then is "legally" executed with an empty $1? (and thus where this patch would incorrectly trigger an error?) Sorry for the breakage. Tested on aarch64 by adding an option to t-aarch64 and no corresponding dirname, and on x86_64. OK for trunk? gcc/ChangeLog: * genmultilib: Fix options and dirnames/osdirnames sanity check. --- gcc/genmultilib | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/gcc/genmultilib b/gcc/genmultilib index b5f372c8358..c0c271eddd6 100644 --- a/gcc/genmultilib +++ b/gcc/genmultilib @@ -141,20 +141,6 @@ multiarch=$9 multilib_reuse=${10} enable_multilib=${11} -# Sanity check: make sure we have as many dirnames as options -if [ -n "${dirnames}" ]; then - set x $options - nboptions=$# - set x $dirnames - nbdirnames=$# - if [ $nbdirnames -ne $nboptions ]; then - echo 1>&2 "Error calling $0: Number of dirnames ($nbdirnames) does not match number of options ($nboptions)" - echo 1>&2 "options: ${options}" - echo 1>&2 "dirnames: ${dirnames}" - exit 1 - fi -fi - echo "static const char *const multilib_raw[] = {" mkdir tmpmultilib.$$ || exit 1 @@ -264,6 +250,10 @@ if [ -n "${dirnames}" ]; then for opts in `echo ${set} | sed -e 's|/| |'g`; do patt="/" for opt in `echo ${opts} | sed -e 's_|_ _'g`; do + if [ -z "$1" ]; then + echo 1>&2 "Error calling $0: No dirname for option: $opt" + exit 1 + fi if [ "$1" != "${opt}" ]; then todirnames="${todirnames} -e s|/${opt}/|/${1}/|g" patt="${patt}${1}/" @@ -320,6 +310,10 @@ if [ -n "${osdirnames}" ]; then for opts in `echo ${set} | sed -e 's|/| |'g`; do patt="/" for opt in `echo ${opts} | sed -e 's_|_ _'g`; do + if [ -z "$1" ]; then + echo 1>&2 "Error calling $0: No osdirname for option: $opt" + exit 1 + fi if [ "$1" != "${opt}" ]; then toosdirnames="${toosdirnames} -e s|/${opt}/|/${1}/|g" patt="${patt}${1}/"