Merge pull request #10551 from Icinga/add-github-problem-matchers

Add Github Problem Matchers actions for GCC/MSVC
This commit is contained in:
Julian Brost 2025-10-16 11:32:28 +02:00 committed by GitHub
commit 3de8975223
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 107 additions and 8 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

@ -5,6 +5,11 @@ export PATH="/usr/lib/ccache/bin:/usr/lib/ccache:/usr/lib64/ccache:$PATH"
export CCACHE_DIR=/icinga2/ccache
export CTEST_OUTPUT_ON_FAILURE=1
CMAKE_OPTS=()
# -Wstringop-overflow is notorious for false positives and has been a problem for years.
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
# -Wtemplate-id-cdtor leaks from using the generated headers. We should reenable this once
# we're considering moving to C++20 and/or the -ti.hpp files are generated differently.
WARN_FLAGS="-Wall -Wextra -Wno-template-id-cdtor -Wno-stringop-overflow"
case "$DISTRO" in
alpine:*)
@ -28,7 +33,7 @@ case "$DISTRO" in
(
cd boost_1_69_0
./bootstrap.sh --with-libraries=context,coroutine,date_time,filesystem,iostreams,program_options,regex,system,test,thread
./b2
./b2 define=BOOST_COROUTINES_NO_DEPRECATION_WARNING
)
ln -vs /usr/bin/cmake3 /usr/local/bin/cmake
@ -79,14 +84,21 @@ esac
case "$DISTRO" in
alpine:*)
CMAKE_OPTS+=(-DUSE_SYSTEMD=OFF -DICINGA2_WITH_MYSQL=OFF -DICINGA2_WITH_PGSQL=OFF)
CMAKE_OPTS+=(
-DUSE_SYSTEMD=OFF
-DICINGA2_WITH_MYSQL=OFF
-DICINGA2_WITH_PGSQL=OFF
-DCMAKE_{C,CXX}_FLAGS="${WARN_FLAGS}"
)
;;
debian:*|ubuntu:*)
CMAKE_OPTS+=(-DICINGA2_LTO_BUILD=ON)
source <(dpkg-buildflags --export=sh)
export CFLAGS="${CFLAGS} ${WARN_FLAGS}"
export CXXFLAGS="${CXXFLAGS} ${WARN_FLAGS}"
;;
*)
CMAKE_OPTS+=(-DCMAKE_{C,CXX}_FLAGS="$(rpm -E '%{optflags} %{?march_flag}')")
CMAKE_OPTS+=(-DCMAKE_{C,CXX}_FLAGS="$(rpm -E '%{optflags} %{?march_flag}') ${WARN_FLAGS}")
export LDFLAGS="$(rpm -E '%{?build_ldflags}')"
;;
esac

View file

@ -65,6 +65,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

View file

@ -20,12 +20,13 @@ using namespace icinga;
* should be printed. If it looks somewhat meaningful, you can probably ignore a failure of this test case.
*/
#ifndef _MSC_VER
#pragma GCC push_options
#pragma GCC optimize ("O0")
#pragma clang optimize off
#ifdef _MSVC_VER
#else /* _MSC_VER */
#pragma optimize("", off)
#endif /* _MSVC_VER */
#endif /* _MSC_VER */
BOOST_AUTO_TEST_SUITE(base_stacktrace)
@ -65,8 +66,9 @@ BOOST_AUTO_TEST_CASE(stacktrace)
BOOST_AUTO_TEST_SUITE_END()
#ifndef _MSC_VER
#pragma GCC pop_options
#pragma clang optimize on
#ifdef _MSVC_VER
#else /* _MSC_VER */
#pragma optimize("", on)
#endif /* _MSVC_VER */
#endif /* _MSC_VER */

View file

@ -6,6 +6,13 @@ set(mmatch_SOURCES
add_library(mmatch OBJECT ${mmatch_SOURCES})
if(NOT MSVC)
target_compile_options(mmatch
PRIVATE
-Wno-implicit-fallthrough
)
endif()
set_target_properties(
mmatch PROPERTIES
FOLDER Lib

@ -1 +0,0 @@
Subproject commit c4ad4af0946b73ce1a40cbc72205d15d196c7e06

View file

@ -1482,6 +1482,10 @@ void ClassCompiler::CompileStream(const std::string& path, std::istream& input,
<< "#pragma warning( push )" << std::endl
<< "#pragma warning( disable : 4244 )" << std::endl
<< "#pragma warning( disable : 4800 )" << std::endl
<< "#else /* _MSC_VER */" << std::endl
<< "#pragma GCC diagnostic push" << std::endl
<< "#pragma GCC diagnostic ignored \"-Wunused-parameter\"" << std::endl
<< "#pragma GCC diagnostic ignored \"-Wunused-variable\"" << std::endl
<< "#endif /* _MSC_VER */" << std::endl << std::endl;
@ -1492,5 +1496,7 @@ void ClassCompiler::CompileStream(const std::string& path, std::istream& input,
oimpl << "#ifdef _MSC_VER" << std::endl
<< "#pragma warning ( pop )" << std::endl
<< "#else /* _MSC_VER */" << std::endl
<< "#pragma GCC diagnostic pop" << std::endl
<< "#endif /* _MSC_VER */" << std::endl;
}