Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/problem-matchers/gcc.json
Original file line number Diff line number Diff line change
@@ -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 changes: 49 additions & 0 deletions .github/problem-matchers/msvc.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
]
}
18 changes: 15 additions & 3 deletions .github/workflows/linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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:*)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions test/base-stacktrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 */
7 changes: 7 additions & 0 deletions third-party/mmatch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion third-party/utf8cpp/extern/ftest
Submodule ftest deleted from c4ad4a
6 changes: 6 additions & 0 deletions tools/mkclass/classcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines 1483 to +1488
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabled warnings for unused parameters/variables on generated files (similar to how it had already been on MSVC, or at least I assume that's what the disabled warnings on MSVC are)

MSVC warnings 4244 and 4800 have nothing to do with unused symbols.

Copy link
Contributor Author

@jschmidt-icinga jschmidt-icinga Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that, I was just reusing the #ifdef block. To me, this was a non-exhaustive list, per platform, of warnings we don't want in our generated files. We may also add more warnings later in case they come up.

PS: I now realize this probably needs a version for __clang__ too. I'll add it to #10609.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you didn't just mix them up while attempting to restore OS symmetry, but you explicitly think the changes highlighted above were a good idea on their own?

<< "#endif /* _MSC_VER */" << std::endl << std::endl;


Expand All @@ -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;
}
Loading