diff options
author | erictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-02-02 03:21:46 +0000 |
---|---|---|
committer | erictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-02-02 03:21:46 +0000 |
commit | 5ee9264acc861940b79497f17d7e49b5c8af3731 (patch) | |
tree | 432dd2d9f1f4ec3d8a62e850c33677909f2f1916 | |
parent | d228526f931a51694919a65867310606e64611a5 (diff) | |
download | edk2-5ee9264acc861940b79497f17d7e49b5c8af3731.zip edk2-5ee9264acc861940b79497f17d7e49b5c8af3731.tar.gz edk2-5ee9264acc861940b79497f17d7e49b5c8af3731.tar.bz2 |
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
-rw-r--r-- | MdePkg/Include/Library/DebugLib.h | 8 | ||||
-rw-r--r-- | MdePkg/Include/Library/UefiLib.h | 38 |
2 files changed, 28 insertions, 18 deletions
diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h index 836d807..bf38fd8 100644 --- a/MdePkg/Include/Library/DebugLib.h +++ b/MdePkg/Include/Library/DebugLib.h @@ -4,11 +4,11 @@ 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.
- Note that a MDEPKG_NDEBUG macro is introduced to switch on/off debug and assert related macros.
- 1. If MDEPKG_NDEBUG is defined, then debug and assert related macros are NULL.
- 2. If MDEPKG_NDEBUG is not defined, then PcdDebugProperyMask is used to turn on/off these helper macros.
+ 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 - 2008, Intel Corporation<BR>
+Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
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
diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h index 56352db..60ba7ff 100644 --- a/MdePkg/Include/Library/UefiLib.h +++ b/MdePkg/Include/Library/UefiLib.h @@ -8,7 +8,11 @@ EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers,
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
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
@@ -280,24 +284,30 @@ EfiInitializeLock ( /**
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,
- then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock
- is not in the locked state, then DebugAssert() is called passing in the source
- filename, source line number, and Lock.
+ If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED
+ bit of PcdDebugProperyMask is set, then this macro evaluates the EFI_LOCK
+ structure specified by Lock. If Lock is not in the locked state, then
+ DebugAssert() is called passing in the source filename, source line number,
+ and Lock.
+
If Lock is NULL, then ASSERT().
@param LockParameter A pointer to the lock to acquire.
**/
-#define ASSERT_LOCKED(LockParameter) \
- do { \
- if (DebugAssertEnabled ()) { \
- ASSERT (LockParameter != NULL); \
- if ((LockParameter)->Lock != EfiLockAcquired) { \
- _ASSERT (LockParameter not locked); \
- } \
- } \
- } while (FALSE)
+#if !defined(MDEPKG_NDEBUG)
+ #define ASSERT_LOCKED(LockParameter) \
+ do { \
+ if (DebugAssertEnabled ()) { \
+ ASSERT (LockParameter != NULL); \
+ if ((LockParameter)->Lock != EfiLockAcquired) { \
+ _ASSERT (LockParameter not locked); \
+ } \
+ } \
+ } while (FALSE)
+#else
+ #define ASSERT_LOCKED(LockParameter)
+#endif
/**
|