edk2-platforms icon indicating copy to clipboard operation
edk2-platforms copied to clipboard

GLOBAL: Align MDEPKG_NDEBUG dependent code with edk2 debug macro changes

Open mikebeaton opened this issue 4 months ago • 4 comments

Description

edk2 commit ae83c6b7fd83a5906e016a32027c1bcd792a624e updates the 'null' variants of the DebugLib macros (used when MDEPKG_NDEBUG is defined) so that they explicitly discard their parameters using if (FALSE) code blocks. These are understood as marking the contained code as referenced but unused by all supported compilers. This avoids the need for additional MDEPKG_NDEBUG dependent code in c files, to conditionally hide static methods or functions which are only used in debug macros. Now, such code can and must be removed.

This commit updates the relevant MDEPKG_NDEBUG code in c files throughout edk2-platforms (there are only some 20 instances).

We also fix a couple of cases where the wrapped variables had incorrectly not been marked STATIC.

Since the RELEASE builds of all platforms which used this kind of code break after the above-mentioned edk2 commit, it is considered preferable to have one single cross-platform commit to edk2-platforms which resolves this, rarther than spreading the fix across multiple commits.

Additionally in a second commit, remove yet more MDEPKG_NDEBUG dependent code by refactoring Platform/ARM/JunoPkg HdLcdArmJuno.c to use DEBUG_CODE_BEGIN and DEBUG_CODE_END. This is preferable as it allows these debug macros to wrap the dependency on MDEPKG_NDEBUG, as originally intended.

  • [ ] Breaking change?
    • Resolves a breaking change as described.
  • [ ] Impacts security?
  • [ ] Includes tests?

How This Was Tested

Local builds.

Integration Instructions

N/A

mikebeaton avatar Oct 23 '24 22:10 mikebeaton