[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH] Turn off ASSERTions in free builds



Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenvbd/assert.h   | 57 +++++++++++++++++++++++++++++++++++++++++++--------
 src/xenvbd/notifier.c |  4 ++--
 2 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/src/xenvbd/assert.h b/src/xenvbd/assert.h
index 9c43560..a0ffcf0 100644
--- a/src/xenvbd/assert.h
+++ b/src/xenvbd/assert.h
@@ -91,6 +91,8 @@ __BugCheck(
 #define BUG_ON_MSG(_EXP, _TEXT)                \
         if (_EXP) BUG_MSG(#_EXP, _TEXT)
 
+#undef  ASSERT
+
 #if DBG
 
 #define __NT_ASSERT(_EXP)                                       \
@@ -110,15 +112,6 @@ __BugCheck(
 #define __ASSERT(_EXP)              __NT_ASSERT(_EXP)
 #define __ASSERT_MSG(_EXP, _TEXT)   __NT_ASSERT_MSG(_EXP, _TEXT)
 
-#else   // DBG
-
-#define __ASSERT(_EXP)              BUG_ON(!(_EXP))
-#define __ASSERT_MSG(_EXP, _TEXT)   BUG_ON_MSG(!(_EXP), _TEXT)
-
-#endif  // DBG
-
-#undef  ASSERT
-
 #define ASSERT(_EXP)                    \
         do {                            \
             __ASSERT(_EXP);             \
@@ -175,6 +168,52 @@ __BugCheck(
             }                                       \
         } while (FALSE)
 
+#else   // DBG
+
+static FORCEINLINE VOID
+_IgnoreAssertion(
+    IN  BOOLEAN Value
+    )
+{
+    UNREFERENCED_PARAMETER(Value);
+}
+
+#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))
+
+#define ASSERT3S(_X, _OP, _Y)           \
+        ASSERT((_X) _OP (_Y))
+
+#define ASSERT3P(_X, _OP, _Y)           \
+        ASSERT((_X) _OP (_Y))
+
+#define ASSERTREFCOUNT(_X, _OP, _Y, _Z) \
+        ASSERT_MSG((_X) _OP (_Y), (_Z))
+
+#endif  // DBG
+
 #ifndef TEST_MEMORY
 #define TEST_MEMORY DBG
 #endif
diff --git a/src/xenvbd/notifier.c b/src/xenvbd/notifier.c
index e9943fa..0b2664f 100644
--- a/src/xenvbd/notifier.c
+++ b/src/xenvbd/notifier.c
@@ -86,7 +86,7 @@ NotifierInterrupt(
     
     UNREFERENCED_PARAMETER(Interrupt);
 
-    ASSERT(Notifier);
+    ASSERT(Notifier != NULL);
 
        ++Notifier->NumInts;
        if (Notifier->Connected) {
@@ -115,7 +115,7 @@ NotifierDpc(
     UNREFERENCED_PARAMETER(Arg1);
     UNREFERENCED_PARAMETER(Arg2);
 
-    ASSERT(Notifier);
+    ASSERT(Notifier != NULL);
     Pdo = FrontendGetPdo(Notifier->Frontend);
 
     if (PdoIsPaused(Pdo)) {
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.