]> xenbits.xensource.com Git - pvdrivers/win/xenvbd.git/commitdiff
Avoid evaluating assertion expressions in free builds
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 22 Jan 2016 17:08:59 +0000 (17:08 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Fri, 22 Jan 2016 17:09:44 +0000 (17:09 +0000)
The evaluations are pointless and the warnings generated by not evaluating
can be squashed with a couple of #pragmas.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenvbd/assert.h

index a0ffcf0d1f33b934dea876f23d31ea259864c631..503d2a566b3ab99df68e7c9c36cdbee07e8e7251 100644 (file)
@@ -170,36 +170,14 @@ __BugCheck(
 
 #else   // DBG
 
-static FORCEINLINE VOID
-_IgnoreAssertion(
-    IN  BOOLEAN Value
-    )
-{
-    UNREFERENCED_PARAMETER(Value);
-}
+#pragma warning(disable:4100)
+#pragma warning(disable:4189)
 
 #define ASSERT(_EXP)                    \
         do {                            \
-            _IgnoreAssertion(_EXP);     \
             __analysis_assume(_EXP);    \
         } while (FALSE)
 
-static FORCEINLINE VOID
-_IgnoreAssertionMessage(
-    IN  BOOLEAN Value,
-    IN  const CHAR *Text
-    )
-{
-    UNREFERENCED_PARAMETER(Value);
-    UNREFERENCED_PARAMETER(Text);
-}
-
-#define ASSERT_MSG(_EXP, _TEXT)                     \
-        do {                                        \
-            _IgnoreAssertionMessage(_EXP, _TEXT);   \
-            __analysis_assume(_EXP);                \
-        } while (FALSE)
-
 #define ASSERT3U(_X, _OP, _Y)           \
         ASSERT((_X) _OP (_Y))
 
@@ -210,7 +188,7 @@ _IgnoreAssertionMessage(
         ASSERT((_X) _OP (_Y))
 
 #define ASSERTREFCOUNT(_X, _OP, _Y, _Z) \
-        ASSERT_MSG((_X) _OP (_Y), (_Z))
+        ASSERT((_X) _OP (_Y))
 
 #endif  // DBG