From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=17.151.62.27; helo=mail-in5.apple.com; envelope-from=afish@apple.com; receiver=edk2-devel@lists.01.org Received: from mail-in5.apple.com (mail-out5.apple.com [17.151.62.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 549F020954CB8 for ; Tue, 27 Feb 2018 10:44:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1519757430; x=2383671030; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=avrURUKyVe0IEwQh6xq7x6gE3SuyWUAuSATICmsqb+g=; b=mZawWQ2OHqw9vwFYx20jKyPrE97SqnX7DsXEVd4COjWANFjLUjRb/fmZ1ppS6q6C mqq4dM+kkD/YTKHTwtMHjAaltutgSpnlc60S/JcFDi2Afjp2bqGcWj6FznvVoAQP Nq3A8Bc5xEJFUs4EiDRoqEZ+jz18aBcSMeNe+s0BlvDfDPXuwdPPAcPCJvwc5lsJ vQe2CCNNrjjJF/vUX1/wqUwF32sN55GfYOFlWSmZbnMrj4m5puMviqPGKPpew3Sb vV/nRVYLTf2MuK4vyaSWceY9yPi6voSMNCQNIGgEhGIn8Yx8J9idtg2TkWnyYYXU reE/SlAHr0k8Ig+KeLbuXg==; Received: from relay7.apple.com (relay7.apple.com [17.128.113.101]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail-in5.apple.com (Apple Secure Mail Relay) with SMTP id 2D.16.13704.678A59A5; Tue, 27 Feb 2018 10:50:30 -0800 (PST) X-AuditID: 11973e13-3f68e9e000003588-a6-5a95a8769383 Received: from nwk-mmpp-sz13.apple.com (nwk-mmpp-sz13.apple.com [17.128.115.216]) by relay7.apple.com (Apple SCV relay) with SMTP id 6D.CB.21982.678A59A5; Tue, 27 Feb 2018 10:50:30 -0800 (PST) MIME-version: 1.0 Received: from [17.235.47.217] by nwk-mmpp-sz13.apple.com (Oracle Communications Messaging Server 8.0.2.2.20180130 64bit (built Jan 30 2018)) with ESMTPSA id <0P4T00EVJOC4CQ20@nwk-mmpp-sz13.apple.com>; Tue, 27 Feb 2018 10:50:30 -0800 (PST) Sender: afish@apple.com From: Andrew Fish Message-id: <6C7D5245-F76E-4FF1-B7B5-B1254EA83C44@apple.com> Date: Tue, 27 Feb 2018 10:50:27 -0800 In-reply-to: <657bb4e2-7271-6a24-7cd3-aecdaaa005f5@redhat.com> Cc: =?utf-8?Q?Marvin_H=C3=A4user?= , "edk2-devel@lists.01.org" , "ruiyu.ni@intel.com" , "eric.dong@intel.com" , "star.zeng@intel.com" To: Laszlo Ersek References: <657bb4e2-7271-6a24-7cd3-aecdaaa005f5@redhat.com> X-Mailer: Apple Mail (2.3445.5.20) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsUi2FCYqlu2YmqUwY0fQhZ7Dh1lttj8Ithi 2bEdLBZv/19lt3jZs5rdYl+vtQObx+I9L5k8umf/Y/HY/PoFs8f7fVfZAliiuGxSUnMyy1KL 9O0SuDLufLzEXrB7N2PFhp9LmRsYjy1l7GLk4JAQMJG4+YC/i5GLQ0hgDZPE7nubWboYOcHi 8y+/Y4dIHGKU6J3RyQ6S4BUQlPgx+R5YEbNAmMSJ1ceZIYq+Mkqc+LWcDSQhLCAu8e7MJmYQ m01AWWLF/A9QzTYSl7a9ZwPZLCwQK3FsdzhImEVAVeLp5TdMIDangJ3Ejz1/mUBmMgs0Mkmc 6fjGCpIQEVCRmD3hARPE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H27swnhvTbbz Kqer0w/13VJ6aK9s273S6UTVzUD33fz8dxML1HNWZnufnRC75KaMkGyU5OsNsfefHutTyp8c fNhBv6X4j/uq47sDZFdZKyjY3hLUPHgy8Mn8Eg7eD0osxRmJhlrMRcWJAKMFe0F5AgAA X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: Re: [PATCH 1/2] MdeModulePkg/PciBusDxe: Prevent truncating constant values. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Feb 2018 18:44:24 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Feb 27, 2018, at 10:42 AM, Laszlo Ersek wrote: >=20 > On 02/27/18 17:49, Marvin H=C3=A4user wrote: >> The toolcahin VS2015x86 issues warnings when truncating constant >> values. Explicitely cast such to avoid it. >>=20 >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Marvin Haeuser >> --- >> MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >>=20 >> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c = b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c >> index 2f713fcee95e..a752853f3e9e 100644 >> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c >> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c >> @@ -1936,7 +1936,7 @@ ProgramP2C ( >> &BridgeControl >> ); >>=20 >> - BridgeControl &=3D (UINT16) = ~PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE; >> + BridgeControl &=3D (UINT16) = ~(UINT16)PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE; >> PciIo->Pci.Write ( >> PciIo, >> EfiPciIoWidthUint16, >> @@ -2005,7 +2005,7 @@ ProgramP2C ( >> &BridgeControl >> ); >>=20 >> - BridgeControl &=3D (UINT16) = ~(PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE); >> + BridgeControl &=3D (UINT16) = ~(UINT16)(PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE); >> PciIo->Pci.Write ( >> PciIo, >> EfiPciIoWidthUint16, >>=20 >=20 > My recommendation is the same as for: >=20 > [edk2] [PATCH 2/2] MdeModulePkg/BaseSerialPortLib16550: Prevent > truncating constant values. >=20 > #define PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE BIT8 > #define PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE BIT9 >=20 > #define BIT8 0x00000100 > #define BIT9 0x00000200 >=20 Laszlo, Stupid question? Would making BIT8 0x00000100U help? I notice we use ULL = for the larger ones, and I don't remember why we don't use U for the = ones that fit into a int? Thanks, Andrew Fish > So I suggest (UINT32) for the casts. >=20 >=20 > I'd also suggest a better subject line / commit message. Can we say: >=20 > Package/Module: avoid bit-negating signed integer constants >=20 > and then the commit message could quote the VS2015x86 warnings. >=20 > Again, just my two cents; I defer to the MdeModulePkg maintainers. >=20 > Thanks! > Laszlo > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel =