#include <boost/assert.hpp>
+#include <iostream>
#ifdef LYX_CALLSTACK_PRINTING
#include <cstdio>
}
+void doAssertStatic(char const * expr, char const * file, long line)
+{
+ cerr << "ASSERTION " << expr << " VIOLATED IN " << file << ":" << line << endl;
+ BOOST_ASSERT(false);
+}
+
+
docstring formatHelper(docstring const & msg,
char const * expr, char const * file, long line)
{
continue with the usual program flow, but failure of expr still means that
there is something that needs to be fixed.
+LATTEST_STATIC(expr)
+ This is the same as macro LATTEST above, except
+ that it does not use lyxerr, so that it is suitable in static
+ variables initialization.
+
LASSERT(expr, escape)
This macro should be used when a failure of expr is not compatible with
continuing the ordinary program flow, but is something from which we can
void doAssert(char const * expr, char const * file, long line);
+void doAssertStatic(char const * expr, char const * file, long line);
void doWarnIf(char const * expr, char const * file, long line);
void doBufErr(char const * expr, char const * file, long line);
void doAppErr(char const * expr, char const * file, long line);
#define LATTEST(expr) \
if (expr) {} else { lyx::doAssert(#expr, __FILE__, __LINE__); }
+#define LATTEST_STATIC(expr) \
+ if (expr) {} else { lyx::doAssertStatic(#expr, __FILE__, __LINE__); }
+
#define LASSERT(expr, escape) \
if (expr) {} else { lyx::doAssert(#expr, __FILE__, __LINE__); escape; }