]> git.lyx.org Git - lyx.git/blobdiff - src/support/LAssert.h
remove commented HAVE_SSTREAM code
[lyx.git] / src / support / LAssert.h
index bf4c3c52bb1644bf49bb040629fc6b6ebdd4fd45..a62e16b3435a474b94fa194bdaec419fd45f2f26 100644 (file)
@@ -8,30 +8,33 @@
 
 #ifdef ENABLE_ASSERTIONS
 
-//template<class X, class A> inline void Assert(A assertion)
-template<class A> inline void Assert(A assertion)
+extern void emergencySave();
+
+/** Live assertion.
+    This is a debug tool to ensure that the assertion holds. If it don't hole
+    we run #emergencySave()# and then #lyx::abort".
+    @param assertion this should evaluate to true unless you want an abort.
+*/
+template<class A>
+inline
+void Assert(A assertion)
 {
-       //if (!assertion) throw X();
        if (!assertion) {
+               ::emergencySave();
                lyx::abort();
        }
 }
 
-
-//template<class A, class E> inline void Assert(A assertion, E except)
-//{
-//     if (!assertion) except;
-//}
-
 #else
 
-template<class A> inline void Assert(A /*assertion*/) {}
+/** Dummy assertion.
+    When compiling without assertions we use this no-op function.
+*/
+template<class A>
+inline
+void Assert(A /*assertion*/) {}
 
 #endif /* ENABLE_ASSERTIONS */
 
-
 //} // end of namespace LyX
-
-
 #endif /* LASSERT_H */
-