Fix some ASAN compile warnings and remove redundant flags Change-Id: I7b2772d917449ca747820641c56e65545f610b23 Reviewed-on: http://gerrit.cloudera.org:8080/3025 Reviewed-by: Tim Armstrong <[email protected]> Tested-by: Internal Jenkins
Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/5c56ec09 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/5c56ec09 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/5c56ec09 Branch: refs/heads/master Commit: 5c56ec0997cfd8f28a508ec796f547724ba8b986 Parents: 1c19c23 Author: Tim Armstrong <[email protected]> Authored: Tue May 10 23:27:06 2016 -0700 Committer: Tim Armstrong <[email protected]> Committed: Thu May 12 14:18:02 2016 -0700 ---------------------------------------------------------------------- be/CMakeLists.txt | 5 ++++- be/src/statestore/statestore.cc | 2 +- be/src/util/pprof-path-handlers.cc | 3 ++- cmake_modules/asan_toolchain.cmake | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5c56ec09/be/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index 8ebdf63..bb90e20 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -60,7 +60,10 @@ SET(CXX_COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage") # makes extra calls to clang which may have extra includes (-I) that are unused. # -fcolor-diagnostics: ensure clang generates colorized output, which is necessary # when using ccache as clang thinks it is not called from a terminal. +# -Wno-mismatched-tags: ignore harmless class/struct mismatch for forward declarations. +# Disabling to be consistent with gcc, which doesn't have this warning. SET(CXX_CLANG_FLAGS "-Qunused-arguments -fcolor-diagnostics -Wno-unused-local-typedef") +SET(CXX_CLANG_FLAGS "${CXX_CLANG_FLAGS} -Wno-mismatched-tags") # For any gcc builds: # -g: Enable symbols for profiler tools # -Wno-unused-local-typedefs: Do not warn for local typedefs that are unused. @@ -103,7 +106,7 @@ if (ENABLE_CODE_COVERAGE) endif() # Add flags that are common across build types -# - fverboase-asm creates better annotated assembly. This doesn't seem to affect +# - fverbose-asm creates better annotated assembly. This doesn't seem to affect # when building the binary. # LLMV_CFLAGS - Adding llvm compile flags SET(CMAKE_CXX_FLAGS "${CXX_COMMON_FLAGS} ${CMAKE_CXX_FLAGS}") http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5c56ec09/be/src/statestore/statestore.cc ---------------------------------------------------------------------- diff --git a/be/src/statestore/statestore.cc b/be/src/statestore/statestore.cc index d11ba0e..aa095c3 100644 --- a/be/src/statestore/statestore.cc +++ b/be/src/statestore/statestore.cc @@ -618,7 +618,7 @@ void Statestore::DoSubscriberUpdate(bool is_heartbeat, int thread_id, SleepForMs(diff_ms); diff_ms = update_deadline - UnixMillis(); } - diff_ms = abs(diff_ms); + diff_ms = std::abs(diff_ms); VLOG(3) << "Sending " << hb_type << " message to: " << update.second << " (deadline accuracy: " << diff_ms << "ms)"; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5c56ec09/be/src/util/pprof-path-handlers.cc ---------------------------------------------------------------------- diff --git a/be/src/util/pprof-path-handlers.cc b/be/src/util/pprof-path-handlers.cc index bc75ff2..2d6876c 100644 --- a/be/src/util/pprof-path-handlers.cc +++ b/be/src/util/pprof-path-handlers.cc @@ -32,7 +32,7 @@ using namespace rapidjson; DECLARE_string(heap_profile_dir); -const int PPROF_DEFAULT_SAMPLE_SECS = 30; // pprof default sample time in seconds. +static const int PPROF_DEFAULT_SAMPLE_SECS = 30; // pprof default sample time in seconds. // pprof asks for the url /pprof/cmdline to figure out what application it's profiling. // The server should respond by reading the contents of /proc/self/cmdline. @@ -52,6 +52,7 @@ void PprofCmdLineHandler(const Webserver::ArgumentMap& args, stringstream* outpu // seconds later, call GetHeapProfile() followed by HeapProfilerStop(). void PprofHeapHandler(const Webserver::ArgumentMap& args, stringstream* output) { #ifdef ADDRESS_SANITIZER + (void)PPROF_DEFAULT_SAMPLE_SECS; // Avoid unused variable warning. (*output) << "Heap profiling is not available with address sanitizer builds."; #else Webserver::ArgumentMap::const_iterator it = args.find("seconds"); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5c56ec09/cmake_modules/asan_toolchain.cmake ---------------------------------------------------------------------- diff --git a/cmake_modules/asan_toolchain.cmake b/cmake_modules/asan_toolchain.cmake index 07440d1..bdc6297 100644 --- a/cmake_modules/asan_toolchain.cmake +++ b/cmake_modules/asan_toolchain.cmake @@ -27,8 +27,7 @@ set(CMAKE_C_COMPILER ${LLVM_ASAN_ROOT}/bin/clang) set(CMAKE_CXX_COMPILER ${LLVM_ASAN_ROOT}/bin/clang++) # Add the GCC root location to the compiler flags -# TODO: remove no-c++11-extensions when we enable c++11 -set(CXX_COMMON_FLAGS "-Wno-unused-local-typedef -Wno-c++11-extensions --gcc-toolchain=${GCC_ROOT}") +set(CXX_COMMON_FLAGS "--gcc-toolchain=${GCC_ROOT}") # The rpath is needed to be able to run the binaries produced by the toolchain without # specifying an LD_LIBRARY_PATH
