Skip to content

Commit 3de8975

Browse files
authored
Merge pull request #10551 from Icinga/add-github-problem-matchers
Add Github Problem Matchers actions for GCC/MSVC
2 parents c7ae088 + 47a9dab commit 3de8975

File tree

9 files changed

+107
-8
lines changed

9 files changed

+107
-8
lines changed

.github/problem-matchers/gcc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "gcc-problem-matcher",
5+
"pattern": [
6+
{
7+
"regexp": "^(?:(?:\\.\\.?)?\\/)?(?:icinga2\\/)?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"severity": 4,
12+
"message": 5
13+
}
14+
]
15+
}
16+
]
17+
}

.github/problem-matchers/msvc.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "msvc-problem-matcher",
5+
"pattern": [
6+
{
7+
"regexp": "^([^\\s].*icinga2.*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\):\\s(error|warning|info)\\s(\\w{1,2}\\d+):\\s([^\\s].*?)\\s\\[(.*)\\]$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"severity": 4,
12+
"code": 5,
13+
"message": 6,
14+
"fromPath": 7
15+
}
16+
]
17+
},
18+
{
19+
"owner": "msvc-template-problem-matcher",
20+
"pattern": [
21+
{
22+
"regexp": "^(?:[^\\s].*Microsoft.*)\\(\\d+,?\\d+?(?:,\\d+,\\d+)?\\):\\s(error|warning|info)\\s(\\w{1,2}\\d+):\\s([^\\s].*?)\\s\\[(.*)\\]$",
23+
"severity": 1,
24+
"code": 2,
25+
"message": 3,
26+
"fromPath": 4
27+
},
28+
{
29+
"regexp": "^\\s*(?:[^\\s].*Microsoft.*)\\(\\d+,?\\d+?(?:,\\d+,\\d+)?\\):.*$"
30+
},
31+
{
32+
"regexp": "^\\s*\\(compiling source file '.*?'\\)$"
33+
},
34+
{
35+
"regexp": "^\\s*(?:[^\\s].*Microsoft.*)\\(\\d+,?\\d+?(?:,\\d+,\\d+)?\\):.*$"
36+
},
37+
{
38+
"regexp": "^\\s+the template instantiation context \\(the oldest one first\\) is$"
39+
},
40+
{
41+
"regexp": "^\\s*([^\\s].*icinga2.*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\):$",
42+
"file": 1,
43+
"line": 2,
44+
"column": 3
45+
}
46+
]
47+
}
48+
]
49+
}

.github/workflows/linux.bash

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/lib64/ccache:$PATH"
55
export CCACHE_DIR=/icinga2/ccache
66
export CTEST_OUTPUT_ON_FAILURE=1
77
CMAKE_OPTS=()
8+
# -Wstringop-overflow is notorious for false positives and has been a problem for years.
9+
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
10+
# -Wtemplate-id-cdtor leaks from using the generated headers. We should reenable this once
11+
# we're considering moving to C++20 and/or the -ti.hpp files are generated differently.
12+
WARN_FLAGS="-Wall -Wextra -Wno-template-id-cdtor -Wno-stringop-overflow"
813

914
case "$DISTRO" in
1015
alpine:*)
@@ -28,7 +33,7 @@ case "$DISTRO" in
2833
(
2934
cd boost_1_69_0
3035
./bootstrap.sh --with-libraries=context,coroutine,date_time,filesystem,iostreams,program_options,regex,system,test,thread
31-
./b2
36+
./b2 define=BOOST_COROUTINES_NO_DEPRECATION_WARNING
3237
)
3338

3439
ln -vs /usr/bin/cmake3 /usr/local/bin/cmake
@@ -79,14 +84,21 @@ esac
7984

