MdePkg: DebugLib: Compilation fix for clang-13

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3704

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]

Signed-off-by: Mikhail Krichanov <krichanov@ispras.ru>
This commit is contained in:
Mikhail Krichanov 2021-12-09 11:45:53 +03:00 committed by Vitaly Cheptsov
parent 1666a3bb9f
commit 61bc3a9cd1
3 changed files with 34 additions and 11 deletions

View File

@ -73,9 +73,9 @@ PeCoffLoaderRelocateImageExtraAction (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
) )
{ {
#if !defined(MDEPKG_NDEBUG) #if defined (__CC_ARM) || defined (__GNUC__)
CHAR8 Temp[512]; CHAR8 Temp[512];
#endif #endif
if (ImageContext->PdbPointer) { if (ImageContext->PdbPointer) {
#ifdef __CC_ARM #ifdef __CC_ARM
@ -115,9 +115,9 @@ PeCoffLoaderUnloadImageExtraAction (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
) )
{ {
#if !defined(MDEPKG_NDEBUG) #if defined (__CC_ARM) || defined (__GNUC__)
CHAR8 Temp[512]; CHAR8 Temp[512];
#endif #endif
if (ImageContext->PdbPointer) { if (ImageContext->PdbPointer) {
#ifdef __CC_ARM #ifdef __CC_ARM

View File

@ -114,7 +114,6 @@ DescribeExceptionSyndrome (
DEBUG ((EFI_D_ERROR, "\n %a \n", Message)); DEBUG ((EFI_D_ERROR, "\n %a \n", Message));
} }
#ifndef MDEPKG_NDEBUG
STATIC STATIC
CONST CHAR8 * CONST CHAR8 *
BaseName ( BaseName (
@ -132,7 +131,6 @@ BaseName (
} }
return Str; return Str;
} }
#endif
/** /**
This is the default action to take on an unexpected exception This is the default action to take on an unexpected exception

View File

@ -405,7 +405,12 @@ UnitTestDebugAssert (
} \ } \
} while (FALSE) } while (FALSE)
#else #else
#define ASSERT(Expression) #define ASSERT(Expression) \
do { \
if ((FALSE)) { \
(VOID) (Expression); \
} \
} while (FALSE)
#endif #endif
/** /**
@ -427,6 +432,16 @@ UnitTestDebugAssert (
_DEBUG (Expression); \ _DEBUG (Expression); \
} \ } \
} while (FALSE) } while (FALSE)
#elif defined (__GNUC__) || defined (__clang__)
#define DEBUG(Expression) \
do { \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wunused-value\"") \
if ((FALSE)) { \
(VOID) Expression; \
} \
_Pragma("GCC diagnostic pop") \
} while (FALSE)
#else #else
#define DEBUG(Expression) #define DEBUG(Expression)
#endif #endif
@ -454,7 +469,12 @@ UnitTestDebugAssert (
} \ } \
} while (FALSE) } while (FALSE)
#else #else
#define ASSERT_EFI_ERROR(StatusParameter) #define ASSERT_EFI_ERROR(StatusParameter) \
do { \
if ((FALSE)) { \
(VOID) (StatusParameter); \
} \
} while (FALSE)
#endif #endif
/** /**
@ -481,7 +501,12 @@ UnitTestDebugAssert (
} \ } \
} while (FALSE) } while (FALSE)
#else #else
#define ASSERT_RETURN_ERROR(StatusParameter) #define ASSERT_RETURN_ERROR(StatusParameter) \
do { \
if ((FALSE)) { \
(VOID) (StatusParameter); \
} \
} while (FALSE)
#endif #endif
/** /**