Gerd's Jenkins CI worker has recently tried to build a few edk2 packages
with gcc-6. Gcc-6 introduces a new warning (among many others, likely)
called "bool-compare":

  
https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/Warning-Options.html#index-Wbool-compare-453

The build broke subsequently, exposing an actual bug in the code:

> "gcc" -g -fshort-wchar -fno-strict-aliasing -Wall -Werror
> -Wno-array-bounds -ffunction-sections -fdata-sections -c -include
> AutoGen.h -fno-common -DSTRING_ARRAY_NAME=PiSmmCpuDxeSmmStrings -m64
> -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))"
> -DNO_BUILTIN_VA_FUNCS -mno-red-zone -Wno-address -mcmodel=large
> -fno-asynchronous-unwind-tables -Wno-address -mno-mmx -mno-sse -o
> Build/OvmfX64/DEBUG_GCC49/X64/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/OUTPUT/X64/SmmProfileArch.obj
> -IUefiCpuPkg/PiSmmCpuDxeSmm/X64 -IUefiCpuPkg/PiSmmCpuDxeSmm
> -IBuild/OvmfX64/DEBUG_GCC49/X64/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/DEBUG
> -IMdePkg -IMdePkg/Include -IMdePkg/Include/X64 -IMdeModulePkg
> -IMdeModulePkg/Include -IUefiCpuPkg -IUefiCpuPkg/Include
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c
>
> In file included from 
> Build/OvmfX64/DEBUG_GCC49/X64/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/DEBUG/AutoGen.h:16:0,
>                  from <command-line>:0:
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c: In function 
> 'InitPagesForPFHandler':
> MdePkg/Include/Base.h:882:75: error: comparison of constant '0' with boolean 
> expression is always false [-Werror=bool-compare]
>  #define RETURN_ERROR(StatusCode)     (((INTN)(RETURN_STATUS)(StatusCode)) < 
> 0)
>                                                                            ^
> MdePkg/Include/Uefi/UefiBaseType.h:169:35: note: in expansion of macro 
> 'RETURN_ERROR'
>  #define EFI_ERROR(A)              RETURN_ERROR(A)
>                                    ^~~~~~~~~~~~
> MdePkg/Include/Library/DebugLib.h:341:13: note: in expansion of macro 
> 'EFI_ERROR'
>          if (EFI_ERROR (StatusParameter)) {                                   
>             \
>              ^~~~~~~~~
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c:81:3: note: in expansion of 
> macro 'ASSERT_EFI_ERROR'
>    ASSERT_EFI_ERROR (Address != NULL);
>    ^~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors

This is fixed by one of the patches in the series (and I added Gerd's
Reported-by there). Then I searched the tree for further misuses of
ASSERT_EFI_ERROR, and fixed what I found.

Cc: David Wei <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Jaben Carsey <[email protected]>
Cc: Jeff Fan <[email protected]>
Cc: Jiaxin Wu <[email protected]>
Cc: Kelly Steele <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Michael D Kinney <[email protected]>
Cc: Shumin Qiu <[email protected]>
Cc: Siyuan Fu <[email protected]>
Cc: Tim He <[email protected]>

Thanks
Laszlo

Laszlo Ersek (6):
  EdkCompatibilityPkg: fix ASSERT_EFI_ERROR() typos
  NetworkPkg: fix ASSERT_EFI_ERROR() typos
  QuarkPlatformPkg: fix ASSERT_EFI_ERROR() typos
  ShellPkg: don't call functions with side effects in ASSERT_EFI_ERROR()
  UefiCpuPkg: fix ASSERT_EFI_ERROR() typos
  Vlv2TbltDevicePkg: fix ASSERT_EFI_ERROR() typos

 EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.c |  
2 +-
 EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c     |  
2 +-
 NetworkPkg/IpSecDxe/Ikev2/Sa.c                                             |  
2 +-
 QuarkPlatformPkg/Acpi/Dxe/AcpiPlatform/AcpiPlatform.c                      |  
2 +-
 QuarkPlatformPkg/Acpi/Dxe/AcpiPlatform/MadtPlatform.c                      |  
2 +-
 QuarkPlatformPkg/Library/PlatformHelperLib/PlatformHelperDxe.c             |  
2 +-
 QuarkPlatformPkg/Platform/Pei/PlatformInit/MrcWrapper.c                    |  
2 +-
 ShellPkg/Library/UefiShellLevel1CommandsLib/If.c                           | 
10 ++++++++--
 ShellPkg/Library/UefiShellLib/UefiShellLib.c                               |  
5 ++++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c                             |  
2 +-
 Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c                               |  
6 +++---
 Vlv2TbltDevicePkg/Library/MultiPlatformLib/BoardClkGens/BoardClkGens.c     |  
8 ++++----
 Vlv2TbltDevicePkg/Library/MultiPlatformLib/PlatformInfoHob.c               |  
2 +-
 13 files changed, 28 insertions(+), 19 deletions(-)

-- 
1.8.3.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to