From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 84A2E221EA0CA for ; Fri, 8 Dec 2017 01:51:15 -0800 (PST) Received: by mail-wr0-x243.google.com with SMTP id y21so10266721wrc.1 for ; Fri, 08 Dec 2017 01:55:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eILe4u2GJ0dbOrNLr/ek04NYATINeZR1sjq7HjkAoAg=; b=EDNJ9A5lrA1oTPXORcpmPrO/BB0CQbY8qdSvLdesrJn0omQmWhkIvK9JhWAlS47y/D pPOpiUuznpHXG41yPZUBLIGGRABZoevDNDWj/pcDoqVC5e2Hb4XBf11rbjazcLewFvRn Cn4D/F26ImZ7MQdWKfOUNzCTXgLjAOJUK9M4E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eILe4u2GJ0dbOrNLr/ek04NYATINeZR1sjq7HjkAoAg=; b=Mmoue36wnFfQz12AMGS6lXl6afvD3OYZYLoqocvo38UjjmMtZPSdWEYkxAUjVgj6GE 0eitIb1T5aTGmUG/SxsKg2kwrqikUjLXL87XYxSVTrB1UvBtmwbPsgLbGPVOmSD/jO0T eFURANG/FDvZwrAUkH7LFiiiBlrXbC/h7ZfVc/GC7flQCUwB6mCHIdgn3a506Kl5RUeP e2BTDuf1/78hhOn1/jJa2HymlsBXaMkXQME59Z7jD7Vp9bwM3pQFo0kl6aF4QZAoAxi/ ill0Y51ikqTl/k7AuLuBW5MbjakT8+3ie2+LIVVaFLl3+UpV3ztb6nvXkCD4IBrt342F CJ3g== X-Gm-Message-State: AJaThX765Wr9UTHmYIwIjVExVZWkUyiPKQ1rGU8dRY2zLMU35L6G7u1K ULBNx1J8XAzhRqAwY+0SnzWyIw== X-Google-Smtp-Source: AGs4zMbjOpJ0yiPuHLRwG0LusHV3CXEBDKEIE4ym3lksQBo6l5cUD2VX6xZWkGWZfboQOkzQYgaW8A== X-Received: by 10.223.145.80 with SMTP id j74mr27019647wrj.250.1512726947782; Fri, 08 Dec 2017 01:55:47 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id y51sm8043692wrc.96.2017.12.08.01.55.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Dec 2017 01:55:46 -0800 (PST) Date: Fri, 8 Dec 2017 09:55:45 +0000 From: Leif Lindholm To: "Gao, Liming" Cc: "edk2-devel@lists.01.org" Message-ID: <20171208095544.tarbg2tlhzre37t6@bivouac.eciton.net> References: <20171207173800.26730-1-leif.lindholm@linaro.org> <4A89E2EF3DFEDB4C8BFDE51014F606A14E18C4B5@SHSMSX104.ccr.corp.intel.com> MIME-Version: 1.0 In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E18C4B5@SHSMSX104.ccr.corp.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH v2] BaseTools: align ERROR/WARNING/RETURN macros with MdePkg versions 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: Fri, 08 Dec 2017 09:51:15 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Dec 08, 2017 at 12:52:56AM +0000, Gao, Liming wrote: > Reviewed-by: Liming Gao Thanks. Pushed as 978779d7b5. > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Leif Lindholm > > Sent: Friday, December 8, 2017 1:38 AM > > To: edk2-devel@lists.01.org > > Cc: Gao, Liming > > Subject: [edk2] [PATCH v2] BaseTools: align ERROR/WARNING/RETURN macros with MdePkg versions > > > > 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=overflow]" > > 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. > > > > While at it, update adjacent ENCODE_WARNING and RETURN_ERROR as well. > > > > 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=maybe-uninitialized). > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Leif Lindholm > > --- > > > > v2 updated for ENCODE_WARNING and RETURN_ERROR, as requested > > by Liming. > > > > BaseTools/Source/C/GenFfs/GenFfs.c | 1 + > > BaseTools/Source/C/Include/Common/BaseTypes.h | 8 ++++---- > > 2 files changed, 5 insertions(+), 4 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 = NULL; > > PeFileBuffer = NULL; > > + *Alignment = 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..08b60bae11 100644 > > --- a/BaseTools/Source/C/Include/Common/BaseTypes.h > > +++ b/BaseTools/Source/C/Include/Common/BaseTypes.h > > @@ -170,15 +170,15 @@ > > // 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) > > +#define ENCODE_WARNING(a) ((RETURN_STATUS)(a)) > > +#define RETURN_ERROR(a) (((INTN)(RETURN_STATUS)(a)) < 0) > > > > #define RETURN_SUCCESS 0 > > #define RETURN_LOAD_ERROR ENCODE_ERROR (1) > > -- > > 2.11.0 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel