diff options
author | Neil <nyamatongwe@gmail.com> | 2021-03-18 18:14:09 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-03-18 18:14:09 +1100 |
commit | cb7f77559b1682e7655af5a88b5bbeb63899eca4 (patch) | |
tree | fe5db395b9e6b344347747ef16de45a0ae2913b2 /src/Debugging.h | |
parent | bac6aef730e569c6b4bcda7026bf1c1db3e827b6 (diff) | |
download | scintilla-mirror-cb7f77559b1682e7655af5a88b5bbeb63899eca4.tar.gz |
Move assert and debug trace functions into their own header Debugging.h.
PLATFORM_ASSERT is used in data structure headers which led to including
graphics and windowing APIs in data structure modules.
Diffstat (limited to 'src/Debugging.h')
-rw-r--r-- | src/Debugging.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/Debugging.h b/src/Debugging.h new file mode 100644 index 000000000..b7ea20b98 --- /dev/null +++ b/src/Debugging.h @@ -0,0 +1,44 @@ +// Scintilla source code edit control +/** @file Debugging.h + ** Assert and debug trace functions. + ** Implemented in each platform layer. + **/ +// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef DEBUGGING_H +#define DEBUGGING_H + +namespace Scintilla { + +#if defined(__clang__) +# if __has_feature(attribute_analyzer_noreturn) +# define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) +# else +# define CLANG_ANALYZER_NORETURN +# endif +#else +# define CLANG_ANALYZER_NORETURN +#endif + +/** + * Platform namespace used to segregate debugging functions. + */ +namespace Platform { + +void DebugDisplay(const char *s) noexcept; +void DebugPrintf(const char *format, ...) noexcept; +bool ShowAssertionPopUps(bool assertionPopUps_) noexcept; +void Assert(const char *c, const char *file, int line) noexcept CLANG_ANALYZER_NORETURN; + +} + +#ifdef NDEBUG +#define PLATFORM_ASSERT(c) ((void)0) +#else +#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__)) +#endif + +} + +#endif |