Add Github Problem Matchers actions for GCC/MSVC

MSVC needs two matchers: One general matcher for regular
single-line warnings, and one multi-line matcher for template
warnings that originate from a template in MSVC's library.

In the latter case, MSVC prints the path to the actual file
that should be annotated several lines down and all lines
in between the first line and that line need to be matched
by one of the regexps.
This commit is contained in:
Johannes Schmidt 2025-09-04 13:32:14 +02:00
parent 2063d2bdbc
commit 43cc092749
4 changed files with 73 additions and 0 deletions

17
.github/problem-matchers/gcc.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "gcc-problem-matcher",
"pattern": [
{
"regexp": "^(?:(?:\\.\\.?)?\\/)?(?:icinga2\\/)?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
}

49
.github/problem-matchers/msvc.json vendored Normal file
View File

@ -0,0 +1,49 @@
{
"problemMatcher": [
{
"owner": "msvc-problem-matcher",
"pattern": [
{
"regexp": "^([^\\s].*icinga2.*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\):\\s(error|warning|info)\\s(\\w{1,2}\\d+):\\s([^\\s].*?)\\s\\[(.*)\\]$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6,
"fromPath": 7
}
]
},
{
"owner": "msvc-template-problem-matcher",
"pattern": [
{
"regexp": "^(?:[^\\s].*Microsoft.*)\\(\\d+,?\\d+?(?:,\\d+,\\d+)?\\):\\s(error|warning|info)\\s(\\w{1,2}\\d+):\\s([^\\s].*?)\\s\\[(.*)\\]$",
"severity": 1,
"code": 2,
"message": 3,
"fromPath": 4
},
{
"regexp": "^\\s*(?:[^\\s].*Microsoft.*)\\(\\d+,?\\d+?(?:,\\d+,\\d+)?\\):.*$"
},
{
"regexp": "^\\s*\\(compiling source file '.*?'\\)$"
},
{
"regexp": "^\\s*(?:[^\\s].*Microsoft.*)\\(\\d+,?\\d+?(?:,\\d+,\\d+)?\\):.*$"
},
{
"regexp": "^\\s+the template instantiation context \\(the oldest one first\\) is$"
},
{
"regexp": "^\\s*([^\\s].*icinga2.*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\):$",
"file": 1,
"line": 2,
"column": 3
}
]
}
]
}

View File

@ -69,6 +69,9 @@ jobs:
- name: Checkout HEAD
uses: actions/checkout@v5
- name: Turn on Problem Matcher
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
- name: Restore/backup ccache
uses: actions/cache@v4
with:

View File

@ -38,6 +38,10 @@ jobs:
Set-PSDebug -Trace 1
& .\doc\win-dev.ps1
- name: Turn on Problem Matcher
run: |
Write-Host "::add-matcher::.github/problem-matchers/msvc.json"
- name: Binary
run: |
Set-PSDebug -Trace 1