mirror of https://github.com/acidanthera/audk.git
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> MdePkg/DebugLib(PerformanceLib): Fix "unused-but-set-variable" warning The current definitions of DEBUG_CODE_BEGIN() and DEBUG_CODE_END() use the local variable __DebugCodeLocal as an attempt to track parity. If DEBUG_CODE_END() is used without a preceding DEBUG_CODE_BEGIN(), __DebugCodeLocal will not have been declared and a compilation error will be issued. The mutations of the variable are not used to track nesting or such. As the value of this variable is never actually used, recent Clang versions issue a "unused-but-set-variable" warning for it. To solve this, re-define __DebugCodeLocal as a BOOLEAN that is always FALSE and use it in a do-while loop condition as done explicitly in many places. Like the previous solution, DEBUG_CODE_END() cannot be used without DEBUG_CODE_BEGIN(), as __DebugCodeLocal will be not have been defined. Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
This commit is contained in:
parent
23bcb9c881
commit
80c73c3923
|
@ -157,7 +157,6 @@ DescribeExceptionSyndrome (
|
||||||
DEBUG ((DEBUG_ERROR, "\n %a \n", Message));
|
DEBUG ((DEBUG_ERROR, "\n %a \n", Message));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MDEPKG_NDEBUG
|
|
||||||
STATIC
|
STATIC
|
||||||
CONST CHAR8 *
|
CONST CHAR8 *
|
||||||
BaseName (
|
BaseName (
|
||||||
|
@ -177,8 +176,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
|
||||||
|
|
||||||
|
|
|
@ -403,7 +403,12 @@ UnitTestDebugAssert (
|
||||||
} \
|
} \
|
||||||
} while (FALSE)
|
} while (FALSE)
|
||||||
#else
|
#else
|
||||||
#define ASSERT(Expression)
|
#define ASSERT(Expression) \
|
||||||
|
do { \
|
||||||
|
if (FALSE) { \
|
||||||
|
(VOID) (Expression); \
|
||||||
|
} \
|
||||||
|
} while (FALSE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -426,7 +431,12 @@ UnitTestDebugAssert (
|
||||||
} \
|
} \
|
||||||
} while (FALSE)
|
} while (FALSE)
|
||||||
#else
|
#else
|
||||||
#define DEBUG(Expression)
|
#define DEBUG(Expression) \
|
||||||
|
do { \
|
||||||
|
if (FALSE) { \
|
||||||
|
_DEBUG (Expression); \
|
||||||
|
} \
|
||||||
|
} while (FALSE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -452,7 +462,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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -479,7 +494,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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -534,7 +554,12 @@ UnitTestDebugAssert (
|
||||||
are not included in a module.
|
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.
|
The macro that marks the end of debug source code.
|
||||||
|
@ -545,7 +570,10 @@ UnitTestDebugAssert (
|
||||||
are not included in a module.
|
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.
|
The macro that declares a section of debug source code.
|
||||||
|
|
|
@ -734,7 +734,12 @@ LogPerformanceMeasurement (
|
||||||
Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module.
|
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.
|
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.
|
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.
|
Macro that declares a section of performance measurement source code.
|
||||||
|
|
Loading…
Reference in New Issue