Skip to content

Commit

Permalink
MdePkg DebugLib: Enable FILE NAME as DEBUG ASSERT for GCC12
Browse files Browse the repository at this point in the history
Using __FILE_NAME__ is useful for reducing the size of debug image and
it's also good for reproducable builds. The gcc-12 also supported this
macro.

Ref: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=1a9b3f04c11eb467a8dc504a37dad57a371a0d4c

This patch removed the checking of __clang__ when using __FILE_NAME__.

References: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42579
Signed-off-by: Chun-Yi Lee <[email protected]>
  • Loading branch information
joeyli committed Sep 13, 2024
1 parent babccb8 commit eef43c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MdePkg/Include/Library/DebugLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,13 @@ UnitTestDebugAssert (
#if defined (_ASSERT)
#undef _ASSERT
#endif
#if defined (__clang__) && defined (__FILE_NAME__)
#if defined (__FILE_NAME__)
#define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression))
#else
#define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression))
#endif
#else
#if defined (__clang__) && defined (__FILE_NAME__)
#if defined (__FILE_NAME__)
#define _ASSERT(Expression) DebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression))
#else
#define _ASSERT(Expression) DebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression))
Expand Down

0 comments on commit eef43c7

Please sign in to comment.