aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-05-01 14:55:01 +1000
committerNeil <nyamatongwe@gmail.com>2020-05-01 14:55:01 +1000
commit2b878d7cf9a92cb3842a7498baef656fc47e5bd9 (patch)
treecc3c21cf33431987d23b85be6d8d64d10a0410a3
parente06f3575be182ffcdf3daf148f784a00cda45ca4 (diff)
downloadscintilla-mirror-2b878d7cf9a92cb3842a7498baef656fc47e5bd9.tar.gz
Backport: Add SCE_ERR_GCC_EXCERPT style for diagnostics introduced by GCC 9.0 like
73 | GTimeVal last_popdown; | ^~~~~~~~~~~~ Backport of changeset 8217:2ea7e2f6a248.
-rw-r--r--include/SciLexer.h1
-rw-r--r--include/Scintilla.iface1
-rw-r--r--lexers/LexErrorList.cxx18
3 files changed, 20 insertions, 0 deletions
diff --git a/include/SciLexer.h b/include/SciLexer.h
index 94cd107f1..e58f6184c 100644
--- a/include/SciLexer.h
+++ b/include/SciLexer.h
@@ -517,6 +517,7 @@
#define SCE_ERR_GCC_INCLUDED_FROM 22
#define SCE_ERR_ESCSEQ 23
#define SCE_ERR_ESCSEQ_UNKNOWN 24
+#define SCE_ERR_GCC_EXCERPT 25
#define SCE_ERR_ES_BLACK 40
#define SCE_ERR_ES_RED 41
#define SCE_ERR_ES_GREEN 42
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 63ab3d8f0..5b07902de 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -3645,6 +3645,7 @@ val SCE_ERR_VALUE=21
val SCE_ERR_GCC_INCLUDED_FROM=22
val SCE_ERR_ESCSEQ=23
val SCE_ERR_ESCSEQ_UNKNOWN=24
+val SCE_ERR_GCC_EXCERPT=25
val SCE_ERR_ES_BLACK=40
val SCE_ERR_ES_RED=41
val SCE_ERR_ES_GREEN=42
diff --git a/lexers/LexErrorList.cxx b/lexers/LexErrorList.cxx
index bf301447a..34bf968fb 100644
--- a/lexers/LexErrorList.cxx
+++ b/lexers/LexErrorList.cxx
@@ -48,6 +48,19 @@ inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
}
+bool IsGccExcerpt(const char *s) noexcept {
+ while (*s) {
+ if (s[0] == ' ' && s[1] == '|' && (s[2] == ' ' || s[2] == '+')) {
+ return true;
+ }
+ if (!(s[0] == ' ' || s[0] == '+' || Is0To9(s[0]))) {
+ return false;
+ }
+ s++;
+ }
+ return true;
+}
+
int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) {
if (lineBuffer[0] == '>') {
// Command or return status
@@ -132,6 +145,11 @@ int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci
// Microsoft linker warning:
// {<object> : } warning LNK9999
return SCE_ERR_MS;
+ } else if (IsGccExcerpt(lineBuffer)) {
+ // GCC code excerpt and pointer to issue
+ // 73 | GTimeVal last_popdown;
+ // | ^~~~~~~~~~~~
+ return SCE_ERR_GCC_EXCERPT;
} else {
// Look for one of the following formats:
// GCC: <filename>:<line>:<message>