]> git.saurik.com Git - wxWidgets.git/commitdiff
added alternative definitions for wxASSERT_MSG and wxCHECK2_MSG to fix CodeWarrior...
authorDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Thu, 15 Jun 2006 12:40:34 +0000 (12:40 +0000)
committerDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Thu, 15 Jun 2006 12:40:34 +0000 (12:40 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/debug.h

index 06f302d8206a1758bb30619ee8513bf09cca14de..a8d452a38eba7a54211334cfbe4ddf97ad606288 100644 (file)
   /*  generic assert macro */
   #define wxASSERT(cond) wxASSERT_MSG(cond, NULL)
 
-  /*  assert with additional message explaining it's cause */
-  #define wxASSERT_MSG(cond, msg)                                             \
-    if ( cond )                                                               \
-        ;                                                                     \
-    else                                                                      \
-        wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(#cond), msg)
+
+  /*  assert with additional message explaining its cause */
+
+  /*  compilers can give a warning (such as "possible unwanted ;") when using */
+  /*  the default definition of wxASSERT_MSG so we provide an alternative */
+  #if defined(__MWERKS__)
+    #define wxASSERT_MSG(cond, msg)                                           \
+      if ( cond )                                                             \
+      {}                                                                      \
+      else                                                                    \
+          wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(#cond), msg)
+  #else
+    #define wxASSERT_MSG(cond, msg)                                           \
+      if ( cond )                                                             \
+          ;                                                                   \
+      else                                                                    \
+          wxOnAssert(__TFILE__, __LINE__, __WXFUNCTION__, _T(#cond), msg)
+  #endif
 
   /*  special form of assert: always triggers it (in debug mode) */
   #define wxFAIL wxFAIL_MSG(NULL)
 #define wxCHECK2(cond, op)           wxCHECK2_MSG(cond, op, NULL)
 
 /*  as wxCHECK2 but with a message explaining why we fail */
-#define wxCHECK2_MSG(cond, op, msg)                                           \
-    if ( cond )                                                               \
-        ;                                                                     \
-    else                                                                      \
-    {                                                                         \
-        wxFAIL_COND_MSG(#cond, msg);                                          \
-        op;                                                                   \
-    }                                                                         \
-    struct wxDummyCheckStruct /* just to force a semicolon */
+
+/* see comment near the definition of wxASSERT_MSG for the # if/else reason */
+#if defined(__MWERKS__)
+    #define wxCHECK2_MSG(cond, op, msg)                                       \
+        if ( cond )                                                           \
+        {}                                                                    \
+        else                                                                  \
+        {                                                                     \
+            wxFAIL_COND_MSG(#cond, msg);                                      \
+            op;                                                               \
+        }                                                                     \
+        struct wxDummyCheckStruct /* just to force a semicolon */
+#else
+    #define wxCHECK2_MSG(cond, op, msg)                                       \
+        if ( cond )                                                           \
+            ;                                                                 \
+        else                                                                  \
+        {                                                                     \
+            wxFAIL_COND_MSG(#cond, msg);                                      \
+            op;                                                               \
+        }                                                                     \
+        struct wxDummyCheckStruct /* just to force a semicolon */
+#endif
 
 /*  special form of wxCHECK2: as wxCHECK, but for use in void functions */
 /*  */