From: "Tim Crawford" <crawfxrd@gmail.com>
To: devel@edk2.groups.io, gaoliming@byosoft.com.cn
Subject: Re: [edk2-devel] [PATCH] BaseTools/GenFw: Fix casting result of comparison
Date: Mon, 29 Mar 2021 07:12:57 -0600 [thread overview]
Message-ID: <CAMO=SwLQPfjedQCGyPc81HYHjQ_q4RYDrHVfRrqAYghWYJ31sg@mail.gmail.com> (raw)
In-Reply-To: <002a01d72459$f637cba0$e2a762e0$@byosoft.com.cn>
This was detected while attempting to use C99's stdbool for the
BOOLEAN type, which causes a compilation error. But I am using GCC10.
On Sun, Mar 28, 2021 at 11:11 PM gaoliming <gaoliming@byosoft.com.cn> wrote:
>
> Tim:
> This change is good. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
>
> Besides, which compiler detects this issue?
>
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Tim Crawford
> > 发送时间: 2021年3月26日 8:48
> > 收件人: devel@edk2.groups.io
> > 主题: [edk2-devel] [PATCH] BaseTools/GenFw: Fix casting result of
> > comparison
> >
> > The cast in IsDataShdr() is only applied the left side, causing it to
> > always return FALSE.
> >
> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3271
> > Signed-off-by: Tim Crawford <tcrawford@system76.com>
> > ---
> > BaseTools/Source/C/GenFw/Elf32Convert.c | 2 +-
> > BaseTools/Source/C/GenFw/Elf64Convert.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c
> > b/BaseTools/Source/C/GenFw/Elf32Convert.c
> > index 7f351287a9..df54991768 100644
> > --- a/BaseTools/Source/C/GenFw/Elf32Convert.c
> > +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
> > @@ -262,7 +262,7 @@ IsDataShdr (
> > if (IsHiiRsrcShdr(Shdr)) {
> >
> > return FALSE;
> >
> > }
> >
> > - return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
> > (SHF_ALLOC | SHF_WRITE);
> >
> > + return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
> > (SHF_ALLOC | SHF_WRITE));
> >
> > }
> >
> >
> >
> > STATIC
> >
> > diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c
> > b/BaseTools/Source/C/GenFw/Elf64Convert.c
> > index 4ed6b4477e..1bf1e9accb 100644
> > --- a/BaseTools/Source/C/GenFw/Elf64Convert.c
> > +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
> > @@ -270,7 +270,7 @@ IsDataShdr (
> > if (IsHiiRsrcShdr(Shdr)) {
> >
> > return FALSE;
> >
> > }
> >
> > - return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
> > (SHF_ALLOC | SHF_WRITE);
> >
> > + return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
> > (SHF_ALLOC | SHF_WRITE));
> >
> > }
> >
> >
> >
> > STATIC
> >
> > --
> > 2.30.2
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#73394): https://edk2.groups.io/g/devel/message/73394
> > Mute This Topic: https://groups.io/mt/81630142/4905953
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> > [gaoliming@byosoft.com.cn]
> > -=-=-=-=-=-=
> >
>
>
>
prev parent reply other threads:[~2021-03-29 13:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 0:48 [PATCH] BaseTools/GenFw: Fix casting result of comparison Tim Crawford
2021-03-29 5:11 ` 回复: [edk2-devel] " gaoliming
2021-03-29 13:12 ` Tim Crawford [this message]
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='CAMO=SwLQPfjedQCGyPc81HYHjQ_q4RYDrHVfRrqAYghWYJ31sg@mail.gmail.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