From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: Vijayenthiran Subramanian <vijayenthiran.subramaniam@arm.com>,
devel@edk2.groups.io
Cc: leif@nuviainc.com, thomas.abraham@arm.com
Subject: Re: [edk2-devel] [edk2-platforms] [PATCH v3] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error
Date: Fri, 27 Nov 2020 12:27:30 +0100 [thread overview]
Message-ID: <6bf9ddbe-7626-c846-850a-89d8ad977dc7@arm.com> (raw)
In-Reply-To: <CAC0BY-fEOKoT+fksxve_PdgSP09X+rgKVWjxoM3LLV6EeZfGXQ@mail.gmail.com>
On 11/27/20 11:45 AM, Vijayenthiran Subramanian wrote:
> Hi Ard,
>
> On Wed, Nov 25, 2020 at 3:05 PM Ard Biesheuvel <ard.biesheuvel@arm.com> wrote:
>>
>> On 11/25/20 3:30 PM, Vijayenthiran Subramaniam wrote:
>>> Fix "use of logical '&&' with constant operand" error when built with
>>> CLANG38 toolchain.
>>>
>>> Reviewed-by: Thomas Abraham <thomas.abraham@arm.com>
>>> Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
>>> ---
>>>
>>> Changes since v2:
>>> - Reviewed-bys added from:
>>> https://edk2.groups.io/g/devel/topic/71391950#55868
>>> - Rebased to latest master and repost.
>>>
>>> Changes since v1:
>>> - Fix Copyright year
>>>
>>> Note:
>>> Fix Clan error reported by Leif in
>>> https://edk2.groups.io/g/devel/message/54586
>>>
>>> Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c | 10 +++++-----
>>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
>>> index 9e5f7e70..f91724b9 100644
>>> --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
>>> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
>>> @@ -1,6 +1,6 @@
>>> /** @file
>>>
>>> - Copyright (c) 2018, ARM Ltd. All rights reserved.<BR>
>>> + Copyright (c) 2018-2020, ARM Limited. All rights reserved.
>>>
>>> SPDX-License-Identifier: BSD-2-Clause-Patent
>>>
>>> @@ -81,8 +81,8 @@ InitVirtioDevices (
>>> STATIC EFI_HANDLE mVirtIoNetController = NULL;
>>>
>>> // Install protocol interface for storage device
>>> - if ((FeaturePcdGet (PcdVirtioBlkSupported)) &&
>>> - (FixedPcdGet32 (PcdVirtioBlkBaseAddress))) {
>>> + if ((FeaturePcdGet (PcdVirtioBlkSupported) == TRUE) &&
>>> + (FixedPcdGet32 (PcdVirtioBlkBaseAddress) != 0)) {
>>
>> Nack
>>
>> Please fix this by disabling this bogus warning in the compiler. The
>> original code is perfectly reasonable, and comparing a boolean
>> expression to TRUE could equally trigger a diagnostic in another
>> compiler for being redundant. (The != 0 check for a UINT32 is fine)
>
> As you suggested, Boolean comparison with TRUE is not required for
> CLANG as well. But != 0 check for UINT32 is required to fix the error while
> building with the CLANG toolchain profile. Would it be ok if I post another
> version with just != 0 check with UNT32?
>
Yes, that is fine.
next prev parent reply other threads:[~2020-11-27 11:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 14:30 [edk2-platforms] [PATCH v3] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error Vijayenthiran Subramaniam
2020-11-25 15:04 ` Ard Biesheuvel
2020-11-26 13:21 ` [edk2-devel] " Vijayenthiran Subramaniam
2020-11-27 10:45 ` Vijayenthiran Subramaniam
2020-11-27 11:27 ` Ard Biesheuvel [this message]
2020-11-25 17:58 ` Leif Lindholm
2020-11-27 12:31 ` [edk2-devel] " Vijayenthiran Subramaniam
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=6bf9ddbe-7626-c846-850a-89d8ad977dc7@arm.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