From f1c5887377c9ae547a7564ec4fc52d72656a974f Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 16 Feb 2023 00:15:09 +0100 Subject: [PATCH] ci: add GCC Release testing (#22274) ci: add GCC release testing We currently have no release testing, so it's good to check for any unwanted behavior on release builds as well. Prefer GCC over clang, as GCC release builds seem to create more warnings on release compared to debug. --- .github/workflows/ci.yml | 6 +++++- src/nvim/CMakeLists.txt | 7 +++++++ src/nvim/marktree.c | 8 ++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4814e89a69..c227fa5460 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -196,6 +196,10 @@ jobs: cc: gcc runner: ubuntu-22.04 flags: -D UNSIGNED_CHAR=ON + - flavor: release + cc: gcc + runner: ubuntu-22.04 + flags: -D CMAKE_BUILD_TYPE=Release - cc: clang runner: macos-12 @@ -262,7 +266,7 @@ jobs: id: abort_job run: echo "status=${{ job.status }}" >> $GITHUB_OUTPUT - - if: matrix.flavor != 'tsan' && matrix.flavor != 'functionaltest-lua' && (success() || failure() && steps.abort_job.outputs.status == 'success') + - if: matrix.flavor != 'tsan' && matrix.flavor != 'release' && matrix.flavor != 'functionaltest-lua' && (success() || failure() && steps.abort_job.outputs.status == 'success') name: Unittest timeout-minutes: 5 run: cmake --build build --target unittest diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index a193af6d51..d6a53456d7 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -92,6 +92,13 @@ else() -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes) + + if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + target_compile_options(main_lib INTERFACE + $<$:-Wno-unused-result> + $<$:-Wno-unused-result> + $<$:-Wno-unused-result>) + endif() endif() # On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index 77ba6e6fa4..cb981bb00c 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -1135,7 +1135,7 @@ void marktree_check(MarkTree *b) mtpos_t dummy; bool last_right = false; - size_t nkeys = check_node(b, b->root, &dummy, &last_right); + size_t nkeys = marktree_check_node(b, b->root, &dummy, &last_right); assert(b->n_keys == nkeys); assert(b->n_keys == map_size(b->id2node)); #else @@ -1145,7 +1145,7 @@ void marktree_check(MarkTree *b) } #ifndef NDEBUG -static size_t check_node(MarkTree *b, mtnode_t *x, mtpos_t *last, bool *last_right) +size_t marktree_check_node(MarkTree *b, mtnode_t *x, mtpos_t *last, bool *last_right) { assert(x->n <= 2 * T - 1); // TODO(bfredl): too strict if checking "in repair" post-delete tree. @@ -1154,7 +1154,7 @@ static size_t check_node(MarkTree *b, mtnode_t *x, mtpos_t *last, bool *last_rig for (int i = 0; i < x->n; i++) { if (x->level) { - n_keys += check_node(b, x->ptr[i], last, last_right); + n_keys += marktree_check_node(b, x->ptr[i], last, last_right); } else { *last = (mtpos_t) { 0, 0 }; } @@ -1171,7 +1171,7 @@ static size_t check_node(MarkTree *b, mtnode_t *x, mtpos_t *last, bool *last_rig } if (x->level) { - n_keys += check_node(b, x->ptr[x->n], last, last_right); + n_keys += marktree_check_node(b, x->ptr[x->n], last, last_right); unrelative(x->key[x->n - 1].pos, last); for (int i = 0; i < x->n + 1; i++) {