summaryrefslogtreecommitdiff
path: root/src/pal/src
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2019-03-11 09:49:05 -0700
committerJan Vorlicek <janvorli@microsoft.com>2019-03-11 18:21:43 +0100
commitc4ca1ddb2413a354e8f49fff4680f175a02e7d8e (patch)
tree37c5608dec218af85dd0f597ad59fff1893d8239 /src/pal/src
parent98cd595b35ced3adb6efe0c667f5160f21067e0b (diff)
downloadcoreclr-c4ca1ddb2413a354e8f49fff4680f175a02e7d8e.tar.gz
coreclr-c4ca1ddb2413a354e8f49fff4680f175a02e7d8e.tar.bz2
coreclr-c4ca1ddb2413a354e8f49fff4680f175a02e7d8e.zip
Fix no-return false positives in static analyzer build
There were about 800 false positive issues in the clang status analyzer build caused by the fact that various forms of asserts were not considered by the analyzer as not returning. This change adds __attribute__((analyzer_noreturn)) (wrapped in a macro) to those assertion functions.
Diffstat (limited to 'src/pal/src')
-rw-r--r--src/pal/src/include/pal/dbgmsg.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/pal/src/include/pal/dbgmsg.h b/src/pal/src/include/pal/dbgmsg.h
index 641de90a60..ad3dd540cd 100644
--- a/src/pal/src/include/pal/dbgmsg.h
+++ b/src/pal/src/include/pal/dbgmsg.h
@@ -355,6 +355,15 @@ bool DBG_ShouldCheckStackAlignment();
#else /* defined(_DEBUG) */
+ANALYZER_NORETURN
+inline void AssertBreak()
+{
+ if(g_Dbg_asserts_enabled)
+ {
+ DebugBreak();
+ }
+}
+
#define ASSERT(...) \
{ \
__ASSERT_ENTER(); \
@@ -362,10 +371,7 @@ bool DBG_ShouldCheckStackAlignment();
{ \
DBG_printf(defdbgchan,DLI_ASSERT,TRUE,__FUNCTION__,__FILE__,__LINE__,__VA_ARGS__); \
} \
- if(g_Dbg_asserts_enabled) \
- { \
- DebugBreak(); \
- } \
+ AssertBreak(); \
}
#define _ASSERT(expr) do { if (!(expr)) { ASSERT(""); } } while(0)