diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2022-05-15 11:41:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-15 11:41:17 +0200 |
commit | 4c7462fdb313a64d6903809ece2d8d564c0ea420 (patch) | |
tree | 431d68e7d3b3332065e742211f55584bd1533d5c /src | |
parent | b1b58020094a2ffa85e40194b8beb2945396610a (diff) | |
download | rneovim-4c7462fdb313a64d6903809ece2d8d564c0ea420.tar.gz rneovim-4c7462fdb313a64d6903809ece2d8d564c0ea420.tar.bz2 rneovim-4c7462fdb313a64d6903809ece2d8d564c0ea420.zip |
build: enable EXITFREE on Debug builds (#17783)
This makes it more convenient to find memory leaks since you don't need
to remember to set the EXITFREE flag every time you use valgrind or a
sanitizer.
Diffstat (limited to 'src')
-rwxr-xr-x | src/nvim/CMakeLists.txt | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 2a323bdea0..38be5bfb1d 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -193,15 +193,16 @@ if(NOT "${MIN_LOG_LEVEL}" MATCHES "^$") add_definitions(-DMIN_LOG_LEVEL=${MIN_LOG_LEVEL}) endif() +if(DEBUG OR CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) + add_definitions(-DEXITFREE) +endif() + get_directory_property(gen_cdefs COMPILE_DEFINITIONS) foreach(gen_cdef ${gen_cdefs} DO_NOT_DEFINE_EMPTY_ATTRIBUTES) if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS") list(APPEND gen_cflags "-D${gen_cdef}") endif() endforeach() -if(CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) - list(APPEND gen_cflags "-DEXITFREE") -endif() get_directory_property(gen_includes INCLUDE_DIRECTORIES) foreach(gen_include ${gen_includes} ${LUA_PREFERRED_INCLUDE_DIRS}) @@ -689,17 +690,14 @@ if(CLANG_ASAN_UBSAN) set(SANITIZE_RECOVER -fno-sanitize-recover) # Clang 3.5- endif() endif() - set_property(TARGET nvim APPEND PROPERTY COMPILE_DEFINITIONS EXITFREE) set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS ${SANITIZE_RECOVER} -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -fsanitize=undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/src/.asan-blacklist) set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=address -fsanitize=undefined ") elseif(CLANG_MSAN) message(STATUS "Enabling Clang memory sanitizer for nvim.") - set_property(TARGET nvim APPEND PROPERTY COMPILE_DEFINITIONS EXITFREE) set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -fno-optimize-sibling-calls) set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=memory -fsanitize-memory-track-origins ") elseif(CLANG_TSAN) message(STATUS "Enabling Clang thread sanitizer for nvim.") - set_property(TARGET nvim APPEND PROPERTY COMPILE_DEFINITIONS EXITFREE) set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS -fsanitize=thread) set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS -fPIE) set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=thread ") |