Re: [edk2] [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.

2017-07-27 Thread Marvin Häuser
Hey Liming,

I would without a doubt vote for VS2005 to be deprecated, especially when it 
isn't even tested anymore.
Who would be in charge of that? The BaseTools maintainers?
If it won't be deprecated, I think merging the changes should be done to 
support all supported toolchains.

Regards,
Marvin.

> -Original Message-
> From: Gao, Liming [mailto:liming@intel.com]
> Sent: Thursday, July 27, 2017 3:17 PM
> To: marvin.haeu...@outlook.com; edk2-devel@lists.01.org
> Cc: Fan, Jeff <jeff@intel.com>
> Subject: RE: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.
> 
> Marvin:
>   Yes. They are too old. We have no verification for them.
> 
> Thanks
> Liming
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Marvin H?user
> > Sent: Wednesday, July 26, 2017 4:36 PM
> > To: edk2-devel@lists.01.org
> > Cc: Fan, Jeff <jeff@intel.com>
> > Subject: Re: [edk2] [PATCH] UefiCpuPkg: Add BOOLEAN casts to return
> statements.
> >
> > Hi Jeff,
> >
> > Visual Studio 2005 (and .NET 2003, though it is too old to compile
> > using EDK2. Maybe it should be deprecated?) is the version generating
> those errors, all newer versions are fine.
> >
> > Thanks and regards,
> > Marvin.
> >
> > > -Original Message-
> > > From: Fan, Jeff [mailto:jeff@intel.com]
> > > Sent: Wednesday, July 26, 2017 4:45 AM
> > > To: Marvin Häuser <marvin.haeu...@outlook.com>; edk2-
> > > de...@lists.01.org
> > > Subject: RE: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return
> statements.
> > >
> > > Marvin,
> > >
> > > Could you tell what VS version you are using?
> > >
> > > Jeff
> > >
> > > -Original Message-
> > > From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
> > > Sent: Friday, July 21, 2017 6:20 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Fan, Jeff
> > > Subject: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.
> > >
> > > Old versions of the Visual Studio C compiler return a value of type
> > > 'int' for comparisons, which is what the C99 standard defines in the
> > > sections 6.5.8 and 6.5.9. When the result of a comparison is
> > > returned, int is implicitely casted to BOOLEAN, which is smaller,
> > > and hence a warning about a possible loss of data is generated. This
> > > patch adds casts to BOOLEAN where necessary to silence these.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Marvin Haeuser <marvin.haeu...@outlook.com>
> > > ---
> > >  UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 8 
> > > 
> > >  UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 8
> -
> > > ---
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c| 2 +-
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c  | 2 +-
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c  | 2
> +-
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c | 2 +-
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c   | 2
> +-
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c   | 4
> ++--
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c | 2
> +-
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c | 6
> > > +++---
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c | 2
> +-
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c | 2
> +-
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c | 2 +-
> > >  UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c   | 2 +-
> > >  UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> > > | 2 +-
> > >  15 files changed, 24 insertions(+), 24 deletions(-)
> > >
> > > diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> > > b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> > > index 2091e5e2d0dd..55aee6c607f7 100644
> > > --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> > > +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> > > @@ -3,7 +3,7 @@
> > >
> > >This local APIC library instance supports xAPIC mode only.
> > >
> > > -  Copyright (c) 2010

Re: [edk2] [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.

2017-07-27 Thread Gao, Liming
Marvin:
  Yes. They are too old. We have no verification for them. 

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Marvin 
> H?user
> Sent: Wednesday, July 26, 2017 4:36 PM
> To: edk2-devel@lists.01.org
> Cc: Fan, Jeff <jeff@intel.com>
> Subject: Re: [edk2] [PATCH] UefiCpuPkg: Add BOOLEAN casts to return 
> statements.
> 
> Hi Jeff,
> 
> Visual Studio 2005 (and .NET 2003, though it is too old to compile using 
> EDK2. Maybe it should be deprecated?) is the version
> generating those errors, all newer versions are fine.
> 
> Thanks and regards,
> Marvin.
> 
> > -Original Message-
> > From: Fan, Jeff [mailto:jeff@intel.com]
> > Sent: Wednesday, July 26, 2017 4:45 AM
> > To: Marvin Häuser <marvin.haeu...@outlook.com>; edk2-
> > de...@lists.01.org
> > Subject: RE: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.
> >
> > Marvin,
> >
> > Could you tell what VS version you are using?
> >
> > Jeff
> >
> > -Original Message-
> > From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
> > Sent: Friday, July 21, 2017 6:20 PM
> > To: edk2-devel@lists.01.org
> > Cc: Fan, Jeff
> > Subject: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.
> >
> > Old versions of the Visual Studio C compiler return a value of type 'int' 
> > for
> > comparisons, which is what the C99 standard defines in the sections 6.5.8 
> > and
> > 6.5.9. When the result of a comparison is returned, int is implicitely 
> > casted to
> > BOOLEAN, which is smaller, and hence a warning about a possible loss of data
> > is generated. This patch adds casts to BOOLEAN where necessary to silence
> > these.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Marvin Haeuser <marvin.haeu...@outlook.com>
> > ---
> >  UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 8 
> > 
> >  UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 8 
> > -
> > ---
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c| 2 +-
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c  | 2 +-
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c  | 2 +-
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c | 2 +-
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c   | 2 +-
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c   | 4 ++--
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c | 2 +-
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c | 6
> > +++---
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c | 2 +-
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c | 2 +-
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c | 2 +-
> >  UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c   | 2 +-
> >  UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 2 +-
> >  15 files changed, 24 insertions(+), 24 deletions(-)
> >
> > diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> > b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> > index 2091e5e2d0dd..55aee6c607f7 100644
> > --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> > +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> > @@ -3,7 +3,7 @@
> >
> >This local APIC library instance supports xAPIC mode only.
> >
> > -  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
> > +  Copyright (c) 2010 - 2017, Intel Corporation. All rights
> > + reserved.
> >Copyright (c) 2017, AMD Inc. All rights reserved.
> >
> >This program and the accompanying materials @@ -49,9 +49,9 @@
> > StandardSignatureIsAuthenticAMD (
> >UINT32  RegEdx;
> >
> >AsmCpuid(CPUID_SIGNATURE, NULL, , , );
> > -  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
> > -  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
> > -  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
> > +  return (BOOLEAN)(RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX
> > &&
> > +   RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
> > +   RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
> >  }
> >
> >  /**
> > diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
> > b/Ue

Re: [edk2] [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.

2017-07-26 Thread Marvin Häuser
Hi Jeff,

Visual Studio 2005 (and .NET 2003, though it is too old to compile using EDK2. 
Maybe it should be deprecated?) is the version generating those errors, all 
newer versions are fine.

Thanks and regards,
Marvin.

> -Original Message-
> From: Fan, Jeff [mailto:jeff@intel.com]
> Sent: Wednesday, July 26, 2017 4:45 AM
> To: Marvin Häuser ; edk2-
> de...@lists.01.org
> Subject: RE: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.
> 
> Marvin,
> 
> Could you tell what VS version you are using?
> 
> Jeff
> 
> -Original Message-
> From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
> Sent: Friday, July 21, 2017 6:20 PM
> To: edk2-devel@lists.01.org
> Cc: Fan, Jeff
> Subject: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.
> 
> Old versions of the Visual Studio C compiler return a value of type 'int' for
> comparisons, which is what the C99 standard defines in the sections 6.5.8 and
> 6.5.9. When the result of a comparison is returned, int is implicitely casted 
> to
> BOOLEAN, which is smaller, and hence a warning about a possible loss of data
> is generated. This patch adds casts to BOOLEAN where necessary to silence
> these.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marvin Haeuser 
> ---
>  UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 8 
> 
>  UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 8 -
> ---
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c| 2 +-
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c  | 2 +-
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c  | 2 +-
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c | 2 +-
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c   | 2 +-
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c   | 4 ++--
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c | 2 +-
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c | 6
> +++---
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c | 2 +-
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c | 2 +-
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c | 2 +-
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c   | 2 +-
>  UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 2 +-
>  15 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> index 2091e5e2d0dd..55aee6c607f7 100644
> --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> @@ -3,7 +3,7 @@
> 
>This local APIC library instance supports xAPIC mode only.
> 
> -  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
> +  Copyright (c) 2010 - 2017, Intel Corporation. All rights
> + reserved.
>Copyright (c) 2017, AMD Inc. All rights reserved.
> 
>This program and the accompanying materials @@ -49,9 +49,9 @@
> StandardSignatureIsAuthenticAMD (
>UINT32  RegEdx;
> 
>AsmCpuid(CPUID_SIGNATURE, NULL, , , );
> -  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
> -  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
> -  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
> +  return (BOOLEAN)(RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX
> &&
> +   RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
> +   RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
>  }
> 
>  /**
> diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
> b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
> index d5d4efaeb408..bfd5acceebfa 100644
> --- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
> +++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
> @@ -4,7 +4,7 @@
>This local APIC library instance supports x2APIC capable processors
>which have xAPIC and x2APIC modes.
> 
> -  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
> +  Copyright (c) 2010 - 2017, Intel Corporation. All rights
> + reserved.
>Copyright (c) 2017, AMD Inc. All rights reserved.
> 
>This program and the accompanying materials @@ -50,9 +50,9 @@
> StandardSignatureIsAuthenticAMD (
>UINT32  RegEdx;
> 
>AsmCpuid(CPUID_SIGNATURE, NULL, , , );
> -  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
> -  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
> -  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
> +  return (BOOLEAN)(RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX
> &&
> +   RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
> +   RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
>  }
> 
>  /**
> diff --git 

Re: [edk2] [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.

2017-07-25 Thread Fan, Jeff
Marvin,

Could you tell what VS version you are using?

Jeff

-Original Message-
From: Marvin Häuser [mailto:marvin.haeu...@outlook.com] 
Sent: Friday, July 21, 2017 6:20 PM
To: edk2-devel@lists.01.org
Cc: Fan, Jeff
Subject: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.

Old versions of the Visual Studio C compiler return a value of type 'int' for 
comparisons, which is what the C99 standard defines in the sections 6.5.8 and 
6.5.9. When the result of a comparison is returned, int is implicitely casted 
to BOOLEAN, which is smaller, and hence a warning about a possible loss of data 
is generated. This patch adds casts to BOOLEAN where necessary to silence these.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser 
---
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 8 
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 8 
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c| 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c  | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c  | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c   | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c   | 4 ++--
 UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c | 6 +++---
 UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c   | 2 +-
 UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 2 +-
 15 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c 
b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
index 2091e5e2d0dd..55aee6c607f7 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
@@ -3,7 +3,7 @@
 
   This local APIC library instance supports xAPIC mode only.
 
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights 
+ reserved.
   Copyright (c) 2017, AMD Inc. All rights reserved.
 
   This program and the accompanying materials @@ -49,9 +49,9 @@ 
StandardSignatureIsAuthenticAMD (
   UINT32  RegEdx;
 
   AsmCpuid(CPUID_SIGNATURE, NULL, , , );
-  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
-  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
-  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
+  return (BOOLEAN)(RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
+   RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
+   RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
 }
 
 /**
diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c 
b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
index d5d4efaeb408..bfd5acceebfa 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
@@ -4,7 +4,7 @@
   This local APIC library instance supports x2APIC capable processors
   which have xAPIC and x2APIC modes.
 
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights 
+ reserved.
   Copyright (c) 2017, AMD Inc. All rights reserved.
 
   This program and the accompanying materials @@ -50,9 +50,9 @@ 
StandardSignatureIsAuthenticAMD (
   UINT32  RegEdx;
 
   AsmCpuid(CPUID_SIGNATURE, NULL, , , );
-  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
-  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
-  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
+  return (BOOLEAN)(RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
+   RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
+   RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
 }
 
 /**
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c 
b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
index 178bfb50abcf..df0f56ab9d82 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
@@ -69,7 +69,7 @@ AesniSupport (
   IS_XEON_PHI_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {
 MsrFeatureConfig = (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) ConfigData;
 MsrFeatureConfig[ProcessorNumber].Uint64 = AsmReadMsr64 
(MSR_SANDY_BRIDGE_FEATURE_CONFIG);
-return (CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI == 1);
+return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI == 1);
   }
   return FALSE;
 }
diff --git 

[edk2] [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.

2017-07-21 Thread Marvin Häuser
Old versions of the Visual Studio C compiler return a value of type
'int' for comparisons, which is what the C99 standard defines in the
sections 6.5.8 and 6.5.9. When the result of a comparison is
returned, int is implicitely casted to BOOLEAN, which is smaller, and
hence a warning about a possible loss of data is generated. This
patch adds casts to BOOLEAN where necessary to silence these.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser 
---
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 8 
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 8 
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c| 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c  | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c  | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c   | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c   | 4 ++--
 UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c | 6 +++---
 UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c   | 2 +-
 UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 2 +-
 15 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c 
b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
index 2091e5e2d0dd..55aee6c607f7 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
@@ -3,7 +3,7 @@
 
   This local APIC library instance supports xAPIC mode only.
 
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
   Copyright (c) 2017, AMD Inc. All rights reserved.
 
   This program and the accompanying materials
@@ -49,9 +49,9 @@ StandardSignatureIsAuthenticAMD (
   UINT32  RegEdx;
 
   AsmCpuid(CPUID_SIGNATURE, NULL, , , );
-  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
-  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
-  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
+  return (BOOLEAN)(RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
+   RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
+   RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
 }
 
 /**
diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c 
b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
index d5d4efaeb408..bfd5acceebfa 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
@@ -4,7 +4,7 @@
   This local APIC library instance supports x2APIC capable processors
   which have xAPIC and x2APIC modes.
 
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
   Copyright (c) 2017, AMD Inc. All rights reserved.
 
   This program and the accompanying materials
@@ -50,9 +50,9 @@ StandardSignatureIsAuthenticAMD (
   UINT32  RegEdx;
 
   AsmCpuid(CPUID_SIGNATURE, NULL, , , );
-  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
-  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
-  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
+  return (BOOLEAN)(RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
+   RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
+   RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
 }
 
 /**
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c 
b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
index 178bfb50abcf..df0f56ab9d82 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
@@ -69,7 +69,7 @@ AesniSupport (
   IS_XEON_PHI_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {
 MsrFeatureConfig = (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) ConfigData;
 MsrFeatureConfig[ProcessorNumber].Uint64 = AsmReadMsr64 
(MSR_SANDY_BRIDGE_FEATURE_CONFIG);
-return (CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI == 1);
+return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI == 1);
   }
   return FALSE;
 }
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c 
b/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
index 47116355a8ff..00ebc5c9a19e 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
@@ -38,7 +38,7 @@ C1eSupport (
   IN VOID