Revision: 16787
http://sourceforge.net/p/edk2/code/16787
Author: lgao4
Date: 2015-02-06 06:33:29 +0000 (Fri, 06 Feb 2015)
Log Message:
-----------
MdePkg: Add new API DebugPrintLevelEnabled() in DebugLib
This API is applied in _DEBUG_PRINT() macro for build time size optimization.
DebugLib library instance should implement this API to return the constant
value.
DEBUG_PRINT() will base on __VA_ARGS__ for build time size optimization.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdePkg/Include/Library/DebugLib.h
Modified: trunk/edk2/MdePkg/Include/Library/DebugLib.h
===================================================================
--- trunk/edk2/MdePkg/Include/Library/DebugLib.h 2015-02-06 06:32:49 UTC
(rev 16786)
+++ trunk/edk2/MdePkg/Include/Library/DebugLib.h 2015-02-06 06:33:29 UTC
(rev 16787)
@@ -8,7 +8,7 @@
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 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under
the terms and conditions of the BSD License that accompanies this
distribution.
The full text of the license may be found at
@@ -220,7 +220,21 @@
VOID
);
+/**
+ Returns TRUE if any one of the bit is set both in ErrorLevel and
PcdFixedDebugPrintErrorLevel.
+ This function compares the bit mask of ErrorLevel and
PcdFixedDebugPrintErrorLevel.
+
+ @retval TRUE Current ErrorLevel is supported.
+ @retval FALSE Current ErrorLevel is not supported.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintLevelEnabled (
+ IN CONST UINTN ErrorLevel
+ );
+
/**
Internal worker macro that calls DebugAssert().
@@ -243,9 +257,19 @@
and a variable argument list based on the format string.
**/
+
+#if !defined(MDE_CPU_EBC)
+ #define _DEBUG_PRINT(PrintLevel, ...) \
+ do { \
+ if (DebugPrintLevelEnabled (PrintLevel)) { \
+ DebugPrint (PrintLevel, ##__VA_ARGS__); \
+ } \
+ } while (FALSE)
+ #define _DEBUG(Expression) _DEBUG_PRINT Expression
+#else
#define _DEBUG(Expression) DebugPrint Expression
+#endif
-
/**
Macro that calls DebugAssert() if an expression evaluates to FALSE.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits