summaryrefslogtreecommitdiffstats
path: root/MdePkg
diff options
context:
space:
mode:
authorMike Beaton <mjsbeaton@gmail.com>2024-04-06 23:06:38 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-09-27 16:57:36 +0000
commit0aa93aecb7e83b9eeaaac801b1e842eaf6423f08 (patch)
tree0289140ca2315525a9ee5a444195df83379f0c27 /MdePkg
parentcc47e8270375e0254ab7aafadcfde4eec9e01119 (diff)
downloadedk2-0aa93aecb7e83b9eeaaac801b1e842eaf6423f08.tar.gz
edk2-0aa93aecb7e83b9eeaaac801b1e842eaf6423f08.tar.bz2
edk2-0aa93aecb7e83b9eeaaac801b1e842eaf6423f08.zip
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>
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/Library/DebugLib.h9
-rw-r--r--MdePkg/Include/Library/PerformanceLib.h9
2 files changed, 14 insertions, 4 deletions
diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
index fc5c83463d..b0742969a8 100644
--- a/MdePkg/Include/Library/DebugLib.h
+++ b/MdePkg/Include/Library/DebugLib.h
@@ -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.
diff --git a/MdePkg/Include/Library/PerformanceLib.h b/MdePkg/Include/Library/PerformanceLib.h
index d0f2dfb070..40e99d0c4a 100644
--- a/MdePkg/Include/Library/PerformanceLib.h
+++ b/MdePkg/Include/Library/PerformanceLib.h
@@ -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.