diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c index a39896d576..1d3ea61311 100644 --- a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c @@ -157,7 +157,6 @@ DescribeExceptionSyndrome ( DEBUG ((DEBUG_ERROR, "\n %a \n", Message)); } -#ifndef MDEPKG_NDEBUG STATIC CONST CHAR8 * BaseName ( @@ -177,8 +176,6 @@ BaseName ( return Str; } -#endif - /** This is the default action to take on an unexpected exception diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h index 0db3b78ec8..4c073825c2 100644 --- a/MdePkg/Include/Library/DebugLib.h +++ b/MdePkg/Include/Library/DebugLib.h @@ -403,7 +403,12 @@ UnitTestDebugAssert ( } \ } while (FALSE) #else -#define ASSERT(Expression) +#define ASSERT(Expression) \ + do { \ + if (FALSE) { \ + (VOID) (Expression); \ + } \ + } while (FALSE) #endif /** @@ -426,7 +431,12 @@ UnitTestDebugAssert ( } \ } while (FALSE) #else -#define DEBUG(Expression) +#define DEBUG(Expression) \ + do { \ + if (FALSE) { \ + _DEBUG (Expression); \ + } \ + } while (FALSE) #endif /** @@ -452,7 +462,12 @@ UnitTestDebugAssert ( } \ } while (FALSE) #else -#define ASSERT_EFI_ERROR(StatusParameter) +#define ASSERT_EFI_ERROR(StatusParameter) \ + do { \ + if (FALSE) { \ + (VOID) (StatusParameter); \ + } \ + } while (FALSE) #endif /** @@ -479,7 +494,12 @@ UnitTestDebugAssert ( } \ } while (FALSE) #else -#define ASSERT_RETURN_ERROR(StatusParameter) +#define ASSERT_RETURN_ERROR(StatusParameter) \ + do { \ + if (FALSE) { \ + (VOID) (StatusParameter); \ + } \ + } while (FALSE) #endif /** @@ -534,7 +554,12 @@ UnitTestDebugAssert ( are not included in a module. **/ -#define DEBUG_CODE_BEGIN() do { if (DebugCodeEnabled ()) { UINT8 __DebugCodeLocal +#define DEBUG_CODE_BEGIN() \ + do { \ + BOOLEAN __DebugCodeLocal; \ + __DebugCodeLocal = FALSE; \ + do { \ + if (DebugCodeEnabled ()) { /** The macro that marks the end of debug source code. @@ -545,7 +570,10 @@ UnitTestDebugAssert ( are not included in a module. **/ -#define DEBUG_CODE_END() __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE) +#define DEBUG_CODE_END() \ + } \ + } while (__DebugCodeLocal); \ + } while (FALSE) /** The macro that declares a section of debug source code. diff --git a/MdePkg/Include/Library/PerformanceLib.h b/MdePkg/Include/Library/PerformanceLib.h index d0f2dfb070..57ba45eb7b 100644 --- a/MdePkg/Include/Library/PerformanceLib.h +++ b/MdePkg/Include/Library/PerformanceLib.h @@ -734,7 +734,12 @@ LogPerformanceMeasurement ( Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module. **/ -#define PERF_CODE_BEGIN() do { if (PerformanceMeasurementEnabled ()) { UINT8 __PerformanceCodeLocal +#define PERF_CODE_BEGIN() \ + do { \ + BOOLEAN __PerformanceCodeLocal; \ + __PerformanceCodeLocal = FALSE; \ + do { \ + if (PerformanceMeasurementEnabled ()) { /** Macro that marks the end of performance measurement source code. @@ -744,7 +749,10 @@ LogPerformanceMeasurement ( Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module. **/ -#define PERF_CODE_END() __PerformanceCodeLocal = 0; __PerformanceCodeLocal++; } } while (FALSE) +#define PERF_CODE_END() \ + } \ + } while (__PerformanceCodeLocal); \ + } while (FALSE) /** Macro that declares a section of performance measurement source code.