]> git.lyx.org Git - lyx.git/blob - src/support/LAssert.C
Move #includes out of header files.
[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 #include "errorlist.h"
19
20 namespace lyx {
21 namespace support {
22
23 namespace {
24
25 void emergencyCleanup()
26 {
27         static bool didCleanup;
28         if (didCleanup)
29                 return;
30
31         didCleanup = true;
32
33         LyX::emergencyCleanup();
34 }
35
36 } // namespace anon
37
38 void Assert(bool assertion)
39 {
40         if (!assertion) {
41                 emergencyCleanup();
42                 lyx::support::abort();
43         }
44 }
45
46 } // namespace support
47 } // namespace lyx
48
49 #endif