From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (EUR02-VE1-obe.outbound.protection.outlook.com [40.107.2.41]) by mx.groups.io with SMTP id smtpd.web10.41124.1589806027049872148 for ; Mon, 18 May 2020 05:47:07 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=QAT/p2rf; spf=pass (domain: arm.com, ip: 40.107.2.41, mailfrom: sami.mujawar@arm.com) 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=YrgJpEHUlY4tzwx8n7kP8962dJlzZQMfZpYg2DZhAWg=; b=QAT/p2rfbXEzZM4q/0+uJa8L303uK216T3pVJviD4qMVOM9b11hm2vOKR9DmxvDr5StIup/PSUcKnR1pzL//+enXGGSiMjDtdhgH5qtNoZ2GQA/DszO8k31H2pvtqCKOwa2lVXpuSByOu3SEsSO2EFUOitSM+GXufIK0UQLuQvU= Received: from AM0PR02CA0103.eurprd02.prod.outlook.com (2603:10a6:208:154::44) by AM0PR08MB4355.eurprd08.prod.outlook.com (2603:10a6:208:13a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20; Mon, 18 May 2020 12:47:04 +0000 Received: from AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:154:cafe::c9) by AM0PR02CA0103.outlook.office365.com (2603:10a6:208:154::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Mon, 18 May 2020 12:47:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (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=bestguesspass 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT063.mail.protection.outlook.com (10.152.16.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Mon, 18 May 2020 12:47:03 +0000 Received: ("Tessian outbound e88319d7ccd0:v54"); Mon, 18 May 2020 12:47:03 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: fc9e8d40de35b927 X-CR-MTA-TID: 64aa7808 Received: from aece70e5677c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 94049801-D3D9-41F9-B959-BCD7634820B8.1; Mon, 18 May 2020 12:46:58 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id aece70e5677c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 May 2020 12:46:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SKQ6IKIcbMFbq4yYqQyFO3yyZkMEH5vU+so9JqstziOsmTYgdb2e1LUKk/mQVeXlcBRQLrsT0UTaMFg0z5O5mHeKL2GNheQYxsSoOgajfCf2BwESFg1+bdgP+N6O57/AubMdBVFSfsWO8qxSsoMRun7Sz+2uWXqwt+jPcjyxXsvtEOKw6q2+3S6Oz6z5aX/wnh1e+genVcVKjf0/NQuoMUwAbqyT1Y48TlTPR6Fv+Pp80De4XrGk9lgkyk1caEsdTqSoubo29q1Xsq94VNa2AJWqWiDjYWyLmIRLDEGsb2q5QIZN8clfeRD/MHrc4JCxONBcEK2XvtuaPlxAgXdbcw== 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=YrgJpEHUlY4tzwx8n7kP8962dJlzZQMfZpYg2DZhAWg=; b=A4bMDuKoeocEFY3b5RQmP22JUWWADFiEhDWFV8r7/c0vMOYzombBWBqB3a3QbEBBcocj/kV3WE01txgXRmjsLU843Hw1ecaQNXm9+hr+/u5JRixRBRL/wDuyH9c1CksdJvhmhOpC5PFqNr3k173TFpSOyCa8WMRfeg/rp//3e61Rr3VUIvdJE2sFqv3dQl1Q5MfbXld3hhxuxxP8+vDtQuBGyN4KTdU6mkKT2SmtuQPVwhOU509QHmxHscdXFOeFjJqobez3tpeoGOkZqPEpe4A9aKzxnTnBVVi632Dw6DsluLKaD4VJxj5tg19BenZOKZ7/0atUHLsR6+Ccz53Efg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); 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=YrgJpEHUlY4tzwx8n7kP8962dJlzZQMfZpYg2DZhAWg=; b=QAT/p2rfbXEzZM4q/0+uJa8L303uK216T3pVJviD4qMVOM9b11hm2vOKR9DmxvDr5StIup/PSUcKnR1pzL//+enXGGSiMjDtdhgH5qtNoZ2GQA/DszO8k31H2pvtqCKOwa2lVXpuSByOu3SEsSO2EFUOitSM+GXufIK0UQLuQvU= Received: from AM6PR10CA0086.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::27) by AM6PR08MB3416.eurprd08.prod.outlook.com (2603:10a6:20b:50::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.27; Mon, 18 May 2020 12:46:56 +0000 Received: from VE1EUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8c:cafe::5) by AM6PR10CA0086.outlook.office365.com (2603:10a6:209:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Mon, 18 May 2020 12:46:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass 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; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT052.mail.protection.outlook.com (10.152.19.173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3000.19 via Frontend Transport; Mon, 18 May 2020 12:46:55 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 18 May 2020 12:46:48 +0000 Received: from E107187.Arm.com (10.57.43.215) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 18 May 2020 12:46:47 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , Subject: [PATCH v2 2/2] ArmPlatformPkg: Fix comparison of constants warning Date: Mon, 18 May 2020 13:46:46 +0100 Message-ID: <20200518124646.45292-3-sami.mujawar@arm.com> X-Mailer: git-send-email 2.11.0.windows.3 In-Reply-To: <20200518124646.45292-1-sami.mujawar@arm.com> References: <20200518124646.45292-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(4636009)(39860400002)(376002)(346002)(136003)(396003)(46966005)(70586007)(70206006)(26005)(7696005)(86362001)(316002)(44832011)(2616005)(426003)(19627235002)(186003)(4326008)(82310400002)(81166007)(82740400003)(47076004)(356005)(966005)(1076003)(8676002)(8936002)(478600001)(5660300002)(54906003)(2906002)(336012)(6916009)(36756003)(46800400005);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce8b2f64-17fb-4b85-78e4-08d7fb2990f4 X-MS-TrafficTypeDiagnostic: AM6PR08MB3416:|AM0PR08MB4355: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 04073E895A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 71nfly1u5aGASjYJVcsFdRHPtxzxBA7QyzrNki8rk1HNfMqCg/6EiG7YxuPzvnBNE7IqqA1K6rLG/jpXUmkDmqXL0GTUD5XJlLBEq8+DvzNC06GNoCHRnNtDbs3/OGnCctWemhjqUCf4H4yehXaXOqdnbGzExBL40wqb9c05tfcLqw8dOqOdXYiPYn165o7KWwkz1RVVfCwwto0kLO8ZOt9u25f8fMZZ9vUCdiZYMoLD3S2I9TfQZO3baJVzMYktd8Ss3QWcf9rYCZzOGoLwWtejWFsVsFzajvoQixtNLzfhCUdQK4S3TXJZOLnJx5l9VgzEwiR3U0qXiQEa4oR67dxh/atAr/BcKFx3SNo4Um2WC/TqGrWLr09xMzis5NSqnmeDiWO6a1RTPZHG23tbe2aqgDCr6JtzFOexML8rAmijWAXPlpV2Cmuk9k9TyzuufjYuqE/DaqN1IweW+YGnXBg6zOBPGtIPdbPZ8eotC4tHGvFb9Aw+t3uW2jJvhqp/OBOf6LbQer0UmbER5f+uPUEhcMjFKo9yadDo9d/Bu84tVb5s1G+Hmu5VHeb6Tcx93T4F/jfwADYhjALrLi9U86YSt/1WPVorg009SCD1hmART6syCbqBBqHY+ZOMFkKT X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3416 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com 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;SFTY:;SFS:(4636009)(346002)(136003)(376002)(39860400002)(396003)(46966005)(26005)(36756003)(47076004)(36906005)(82740400003)(316002)(19627235002)(478600001)(54906003)(81166007)(2906002)(86362001)(966005)(82310400002)(336012)(2616005)(1076003)(44832011)(6916009)(426003)(7696005)(70206006)(70586007)(5660300002)(8676002)(186003)(8936002)(4326008)(46800400005);DIR:OUT;SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 4820c42d-e85d-4a59-1575-08d7fb298c2d X-Forefront-PRVS: 04073E895A X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pi2XIq003PK4pzKTCaVGfHyBRTi/qKmzXYVDhFZ5dBi1xuiq/5ioucJ7WgeqsNXX50wQiWDv9EWg0KcEIgGYDno39H325spGqaZiQc95Is69OwrCMvTSamkvnTUUSmLiMXl6ItMhV0ZnqRDYEqjRw/+4fXUmUiHaRPLJHRa1WN3BBGoq/Q5oPZxpihc8g/4e1FgD+DuIPFLXI5S54SfP77bTniRALBXJFCIPNpDcScFrGDC86kyibqyjAfq/ahBpSdHTD3bmCWz+T61853fw5Gvksh/7k23pvxWf7RWUYmfJ48VDH6rPGzHGIStTYZRi0iRI3uYDTN8DsIXTK683yYyTf7nX+bXVY+GKwhdEagR2eu2apOrqpHpqwzfF8gprUs3QMKuzRROXYonlXoEXmT/83Fs2Sw0kTVEL/L6Kc13gynBLGFodNLqLYOYLWq9bawnFVke/LBYmjI/wd7scNlb/gFKCZ1faHwkwOjNRpmPgxAe1IGcliCVxK3BykWy0jTaRdJFh6tkR0F9kiA4FnA+UxVgwPp+Qm2BogpVCz0wwF2k+lVr4Q8ltkvSHTUNhYdVd8cPbFGH8P2uG/BGSBFTw0LRbXx8zMsUBDUjx2an+7FiXz+yFck7TgU66bwii X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2020 12:47:03.9816 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce8b2f64-17fb-4b85-78e4-08d7fb2990f4 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: AM0PR08MB4355 Content-Type: text/plain 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) != 0) { Integer = FixedPcdGet32 (PL011UartInteger); Fractional = 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. In this case the warning reported by the Visual Studio compiler does not evaluate to an issue. However, it can be useful to detect potential issues in other scenarios. Other compilers may either be incapable of detecting and reporting comparison with constant warnings or may be good at reducing false positives. So, it is definitely useful to keep this warning enabled, and disabling it case by case is a suitable option. Therefore, disable this warning for Visual studio compilers using the pragma suppress directive that: 'Pushes the current state of the pragma on the stack, disables the specified warning for the next line, and then pops the warning stack so that the pragma state is reset.' Signed-off-by: Sami Mujawar --- Notes: v2: - Update patch to selectively suppress comparison of [SAMI] constant warning and submit as a separate series. v1: - Fix comparison of constant warning reported by VS2017 [SAMI] - Various feedbacks can be seen at: https://edk2.groups.io/g/devel/topic/32999801#46278 ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c index 2d3c279cce49304959953ec4a34b50e09a7d0045..3c915e1e8de22a0b0b4cc46d495a5a6cbc784013 100644 --- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c +++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c @@ -2,7 +2,7 @@ Serial I/O Port library functions with no library constructor/destructor Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
- Copyright (c) 2011 - 2019, ARM Ltd. All rights reserved.
+ Copyright (c) 2011 - 2020, ARM Ltd. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -174,6 +174,14 @@ PL011UartInitializePort ( // // If PL011 Integer value has been defined then always ignore the BAUD rate +#if defined(_MSC_EXTENSIONS) + // Suppress 'warning C6326' reported by Visual Studio compiler using + // the suppress pragma directive that: 'Pushes the current state of + // the pragma on the stack, disables the specified warning for the + // next line, and then pops the warning stack so that the pragma state + // is reset.' +#pragma warning(suppress:6326) +#endif if (FixedPcdGet32 (PL011UartInteger) != 0) { Integer = FixedPcdGet32 (PL011UartInteger); Fractional = FixedPcdGet32 (PL011UartFractional); -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'