From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 440992218E923 for ; Wed, 6 Dec 2017 18:36:57 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Dec 2017 18:41:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,370,1508828400"; d="scan'208";a="10330666" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 06 Dec 2017 18:41:29 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 6 Dec 2017 18:41:28 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 6 Dec 2017 18:41:28 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.152]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Thu, 7 Dec 2017 10:41:26 +0800 From: "Gao, Liming" To: Leif Lindholm , "edk2-devel@lists.01.org" Thread-Topic: [PATCH v2] BaseTools: align ENCODE_ERROR macro with MdePkg version Thread-Index: AQHTbeOU5mdUz8vFE06wVVhDfqvvN6M3LUqA Date: Thu, 7 Dec 2017 02:41:25 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E18B9C7@SHSMSX104.ccr.corp.intel.com> References: <20171205161016.12879-1-leif.lindholm@linaro.org> In-Reply-To: <20171205161016.12879-1-leif.lindholm@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2] BaseTools: align ENCODE_ERROR macro with MdePkg version X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Dec 2017 02:36:57 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Leif: Could you also update ENCODE_WARNING() and RETURN_ERROR() to align to Mde= Pkg? Thanks Liming >-----Original Message----- >From: Leif Lindholm [mailto:leif.lindholm@linaro.org] >Sent: Wednesday, December 06, 2017 12:10 AM >To: edk2-devel@lists.01.org >Cc: Zhu, Yonghong ; Gao, Liming > >Subject: [PATCH v2] BaseTools: align ENCODE_ERROR macro with MdePkg >version > >BaseTools' BaseTypes.h defined the ENCODE_ERROR macro as > #define ENCODE_ERROR(a) ((RETURN_STATUS)(MAX_BIT | (a))) >whereas MdePkg defines it as > #define ENCODE_ERROR(StatusCode) ((RETURN_STATUS)(MAX_BIT | >(StatusCode))) > >When building with GCC 6.3 (at least) the former triggers >"error: overflow in implicit constant conversion [-Werror=3Doverflow]" >Resolve this by aligning it with the latter one. > >This also requires aligning the BaseTools typedef of RETURN_STATUS with >the MdePkg one: INTN -> UINTN. > >Add an explicit initialization of *Alignment to 0 in GenFfs.c >GetAlignmentFromFile to get rid of a warning occuring with GCC after >this change (-Werror=3Dmaybe-uninitialized). > >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Leif Lindholm >--- > >Sending out a v2 because I got cought out by the leading # in the commit >message... > > BaseTools/Source/C/GenFfs/GenFfs.c | 1 + > BaseTools/Source/C/Include/Common/BaseTypes.h | 4 ++-- > 2 files changed, 3 insertions(+), 2 deletions(-) > >diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c >b/BaseTools/Source/C/GenFfs/GenFfs.c >index e2fb3e0d1e..3b4a9b7761 100644 >--- a/BaseTools/Source/C/GenFfs/GenFfs.c >+++ b/BaseTools/Source/C/GenFfs/GenFfs.c >@@ -529,6 +529,7 @@ GetAlignmentFromFile(char *InFile, UINT32 >*Alignment) > > InFileHandle =3D NULL; > PeFileBuffer =3D NULL; >+ *Alignment =3D 0; > > memset (&ImageContext, 0, sizeof (ImageContext)); > >diff --git a/BaseTools/Source/C/Include/Common/BaseTypes.h >b/BaseTools/Source/C/Include/Common/BaseTypes.h >index 198647ab95..5fa4e560d8 100644 >--- a/BaseTools/Source/C/Include/Common/BaseTypes.h >+++ b/BaseTools/Source/C/Include/Common/BaseTypes.h >@@ -170,12 +170,12 @@ > // EFI Error Codes common to all execution phases > // > >-typedef INTN RETURN_STATUS; >+typedef UINTN RETURN_STATUS; > > /// > /// Set the upper bit to indicate EFI Error. > /// >-#define ENCODE_ERROR(a) (MAX_BIT | (a)) >+#define ENCODE_ERROR(a) ((RETURN_STATUS)(MAX_BIT | (a))) > > #define ENCODE_WARNING(a) (a) > #define RETURN_ERROR(a) ((a) < 0) >-- >2.11.0