This makes sure the analyzer actually honors assert() in an MSVC project.
Patch by Anders Montonen!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194716
91177308-0d34-0410-b5e6-
96231b3b80d8
.Case("assfail", true)
.Case("db_error", true)
.Case("__assert", true)
+ // For the purpose of static analysis, we do not care that
+ // this MSVC function will return if the user decides to continue.
+ .Case("_wassert", true)
.Case("__assert_rtn", true)
.Case("__assert_fail", true)
.Case("dtrace_assfail", true)
*p = 0xDEADBEEF; // no-warning
}
+// Test that hard-coded Microsoft _wassert name is recognized as a noreturn
+#define assert(_Expression) (void)( (!!(_Expression)) || (_wassert(#_Expression, __FILE__, __LINE__), 0) )
+extern void _wassert(const char * _Message, const char *_File, unsigned _Line);
+void test_wassert() {
+ assert(0);
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+}