[build] add -D{LEAK,UNDEFINED}_SANITIZER To enable __lsan_default_suppressions() defined in src/kudu/util/sanitizer_options.cc, it's necessary to have LEAK_SANITIZER macro enabled during the compilation. Also, defined UNDEFINED_SANITIZER macro to compile-in __ubsan_default_options() as well.
This patch fixes negotiation-test failures in ASAN builds. This is a follow-up for a8d088e11b8b901a91e4820dcfdca9537a1e801a. Change-Id: Ie8caeaa080b93f67768d3d2251c7a366390a48f9 Reviewed-on: http://gerrit.cloudera.org:8080/11340 Reviewed-by: Grant Henke <granthe...@apache.org> Tested-by: Alexey Serbin <aser...@cloudera.com> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/3bb5f56c Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/3bb5f56c Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/3bb5f56c Branch: refs/heads/master Commit: 3bb5f56cf0929fc80ad98672d15baf0263f84a18 Parents: 54afea0 Author: Alexey Serbin <aser...@cloudera.com> Authored: Mon Aug 27 18:20:09 2018 -0700 Committer: Alexey Serbin <aser...@cloudera.com> Committed: Tue Aug 28 03:08:59 2018 +0000 ---------------------------------------------------------------------- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/3bb5f56c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index bfdacd5..11b47b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -311,8 +311,8 @@ if ("${KUDU_USE_ASAN}" AND "${KUDU_USE_TSAN}") message(SEND_ERROR "Can only enable one of ASAN or TSAN at a time") endif() -# Flag to enable clang address sanitizer -# This will only build if clang or a recent enough gcc is the chosen compiler +# Flag to enable clang address sanitizer (using it along with leak sanitizer). +# This will only build if clang or a recent enough gcc is the chosen compiler. if (${KUDU_USE_ASAN}) if(NOT (("${COMPILER_FAMILY}" STREQUAL "clang") OR ("${COMPILER_FAMILY}" STREQUAL "gcc" AND "${COMPILER_VERSION}" VERSION_GREATER "4.8"))) @@ -332,6 +332,7 @@ if (${KUDU_USE_ASAN}) endif() endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -DADDRESS_SANITIZER") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLEAK_SANITIZER") endif() if (${KUDU_USE_XRAY}) @@ -355,6 +356,7 @@ if (${KUDU_USE_UBSAN}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize-blacklist=${CMAKE_CURRENT_SOURCE_DIR}/build-support/ubsan-blacklist.txt") # Stop execution after UB or overflow is detected. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNDEFINED_SANITIZER") endif () # Flag to enable thread sanitizer (clang or gcc 4.8)