1 | // Scintilla source code edit control |
2 | /** @file Debugging.h |
3 | ** Assert and debug trace functions. |
4 | ** Implemented in each platform layer. |
5 | **/ |
6 | // Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org> |
7 | // The License.txt file describes the conditions under which this software may be distributed. |
8 | |
9 | #ifndef DEBUGGING_H |
10 | #define DEBUGGING_H |
11 | |
12 | namespace Scintilla::Internal { |
13 | |
14 | #if defined(__clang__) |
15 | # if __has_feature(attribute_analyzer_noreturn) |
16 | # define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) |
17 | # else |
18 | # define CLANG_ANALYZER_NORETURN |
19 | # endif |
20 | #else |
21 | # define CLANG_ANALYZER_NORETURN |
22 | #endif |
23 | |
24 | /** |
25 | * Platform namespace used to segregate debugging functions. |
26 | */ |
27 | namespace Platform { |
28 | |
29 | void DebugDisplay(const char *s) noexcept; |
30 | void DebugPrintf(const char *format, ...) noexcept; |
31 | bool (bool ) noexcept; |
32 | void Assert(const char *c, const char *file, int line) noexcept CLANG_ANALYZER_NORETURN; |
33 | |
34 | } |
35 | |
36 | #ifdef NDEBUG |
37 | #define PLATFORM_ASSERT(c) ((void)0) |
38 | #else |
39 | #define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Internal::Platform::Assert(#c, __FILE__, __LINE__)) |
40 | #endif |
41 | |
42 | } |
43 | |
44 | #endif |
45 | |