From 694633e19b38e469171c3cc238ad5c208c98587c Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Wed, 12 Sep 2012 07:38:47 +0000 Subject: [PATCH] [Sanitizer] first effort to start building ASan runtime with -Werror in CMake build llvm-svn: 163686 --- compiler-rt/CMakeLists.txt | 1 + compiler-rt/lib/asan/asan_interceptors.cc | 2 +- compiler-rt/lib/asan/tests/CMakeLists.txt | 1 + compiler-rt/lib/asan/tests/asan_noinst_test.cc | 7 ++++--- compiler-rt/lib/sanitizer_common/CMakeLists.txt | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index d336eedda6cb..a10a83bfe5e6 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -62,6 +62,7 @@ endfunction() # Provide some common commmandline flags for Sanitizer runtimes. set(SANITIZER_COMMON_CFLAGS + -Werror -fPIC -fno-builtin -fno-exceptions diff --git a/compiler-rt/lib/asan/asan_interceptors.cc b/compiler-rt/lib/asan/asan_interceptors.cc index 900bf5ac8b89..cbc35abf734f 100644 --- a/compiler-rt/lib/asan/asan_interceptors.cc +++ b/compiler-rt/lib/asan/asan_interceptors.cc @@ -625,7 +625,7 @@ void InitializeAsanInterceptors() { #if !MAC_INTERPOSE_FUNCTIONS // If we're using dynamic interceptors on Mac, these two are just plain // functions. - *(uptr*)&REAL(memcpy) = (uptr)REAL(memmove); + internal_memcpy(&REAL(memcpy), &REAL(memmove), sizeof(REAL(memmove))); #endif } diff --git a/compiler-rt/lib/asan/tests/CMakeLists.txt b/compiler-rt/lib/asan/tests/CMakeLists.txt index b8ff061128e5..d92e6474176a 100644 --- a/compiler-rt/lib/asan/tests/CMakeLists.txt +++ b/compiler-rt/lib/asan/tests/CMakeLists.txt @@ -17,6 +17,7 @@ include_directories(../..) set(ASAN_UNITTEST_COMMON_CFLAGS -Wall -Wno-format + -Werror -fvisibility=hidden -g -O2 diff --git a/compiler-rt/lib/asan/tests/asan_noinst_test.cc b/compiler-rt/lib/asan/tests/asan_noinst_test.cc index 70b59f029f72..76ec387549bd 100644 --- a/compiler-rt/lib/asan/tests/asan_noinst_test.cc +++ b/compiler-rt/lib/asan/tests/asan_noinst_test.cc @@ -678,9 +678,10 @@ TEST(AddressSanitizerInterface, DISABLED_InvalidPoisonAndUnpoisonCallsTest) { } static void ErrorReportCallbackOneToZ(const char *report) { - write(2, "ABCDEF", 6); - write(2, report, strlen(report)); - write(2, "ABCDEF", 6); + int report_len = strlen(report); + ASSERT_EQ(6, write(2, "ABCDEF", 6)); + ASSERT_EQ(report_len, write(2, report, report_len)); + ASSERT_EQ(6, write(2, "ABCDEF", 6)); _exit(1); } diff --git a/compiler-rt/lib/sanitizer_common/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/CMakeLists.txt index 4c24fceb3ede..f3461630b082 100644 --- a/compiler-rt/lib/sanitizer_common/CMakeLists.txt +++ b/compiler-rt/lib/sanitizer_common/CMakeLists.txt @@ -58,7 +58,7 @@ if(LLVM_INCLUDE_TESTS) add_library(RTSanitizerCommon.test STATIC ${SANITIZER_SOURCES}) # Build test library with debug info. set_target_compile_flags(RTSanitizerCommon.test - ${SANITIZER_CFLAGS} -g -Werror) + ${SANITIZER_CFLAGS} -g) set_target_properties(RTSanitizerCommon.test PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})