IMPALA-3182: Reenable -Werror for kudu files Now the macros DISALLOW_COPY_AND_ASSIGN and COMPILE_ASSERT are potentially defined by either the Kudu client or gutil. Either definition should be fine. This change adds an "ifndef" around gutil's definitions to avoid warning about redefining the macros. Kudu already has conditional ifdefs.
Change-Id: I87c84b667c56dacc369bf9a2ff6550bb59b4fea9 Reviewed-on: http://gerrit.cloudera.org:8080/2660 Reviewed-by: Tim Armstrong <[email protected]> Reviewed-by: Dan Hecht <[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/2d0b9445 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/2d0b9445 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/2d0b9445 Branch: refs/heads/master Commit: 2d0b944500f6a44fcf95ea5b519393bec0dc749c Parents: b74e57a Author: casey <[email protected]> Authored: Tue Mar 29 14:49:31 2016 -0700 Committer: Internal Jenkins <[email protected]> Committed: Wed Mar 30 06:18:23 2016 +0000 ---------------------------------------------------------------------- be/src/exec/CMakeLists.txt | 19 ------------------- be/src/gutil/macros.h | 4 ++++ 2 files changed, 4 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/2d0b9445/be/src/exec/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/be/src/exec/CMakeLists.txt b/be/src/exec/CMakeLists.txt index 002d38f..af86306 100644 --- a/be/src/exec/CMakeLists.txt +++ b/be/src/exec/CMakeLists.txt @@ -84,21 +84,6 @@ add_library(Exec unnest-node.cc ) -# Some of the macros defined in gutil (COMPILE_ASSERT, DISALLOW_COPY_AND_ASSIGN) -# are redefined in Kudu's kudu/client/stubs.h and because "-Werror" is set, compilation -# fails on macro redefinition warnings. The ideal workaround would be to just disable -# that particular warning (which is possible in recent LLVM releases with -# "-Wno-macro-redefined") but gcc doesn't have a flag to do it, so we simply disable -# "-Werror" for these particular files. -set_source_files_properties(kudu-scanner.cc PROPERTIES COMPILE_FLAGS - "${CXX_COMMON_FLAGS} -Wno-error") -set_source_files_properties(kudu-scan-node.cc PROPERTIES COMPILE_FLAGS - "${CXX_COMMON_FLAGS} -Wno-error") -set_source_files_properties(kudu-table-sink.cc PROPERTIES COMPILE_FLAGS - "${CXX_COMMON_FLAGS} -Wno-error") -set_source_files_properties(kudu-util.cc PROPERTIES COMPILE_FLAGS - "${CXX_COMMON_FLAGS} -Wno-error") - add_dependencies(Exec thrift-deps) ADD_BE_TEST(zigzag-test) @@ -112,7 +97,3 @@ ADD_BE_TEST(row-batch-list-test) ADD_BE_TEST(incr-stats-util-test) ADD_BE_TEST(kudu-scan-node-test) ADD_BE_TEST(kudu-table-sink-test) -SET_TARGET_PROPERTIES(kudu-scan-node-test PROPERTIES COMPILE_FLAGS - "${CXX_COMMON_FLAGS} -Wno-error") -SET_TARGET_PROPERTIES(kudu-table-sink-test PROPERTIES COMPILE_FLAGS - "${CXX_COMMON_FLAGS} -Wno-error") http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/2d0b9445/be/src/gutil/macros.h ---------------------------------------------------------------------- diff --git a/be/src/gutil/macros.h b/be/src/gutil/macros.h index 9de3c2c..ca0daea 100644 --- a/be/src/gutil/macros.h +++ b/be/src/gutil/macros.h @@ -39,8 +39,10 @@ template <bool> struct CompileAssert { }; +#ifndef COMPILE_ASSERT #define COMPILE_ASSERT(expr, msg) \ typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] +#endif // Implementation details of COMPILE_ASSERT: // @@ -98,6 +100,7 @@ struct CompileAssert { // http://gcc.gnu.org/PR51213 in gcc-4.7 / Crosstool v16. // TODO(user): Remove "&& !defined(__clang_)" when =delete is // gcc-4.7 before =delete is allowed, go back to the C++98 definition. +#ifndef DISALLOW_COPY_AND_ASSIGN #if LANG_CXX11 && !defined(__clang__) #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&) = delete; \ @@ -107,6 +110,7 @@ struct CompileAssert { TypeName(const TypeName&); \ void operator=(const TypeName&) #endif +#endif // An older, politically incorrect name for the above. // Prefer DISALLOW_COPY_AND_ASSIGN for new code.
