]> git.lyx.org Git - lyx.git/blob - src/support/LAssert.C
zlib stuff
[lyx.git] / src / support / LAssert.C
1 /**
2  * \file LAssert.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #include "LAssert.h"
14 #include "support/lyxlib.h"
15
16 #ifdef ENABLE_ASSERTIONS
17 #include "lyx_main.h"
18
19 namespace lyx {
20 namespace support {
21
22 namespace {
23
24 void emergencyCleanup()
25 {
26         static bool didCleanup;
27         if (didCleanup)
28                 return;
29
30         didCleanup = true;
31
32         LyX::emergencyCleanup();
33 }
34
35 } // namespace anon
36
37 void Assert(bool assertion)
38 {
39         if (!assertion) {
40                 emergencyCleanup();
41                 lyx::support::abort();
42         }
43 }
44
45 } // namespace support
46 } // namespace lyx
47
48 #endif