mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-13 06:20:28 +00:00
797d87b451
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@956 a592a061-630c-0410-9148-cb99ea01b6c8
41 lines
737 B
C++
41 lines
737 B
C++
// -*- C++ -*-
|
|
#ifndef LASSERT_H
|
|
#define LASSERT_H
|
|
|
|
#include "support/lyxlib.h"
|
|
|
|
//namespace LyX {
|
|
|
|
#ifdef ENABLE_ASSERTIONS
|
|
|
|
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) {
|
|
::emergencySave();
|
|
lyx::abort();
|
|
}
|
|
}
|
|
|
|
#else
|
|
|
|
/** 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 */
|