From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web12.22977.1574339746338318515 for ; Thu, 21 Nov 2019 04:35:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=ExwwT/wZ; spf=pass (domain: linaro.org, ip: 209.85.128.66, mailfrom: leif.lindholm@linaro.org) Received: by mail-wm1-f66.google.com with SMTP id f129so2166333wmf.2 for ; Thu, 21 Nov 2019 04:35:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=89V+WCIUvkQ4bczTzxmrUbX8sDCcVdNXesh2+NJ2kPw=; b=ExwwT/wZYZLkJBwvBD3cJTUntv2NcHrJ1ytbqM7YJX1vVxK/xqeGMdLzlke6Dq65zP eN1dv6FG+eUpR82tKZLCVIYFj/F286Vrbz5vK9KeXxvqEUko9tugQnMk00KqSk9+xDJb cFXm3e5td+td0yRgE+NcyRQNiwq8Ne8O6xZe4apaDkknwgIDjGgZpayhWonPpGYY3ZmN slcCJR4Hk35IXblBQ6BZrj3tW4bnEkMEe2NZmdiDKaF+lzS8OPz9xsee0PKs3dvyDTKg 6tCX+AsIy08IpE/FUtuoFR7hOVfhMqeKB8H4UTL4f0eT4BN+777NhISfn/YdGh1jBgP0 0M2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=89V+WCIUvkQ4bczTzxmrUbX8sDCcVdNXesh2+NJ2kPw=; b=UBWGrg0L1Kvky+Z646duHmnkVd1PJylQUA9zcU+9EYwIHHRVTWSoH9EpHigpKpXVzj jHtrt1JUHy4aSnEFC445BXcURiJPBxjU7MryAd0Csc5Od+E46bE6JUp3Yz3ZWRHEzMpr TG48vNrzb3SxIWulbH+HkoL04VQrLMMKqNSJo0MRjr0vIxNzXIP0/O7DdByx72ahEjI0 gj0n7YcaljvG50BZNJfgxVBs/juMbz9xJChNdOdmrOfYnnjayfJKweywUPWmtGD2vTi5 Dmf9+XRfpcGfIG7o3Vp39R+zFDsdPzcSEwJ+9MGKlcbE/ley4xHya03U9dpBPslwk+7J GZHA== X-Gm-Message-State: APjAAAXIqhbZ4l/jxWG3PG9/TGfWlAcqchHY4ihhBY9UpIK7taaadbN7 F20QHrysVjOLQBV5Pl3ADyOVXQ== X-Google-Smtp-Source: APXvYqx39vl2b2mN40bS5MBBBiUHUiVMbdwmgdngNYMq6TDmjAv71ZZfchg01+Xh9uYKg8gt7Vyd3Q== X-Received: by 2002:a1c:e08a:: with SMTP id x132mr9794547wmg.146.1574339744815; Thu, 21 Nov 2019 04:35:44 -0800 (PST) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id a17sm3173859wrs.33.2019.11.21.04.35.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 04:35:44 -0800 (PST) Date: Thu, 21 Nov 2019 12:35:42 +0000 From: "Leif Lindholm" To: Sami Mujawar Cc: devel@edk2.groups.io, Alexei.Fedorov@arm.com, ard.biesheuvel@linaro.org, Matteo.Carlini@arm.com, nd@arm.com Subject: Re: [PATCH v1 18/19] ArmPlatformPkg: Fix comparison of constants warning Message-ID: <20191121123542.GD7359@bivouac.eciton.net> References: <20190823105539.13260-1-sami.mujawar@arm.com> <20190823105539.13260-19-sami.mujawar@arm.com> MIME-Version: 1.0 In-Reply-To: <20190823105539.13260-19-sami.mujawar@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 23, 2019 at 11:55:38 +0100, Sami Mujawar wrote: > 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 Reviewed-by: Leif Lindholm > --- > 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)' > >