mirror of https://github.com/acidanthera/audk.git
MdePkg: Fix DEBUG_CODE and PERF_CODE macros for XCODE5
Without these changes, we get the error: error: variable '__DebugCodeLocal' set but not used from the DebugLib.h DEBUG_CODE_BEGIN()/END() macros on XCODE5. Similarly, in NOOPT builds only, we get: error: variable '__PerformanceCodeLocal' set but not used from the PerformanceLib.h PERF_CODE_BEGIN()/END() macros on XCODE5. It is important to note that the previous code involving a local variable was intended to ensure correct behaviour of ; following the macros, in particular that ; should be required: - https://github.com/tianocore/edk2/pull/6226#issuecomment-2364087866 - https://github.com/tianocore/edk2/pull/6226#issuecomment-2364619759 This converted version repeats the standard do { ... } while (FALSE) idiom (which is already used in the END macro) to achieve the same affect. The modified versions work on all toolchains. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
This commit is contained in:
parent
cc47e82703
commit
0aa93aecb7
|
@ -534,7 +534,10 @@ UnitTestDebugAssert (
|
|||
are not included in a module.
|
||||
|
||||
**/
|
||||
#define DEBUG_CODE_BEGIN() do { if (DebugCodeEnabled ()) { UINT8 __DebugCodeLocal
|
||||
#define DEBUG_CODE_BEGIN() \
|
||||
do { \
|
||||
if (DebugCodeEnabled ()) { \
|
||||
do { } while (FALSE)
|
||||
|
||||
/**
|
||||
The macro that marks the end of debug source code.
|
||||
|
@ -545,7 +548,9 @@ UnitTestDebugAssert (
|
|||
are not included in a module.
|
||||
|
||||
**/
|
||||
#define DEBUG_CODE_END() __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE)
|
||||
#define DEBUG_CODE_END() \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
/**
|
||||
The macro that declares a section of debug source code.
|
||||
|
|
|
@ -734,7 +734,10 @@ 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 { \
|
||||
if (PerformanceMeasurementEnabled ()) { \
|
||||
do { } while (FALSE)
|
||||
|
||||
/**
|
||||
Macro that marks the end of performance measurement source code.
|
||||
|
@ -744,7 +747,9 @@ 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 (FALSE)
|
||||
|
||||
/**
|
||||
Macro that declares a section of performance measurement source code.
|
||||
|
|
Loading…
Reference in New Issue