[edk2-devel] [edk2-platforms] [PATCH] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error

Vijayenthiran Subramaniam posted 1 patch 4 years, 9 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[edk2-devel] [edk2-platforms] [PATCH] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error
Posted by Vijayenthiran Subramaniam 4 years, 9 months ago
Fix "use of logical '&&' with constant operand" error when built with
CLANG38 toolchain.

Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
---

Notes:
    Fix Clan error reported by Leif in https://edk2.groups.io/g/devel/message/54586.
    Build tested with clang 9:
    CLANG38_AARCH64_PREFIX=aarch64-linux-gnu- build -n $NUM_CPUS -a AARCH64 \
    -t CLANG38 -p Platform/ARM/SgiPkg/SgiPlatform.dsc

 Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
index 9e5f7e704e24..d8af525f52b1 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/VirtioDevices.c
@@ -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)) {
     Status = gBS->InstallProtocolInterface (&mVirtIoBlkController,
                     &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
                     &mVirtioBlockDevicePath);
@@ -110,8 +110,8 @@ InitVirtioDevices (
   }
 
   // Install protocol interface for network device
-  if ((FeaturePcdGet (PcdVirtioNetSupported)) &&
-      (FixedPcdGet32 (PcdVirtioNetBaseAddress))) {
+  if ((FeaturePcdGet (PcdVirtioNetSupported) == TRUE) &&
+      (FixedPcdGet32 (PcdVirtioNetBaseAddress) != 0)) {
     Status = gBS->InstallProtocolInterface (&mVirtIoNetController,
                     &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
                     &mVirtioNetDevicePath);
-- 
2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54614): https://edk2.groups.io/g/devel/message/54614
Mute This Topic: https://groups.io/mt/71391794/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

[edk2-devel] [edk2-platforms] [PATCH v2] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error
Posted by Vijayenthiran Subramaniam 4 years, 9 months ago
Fix "use of logical '&&' with constant operand" error when built with
CLANG38 toolchain.

Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
---

Changes since v1:
  - Fix Copyright year

Notes:
    Fix Clan error reported by Leif in https://edk2.groups.io/g/devel/message/54586.
    Build tested with clang 9:
    CLANG38_AARCH64_PREFIX=aarch64-linux-gnu- build -n $NUM_CPUS -a AARCH64 \
    -t CLANG38 -p Platform/ARM/SgiPkg/SgiPlatform.dsc

 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 9e5f7e704e24..f91724b95a42 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)) {
     Status = gBS->InstallProtocolInterface (&mVirtIoBlkController,
                     &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
                     &mVirtioBlockDevicePath);
@@ -110,8 +110,8 @@ InitVirtioDevices (
   }
 
   // Install protocol interface for network device
-  if ((FeaturePcdGet (PcdVirtioNetSupported)) &&
-      (FixedPcdGet32 (PcdVirtioNetBaseAddress))) {
+  if ((FeaturePcdGet (PcdVirtioNetSupported) == TRUE) &&
+      (FixedPcdGet32 (PcdVirtioNetBaseAddress) != 0)) {
     Status = gBS->InstallProtocolInterface (&mVirtIoNetController,
                     &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
                     &mVirtioNetDevicePath);
-- 
2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54618): https://edk2.groups.io/g/devel/message/54618
Mute This Topic: https://groups.io/mt/71391950/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms] [PATCH v2] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error
Posted by Vijayenthiran Subramaniam 4 years, 9 months ago
Hi,

On Wed, Feb 19, 2020 at 8:37 AM Vijayenthiran Subramaniam
<vijayenthiran.subramaniam@arm.com> wrote:
>
> Fix "use of logical '&&' with constant operand" error when built with
> CLANG38 toolchain.
>
> Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
> ---
>
> Changes since v1:
>   - Fix Copyright year
>
> Notes:
>     Fix Clan error reported by Leif in https://edk2.groups.io/g/devel/message/54586.
>     Build tested with clang 9:
>     CLANG38_AARCH64_PREFIX=aarch64-linux-gnu- build -n $NUM_CPUS -a AARCH64 \
>     -t CLANG38 -p Platform/ARM/SgiPkg/SgiPlatform.dsc
>
>  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 9e5f7e704e24..f91724b95a42 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)) {
>      Status = gBS->InstallProtocolInterface (&mVirtIoBlkController,
>                      &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
>                      &mVirtioBlockDevicePath);
> @@ -110,8 +110,8 @@ InitVirtioDevices (
>    }
>
>    // Install protocol interface for network device
> -  if ((FeaturePcdGet (PcdVirtioNetSupported)) &&
> -      (FixedPcdGet32 (PcdVirtioNetBaseAddress))) {
> +  if ((FeaturePcdGet (PcdVirtioNetSupported) == TRUE) &&
> +      (FixedPcdGet32 (PcdVirtioNetBaseAddress) != 0)) {
>      Status = gBS->InstallProtocolInterface (&mVirtIoNetController,
>                      &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
>                      &mVirtioNetDevicePath);
> --
> 2.7.4
>

Any feedback on this patch?

Regards,
Vijay.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55138): https://edk2.groups.io/g/devel/message/55138
Mute This Topic: https://groups.io/mt/71391950/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms] [PATCH v2] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error
Posted by Thomas Abraham 4 years, 8 months ago
Reviewed-by: Thomas Abraham <thomas.abraham@arm.com>

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55868): https://edk2.groups.io/g/devel/message/55868
Mute This Topic: https://groups.io/mt/71391950/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms] [PATCH v2] Platform/ARM/SgiPkg: Fix constant-logical-operand clang error
Posted by Vijayenthiran Subramaniam 4 years, 6 months ago
Hi Thomas,
Thanks for reviewing.

Hi Leif,
Any feedback on this patch. For context, this patch fixes the Clang build errors reported here: https://edk2.groups.io/g/devel/message/54586

Regards,
Vijay.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#59690): https://edk2.groups.io/g/devel/message/59690
Mute This Topic: https://groups.io/mt/71391950/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-