From 5ee9264acc861940b79497f17d7e49b5c8af3731 Mon Sep 17 00:00:00 2001 From: erictian Date: Tue, 2 Feb 2010 03:21:46 +0000 Subject: [PATCH] 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 --- MdePkg/Include/Library/DebugLib.h | 8 +++---- 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 836d807dcf..bf38fd8bf5 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
+Copyright (c) 2006 - 2010, Intel Corporation
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 56352dbf30..60ba7ff1e7 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
+ 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
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 /**