summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorMarvin H?user <Marvin.Haeuser@outlook.com>2016-06-19 09:29:39 +0800
committerLiming Gao <liming.gao@intel.com>2016-06-22 09:37:12 +0800
commit90eda6fc279744c3ab200c149e4b75ed0c5dabf0 (patch)
tree3b59a235a4b160a085ca2a0ec3c17f15d32e78dc /MdePkg
parent001f28caefbb2b5b05435adf36fc4e695b7b0f66 (diff)
downloadedk2-platforms-90eda6fc279744c3ab200c149e4b75ed0c5dabf0.tar.xz
MdePkg/DebugLib: Flag post-_ASSERT() as unreachable for analyzers.
When a variable is compared to NULL as part of an ASSERT() call, the code implies that the variable may be NULL. Certain Static Analyzers, such as the Clang Static Analyzer, then issue false warnings for any untested access of that pointer, even though that defeats the intention behind ASSERT(). This patch flags the position after _ASSERT() as unreachable for Static Analyzers to indicate that if the variable is NULL, execution cannot pass. As the ANALYZER-prefixed version is used, the executables will not have any code stripped during compilation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/Library/DebugLib.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
index 93b6f8df34..803872cf3b 100644
--- a/MdePkg/Include/Library/DebugLib.h
+++ b/MdePkg/Include/Library/DebugLib.h
@@ -291,6 +291,7 @@ DebugPrintLevelEnabled (
if (DebugAssertEnabled ()) { \
if (!(Expression)) { \
_ASSERT (Expression); \
+ ANALYZER_UNREACHABLE (); \
} \
} \
} while (FALSE)