From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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) 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- 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 Date: Sat, 9 Dec 2017 19:43:52 +0000 (UTC) From: Zenith432 Reply-To: 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: [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: , X-List-Received-Date: Sat, 09 Dec 2017 19:39:21 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit This is a proposal to resolve bug 741: UefiLib.c compilation failure with clang error: passing an object that undergoes default argument promotion to 'va_start' 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 silenced 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-bit 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 INT32 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/UefiLib.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, - IN BOOLEAN Iso639Language, + IN INT32 Iso639Language, ... ); diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.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, - IN BOOLEAN Iso639Language, + IN INT32 Iso639Language, ... ) { -- 2.14.3 (Apple Git-98)