Reviewed-by: Alexei Fedorov Alexei ________________________________ From: Sami Mujawar Sent: 23 August 2019 11:55 To: devel@edk2.groups.io Cc: Sami Mujawar ; Alexei Fedorov ; ard.biesheuvel@linaro.org ; leif.lindholm@linaro.org ; Matteo Carlini ; nd Subject: [PATCH v1 18/19] ArmPlatformPkg: Fix comparison of constants warning The VS2017 compiler reports 'warning C6326: potential comparison of a constant with another constant' when a fixed PCD value is compared with a constant value. The faulting code is as marked by '-->' below: --> if (FixedPcdGet32 (PL011UartInteger) != 0) { Integer = FixedPcdGet32 (PL011UartInteger); Fractional = FixedPcdGet32 (PL011UartFractional); } else { ... The macro FixedPcdGet32 (PL011UartInteger) evaluates to a macro _PCD_VALUE_PL011UartInteger that is defined by the build system to represent the UART Integer value. Therefore, the VS2017 compiler reports the above warning. Fix this warning by enclosing the code in appropriate #if .. #else .. #endif directives. Signed-off-by: Sami Mujawar --- ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c index 2d3c279cce49304959953ec4a34b50e09a7d0045..dabf099b9bc82e1fb1bd5a2eae3fa4b5878a9e07 100644 --- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c +++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c @@ -174,10 +174,10 @@ PL011UartInitializePort ( // // If PL011 Integer value has been defined then always ignore the BAUD rate - if (FixedPcdGet32 (PL011UartInteger) != 0) { +#if (FixedPcdGet32 (PL011UartInteger) != 0) Integer = FixedPcdGet32 (PL011UartInteger); Fractional = FixedPcdGet32 (PL011UartFractional); - } else { +#else // If BAUD rate is zero then replace it with the system default value if (*BaudRate == 0) { *BaudRate = FixedPcdGet32 (PcdSerialBaudRate); @@ -197,7 +197,7 @@ PL011UartInitializePort ( Divisor = (UINT32)DivisorValue; Integer = Divisor >> FRACTION_PART_SIZE_IN_BITS; Fractional = Divisor & FRACTION_PART_MASK; - } +#endif // // If PL011 is already initialized, check the current settings -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.