Hi Mikhail, For RELEASE GCC5 toolchains in tools_def.txt, I see this warning is disabled. Likely for the same reason.
RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os -Wno-unused-but-set-variable -Wno-unused-const-variable RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os -Wno-unused-but-set-variable -Wno-unused-const-variable RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable RELEASE_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable I think it would be better to ignore the same warning in RELEASE CLANG38 tool chains with an update to tools_def.txt instead of DebugLib.h. Unless you are thinking that disabling this warning is hiding some bad code practices that need to be cleaned up. Best regards, Mike > -----Original Message----- > From: Mikhail Krichanov <kricha...@ispras.ru> > Sent: Friday, November 19, 2021 1:05 AM > To: devel@edk2.groups.io > Cc: Kinney, Michael D <michael.d.kin...@intel.com>; Liming Gao > <gaolim...@byosoft.com.cn>; Liu, Zhiguang > <zhiguang....@intel.com>; Vitaly Cheptsov <vit9...@protonmail.com>; Mikhail > Krichanov <kricha...@ispras.ru> > Subject: [PATCH] MdePkg: DebugLib: Compilation fix for clang-13. > > build -a X64 -t CLANG38 -b RELEASE -p OvmfPkg/OvmfPkgX64.dsc > results in > UDK/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c:1284:31: > error: variable 'Status' set but not used [-Werror,-Wunused-but-set-variable] > EFI_STATUS Status; > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3704 > > Cc: Michael D Kinney <michael.d.kin...@intel.com> > Cc: Liming Gao <gaolim...@byosoft.com.cn> > Cc: Zhiguang Liu <zhiguang....@intel.com> > Cc: Vitaly Cheptsov <vit9...@protonmail.com> > Signed-off-by: Mikhail Krichanov <kricha...@ispras.ru> > --- > MdePkg/Include/Library/DebugLib.h | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > > diff --git a/MdePkg/Include/Library/DebugLib.h > b/MdePkg/Include/Library/DebugLib.h > index 4cacd4b8..7785e99d 100644 > --- a/MdePkg/Include/Library/DebugLib.h > +++ b/MdePkg/Include/Library/DebugLib.h > @@ -370,7 +370,10 @@ UnitTestDebugAssert ( > } \ > } while (FALSE) > #else > - #define ASSERT(Expression) > + #define ASSERT(Expression) \ > + do { \ > + (VOID) (Expression); \ > + } while (FALSE) > #endif > > /** > @@ -392,6 +395,14 @@ UnitTestDebugAssert ( > _DEBUG (Expression); \ > } \ > } while (FALSE) > +#elif defined(__GNUC__) || defined(__clang__) > + #define DEBUG(Expression) \ > + do { \ > + _Pragma("GCC diagnostic push") \ > + _Pragma("GCC diagnostic ignored \"-Wunused-value\"") \ > + (VOID) Expression; \ > + _Pragma("GCC diagnostic pop") \ > + } while (FALSE) > #else > #define DEBUG(Expression) > #endif > @@ -419,7 +430,10 @@ UnitTestDebugAssert ( > } > \ > } while (FALSE) > #else > - #define ASSERT_EFI_ERROR(StatusParameter) > + #define ASSERT_EFI_ERROR(StatusParameter) > \ > + do { > \ > + (VOID) (StatusParameter); > \ > + } while (FALSE) > #endif > > /** > @@ -446,7 +460,10 @@ UnitTestDebugAssert ( > } \ > } while (FALSE) > #else > - #define ASSERT_RETURN_ERROR(StatusParameter) > + #define ASSERT_RETURN_ERROR(StatusParameter) \ > + do { \ > + (VOID) (StatusParameter); \ > + } while (FALSE) > #endif > > /** > -- > 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83902): https://edk2.groups.io/g/devel/message/83902 Mute This Topic: https://groups.io/mt/87172427/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-