From nobody Tue Dec 24 01:01:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512848640508255.36216409678786; Sat, 9 Dec 2017 11:44:00 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7DB8E2214E35C; Sat, 9 Dec 2017 11:39:22 -0800 (PST) Received: from sonic317-48.consmr.mail.ne1.yahoo.com (sonic317-48.consmr.mail.ne1.yahoo.com [66.163.184.59]) (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 4DD512214E335 for ; Sat, 9 Dec 2017 11:39:21 -0800 (PST) Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.ne1.yahoo.com with HTTP; Sat, 9 Dec 2017 19:43:55 +0000 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.163.184.59; helo=sonic317-48.consmr.mail.ne1.yahoo.com; envelope-from=zenith432@users.sourceforge.net; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1512848635; bh=YcWV8RM/sz9W2KqBVnxXEx8H/VvZLBxIsw4CB+2WhqA=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=Svg8X0XwBwRoQZBnBQEuwUiVactE6yaR/6jlq/VhIDFSZrl516iLgtlDJIY5mqv/xs6McXYALUQQo/GwVXBHvji7lPdPmC4m5By2xi1GKHu/kl7ar2wEobPXT2mlJw7qeRZqE4icrk/AohNt+ihm+aybt7CgzemAsphtj/DYndPcSz+ZZgyPSYtc1daHm+F3v3jK7Dp5WahpQUHCXnQ+8M14yIzY4N+7vk6XXzSV09UlIPM9CdlHh7NB0QSmIU0G3E9DFZkWVZ/YLhp4e374ZQJMEse/sGJx98puxn7xVmZY65C+v1wQguGnpB71BjncA+qYj47yjyOoAS6VTwmZzQ== X-YMail-OSG: YD4iK3oVM1lyyosRw3gJSu6K11TaggisSGI7PYfhXhlu1HJ68e3tdflY0K9Pz9r fXOu4HwBB1GujTdtLALnda.7yaxsycCB_ebhppVWlKWTI8v.MMTdDc1zu3fR7a73KoPv0ZQjV2l9 zaFkRPZV_pPkVnpHpUdyOkAczT3FrmJ05g4yWz4cyGC1S.I8irEErXZWS5MG14iIf4VrHxvdAa5j HUaw9o2FKSMC7j022pJx7bM.o6i9TDHEPttuJZGw5P11SAxthHYd_PnZ_y4bp3hr1Rohe1iRq._K 7B1SN0kLb0438xK.mew0hBXihh4hcxK8maz7c7J2rqbLH04FhXLE4ZMDl7CuXepkqEzH5gL3yCs_ U0KmKBwqKYLwVgeqZ858d_ceKySJyBPAbKpsJJOapk9EV8MUphdS4vonaXrqWDgSW85x9h5v.GWj Uj7IY_GhjsZ339ggYrh5n7gLriRn4SDcx2vOXiFTgw5QkNW7Zp18Y3b2UAMg3DHSlsEg2zlYkLpn s4GNC9yC9LCl2IbxSU1JrJrPXN.mAtgsVUYN6o8w- Date: Sat, 9 Dec 2017 19:43:52 +0000 (UTC) From: Zenith432 To: Message-ID: <541697813.1899563.1512848632833@mail.yahoo.com> MIME-Version: 1.0 References: <541697813.1899563.1512848632833.ref@mail.yahoo.com> X-Mailer: WebService/1.1.11051 YahooMailBasic Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0.2 Safari/604.4.7 Subject: [edk2] [PATCH] MdePkg: resolve bug 741 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: , Reply-To: Zenith432 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is a proposal to resolve bug 741: UefiLib.c compilation failure with c= lang error: passing an object that undergoes default argument promotion to 'va_s= tart' has undefined behavior [-Werror,-Wvarargs]" Rationale: 1. Default argument promotion causes the sizeof a function's argument to be= different than the corresponding parameter's sizeof. This may break a permissible implemenation of stdarg.h= , which is why it is considered undefined behavior in C. The condition should be repaired rather than sile= nced with -Wno-varargs. 2. The warning is due to the last non-variadic parameter of GetBestLanguage= having type BOOLEAN. 3. BOOLEAN is typedef'd to 'unsigned char' in all ProcessorBind.h. 4. 'unsigned char' goes default argument promotion to int. 5. All ProcessorBind.h typedef the type INT32 to either 'int' or some 32-bi= t equivalent. 6. As a result it is safe to replace the type of the parameter from BOOLEAN= to INT32 in all current supported architectures. 7. The change is consistent with the BOOLEAN argument being converted to IN= T32 at the caller site. The function GetBestLanguage currently converts the argument from INT32 back to= BOOLEAN, however the function's logic is not disturbed by treating the argument as an INT32. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 --- MdePkg/Include/Library/UefiLib.h | 2 +- MdePkg/Library/UefiLib/UefiLib.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/Uefi= Lib.h index 0b14792a..5d98eb26 100644 --- a/MdePkg/Include/Library/UefiLib.h +++ b/MdePkg/Include/Library/UefiLib.h @@ -818,7 +818,7 @@ CHAR8 * EFIAPI GetBestLanguage ( IN CONST CHAR8 *SupportedLanguages,=20 - IN BOOLEAN Iso639Language, + IN INT32 Iso639Language, ... ); =20 diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/Uefi= Lib.c index a7eee012..57236511 100644 --- a/MdePkg/Library/UefiLib/UefiLib.c +++ b/MdePkg/Library/UefiLib/UefiLib.c @@ -1514,7 +1514,7 @@ CHAR8 * EFIAPI GetBestLanguage ( IN CONST CHAR8 *SupportedLanguages,=20 - IN BOOLEAN Iso639Language, + IN INT32 Iso639Language, ... ) { --=20 2.14.3 (Apple Git-98) _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel