From patchwork Wed Jul 17 06:47:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11047327 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E85B413A4 for ; Wed, 17 Jul 2019 06:49:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5E1028711 for ; Wed, 17 Jul 2019 06:49:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8CDD28715; Wed, 17 Jul 2019 06:49:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 65AD428711 for ; Wed, 17 Jul 2019 06:49:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hndjN-0006cj-Ll; Wed, 17 Jul 2019 06:48:01 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hndjM-0006cb-HS for xen-devel@lists.xenproject.org; Wed, 17 Jul 2019 06:48:00 +0000 X-Inumbo-ID: cdc8621a-a85e-11e9-bdd8-8b94ad2e519a Received: from m4a0039g.houston.softwaregrp.com (unknown [15.124.2.85]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id cdc8621a-a85e-11e9-bdd8-8b94ad2e519a; Wed, 17 Jul 2019 06:47:55 +0000 (UTC) Received: FROM m4a0039g.houston.softwaregrp.com (15.120.17.146) BY m4a0039g.houston.softwaregrp.com WITH ESMTP; Wed, 17 Jul 2019 06:47:54 +0000 Received: from M4W0335.microfocus.com (2002:f78:1193::f78:1193) by M4W0334.microfocus.com (2002:f78:1192::f78:1192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 17 Jul 2019 06:47:35 +0000 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (15.124.8.13) by M4W0335.microfocus.com (15.120.17.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Wed, 17 Jul 2019 06:47:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IUi2SpBMEGa2iVZuM8RBvsduYdpby8UwPYidC4LnE4qXMfede3Zd5Qs26UbvbGBoqtf4xCvoRgJTUb5VZ/T8ix49Ooubtqtqfn9ebuHXwepReFn7gz9iG4hLpLSUNguGChgTzD9obl9fnXQeHlu/nlentoxzAov68VLithI7k+3DaiWlVvdbmr+O7TZYjlnZulQyZNvFjXsS4RUL7QZJANV4cgU64+fiwLuz3K7cmgrax7tvDkAgNxDnSLsZEJxKb3T+7DcyWMrfNZeNCmL7uR6MQO/O+qX7DDNqFL2EIG8ob2fZZ0C38iwYdXUkjdOgp89dgtXaf8JIum0qzjHErw== 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-SenderADCheck; bh=5b+uPodbBUie/MoyVnYCKTOJd6+psFNzMyUEz2oMvng=; b=Ur9uVv40MxCPcNj1U836nSxAVkksict3bMLM+KRjqsKxrsSWICTEBToz8WGK8BzTE7ApX/sPv2e9c/jSFlJ7QdzXr1c4VQJDWJBXVftkfC9MTdpJMrXKfzRiJCZpnIz9O6KswZAZGR/7zPiSA2Tg7dBW0X2n3+haOaW2GRREQvUy1ejXkWgTCCg+jfFnltBHZNlbiU4F52wInqnnAhwoVWQM7TnXBIpnBxvgWEdv0OMCWOaIFOcxb0AFFeHSAJJ/JfvrhWFM/VQwCIYs5VRgYrwLnqQu6CE5Z9iOynRhSw6jR7g8pLk6HtUN/pOmGJs45K6SKURP4i9jTM8uc+aYDA== 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 Received: from DM6PR18MB3401.namprd18.prod.outlook.com (10.255.174.218) by DM6PR18MB2650.namprd18.prod.outlook.com (20.179.106.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.11; Wed, 17 Jul 2019 06:47:33 +0000 Received: from DM6PR18MB3401.namprd18.prod.outlook.com ([fe80::1fe:35f6:faf3:78c7]) by DM6PR18MB3401.namprd18.prod.outlook.com ([fe80::1fe:35f6:faf3:78c7%7]) with mapi id 15.20.2073.012; Wed, 17 Jul 2019 06:47:33 +0000 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Thread-Topic: [PATCH v2] dom0-build: fix build with clang5 Thread-Index: AQHVPGuDyWWK6Geo3ESEScpkr4UVEw== Date: Wed, 17 Jul 2019 06:47:33 +0000 Message-ID: <5c88239b-de0f-5f81-72c4-7fdb07524278@suse.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P123CA0023.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::35) To DM6PR18MB3401.namprd18.prod.outlook.com (2603:10b6:5:1cc::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@suse.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [87.234.252.170] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f6ecb642-b54d-40aa-71c2-08d70a82a584 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:DM6PR18MB2650; x-ms-traffictypediagnostic: DM6PR18MB2650: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 01018CB5B3 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(4636009)(136003)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(6436002)(53936002)(8936002)(6506007)(386003)(478600001)(6486002)(2616005)(81166006)(81156014)(2351001)(25786009)(8676002)(5660300002)(26005)(102836004)(66946007)(476003)(64756008)(66556008)(66476007)(66446008)(99286004)(86362001)(186003)(316002)(54906003)(71190400001)(31696002)(71200400001)(31686004)(66066001)(305945005)(6116002)(3846002)(14454004)(2501003)(4326008)(256004)(7736002)(36756003)(14444005)(6916009)(68736007)(486006)(2906002)(6512007)(5640700003)(52116002)(80792005); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR18MB2650; H:DM6PR18MB3401.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: suse.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: KxyoNJxWbkXr7eym3w/CdiiQZ4gXedpsEBdYv0RVErVTCFuk3gLxPRQhJOu64RapblbWP9AagFcSy9ZxQx/KqAlf2LpvjYh0UNmJzR9dEIlFJm2QDvfnOx4QclBpBL8NYuLX2A/cNxm0E+VaMx3+H2yzRsTHowoEakrFDNf9xe14dCtyPod5qNxTGMe9cqMI3drlNs+zmN0ahRqlc/UBIury5yXVRApt4xM/wWlD8MJ0Yqz1r8mFGXPojSWfFddK34EyBsyE8jomXK8KusO9CrDDRNuuadijjPI6PlhDUw79zEMkd9RM3CBBcaWwuTg64F7Tem+tDERG2mgh/U4PfECfE4l3G9Hg33vnVrtFbA9st66Cqxio7cSoa8YUzLNj9Yxx3H+BVjUU5KYblabnQWYoUuxFN9QN0BvJvVyHkv4= Content-ID: <6EBA2EE7D4344E408136FE7A6EF3CF54@namprd18.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: f6ecb642-b54d-40aa-71c2-08d70a82a584 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jul 2019 06:47:33.8139 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: JBeulich@suse.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR18MB2650 X-OriginatorOrg: suse.com Subject: [Xen-devel] [PATCH v2] dom0-build: fix build with clang5 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Julien Grall , Stefano Stabellini , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP With non-empty CONFIG_DOM0_MEM clang5 produces dom0_build.c:344:24: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand] if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] ) ^ ~~~~~~~~~~~~~~~~~~ dom0_build.c:344:24: note: use '&' for a bitwise operation if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] ) ^~ & dom0_build.c:344:24: note: remove constant to silence this warning if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] ) ~^~~~~~~~~~~~~~~~~~~~~ 1 error generated. Obviously neither of the two suggestions are an option here. Oddly enough swapping the operands of the && helps, while e.g. casting or parenthesizing doesn't. Another workable variant looks to be the use of !! on the constant. Signed-off-by: Jan Beulich Acked-by: Julien Grall Acked-by: Roger Pau Monné --- v2: Also adjust the Arm incarnation of the same construct. --- I'm open to going the !! or yet some different route (but not really the suggested strlen() one). No matter which one we choose, I'm afraid it is going to remain guesswork what newer (and future) versions of clang will choke on. --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2125,7 +2125,7 @@ int __init construct_dom0(struct domain printk("*** LOADING DOMAIN 0 ***\n"); - if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] ) + if ( CONFIG_DOM0_MEM[0] && !dom0_mem_set ) parse_dom0_mem(CONFIG_DOM0_MEM); if ( dom0_mem <= 0 ) --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -341,7 +341,7 @@ unsigned long __init dom0_compute_nr_pag unsigned long avail = 0, nr_pages, min_pages, max_pages; bool need_paging; - if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] ) + if ( CONFIG_DOM0_MEM[0] && !dom0_mem_set ) parse_dom0_mem(CONFIG_DOM0_MEM); for_each_node_mask ( node, dom0_nodes )