* [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements. @ 2017-07-21 10:20 Marvin Häuser 2017-07-26 2:44 ` Fan, Jeff 0 siblings, 1 reply; 5+ messages in thread From: Marvin Häuser @ 2017-07-21 10:20 UTC (permalink / raw) To: edk2-devel@lists.01.org; +Cc: jeff.fan@intel.com 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.Haeuser@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.<BR> + Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017, AMD Inc. All rights reserved.<BR> This program and the accompanying materials @@ -49,9 +49,9 @@ StandardSignatureIsAuthenticAMD ( UINT32 RegEdx; AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); - 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.<BR> + Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017, AMD Inc. All rights reserved.<BR> This program and the accompanying materials @@ -50,9 +50,9 @@ StandardSignatureIsAuthenticAMD ( UINT32 RegEdx; AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); - 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 *ConfigData OPTIONAL ) { - return IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel); + return (BOOLEAN)IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c index 56e53561e9de..e625b061829f 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c @@ -38,7 +38,7 @@ ClockModulationSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c index 2038171a14c3..593a1e1b35b5 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c @@ -38,7 +38,7 @@ EistSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c index 921656a1e869..1ba942990113 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c @@ -50,7 +50,7 @@ ExecuteDisableSupport ( } AsmCpuid (CPUID_EXTENDED_CPU_SIG, NULL, NULL, NULL, &Edx.Uint32); - return (Edx.Bits.NX != 0); + return (BOOLEAN)(Edx.Bits.NX != 0); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c index d28c4ec51a04..fae09d8be711 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c @@ -65,7 +65,7 @@ VmxSupport ( ASSERT (ConfigData != NULL); MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData; MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL); - return (CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); } /** @@ -215,7 +215,7 @@ SmxSupport ( ASSERT (ConfigData != NULL); MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData; MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL); - return (CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c index 40cc9d5fe0cf..ee037c35dc5a 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c @@ -41,7 +41,7 @@ LimitCpuidMaxvalSupport ( UINT32 Eax; AsmCpuid (CPUID_SIGNATURE, &Eax, NULL, NULL, NULL); - return (Eax > 3); + return (BOOLEAN)(Eax > 3); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c index 72f665d32e36..0e3b3468d7bc 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c @@ -38,7 +38,7 @@ MceSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); } /** @@ -105,7 +105,7 @@ McaSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); } /** @@ -191,7 +191,7 @@ McgCtlSupport ( return FALSE; } McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP); - return (McgCap.Bits.MCG_CTL_P == 1); + return (BOOLEAN)(McgCap.Bits.MCG_CTL_P == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c index 1d43bd128afe..67aaf37d4e3d 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c @@ -38,7 +38,7 @@ MonitorMwaitSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c index 8cafba4f4a87..5df2ef15ddcf 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c @@ -43,7 +43,7 @@ PendingBreakSupport ( IS_CORE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) || IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) || IS_PENTIUM_M_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) { - return (CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); } return FALSE; } diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c index 146c4cfda3f9..438578a83230 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c @@ -53,7 +53,7 @@ PpinSupport ( // Check whether platform support this feature. // PlatformInfo.Uint64 = AsmReadMsr64 (MSR_IVY_BRIDGE_PLATFORM_INFO_1); - return (PlatformInfo.Bits.PPIN_CAP != 0); + return (BOOLEAN)(PlatformInfo.Bits.PPIN_CAP != 0); } return FALSE; diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c index b4a453c3525c..ecaf47a4af00 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c @@ -71,7 +71,7 @@ X2ApicSupport ( // X2ApicEnabled[ProcessorNumber] = (GetApicMode () == LOCAL_APIC_MODE_X2APIC) ? TRUE : FALSE; - return (CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); } /** diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c index 338f1a495cf4..c093356ab150 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c @@ -650,7 +650,7 @@ IsCpuFeatureSetInCpuPcd ( if ((Feature >> 3) >= CpuBitMaskSize) { return FALSE; } - return ((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature & 0x07))) != 0); + return (BOOLEAN)((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature & 0x07))) != 0); } /** -- 2.12.2.windows.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements. 2017-07-21 10:20 [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements Marvin Häuser @ 2017-07-26 2:44 ` Fan, Jeff 2017-07-26 8:36 ` Marvin Häuser 0 siblings, 1 reply; 5+ messages in thread From: Fan, Jeff @ 2017-07-26 2:44 UTC (permalink / raw) To: Marvin Häuser, edk2-devel@lists.01.org Marvin, Could you tell what VS version you are using? Jeff -----Original Message----- From: Marvin Häuser [mailto:Marvin.Haeuser@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.Haeuser@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.<BR> + Copyright (c) 2010 - 2017, Intel Corporation. All rights + reserved.<BR> Copyright (c) 2017, AMD Inc. All rights reserved.<BR> This program and the accompanying materials @@ -49,9 +49,9 @@ StandardSignatureIsAuthenticAMD ( UINT32 RegEdx; AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); - 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.<BR> + Copyright (c) 2010 - 2017, Intel Corporation. All rights + reserved.<BR> Copyright (c) 2017, AMD Inc. All rights reserved.<BR> This program and the accompanying materials @@ -50,9 +50,9 @@ StandardSignatureIsAuthenticAMD ( UINT32 RegEdx; AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); - 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 *ConfigData OPTIONAL ) { - return IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel); + return (BOOLEAN)IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, + CpuInfo->DisplayModel); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c index 56e53561e9de..e625b061829f 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c @@ -38,7 +38,7 @@ ClockModulationSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c index 2038171a14c3..593a1e1b35b5 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c @@ -38,7 +38,7 @@ EistSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c index 921656a1e869..1ba942990113 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c @@ -50,7 +50,7 @@ ExecuteDisableSupport ( } AsmCpuid (CPUID_EXTENDED_CPU_SIG, NULL, NULL, NULL, &Edx.Uint32); - return (Edx.Bits.NX != 0); + return (BOOLEAN)(Edx.Bits.NX != 0); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c index d28c4ec51a04..fae09d8be711 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c @@ -65,7 +65,7 @@ VmxSupport ( ASSERT (ConfigData != NULL); MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData; MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL); - return (CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); } /** @@ -215,7 +215,7 @@ SmxSupport ( ASSERT (ConfigData != NULL); MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData; MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL); - return (CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c index 40cc9d5fe0cf..ee037c35dc5a 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c @@ -41,7 +41,7 @@ LimitCpuidMaxvalSupport ( UINT32 Eax; AsmCpuid (CPUID_SIGNATURE, &Eax, NULL, NULL, NULL); - return (Eax > 3); + return (BOOLEAN)(Eax > 3); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c index 72f665d32e36..0e3b3468d7bc 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c @@ -38,7 +38,7 @@ MceSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); } /** @@ -105,7 +105,7 @@ McaSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); } /** @@ -191,7 +191,7 @@ McgCtlSupport ( return FALSE; } McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP); - return (McgCap.Bits.MCG_CTL_P == 1); + return (BOOLEAN)(McgCap.Bits.MCG_CTL_P == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c index 1d43bd128afe..67aaf37d4e3d 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c @@ -38,7 +38,7 @@ MonitorMwaitSupport ( IN VOID *ConfigData OPTIONAL ) { - return (CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1); } /** diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c index 8cafba4f4a87..5df2ef15ddcf 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c @@ -43,7 +43,7 @@ PendingBreakSupport ( IS_CORE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) || IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) || IS_PENTIUM_M_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) { - return (CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); } return FALSE; } diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c index 146c4cfda3f9..438578a83230 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c @@ -53,7 +53,7 @@ PpinSupport ( // Check whether platform support this feature. // PlatformInfo.Uint64 = AsmReadMsr64 (MSR_IVY_BRIDGE_PLATFORM_INFO_1); - return (PlatformInfo.Bits.PPIN_CAP != 0); + return (BOOLEAN)(PlatformInfo.Bits.PPIN_CAP != 0); } return FALSE; diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c index b4a453c3525c..ecaf47a4af00 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c @@ -71,7 +71,7 @@ X2ApicSupport ( // X2ApicEnabled[ProcessorNumber] = (GetApicMode () == LOCAL_APIC_MODE_X2APIC) ? TRUE : FALSE; - return (CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); } /** diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c index 338f1a495cf4..c093356ab150 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c @@ -650,7 +650,7 @@ IsCpuFeatureSetInCpuPcd ( if ((Feature >> 3) >= CpuBitMaskSize) { return FALSE; } - return ((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature & 0x07))) != 0); + return (BOOLEAN)((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature & + 0x07))) != 0); } /** -- 2.12.2.windows.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements. 2017-07-26 2:44 ` Fan, Jeff @ 2017-07-26 8:36 ` Marvin Häuser 2017-07-27 13:17 ` Gao, Liming 0 siblings, 1 reply; 5+ messages in thread From: Marvin Häuser @ 2017-07-26 8:36 UTC (permalink / raw) To: edk2-devel@lists.01.org; +Cc: Fan, Jeff 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.fan@intel.com] > Sent: Wednesday, July 26, 2017 4:45 AM > To: Marvin Häuser <Marvin.Haeuser@outlook.com>; edk2- > devel@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.Haeuser@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.Haeuser@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.<BR> > + Copyright (c) 2010 - 2017, Intel Corporation. All rights > + reserved.<BR> > Copyright (c) 2017, AMD Inc. All rights reserved.<BR> > > This program and the accompanying materials @@ -49,9 +49,9 @@ > StandardSignatureIsAuthenticAMD ( > UINT32 RegEdx; > > AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); > - 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.<BR> > + Copyright (c) 2010 - 2017, Intel Corporation. All rights > + reserved.<BR> > Copyright (c) 2017, AMD Inc. All rights reserved.<BR> > > This program and the accompanying materials @@ -50,9 +50,9 @@ > StandardSignatureIsAuthenticAMD ( > UINT32 RegEdx; > > AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); > - 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 *ConfigData OPTIONAL > ) > { > - return IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo- > >DisplayModel); > + return (BOOLEAN)IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, > + CpuInfo->DisplayModel); > } > > /** > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > index 56e53561e9de..e625b061829f 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > @@ -38,7 +38,7 @@ ClockModulationSupport ( > IN VOID *ConfigData OPTIONAL > ) > { > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); > } > > /** > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > index 2038171a14c3..593a1e1b35b5 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > @@ -38,7 +38,7 @@ EistSupport ( > IN VOID *ConfigData OPTIONAL > ) > { > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); > } > > /** > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > index 921656a1e869..1ba942990113 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > @@ -50,7 +50,7 @@ ExecuteDisableSupport ( > } > > AsmCpuid (CPUID_EXTENDED_CPU_SIG, NULL, NULL, NULL, &Edx.Uint32); > - return (Edx.Bits.NX != 0); > + return (BOOLEAN)(Edx.Bits.NX != 0); > } > > /** > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > index d28c4ec51a04..fae09d8be711 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > @@ -65,7 +65,7 @@ VmxSupport ( > ASSERT (ConfigData != NULL); > MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData; > MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 > (MSR_IA32_FEATURE_CONTROL); > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); > } > > /** > @@ -215,7 +215,7 @@ SmxSupport ( > ASSERT (ConfigData != NULL); > MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData; > MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 > (MSR_IA32_FEATURE_CONTROL); > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); > } > > /** > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > index 40cc9d5fe0cf..ee037c35dc5a 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > @@ -41,7 +41,7 @@ LimitCpuidMaxvalSupport ( > UINT32 Eax; > > AsmCpuid (CPUID_SIGNATURE, &Eax, NULL, NULL, NULL); > - return (Eax > 3); > + return (BOOLEAN)(Eax > 3); > } > > /** > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > index 72f665d32e36..0e3b3468d7bc 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > @@ -38,7 +38,7 @@ MceSupport ( > IN VOID *ConfigData OPTIONAL > ) > { > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); > } > > /** > @@ -105,7 +105,7 @@ McaSupport ( > IN VOID *ConfigData OPTIONAL > ) > { > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); > } > > /** > @@ -191,7 +191,7 @@ McgCtlSupport ( > return FALSE; > } > McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP); > - return (McgCap.Bits.MCG_CTL_P == 1); > + return (BOOLEAN)(McgCap.Bits.MCG_CTL_P == 1); > } > > /** > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > index 1d43bd128afe..67aaf37d4e3d 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > @@ -38,7 +38,7 @@ MonitorMwaitSupport ( > IN VOID *ConfigData OPTIONAL > ) > { > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1); > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1); > } > > /** > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > index 8cafba4f4a87..5df2ef15ddcf 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > @@ -43,7 +43,7 @@ PendingBreakSupport ( > IS_CORE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) > || > IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo- > >DisplayModel) || > IS_PENTIUM_M_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo- > >DisplayModel)) { > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); > } > return FALSE; > } > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > index 146c4cfda3f9..438578a83230 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > @@ -53,7 +53,7 @@ PpinSupport ( > // Check whether platform support this feature. > // > PlatformInfo.Uint64 = AsmReadMsr64 > (MSR_IVY_BRIDGE_PLATFORM_INFO_1); > - return (PlatformInfo.Bits.PPIN_CAP != 0); > + return (BOOLEAN)(PlatformInfo.Bits.PPIN_CAP != 0); > } > > return FALSE; > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > index b4a453c3525c..ecaf47a4af00 100644 > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > @@ -71,7 +71,7 @@ X2ApicSupport ( > // > X2ApicEnabled[ProcessorNumber] = (GetApicMode () == > LOCAL_APIC_MODE_X2APIC) ? TRUE : FALSE; > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); > } > > /** > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > index 338f1a495cf4..c093356ab150 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > +++ > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > @@ -650,7 +650,7 @@ IsCpuFeatureSetInCpuPcd ( > if ((Feature >> 3) >= CpuBitMaskSize) { > return FALSE; > } > - return ((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature & 0x07))) != 0); > + return (BOOLEAN)((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature & > + 0x07))) != 0); > } > > /** > -- > 2.12.2.windows.2 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements. 2017-07-26 8:36 ` Marvin Häuser @ 2017-07-27 13:17 ` Gao, Liming 2017-07-27 13:41 ` Marvin Häuser 0 siblings, 1 reply; 5+ messages in thread From: Gao, Liming @ 2017-07-27 13:17 UTC (permalink / raw) To: Marvin.Haeuser@outlook.com, edk2-devel@lists.01.org; +Cc: Fan, Jeff Marvin: Yes. They are too old. We have no verification for them. Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@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.fan@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.fan@intel.com] > > Sent: Wednesday, July 26, 2017 4:45 AM > > To: Marvin Häuser <Marvin.Haeuser@outlook.com>; edk2- > > devel@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.Haeuser@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.Haeuser@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.<BR> > > + Copyright (c) 2010 - 2017, Intel Corporation. All rights > > + reserved.<BR> > > Copyright (c) 2017, AMD Inc. All rights reserved.<BR> > > > > This program and the accompanying materials @@ -49,9 +49,9 @@ > > StandardSignatureIsAuthenticAMD ( > > UINT32 RegEdx; > > > > AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); > > - 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.<BR> > > + Copyright (c) 2010 - 2017, Intel Corporation. All rights > > + reserved.<BR> > > Copyright (c) 2017, AMD Inc. All rights reserved.<BR> > > > > This program and the accompanying materials @@ -50,9 +50,9 @@ > > StandardSignatureIsAuthenticAMD ( > > UINT32 RegEdx; > > > > AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); > > - 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 *ConfigData OPTIONAL > > ) > > { > > - return IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo- > > >DisplayModel); > > + return (BOOLEAN)IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, > > + CpuInfo->DisplayModel); > > } > > > > /** > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > > index 56e53561e9de..e625b061829f 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > > @@ -38,7 +38,7 @@ ClockModulationSupport ( > > IN VOID *ConfigData OPTIONAL > > ) > > { > > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); > > } > > > > /** > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > > index 2038171a14c3..593a1e1b35b5 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > > @@ -38,7 +38,7 @@ EistSupport ( > > IN VOID *ConfigData OPTIONAL > > ) > > { > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); > > } > > > > /** > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > > index 921656a1e869..1ba942990113 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > > @@ -50,7 +50,7 @@ ExecuteDisableSupport ( > > } > > > > AsmCpuid (CPUID_EXTENDED_CPU_SIG, NULL, NULL, NULL, &Edx.Uint32); > > - return (Edx.Bits.NX != 0); > > + return (BOOLEAN)(Edx.Bits.NX != 0); > > } > > > > /** > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > > index d28c4ec51a04..fae09d8be711 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > > @@ -65,7 +65,7 @@ VmxSupport ( > > ASSERT (ConfigData != NULL); > > MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData; > > MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 > > (MSR_IA32_FEATURE_CONTROL); > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); > > } > > > > /** > > @@ -215,7 +215,7 @@ SmxSupport ( > > ASSERT (ConfigData != NULL); > > MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) ConfigData; > > MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 > > (MSR_IA32_FEATURE_CONTROL); > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); > > } > > > > /** > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > > index 40cc9d5fe0cf..ee037c35dc5a 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > > @@ -41,7 +41,7 @@ LimitCpuidMaxvalSupport ( > > UINT32 Eax; > > > > AsmCpuid (CPUID_SIGNATURE, &Eax, NULL, NULL, NULL); > > - return (Eax > 3); > > + return (BOOLEAN)(Eax > 3); > > } > > > > /** > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > > index 72f665d32e36..0e3b3468d7bc 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > > @@ -38,7 +38,7 @@ MceSupport ( > > IN VOID *ConfigData OPTIONAL > > ) > > { > > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); > > } > > > > /** > > @@ -105,7 +105,7 @@ McaSupport ( > > IN VOID *ConfigData OPTIONAL > > ) > > { > > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); > > } > > > > /** > > @@ -191,7 +191,7 @@ McgCtlSupport ( > > return FALSE; > > } > > McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP); > > - return (McgCap.Bits.MCG_CTL_P == 1); > > + return (BOOLEAN)(McgCap.Bits.MCG_CTL_P == 1); > > } > > > > /** > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > > index 1d43bd128afe..67aaf37d4e3d 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > > @@ -38,7 +38,7 @@ MonitorMwaitSupport ( > > IN VOID *ConfigData OPTIONAL > > ) > > { > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1); > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1); > > } > > > > /** > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > > index 8cafba4f4a87..5df2ef15ddcf 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > > @@ -43,7 +43,7 @@ PendingBreakSupport ( > > IS_CORE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) > > || > > IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo- > > >DisplayModel) || > > IS_PENTIUM_M_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo- > > >DisplayModel)) { > > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); > > } > > return FALSE; > > } > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > > index 146c4cfda3f9..438578a83230 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > > @@ -53,7 +53,7 @@ PpinSupport ( > > // Check whether platform support this feature. > > // > > PlatformInfo.Uint64 = AsmReadMsr64 > > (MSR_IVY_BRIDGE_PLATFORM_INFO_1); > > - return (PlatformInfo.Bits.PPIN_CAP != 0); > > + return (BOOLEAN)(PlatformInfo.Bits.PPIN_CAP != 0); > > } > > > > return FALSE; > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > > index b4a453c3525c..ecaf47a4af00 100644 > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > > @@ -71,7 +71,7 @@ X2ApicSupport ( > > // > > X2ApicEnabled[ProcessorNumber] = (GetApicMode () == > > LOCAL_APIC_MODE_X2APIC) ? TRUE : FALSE; > > > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); > > } > > > > /** > > diff --git > > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > > index 338f1a495cf4..c093356ab150 100644 > > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > > +++ > > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > > @@ -650,7 +650,7 @@ IsCpuFeatureSetInCpuPcd ( > > if ((Feature >> 3) >= CpuBitMaskSize) { > > return FALSE; > > } > > - return ((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature & 0x07))) != 0); > > + return (BOOLEAN)((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature & > > + 0x07))) != 0); > > } > > > > /** > > -- > > 2.12.2.windows.2 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements. 2017-07-27 13:17 ` Gao, Liming @ 2017-07-27 13:41 ` Marvin Häuser 0 siblings, 0 replies; 5+ messages in thread From: Marvin Häuser @ 2017-07-27 13:41 UTC (permalink / raw) To: edk2-devel@lists.01.org; +Cc: Gao, Liming 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.gao@intel.com] > Sent: Thursday, July 27, 2017 3:17 PM > To: Marvin.Haeuser@outlook.com; edk2-devel@lists.01.org > Cc: Fan, Jeff <jeff.fan@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-bounces@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.fan@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.fan@intel.com] > > > Sent: Wednesday, July 26, 2017 4:45 AM > > > To: Marvin Häuser <Marvin.Haeuser@outlook.com>; edk2- > > > devel@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.Haeuser@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.Haeuser@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.<BR> > > > + Copyright (c) 2010 - 2017, Intel Corporation. All rights > > > + reserved.<BR> > > > Copyright (c) 2017, AMD Inc. All rights reserved.<BR> > > > > > > This program and the accompanying materials @@ -49,9 +49,9 @@ > > > StandardSignatureIsAuthenticAMD ( > > > UINT32 RegEdx; > > > > > > AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); > > > - 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.<BR> > > > + Copyright (c) 2010 - 2017, Intel Corporation. All rights > > > + reserved.<BR> > > > Copyright (c) 2017, AMD Inc. All rights reserved.<BR> > > > > > > This program and the accompanying materials @@ -50,9 +50,9 @@ > > > StandardSignatureIsAuthenticAMD ( > > > UINT32 RegEdx; > > > > > > AsmCpuid(CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); > > > - 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 *ConfigData OPTIONAL > > > ) > > > { > > > - return IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo- > > > >DisplayModel); > > > + return (BOOLEAN)IS_NEHALEM_PROCESSOR (CpuInfo->DisplayFamily, > > > + CpuInfo->DisplayModel); > > > } > > > > > > /** > > > diff --git > > > a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > > > index 56e53561e9de..e625b061829f 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c > > > @@ -38,7 +38,7 @@ ClockModulationSupport ( > > > IN VOID *ConfigData OPTIONAL > > > ) > > > { > > > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); > > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1); > > > } > > > > > > /** > > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > > > index 2038171a14c3..593a1e1b35b5 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c > > > @@ -38,7 +38,7 @@ EistSupport ( > > > IN VOID *ConfigData OPTIONAL > > > ) > > > { > > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); > > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.EIST == 1); > > > } > > > > > > /** > > > diff --git > > > a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > > > index 921656a1e869..1ba942990113 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c > > > @@ -50,7 +50,7 @@ ExecuteDisableSupport ( > > > } > > > > > > AsmCpuid (CPUID_EXTENDED_CPU_SIG, NULL, NULL, NULL, > &Edx.Uint32); > > > - return (Edx.Bits.NX != 0); > > > + return (BOOLEAN)(Edx.Bits.NX != 0); > > > } > > > > > > /** > > > diff --git > > > a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > > > index d28c4ec51a04..fae09d8be711 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c > > > @@ -65,7 +65,7 @@ VmxSupport ( > > > ASSERT (ConfigData != NULL); > > > MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) > ConfigData; > > > MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 > > > (MSR_IA32_FEATURE_CONTROL); > > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); > > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.VMX == 1); > > > } > > > > > > /** > > > @@ -215,7 +215,7 @@ SmxSupport ( > > > ASSERT (ConfigData != NULL); > > > MsrRegister = (MSR_IA32_FEATURE_CONTROL_REGISTER *) > ConfigData; > > > MsrRegister[ProcessorNumber].Uint64 = AsmReadMsr64 > > > (MSR_IA32_FEATURE_CONTROL); > > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); > > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.SMX == 1); > > > } > > > > > > /** > > > diff --git > > > a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > > > index 40cc9d5fe0cf..ee037c35dc5a 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c > > > @@ -41,7 +41,7 @@ LimitCpuidMaxvalSupport ( > > > UINT32 Eax; > > > > > > AsmCpuid (CPUID_SIGNATURE, &Eax, NULL, NULL, NULL); > > > - return (Eax > 3); > > > + return (BOOLEAN)(Eax > 3); > > > } > > > > > > /** > > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > > > index 72f665d32e36..0e3b3468d7bc 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c > > > @@ -38,7 +38,7 @@ MceSupport ( > > > IN VOID *ConfigData OPTIONAL > > > ) > > > { > > > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); > > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCE == 1); > > > } > > > > > > /** > > > @@ -105,7 +105,7 @@ McaSupport ( > > > IN VOID *ConfigData OPTIONAL > > > ) > > > { > > > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); > > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); > > > } > > > > > > /** > > > @@ -191,7 +191,7 @@ McgCtlSupport ( > > > return FALSE; > > > } > > > McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP); > > > - return (McgCap.Bits.MCG_CTL_P == 1); > > > + return (BOOLEAN)(McgCap.Bits.MCG_CTL_P == 1); > > > } > > > > > > /** > > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > > > index 1d43bd128afe..67aaf37d4e3d 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c > > > @@ -38,7 +38,7 @@ MonitorMwaitSupport ( > > > IN VOID *ConfigData OPTIONAL > > > ) > > > { > > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == 1); > > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.MONITOR == > 1); > > > } > > > > > > /** > > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > > > index 8cafba4f4a87..5df2ef15ddcf 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c > > > @@ -43,7 +43,7 @@ PendingBreakSupport ( > > > IS_CORE_PROCESSOR (CpuInfo->DisplayFamily, > > > CpuInfo->DisplayModel) > > > || > > > IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo- > > > >DisplayModel) || > > > IS_PENTIUM_M_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo- > > > >DisplayModel)) { > > > - return (CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); > > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEdx.Bits.PBE == 1); > > > } > > > return FALSE; > > > } > > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > > > index 146c4cfda3f9..438578a83230 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c > > > @@ -53,7 +53,7 @@ PpinSupport ( > > > // Check whether platform support this feature. > > > // > > > PlatformInfo.Uint64 = AsmReadMsr64 > > > (MSR_IVY_BRIDGE_PLATFORM_INFO_1); > > > - return (PlatformInfo.Bits.PPIN_CAP != 0); > > > + return (BOOLEAN)(PlatformInfo.Bits.PPIN_CAP != 0); > > > } > > > > > > return FALSE; > > > diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > > > b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > > > index b4a453c3525c..ecaf47a4af00 100644 > > > --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > > > +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c > > > @@ -71,7 +71,7 @@ X2ApicSupport ( > > > // > > > X2ApicEnabled[ProcessorNumber] = (GetApicMode () == > > > LOCAL_APIC_MODE_X2APIC) ? TRUE : FALSE; > > > > > > - return (CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); > > > + return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.x2APIC == 1); > > > } > > > > > > /** > > > diff --git > > > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > > > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > > > index 338f1a495cf4..c093356ab150 100644 > > > --- > > > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > > > +++ > > > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > > > @@ -650,7 +650,7 @@ IsCpuFeatureSetInCpuPcd ( > > > if ((Feature >> 3) >= CpuBitMaskSize) { > > > return FALSE; > > > } > > > - return ((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature & > > > 0x07))) != 0); > > > + return (BOOLEAN)((*(CpuBitMask + (Feature >> 3)) & (1 << (Feature > > > + & > > > + 0x07))) != 0); > > > } > > > > > > /** > > > -- > > > 2.12.2.windows.2 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-27 13:39 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-07-21 10:20 [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements Marvin Häuser 2017-07-26 2:44 ` Fan, Jeff 2017-07-26 8:36 ` Marvin Häuser 2017-07-27 13:17 ` Gao, Liming 2017-07-27 13:41 ` Marvin Häuser
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox