From 2b878d7cf9a92cb3842a7498baef656fc47e5bd9 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 1 May 2020 14:55:01 +1000 Subject: Backport: Add SCE_ERR_GCC_EXCERPT style for diagnostics introduced by GCC 9.0 like 73 | GTimeVal last_popdown; | ^~~~~~~~~~~~ Backport of changeset 8217:2ea7e2f6a248. --- lexers/LexErrorList.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lexers') 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: // { : } 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: :: -- cgit v1.2.3