aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-18 18:14:09 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-18 18:14:09 +1100
commitcb7f77559b1682e7655af5a88b5bbeb63899eca4 (patch)
treefe5db395b9e6b344347747ef16de45a0ae2913b2 /src
parentbac6aef730e569c6b4bcda7026bf1c1db3e827b6 (diff)
downloadscintilla-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')
-rw-r--r--src/AutoComplete.cxx1
-rw-r--r--src/CallTip.cxx1
-rw-r--r--src/CellBuffer.cxx3
-rw-r--r--src/ContractionState.cxx3
-rw-r--r--src/Debugging.h44
-rw-r--r--src/Decoration.cxx3
-rw-r--r--src/Document.cxx3
-rw-r--r--src/EditModel.cxx1
-rw-r--r--src/EditView.cxx1
-rw-r--r--src/Editor.cxx1
-rw-r--r--src/Indicator.cxx1
-rw-r--r--src/KeyMap.cxx3
-rw-r--r--src/LineMarker.cxx1
-rw-r--r--src/MarginView.cxx1
-rw-r--r--src/PerLine.cxx1
-rw-r--r--src/Platform.h21
-rw-r--r--src/PositionCache.cxx1
-rw-r--r--src/RunStyles.cxx3
-rw-r--r--src/ScintillaBase.cxx1
-rw-r--r--src/Selection.cxx3
-rw-r--r--src/Style.cxx1
-rw-r--r--src/ViewStyle.cxx1
-rw-r--r--src/XPM.cxx1
23 files changed, 65 insertions, 35 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx
index 102624bbb..b4444ff0c 100644
--- a/src/AutoComplete.cxx
+++ b/src/AutoComplete.cxx
@@ -18,6 +18,7 @@
#include <algorithm>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index e6bfc2b7e..418088470 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -19,6 +19,7 @@
#include <algorithm>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index 4ddbfb718..a13d74ebf 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -19,8 +19,7 @@
#include <algorithm>
#include <memory>
-#include "Geometry.h"
-#include "Platform.h"
+#include "Debugging.h"
#include "Scintilla.h"
#include "Position.h"
diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx
index ace6ef4ef..af1c88bb7 100644
--- a/src/ContractionState.cxx
+++ b/src/ContractionState.cxx
@@ -15,8 +15,7 @@
#include <algorithm>
#include <memory>
-#include "Geometry.h"
-#include "Platform.h"
+#include "Debugging.h"
#include "Position.h"
#include "UniqueString.h"
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
diff --git a/src/Decoration.cxx b/src/Decoration.cxx
index ce9e29d07..9a88c03dd 100644
--- a/src/Decoration.cxx
+++ b/src/Decoration.cxx
@@ -16,8 +16,7 @@
#include <algorithm>
#include <memory>
-#include "Geometry.h"
-#include "Platform.h"
+#include "Debugging.h"
#include "Scintilla.h"
#include "Position.h"
diff --git a/src/Document.cxx b/src/Document.cxx
index f7f58bd13..564959eb0 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -25,8 +25,7 @@
#include <regex>
#endif
-#include "Geometry.h"
-#include "Platform.h"
+#include "Debugging.h"
#include "ILoader.h"
#include "ILexer.h"
diff --git a/src/EditModel.cxx b/src/EditModel.cxx
index 51d077aee..d99c0a88a 100644
--- a/src/EditModel.cxx
+++ b/src/EditModel.cxx
@@ -19,6 +19,7 @@
#include <algorithm>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/EditView.cxx b/src/EditView.cxx
index fcb747d21..b274e02ba 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -23,6 +23,7 @@
#include <memory>
#include <chrono>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 56164a312..a88ec2d1c 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -23,6 +23,7 @@
#include <memory>
#include <chrono>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/Indicator.cxx b/src/Indicator.cxx
index 91540e14e..007f30f77 100644
--- a/src/Indicator.cxx
+++ b/src/Indicator.cxx
@@ -14,6 +14,7 @@
#include <algorithm>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/KeyMap.cxx b/src/KeyMap.cxx
index 938d98997..58099de8c 100644
--- a/src/KeyMap.cxx
+++ b/src/KeyMap.cxx
@@ -13,8 +13,7 @@
#include <map>
#include <memory>
-#include "Geometry.h"
-#include "Platform.h"
+#include "Debugging.h"
#include "Scintilla.h"
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index 861ae58aa..09fe0e86d 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -16,6 +16,7 @@
#include <algorithm>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/MarginView.cxx b/src/MarginView.cxx
index 27b057bd4..1e4144771 100644
--- a/src/MarginView.cxx
+++ b/src/MarginView.cxx
@@ -20,6 +20,7 @@
#include <algorithm>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/PerLine.cxx b/src/PerLine.cxx
index e42844602..b478c7f07 100644
--- a/src/PerLine.cxx
+++ b/src/PerLine.cxx
@@ -16,6 +16,7 @@
#include <algorithm>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/Platform.h b/src/Platform.h
index 33116999c..5ba79a936 100644
--- a/src/Platform.h
+++ b/src/Platform.h
@@ -313,16 +313,6 @@ public:
void Show(Point pt, const Window &w);
};
-#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 retrieve system wide parameters such as double click speed
* and chrome colour.
@@ -338,19 +328,8 @@ constexpr long LongFromTwoShorts(short a,short b) noexcept {
return (a) | ((b) << 16);
}
-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
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 8665c19be..8ad940f5a 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -19,6 +19,7 @@
#include <iterator>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx
index c61e3ca41..e36d1ff12 100644
--- a/src/RunStyles.cxx
+++ b/src/RunStyles.cxx
@@ -18,8 +18,7 @@
#include <algorithm>
#include <memory>
-#include "Geometry.h"
-#include "Platform.h"
+#include "Debugging.h"
#include "Scintilla.h"
#include "Position.h"
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index b46a2207a..91abd0d85 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -18,6 +18,7 @@
#include <algorithm>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/Selection.cxx b/src/Selection.cxx
index 261fa81c5..5a5d998c4 100644
--- a/src/Selection.cxx
+++ b/src/Selection.cxx
@@ -14,8 +14,7 @@
#include <algorithm>
#include <memory>
-#include "Geometry.h"
-#include "Platform.h"
+#include "Debugging.h"
#include "Scintilla.h"
diff --git a/src/Style.cxx b/src/Style.cxx
index 85ac58738..dfeb5f1b9 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -10,6 +10,7 @@
#include <vector>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 0a3451026..28a09016b 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -16,6 +16,7 @@
#include <algorithm>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
diff --git a/src/XPM.cxx b/src/XPM.cxx
index 2ad21377a..a789a47d4 100644
--- a/src/XPM.cxx
+++ b/src/XPM.cxx
@@ -16,6 +16,7 @@
#include <iterator>
#include <memory>
+#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"