Author: tkreuzer
Date: Tue Mar 10 00:10:46 2015
New Revision: 66642
URL:
http://svn.reactos.org/svn/reactos?rev=66642&view=rev
Log:
[PSDK/DDK/XDK]
- Make NT_ASSERT() give the MSVC static analyzer a hint that the condition can now be
excpected to be true. This adds __analysis_unreachable(), which uses __assume(0) on
_PREFAST_ builds. This is neccessary, since it seems impossible to make MSVC respect
__analysis_noreturn / __declspec(noreturn) on an intrinsic prototype like __int2c().
Modified:
trunk/reactos/include/ddk/wdm.h
trunk/reactos/include/xdk/rtlfuncs.h
Modified: trunk/reactos/include/ddk/wdm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=6664…
==============================================================================
--- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Tue Mar 10 00:10:46 2015
@@ -11189,6 +11189,12 @@
DbgPrint("Assertion failed at %s(%d): %S\n", __FILE__, __LINE__, msg)
#endif
+#ifdef _PREFAST_
+#define __analysis_unreachable() __assume(0)
+#else
+#define __analysis_unreachable() ((void)0)
+#endif
+
#define NT_VERIFY(exp) \
((!(exp)) ? \
(__assert_annotationA(#exp), \
@@ -11208,17 +11214,17 @@
#define NT_ASSERT(exp) \
((VOID)((!(exp)) ? \
(__assert_annotationA(#exp), \
- DbgRaiseAssertionFailure(), FALSE) : TRUE))
+ DbgRaiseAssertionFailure(), __analysis_unreachable(), FALSE) : TRUE))
#define NT_ASSERTMSG(msg, exp) \
((VOID)((!(exp)) ? \
(__assert_annotationA(msg), \
- DbgRaiseAssertionFailure(), FALSE) : TRUE))
+ DbgRaiseAssertionFailure(), __analysis_unreachable(), FALSE) : TRUE))
#define NT_ASSERTMSGW(msg, exp) \
((VOID)((!(exp)) ? \
(__assert_annotationW(msg), \
- DbgRaiseAssertionFailure(), FALSE) : TRUE))
+ DbgRaiseAssertionFailure(), __analysis_unreachable(), FALSE) : TRUE))
#else /* !DBG */
Modified: trunk/reactos/include/xdk/rtlfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/rtlfuncs.h?rev…
==============================================================================
--- trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] Tue Mar 10 00:10:46 2015
@@ -3241,6 +3241,12 @@
DbgPrint("Assertion failed at %s(%d): %S\n", __FILE__, __LINE__, msg)
#endif
+#ifdef _PREFAST_
+#define __analysis_unreachable() __assume(0)
+#else
+#define __analysis_unreachable() ((void)0)
+#endif
+
#define NT_VERIFY(exp) \
((!(exp)) ? \
(__assert_annotationA(#exp), \
@@ -3260,17 +3266,17 @@
#define NT_ASSERT(exp) \
((VOID)((!(exp)) ? \
(__assert_annotationA(#exp), \
- DbgRaiseAssertionFailure(), FALSE) : TRUE))
+ DbgRaiseAssertionFailure(), __analysis_unreachable(), FALSE) : TRUE))
#define NT_ASSERTMSG(msg, exp) \
((VOID)((!(exp)) ? \
(__assert_annotationA(msg), \
- DbgRaiseAssertionFailure(), FALSE) : TRUE))
+ DbgRaiseAssertionFailure(), __analysis_unreachable(), FALSE) : TRUE))
#define NT_ASSERTMSGW(msg, exp) \
((VOID)((!(exp)) ? \
(__assert_annotationW(msg), \
- DbgRaiseAssertionFailure(), FALSE) : TRUE))
+ DbgRaiseAssertionFailure(), __analysis_unreachable(), FALSE) : TRUE))
#else /* !DBG */