8085
case "$DISTRO" in
8186
alpine:*)
82-
CMAKE_OPTS+=(-DUSE_SYSTEMD=OFF -DICINGA2_WITH_MYSQL=OFF -DICINGA2_WITH_PGSQL=OFF)
87+
CMAKE_OPTS+=(
88+
-DUSE_SYSTEMD=OFF
89+
-DICINGA2_WITH_MYSQL=OFF
90+
-DICINGA2_WITH_PGSQL=OFF
91+
-DCMAKE_{C,CXX}_FLAGS="${WARN_FLAGS}"
92+
)
8393
;;
8494
debian:*|ubuntu:*)
8595
CMAKE_OPTS+=(-DICINGA2_LTO_BUILD=ON)
8696
source <(dpkg-buildflags --export=sh)
97+
export CFLAGS="${CFLAGS} ${WARN_FLAGS}"
98+
export CXXFLAGS="${CXXFLAGS} ${WARN_FLAGS}"
8799
;;
88100
*)
89-
CMAKE_OPTS+=(-DCMAKE_{C,CXX}_FLAGS="$(rpm -E '%{optflags} %{?march_flag}')")
101+
CMAKE_OPTS+=(-DCMAKE_{C,CXX}_FLAGS="$(rpm -E '%{optflags} %{?march_flag}') ${WARN_FLAGS}")
90102
export LDFLAGS="$(rpm -E '%{?build_ldflags}')"
91103
;;
92104
esac

.github/workflows/linux.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ jobs:
6565
- name: Checkout HEAD
6666
uses: actions/checkout@v5
6767

68+
- name: Turn on Problem Matcher
69+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
70+
6871
- name: Restore/backup ccache
6972
uses: actions/cache@v4
7073
with:

.github/workflows/windows.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ jobs:
3838
Set-PSDebug -Trace 1
3939
& .\doc\win-dev.ps1
4040
41+
- name: Turn on Problem Matcher
42+
run: |
43+
Write-Host "::add-matcher::.github/problem-matchers/msvc.json"
44+
4145
- name: Binary
4246
run: |
4347
Set-PSDebug -Trace 1

test/base-stacktrace.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ using namespace icinga;
2020
* should be printed. If it looks somewhat meaningful, you can probably ignore a failure of this test case.
2121
*/
2222

23+
#ifndef _MSC_VER
2324
#pragma GCC push_options
2425
#pragma GCC optimize ("O0")
2526
#pragma clang optimize off
26-
#ifdef _MSVC_VER
27+
#else /* _MSC_VER */
2728
#pragma optimize("", off)
28-
#endif /* _MSVC_VER */
29+
#endif /* _MSC_VER */
2930

3031
BOOST_AUTO_TEST_SUITE(base_stacktrace)
3132

@@ -65,8 +66,9 @@ BOOST_AUTO_TEST_CASE(stacktrace)
6566

6667
BOOST_AUTO_TEST_SUITE_END()
6768

69+
#ifndef _MSC_VER
6870
#pragma GCC pop_options
6971
#pragma clang optimize on
70-
#ifdef _MSVC_VER
72+
#else /* _MSC_VER */
7173
#pragma optimize("", on)
72-
#endif /* _MSVC_VER */
74+
#endif /* _MSC_VER */

third-party/mmatch/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ set(mmatch_SOURCES
66

77
add_library(mmatch OBJECT ${mmatch_SOURCES})
88

9+
if(NOT MSVC)
10+
target_compile_options(mmatch
11+
PRIVATE
12+
-Wno-implicit-fallthrough
13+
)
14+
endif()
15+
916
set_target_properties(
1017
mmatch PROPERTIES
1118
FOLDER Lib

third-party/utf8cpp/extern/ftest

Lines changed: 0 additions & 1 deletion
This file was deleted.

tools/mkclass/classcompiler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,10 @@ void ClassCompiler::CompileStream(const std::string& path, std::istream& input,
14821482
<< "#pragma warning( push )" << std::endl
14831483
<< "#pragma warning( disable : 4244 )" << std::endl
14841484
<< "#pragma warning( disable : 4800 )" << std::endl
1485+
<< "#else /* _MSC_VER */" << std::endl
1486+
<< "#pragma GCC diagnostic push" << std::endl
1487+
<< "#pragma GCC diagnostic ignored \"-Wunused-parameter\"" << std::endl
1488+
<< "#pragma GCC diagnostic ignored \"-Wunused-variable\"" << std::endl
14851489
<< "#endif /* _MSC_VER */" << std::endl << std::endl;
14861490

14871491

@@ -1492,5 +1496,7 @@ void ClassCompiler::CompileStream(const std::string& path, std::istream& input,
14921496

14931497
oimpl << "#ifdef _MSC_VER" << std::endl
14941498
<< "#pragma warning ( pop )" << std::endl
1499+
<< "#else /* _MSC_VER */" << std::endl
1500+
<< "#pragma GCC diagnostic pop" << std::endl
14951501
<< "#endif /* _MSC_VER */" << std::endl;
14961502
}

0 commit comments

Comments
 (0)