From: Marvin H?user <Marvin.Haeuser@outlook.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Zenith432 <zenith432@users.sourceforge.net>,
"michael.d.kinney@intel.com" <michael.d.kinney@intel.com>,
"liming.gao@intel.com" <liming.gao@intel.com>
Subject: Re: [PATCH] MdePkg: resolve bug 741
Date: Sat, 9 Dec 2017 20:22:33 +0000 [thread overview]
Message-ID: <AM4PR06MB1491AC0B6E3F3B783A81AE5180310@AM4PR06MB1491.eurprd06.prod.outlook.com> (raw)
In-Reply-To: <541697813.1899563.1512848632833@mail.yahoo.com>
For code style purposes, I suggest to declare the first member of the language list as a third argument, process it, and then use it to get the following from the VA.
Also, I think you forgot to CC the MdePkg maintainers, so I did with this mail.
Regards,
Marvin.
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Zenith432
> Sent: Saturday, December 9, 2017 8:44 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH] MdePkg: resolve bug 741
>
> 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 <zenith432@users.sourceforge.net>
> ---
> 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)
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
next prev parent reply other threads:[~2017-12-09 20:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <541697813.1899563.1512848632833.ref@mail.yahoo.com>
2017-12-09 19:43 ` [PATCH] MdePkg: resolve bug 741 Zenith432
2017-12-09 20:22 ` Marvin H?user [this message]
2017-12-10 13:52 ` Gao, Liming
2017-12-10 14:41 ` Zenith432
[not found] <1822489314.1922023.1512852000221.ref@mail.yahoo.com>
2017-12-09 20:40 ` Zenith432
2017-12-09 20:57 ` Marvin Häuser
[not found] <617598899.1906935.1512855198518.ref@mail.yahoo.com>
2017-12-09 21:33 ` Zenith432
2018-01-03 2:06 ` Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AM4PR06MB1491AC0B6E3F3B783A81AE5180310@AM4PR06MB1491.eurprd06.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox