From patchwork Tue Dec 5 16:10:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 120713 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5934104qgn; Tue, 5 Dec 2017 08:10:23 -0800 (PST) X-Google-Smtp-Source: AGs4zMa+J2VUmf2UcuJwbWPQeghPzNL9D+ms3d7RlT1doD0V1vVfgt6si5fEg3MdxCen6xFJ5upq X-Received: by 10.101.86.133 with SMTP id v5mr17729029pgs.266.1512490223542; Tue, 05 Dec 2017 08:10:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512490223; cv=none; d=google.com; s=arc-20160816; b=n/KyMKPjI21P6vAIO0xWOy4uSxSwPJeJ0W7FN0CR2rryKQTbTlMUksGc86q5umioBB d8cvyZs7qiyqB2hDUi9ZHAM4C8DVfdSMnBGZ6Om+aw4V02KbyHzgZBMGu21xQxEJWiDe MQu3c5ENcSlNG3gRWyQxU7M93J2bu4zHF6V/MJn+hzhwB4IW6AgHtGQOVVsXTL4+MgOK o84S5M7Q2d3u2SBFK2AAijlo6BfPsbk1r5/HKapvC1jYurZDwL+RsxuZMHzF9rRyDejC zXDw0JfCrfFIBw26yBEXIKs/xAXkgcK5Owmhl4uHNEXuo42AH+BjQQ7IzeAjjQyAVP8d lXdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=aSGZtWQWobnRHZVdvlbSZW2AY0HcxtSZKbn360n+I78=; b=yop42CNfJTwfdHHy/DEY4ieZyDsOAZ0LqB0bDMrfZmwfDg9LJb9Y/8sjWjGKCJcydw +sk7CK9Sfu0fZ5ew58dQBaLGR0oy6UdZXpnWAxxYcH+4x5zPL3LxBaHUXQAT7hGdVpgx SK+b1FXInIzxxhmGcSbLt6JlDlY5wCdLvtIuoOApnqdNKrF1YnZ6vw+EnOWCkUNgEU2b 8JJhuA8LYqq6//cKfK4KJvXfbNAYC/JjXjz53um6K3AFHeef5ScPg4BtnZooHbu/GJ/P FD831NwbC1Zp0fVCjPhVN7dHYPqh2LmqnYwFetr3htkjfRHHeWxT1RSkielUOezmUfah 16Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MKbbvW1H; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id r74si291583pfe.273.2017.12.05.08.10.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 08:10:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MKbbvW1H; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2CA7B2034C5E7; Tue, 5 Dec 2017 08:05:50 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (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 C321A2035627C for ; Tue, 5 Dec 2017 08:05:48 -0800 (PST) Received: by mail-wr0-x244.google.com with SMTP id g53so882967wra.2 for ; Tue, 05 Dec 2017 08:10:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=BtWDYggAVpkS4fhzVnZN4tkc5X7oPEe/RUudjAJCpAk=; b=MKbbvW1HSmsyZFoI+ETIk5IEJrbzGG/kkinPlxVxFuLCH/6rh6hDV8J/U3ZTjkv+ON 1HiL3gaWp8e1qLVH7flWQXZVZHC/V8qYu0IxVVPWdrIYqezvPWGc7FQ2xGsHcN8dHeuy FaaUWhyeJt42NBLZUPxeHtyt+f4vkoxprKFEU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BtWDYggAVpkS4fhzVnZN4tkc5X7oPEe/RUudjAJCpAk=; b=Wvb9heWOQlhjNIQHFt/AFaVz5EIMuaJJgggiKeI7QHcd5s3Cqcnl3GqtMa5aQnnCpl BhW7zvUZJa0feN2MBFVTFOYmiZzfARZjOX+pQYAY+ati4zD2h0LEcs5xPi1TTTxvKD8a S6MGn5QeEUQg5J9+b5hXYQQjm7rfzvadYzWEeCfWnOuzst5onPwt1ienSu2H9lwVqGU5 wqlsx9X2eHxb1u28S+iArW9TOGekFrASlNG6brn2G+ldOoQSRlcIwm3erP1K6bLTihOK z5YGBGNZwiBn5vC2V/TIG4Qcjlq7tTxC6Ob/q6vUPXxnu19p4urndzXTlKhN79/Pja1i cqkw== X-Gm-Message-State: AJaThX53mBeqUUVJ1Ax93Czz0pHC2xz+nYswywAQj9gWMARM1p+6okeQ xvoUAINnt9PND+w3ghKALoISGGWI9TQ= X-Received: by 10.223.161.222 with SMTP id v30mr16681984wrv.191.1512490218008; Tue, 05 Dec 2017 08:10:18 -0800 (PST) Received: from vanye.hemma.eciton.net (cpc92316-cmbg19-2-0-cust118.5-4.cable.virginm.net. [82.12.0.119]) by smtp.gmail.com with ESMTPSA id s187sm780040wmf.16.2017.12.05.08.10.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 08:10:16 -0800 (PST) From: Leif Lindholm To: edk2-devel@lists.01.org Date: Tue, 5 Dec 2017 16:10:15 +0000 Message-Id: <20171205161016.12879-1-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [edk2] [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: , Cc: Liming Gao MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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. 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 --- 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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..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)