aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/CMakeLists.txt1
-rw-r--r--src/nvim/event/process.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 77c5bf59e4..99171dbb02 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -7,6 +7,7 @@ if(USE_GCOV)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
+ add_compile_definitions(USE_GCOV)
endif()
endif()
diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c
index 7a8a39dbcf..7059a41def 100644
--- a/src/nvim/event/process.c
+++ b/src/nvim/event/process.c
@@ -22,6 +22,11 @@
# include "event/process.c.generated.h"
#endif
+/// Externally defined with gcov.
+#ifdef USE_GCOV
+void __gcov_dump(void);
+#endif
+
// Time for a process to exit cleanly before we send KILL.
// For PTY processes SIGTERM is sent first (in case SIGHUP was not enough).
#define KILL_TIMEOUT_MS 2000
@@ -50,6 +55,11 @@ int process_spawn(Process *proc, bool in, bool out, bool err)
proc->err.closed = true;
}
+#ifdef USE_GCOV
+ // Dump coverage data before forking, to avoid "Merge mismatch" errors.
+ __gcov_dump();
+#endif
+
int status;
switch (proc->type) {
case kProcessTypeUv: