I think that you are advocating that since we have code that error checks on DEBUG and not RELEASE builds we should relax the RELEASE build compiler flags?

/home/abuild/rpmbuild/BUILD/edk2-edk2-stable202305/MdeModulePkg/Core/Dxe/Hand/Handle.c:1183:24: error: ‘Prot’ may be used uninitialized [-Werror=maybe-uninitialized]
      ASSERT (Prot != NULL);
      //
      // EFI_ALREADY_STARTED is not an error for bus driver.
      // Return the corresponding protocol interface.
      //
      *Interface = Prot->Interface;

A given platform can add ASSERT into release builds if it wants. I’ve actually done that for power on before. If your compiler supports LTO you are not required to set MDEPKG_NDEBUG on RELEASE builds, and you can used a PCD to configure your debug level, per build type. 

Maybe we should just have the error checks in all paths?

Thanks,

Andrew Fish

On Aug 10, 2023, at 6:44 AM, 汪流 <wangliu@iscas.ac.cn> wrote:

I want to build a rpm package for edk2-stable202305 on riscv64, however I get some uninitialized variable error, I have found that the reason is -Werror flag.
My build target was release. I think the flag should used in the debug ,not in release.
My build command:  build -t GCC5 -n $NCPUS -b RELEASE -a RISCV64 -p OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc -D SECURE_BOOT_ENABLE=TRUE -D TPM_ENABLE=TRUE -D TPM_CONFIG_ENABLE=TRUE

This is my packet log:   

https://build.tarsier-infra.com/package/live_build_log/home:ouuleilei:branches:home:ouuleilei:branches:openEuler:Mainline/edk2-test/openEuler_Mainline_standard_riscv64_gcc/riscv64

https://build.tarsier-infra.com/build/home:ouuleilei:branches:home:ouuleilei:branches:openEuler:Mainline/openEuler_Mainline_standard_riscv64_gcc/riscv64/edk2-test/_log

_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#107692) | | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_