Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DebugLib: Simplify DEBUG and ASSERT macros used when MDEPKG_NDEBUG is defined #61

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions MdePkg/Include/Library/DebugLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ UnitTestDebugAssert (
#else
#define ASSERT(Expression) \
do { \
if ((FALSE)) { \
if (FALSE) { \
(VOID) (Expression); \
} \
} while (FALSE)
Expand All @@ -433,18 +433,13 @@ UnitTestDebugAssert (
_DEBUG (Expression); \
} \
} while (FALSE)
#elif defined (__GNUC__) || defined (__clang__)
#define DEBUG(Expression) \
do { \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wunused-value\"") \
if ((FALSE)) { \
(VOID) Expression; \
} \
_Pragma("GCC diagnostic pop") \
} while (FALSE)
#else
#define DEBUG(Expression)
#define DEBUG(Expression) \
do { \
if (FALSE) { \
_DEBUG (Expression); \
} \
} while (FALSE)
#endif

/**
Expand Down Expand Up @@ -472,7 +467,7 @@ UnitTestDebugAssert (
#else
#define ASSERT_EFI_ERROR(StatusParameter) \
do { \
if ((FALSE)) { \
if (FALSE) { \
(VOID) (StatusParameter); \
} \
} while (FALSE)
Expand Down Expand Up @@ -504,7 +499,7 @@ UnitTestDebugAssert (
#else
#define ASSERT_RETURN_ERROR(StatusParameter) \
do { \
if ((FALSE)) { \
if (FALSE) { \
(VOID) (StatusParameter); \
} \
} while (FALSE)
Expand Down