Skip to content

Commit 16ca7ce

Browse files
bfredljustinmk
authored andcommitted
fix(build): disable problematic marktree assert in RelWithDebInfo builds
Workaround (not a fix) for #27196 and for #33067 Asserts are meant to apply to debug builds but not release builds for users. However the intermediate RelWithDebInfo build type is quite often used by end users, so we might want to disable certain problematic asserts there, while still preserving them in Debug mode for CI.
1 parent 85404d1 commit 16ca7ce

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ set(NVIM_API_PRERELEASE false)
151151

152152
# We _want_ assertions in RelWithDebInfo build-type.
153153
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
154-
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
155-
string(REPLACE "/DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
154+
string(REPLACE "-DNDEBUG" "-DRELDEBUG" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
155+
string(REPLACE "/DNDEBUG" "/DRELDEBUG" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
156156
string(REPLACE " " " " CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") # Remove duplicate whitespace
157157
endif()
158158

src/nvim/decoration.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,10 @@ void buf_signcols_count_range(buf_T *buf, int row1, int row2, int add, TriState
10681068
int prevwidth = MIN(SIGN_SHOW_MAX, count[i] - add);
10691069
if (clear != kNone && prevwidth > 0) {
10701070
buf->b_signcols.count[prevwidth - 1]--;
1071+
#ifndef RELDEBUG
1072+
// TODO(bfredl): correct marktree splicing so that this doesn't fail
10711073
assert(buf->b_signcols.count[prevwidth - 1] >= 0);
1074+
#endif
10721075
}
10731076
int width = MIN(SIGN_SHOW_MAX, count[i]);
10741077
if (clear != kTrue && width > 0) {

src/nvim/marktree.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,13 @@ static void unintersect_node(MarkTree *b, MTNode *x, uint64_t id, bool strict)
372372
}
373373
}
374374
if (strict) {
375+
#ifndef RELDEBUG
376+
// TODO(bfredl): This assert has been seen to fail for end users
377+
// using RelWithDebInfo builds. While indicating an invalid state for
378+
// the marktree, this error doesn't need to be fatal. The assert still
379+
// needs to present in Debug builds to be able to detect regressions in tests.
375380
assert(seen);
381+
#endif
376382
}
377383

378384
if (seen) {

0 commit comments

Comments
 (0)