From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=1wWHn/zc; spf=pass (domain: arm.com, ip: 40.107.14.77, mailfrom: alexei.fedorov@arm.com) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (EUR01-VE1-obe.outbound.protection.outlook.com [40.107.14.77]) by groups.io with SMTP; Fri, 23 Aug 2019 04:49:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uB1nVpffC0zl4YmL2kCmmEXFlvCDiBvdO24/qfPA98M=; b=1wWHn/zcas1lLg5E1St+/MYQCZovAYPwQ5tbkM0sFbYX2dsSX9eTDZcTt5up6cBMlb9cpK8PrxISLX0nExIVyFnDQF1Lyg3iFSi7ihbVWAW/Iqz1vG4Zv6v+GoVBQ/+v3oUX0J2Bf3qhSooB6R1Hk024Nj5o+77oT3h5dOvowR0= Received: from DB7PR08CA0002.eurprd08.prod.outlook.com (2603:10a6:5:16::15) by VI1PR0801MB1853.eurprd08.prod.outlook.com (2603:10a6:800:5a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.19; Fri, 23 Aug 2019 11:49:24 +0000 Received: from AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::204) by DB7PR08CA0002.outlook.office365.com (2603:10a6:5:16::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.14 via Frontend Transport; Fri, 23 Aug 2019 11:49:24 +0000 Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT033.mail.protection.outlook.com (10.152.16.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.13 via Frontend Transport; Fri, 23 Aug 2019 11:49:22 +0000 Received: ("Tessian outbound 0c23f37acac0:v27"); Fri, 23 Aug 2019 11:49:22 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f34b0389356be1d1 X-CR-MTA-TID: 64aa7808 Received: from 54566adec331.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.5.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 99530E8F-5C52-45A0-9055-C92506D8484E.1; Fri, 23 Aug 2019 11:49:17 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02lp2053.outbound.protection.outlook.com [104.47.5.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 54566adec331.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 23 Aug 2019 11:49:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EJIfus4EyKDtFE6nDF4PAnx3CKqbY/4+Vx38M+4F3clwt0XYN6UmbEK2RtAbjkdH+6z8RhFCibCu+qImzqCDERbYbxYhYiYzcOTFarWr60tEJZ2sIudovQmDxnJziJcgTHUpari0BMyy+DpD69WYHcXUB7skh0oGVqQbdoI3o9IcJf6UXo7RrHV+q/wDzHfTR+W30KDg7NUi0gf7+cyLsoxzhAlJpZkQHcBRw9K3e0W1W/Zi4IgQy3M5PcLV/c99b666hdsAUifHJd6hTx/ZnolUBY4eGTcag1NrdNmr+v3+0+A4X5nlgfYLzJnR3MNMKpMQjmOY8k8EHBImpQOYHg== 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=UbRAe2Am75clKQCSAU5MC8+Pt4kYUqJqOcN9LkoTK98=; b=nX4aOdgB5kzxysWELTIrS41MfGIf2PzchyISG+WzfCk5Lb7YYPH43NcXb2VQaIfbLIGs/7ecRa3riKYhJlx4RtgU3UaD8RkxFylLoo/XeHkTl7V5TgPLfJPRq6nMMYnfQXznbzqq7jWNOOjujco3AaQI4KSTyLrnunvj4G7j6uFrd8cRexGISdNdo67FLK4lAk3iyNpnqCLajwhcX8G5zv+Fx39HrrQiJQpH1d1V3ZxX7zJ11NjvpQYt/dw4LH4js/VCbTWhkeGah2moNaNplqtrkKAMSViE0kQ4FZTP/MVKlv1kYG2J7OvKYon+hAIxv5VzNLHJzvEepPuhAF9eyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UbRAe2Am75clKQCSAU5MC8+Pt4kYUqJqOcN9LkoTK98=; b=Ak49ZIyuLcNdyOlHjqhHLZeMsPRKmPyKBARXGhGHOqPCJWHiNxulaQBVJzfx06EztDYmWrVANra4uvuzNVFZfjaEP9CiOlvtL5Au5fUzR8kcKSWxvFvYzIu9JtWceP8OrzgNexYv8MBw9f+tv0gTZp9+U8Pse69N/7mmkchL9dY= Received: from AM5PR0801MB1732.eurprd08.prod.outlook.com (10.169.244.21) by AM5PR0801MB1906.eurprd08.prod.outlook.com (10.168.156.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Fri, 23 Aug 2019 11:49:16 +0000 Received: from AM5PR0801MB1732.eurprd08.prod.outlook.com ([fe80::50d7:cef5:ee39:2e83]) by AM5PR0801MB1732.eurprd08.prod.outlook.com ([fe80::50d7:cef5:ee39:2e83%9]) with mapi id 15.20.2178.020; Fri, 23 Aug 2019 11:49:16 +0000 From: "Alexei Fedorov" To: Sami Mujawar , "devel@edk2.groups.io" Subject: Re: [PATCH v1 18/19] ArmPlatformPkg: Fix comparison of constants warning Thread-Topic: [PATCH v1 18/19] ArmPlatformPkg: Fix comparison of constants warning Thread-Index: AQHVWaGr6iEQozjG8UGX3XjWATYUqacInkQB Date: Fri, 23 Aug 2019 11:49:16 +0000 Message-ID: References: <20190823105539.13260-1-sami.mujawar@arm.com>,<20190823105539.13260-19-sami.mujawar@arm.com> In-Reply-To: <20190823105539.13260-19-sami.mujawar@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Alexei.Fedorov@arm.com; x-originating-ip: [217.140.106.49] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 7a35ddd8-e35e-4e99-295d-08d727bff0e6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:AM5PR0801MB1906; X-MS-TrafficTypeDiagnostic: AM5PR0801MB1906:|VI1PR0801MB1853: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:247;OLM:247; x-forefront-prvs: 0138CD935C X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(346002)(396003)(136003)(376002)(39860400002)(366004)(189003)(199004)(76176011)(19627405001)(26005)(2501003)(9686003)(66066001)(186003)(3846002)(102836004)(25786009)(105004)(6116002)(2906002)(55016002)(99286004)(66946007)(476003)(14444005)(53546011)(7696005)(446003)(76116006)(66446008)(478600001)(256004)(11346002)(66476007)(66556008)(64756008)(8936002)(8676002)(53936002)(52536014)(229853002)(486006)(33656002)(6506007)(19627235002)(81166006)(74316002)(6246003)(316002)(7736002)(71190400001)(71200400001)(54896002)(5660300002)(81156014)(86362001)(110136005)(14454004)(6436002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0801MB1906;H:AM5PR0801MB1732.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: ldIV4lKY3h2akQFJ2C47grY8sRiTEFefDu+GTb10AHdNvyjFDADzGeNtwuVsOwGbRk7dqYqWF/wbM/NpFjAOx5pdXWyU5I/oSNb2be8kXFKzdPfsZyQi7AhPMxEOLS5VWVTU4VpVn3wrGOuzgDBN8+VpE8TfB5JPupEOsfhHg6Uff+kTwHMGlKHDORmSkhRg0Ty508xT4ugOJheNAkUHoHdRarymZ4KNypN9XKo60SPrn66rSSDotYcBsRZKCQVjkiinx+37CQZ1Yf+oRAC6cGSSr9D7tiNtEDTPM+qzjxWvzz2xomtGR+bi7im9fA7oj2ssXVjyFLe8bzmR+EJ3pH9tnJbcm13r60K155BDN1usrmz3TzsKSRjMtQpXyghw6dX3dPI6+u4atmVVSDnwkEHeQ+5ZULTnI9ka6XValqI= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1906 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alexei.Fedorov@arm.com; Return-Path: Alexei.Fedorov@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(136003)(346002)(396003)(376002)(2980300002)(40434004)(199004)(189003)(446003)(81166006)(81156014)(53546011)(102836004)(16586007)(36906005)(8676002)(26005)(76130400001)(229853002)(86362001)(5660300002)(316002)(70206006)(70586007)(6246003)(6506007)(110136005)(14454004)(486006)(26826003)(22756006)(14444005)(5024004)(126002)(476003)(76176011)(105004)(6116002)(3846002)(99286004)(19627405001)(54896002)(55016002)(9686003)(71190400001)(478600001)(19627235002)(33656002)(186003)(356004)(52536014)(66066001)(74316002)(8936002)(2906002)(25786009)(336012)(11346002)(63350400001)(63370400001)(7736002)(7696005)(2501003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0801MB1853;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:TempError;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;A:1;MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 4b694bb3-0143-466d-5880-08d727bfecda X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(710020)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:VI1PR0801MB1853; X-Forefront-PRVS: 0138CD935C X-Microsoft-Antispam-Message-Info: fS250qnzqPQHLkF5/YQqhrIFyQ2QdQ6uQrP1CPwdFQud2y+1Ad/dAMxzv+MEIJdhY8lFsyvP5BKpfVQIBvYY9yonMHqVsUx1LDzGhHUQT8iaH+qSsVn+GvL+3Prhz1iYS6QxE3J9GYL3SK1outceA7loPzMUKeTeY7eYBgmRFr8rTeJPtU8ahLRPoZTFy+Wwe5QwUQ84FBSNQDubOZ/og9+8+3flDhOeWDuqmHhi3DbT77yB66MNqZiaaMAS8PrevtQ/iDZuvH9ooew4ZoxwBbvsCdgBymtTOwDUUGHC2xawLQg+uf2pNS7ZLlX+LfSlGt4qvROal3l27EhZZ/ANHe5N1iaXd0yZSa7qehf/WES929TEbQxO/1c0vRYRdY6fv0UEDHEAcUE7c7oCDYea0uV/zatH3MGTtqt8+2uB+eU= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2019 11:49:22.9316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a35ddd8-e35e-4e99-295d-08d727bff0e6 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1853 Content-Language: en-GB Content-Type: multipart/alternative; boundary="_000_AM5PR0801MB1732F1D39D93BBAAA40A8D1F9AA40AM5PR0801MB1732_" --_000_AM5PR0801MB1732F1D39D93BBAAA40A8D1F9AA40AM5PR0801MB1732_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Alexei Fedorov Alexei ________________________________ From: Sami Mujawar Sent: 23 August 2019 11:55 To: devel@edk2.groups.io Cc: Sami Mujawar ; Alexei Fedorov ; ard.biesheuvel@linaro.org ; leif.lindholm= @linaro.org ; Matteo Carlini ; nd Subject: [PATCH v1 18/19] ArmPlatformPkg: Fix comparison of constants warni= ng The VS2017 compiler reports 'warning C6326: potential comparison of a constant with another constant' when a fixed PCD value is compared with a constant value. The faulting code is as marked by '-->' below: --> if (FixedPcdGet32 (PL011UartInteger) !=3D 0) { Integer =3D FixedPcdGet32 (PL011UartInteger); Fractional =3D FixedPcdGet32 (PL011UartFractional); } else { ... The macro FixedPcdGet32 (PL011UartInteger) evaluates to a macro _PCD_VALUE_PL011UartInteger that is defined by the build system to represent the UART Integer value. Therefore, the VS2017 compiler reports the above warning. Fix this warning by enclosing the code in appropriate #if .. #else .. #endif directives. Signed-off-by: Sami Mujawar --- ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c b/ArmPlatfo= rmPkg/Library/PL011UartLib/PL011UartLib.c index 2d3c279cce49304959953ec4a34b50e09a7d0045..dabf099b9bc82e1fb1bd5a2eae3= fa4b5878a9e07 100644 --- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c +++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c @@ -174,10 +174,10 @@ PL011UartInitializePort ( // // If PL011 Integer value has been defined then always ignore the BAUD r= ate - if (FixedPcdGet32 (PL011UartInteger) !=3D 0) { +#if (FixedPcdGet32 (PL011UartInteger) !=3D 0) Integer =3D FixedPcdGet32 (PL011UartInteger); Fractional =3D FixedPcdGet32 (PL011UartFractional); - } else { +#else // If BAUD rate is zero then replace it with the system default value if (*BaudRate =3D=3D 0) { *BaudRate =3D FixedPcdGet32 (PcdSerialBaudRate); @@ -197,7 +197,7 @@ PL011UartInitializePort ( Divisor =3D (UINT32)DivisorValue; Integer =3D Divisor >> FRACTION_PART_SIZE_IN_BITS; Fractional =3D Divisor & FRACTION_PART_MASK; - } +#endif // // If PL011 is already initialized, check the current settings -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you. --_000_AM5PR0801MB1732F1D39D93BBAAA40A8D1F9AA40AM5PR0801MB1732_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>

Alexei


From: Sami Mujawar <sami= .mujawar@arm.com>
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Sami Mujawar <Sami.Mujawar@arm.com>; Alexei Fedorov <Al= exei.Fedorov@arm.com>; ard.biesheuvel@linaro.org <ard.biesheuvel@lina= ro.org>; leif.lindholm@linaro.org <leif.lindholm@linaro.org>; Matt= eo Carlini <Matteo.Carlini@arm.com>; nd <nd@arm.com>
Subject: [PATCH v1 18/19] ArmPlatformPkg: Fix comparison of constant= s warning
 
The VS2017 compiler reports 'warning C6326: potent= ial
comparison of a constant with another constant' when
a fixed PCD value is compared with a constant value.

The faulting code is as marked by '-->' below:

--> if (FixedPcdGet32 (PL011UartInteger) !=3D 0) {
      Integer =3D FixedPcdGet32 (PL011UartInteger)= ;
      Fractional =3D FixedPcdGet32 (PL011UartFract= ional);
    } else {
    ...

The macro FixedPcdGet32 (PL011UartInteger) evaluates
to a macro _PCD_VALUE_PL011UartInteger that is defined
by the build system to represent the UART Integer
value. Therefore, the VS2017 compiler reports the above
warning.

Fix this warning by enclosing the code in appropriate
 #if .. #else .. #endif directives.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c | 6 +++= ;---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c b/ArmPlatfo= rmPkg/Library/PL011UartLib/PL011UartLib.c
index 2d3c279cce49304959953ec4a34b50e09a7d0045..dabf099b9bc82e1fb1bd5a2eae3= fa4b5878a9e07 100644
--- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
+++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
@@ -174,10 +174,10 @@ PL011UartInitializePort (
   //
 
   // If PL011 Integer value has been defined then always ignore = the BAUD rate
-  if (FixedPcdGet32 (PL011UartInteger) !=3D 0) {
+#if (FixedPcdGet32 (PL011UartInteger) !=3D 0)
     Integer =3D FixedPcdGet32 (PL011UartInteger);
     Fractional =3D FixedPcdGet32 (PL011UartFractional)= ;
-  } else {
+#else
     // If BAUD rate is zero then replace it with the s= ystem default value
     if (*BaudRate =3D=3D 0) {
       *BaudRate =3D FixedPcdGet32 (PcdSerial= BaudRate);
@@ -197,7 +197,7 @@ PL011UartInitializePort (
     Divisor =3D (UINT32)DivisorValue;
     Integer =3D Divisor >> FRACTION_PART_SIZE_IN= _BITS;
     Fractional =3D Divisor & FRACTION_PART_MASK; -  }
+#endif
 
   //
   // If PL011 is already initialized, check the current settings=
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in any medium. Thank you. --_000_AM5PR0801MB1732F1D39D93BBAAA40A8D1F9AA40AM5PR0801MB1732_--