From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) by mx.groups.io with SMTP id smtpd.web09.21288.1617023589374721658 for ; Mon, 29 Mar 2021 06:13:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B/hzdbab; spf=pass (domain: gmail.com, ip: 209.85.219.169, mailfrom: crawfxrd@gmail.com) Received: by mail-yb1-f169.google.com with SMTP id m132so13742359ybf.2 for ; Mon, 29 Mar 2021 06:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=Ec/ptG/EuIj3K95euq7m7lP/pmxAvjUPZW79mymMHV0=; b=B/hzdbablxEltouXcDCnAyD2sGAL36EKL2wMCrwOrvb+Coyf32qwhou85rBpaCM1FY Tc+E8wafBrl+2cE6iGffyLWULU77coaSlzfWqYEu5HIMIb/SZVtNR9JhZUmVuQbDz2K6 pR4zJfAeRPKdjZBlMyxezJuIlVisWjhymEz/03qOLvy6r+j8DvvqXMNl/oT0Dgz9GLJ8 SEMDwPgGcEReXq/8lrhMtHNrO/sCRv3IIjz4Gtv/7cUunEGgCyuVcwI1z82W2vggOi2Q GpurRj5qfLMwUzPViFUKviRZi5KMCjAQNJ/f596CiHaAAnKyFjbyjSN1kZmUJ0eDmDPG Ft3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=Ec/ptG/EuIj3K95euq7m7lP/pmxAvjUPZW79mymMHV0=; b=dMZIkVjgm3/nKX3RmAptaItdTckCYeS6fwubAW01x/30PsaQdjJf4WO4P7feCYJEwB iSCre4GV/0ZEiVuvuMt+bmcoCnYEF8YbMEz/eT76KyluzTB+UMGIT5+yKVBrBKaQJHR+ VWSei1w430tmJf/XDOKDtKbCjz2Z+FmywTpkx+anVKFbHWzOR48qWISE4ey5BX1ovQlE qIjY4eZARvMZ2xrU7TCqO8YWXmR5y5qBskfxM3tFO+LCq1ZKHbmFFCZJyz918vkslpuV Hi1LI0Gs34tZ8h7INv2Uxd3UYx9PMAsQCYYfdeZMUxMGEHKM1N+CPHp1By6b7fj36G4l lCFg== X-Gm-Message-State: AOAM531g18Ow/plbRJKmKqnGpoqFZCSSeE1+UDDF6xIGAThyJEDhASgx VcbVIZqhgwQiZiR3tLsLJL2KiqVaf+0OfzvhYSZP42iWPdk= X-Google-Smtp-Source: ABdhPJweexJMHScliack0UnBShGNa/i/K2nzrBUIzEYyIgpXvxr33rzfeZ3BHcT0L/s6ZlVr3NJk/iX6TxEgC888yWE= X-Received: by 2002:a25:8405:: with SMTP id u5mr38932867ybk.274.1617023588465; Mon, 29 Mar 2021 06:13:08 -0700 (PDT) MIME-Version: 1.0 References: <002a01d72459$f637cba0$e2a762e0$@byosoft.com.cn> In-Reply-To: <002a01d72459$f637cba0$e2a762e0$@byosoft.com.cn> From: "Tim Crawford" Date: Mon, 29 Mar 2021 07:12:57 -0600 Message-ID: Subject: Re: [edk2-devel] [PATCH] BaseTools/GenFw: Fix casting result of comparison To: devel@edk2.groups.io, gaoliming@byosoft.com.cn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 wrote= : > > Tim: > This change is good. Reviewed-by: Liming Gao > > Besides, which compiler detects this issue? > > Thanks > Liming > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io =E4=BB=A3=E8=A1=A8 Tim Crawford > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B43=E6=9C=8826=E6=97= =A5 8:48 > > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > > =E4=B8=BB=E9=A2=98: [edk2-devel] [PATCH] BaseTools/GenFw: Fix casting r= esult 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=3D3271 > > Signed-off-by: Tim Crawford > > --- > > 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)) =3D=3D > > (SHF_ALLOC | SHF_WRITE); > > > > + return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) =3D=3D > > (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)) =3D=3D > > (SHF_ALLOC | SHF_WRITE); > > > > + return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) =3D=3D > > (SHF_ALLOC | SHF_WRITE)); > > > > } > > > > > > > > STATIC > > > > -- > > 2.30.2 > > > > > > > > -=3D-=3D-=3D-=3D-=3D-=3D > > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#73394): https://edk2.groups.io/g/devel/message/7339= 4 > > 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] > > -=3D-=3D-=3D-=3D-=3D-=3D > > > > >