wrap ASSERT_LOCKED macro with MDEPKG_NDEBUG.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9907 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
erictian 2010-02-02 03:21:46 +00:00
parent d228526f93
commit 5ee9264acc
2 changed files with 28 additions and 18 deletions

View File

@ -4,11 +4,11 @@
The Debug library supports debug print and asserts based on a combination of macros and code. The Debug library supports debug print and asserts based on a combination of macros and code.
The debug library can be turned on and off so that the debug code does not increase the size of an image. The debug library can be turned on and off so that the debug code does not increase the size of an image.
Note that a MDEPKG_NDEBUG macro is introduced to switch on/off debug and assert related macros. Note that a reserved macro named MDEPKG_NDEBUG is introduced for the intention
1. If MDEPKG_NDEBUG is defined, then debug and assert related macros are NULL. of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is
2. If MDEPKG_NDEBUG is not defined, then PcdDebugProperyMask is used to turn on/off these helper macros. defined, then debug and assert related macros wrapped by it are the NULL implementations.
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@ -8,7 +8,11 @@
EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers,
and print messages on the console output and standard error devices. and print messages on the console output and standard error devices.
Copyright (c) 2006 - 2008, Intel Corporation<BR> Note that a reserved macro named MDEPKG_NDEBUG is introduced for the intention
of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is
defined, then debug and assert related macros wrapped by it are the NULL implementations.
Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -280,24 +284,30 @@ EfiInitializeLock (
/** /**
Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state. Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set, If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED
then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock bit of PcdDebugProperyMask is set, then this macro evaluates the EFI_LOCK
is not in the locked state, then DebugAssert() is called passing in the source structure specified by Lock. If Lock is not in the locked state, then
filename, source line number, and Lock. DebugAssert() is called passing in the source filename, source line number,
and Lock.
If Lock is NULL, then ASSERT(). If Lock is NULL, then ASSERT().
@param LockParameter A pointer to the lock to acquire. @param LockParameter A pointer to the lock to acquire.
**/ **/
#define ASSERT_LOCKED(LockParameter) \ #if !defined(MDEPKG_NDEBUG)
do { \ #define ASSERT_LOCKED(LockParameter) \
if (DebugAssertEnabled ()) { \ do { \
ASSERT (LockParameter != NULL); \ if (DebugAssertEnabled ()) { \
if ((LockParameter)->Lock != EfiLockAcquired) { \ ASSERT (LockParameter != NULL); \
_ASSERT (LockParameter not locked); \ if ((LockParameter)->Lock != EfiLockAcquired) { \
} \ _ASSERT (LockParameter not locked); \
} \ } \
} while (FALSE) } \
} while (FALSE)
#else
#define ASSERT_LOCKED(LockParameter)
#endif
/** /**