This is an automated email from the ASF dual-hosted git repository. zhaoc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new 57cbfb7 Add -Werror when gcc<=7.3.0 & udf fix (#3533) 57cbfb7 is described below commit 57cbfb772d2f6df1a5f0b632ba23f574c9db2b26 Author: HuangWei <huangw...@xiaomi.com> AuthorDate: Mon May 11 10:31:38 2020 +0800 Add -Werror when gcc<=7.3.0 & udf fix (#3533) --- be/CMakeLists.txt | 27 ++++++++++++++++----------- be/src/udf/udf.cpp | 7 +++++-- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index fa0b966..aa67c27 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -70,6 +70,13 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.2") message(FATAL_ERROR "Need GCC version at least 4.8.2") endif() + + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.3.0") + message(STATUS "GCC version is greater than 7.3.0, disable -Werror. Be careful with compile warnings.") + else() + # -Werror: compile warnings should be errors when using the toolchain compiler. + set(CXX_GCC_FLAGS "${CXX_GCC_FLAGS} -Werror") + endif() elseif (NOT APPLE) message(FATAL_ERROR "Compiler should be GNU") endif() @@ -281,14 +288,12 @@ endif() # For any gcc builds: # -g: Enable symbols for profiler tools # -Wno-unused-local-typedefs: Do not warn for local typedefs that are unused. -set(CXX_GCC_FLAGS "-g -Wno-unused-local-typedefs") +set(CXX_GCC_FLAGS "${CXX_GCC_FLAGS} -g -Wno-unused-local-typedefs") # For CMAKE_BUILD_TYPE=Debug # -ggdb: Enable gdb debugging # Debug information is stored as dwarf2 to be as compatible as possible -# -Werror: compile warnings should be errors when using the toolchain compiler. -# Only enable for debug builds because this is what we test in pre-commit tests. -set(CXX_FLAGS_DEBUG "${CXX_GCC_FLAGS} -Werror -ggdb -O0 -gdwarf-2") +set(CXX_FLAGS_DEBUG "${CXX_GCC_FLAGS} -ggdb -O0 -gdwarf-2") # For CMAKE_BUILD_TYPE=Release # -O3: Enable all compiler optimizations @@ -303,7 +308,7 @@ SET(CXX_FLAGS_LSAN "${CXX_GCC_FLAGS} -O1 -fsanitize=leak -DLEAK_SANITIZER") # Turn on sanitizer and debug symbols to get stack traces: SET(CXX_FLAGS_UBSAN "${CXX_GCC_FLAGS} -ggdb3 -fsanitize=undefined") # Ignore a number of noisy errors with too many false positives: -# TODO(zc): +# TODO(zc): # SET(CXX_FLAGS_UBSAN "${CXX_FLAGS_UBSAN} -fno-sanitize=alignment,function,vptr,float-divide-by-zero,float-cast-overflow") # Don't enforce wrapped signed integer arithmetic so that the sanitizer actually sees # undefined wrapping: @@ -341,7 +346,7 @@ message(STATUS "Compiler Flags: ${CMAKE_CXX_FLAGS}") add_definitions(-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H) # Set include dirs -include_directories( +include_directories( ${SRC_DIR}/ ${TEST_DIR}/ ${GENSRC_DIR}/ @@ -375,7 +380,7 @@ set(DORIS_LINK_LIBS Webserver TestUtil Geo - Plugin + Plugin ${WL_END_GROUP} ) @@ -466,7 +471,7 @@ set(DORIS_LINK_LIBS ${DORIS_LINK_LIBS} ) # Set libraries for test -set (TEST_LINK_LIBS ${DORIS_LINK_LIBS} +set (TEST_LINK_LIBS ${DORIS_LINK_LIBS} ${WL_START_GROUP} gmock gtest @@ -521,13 +526,13 @@ ENDFUNCTION() FUNCTION(ADD_BE_PLUGIN PLUGIN_NAME) set(BUILD_OUTPUT_ROOT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/") - + get_filename_component(DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) get_filename_component(PLUGIN_DIR_NAME ${PLUGIN_NAME} PATH) get_filename_component(PLUGIN_FILE_NAME ${PLUGIN_NAME} NAME) - + ADD_LIBRARY(${PLUGIN_FILE_NAME} SHARED ${PLUGIN_NAME}.cpp) - + TARGET_LINK_LIBRARIES(${PLUGIN_FILE_NAME} ${DORIS_LINK_LIBS}) SET_TARGET_PROPERTIES(${PLUGIN_FILE_NAME} PROPERTIES COMPILE_FLAGS "-fno-access-control") diff --git a/be/src/udf/udf.cpp b/be/src/udf/udf.cpp index 6b010be..3270d72 100755 --- a/be/src/udf/udf.cpp +++ b/be/src/udf/udf.cpp @@ -68,9 +68,12 @@ public: return false; } - const std::string user() const { - return ""; + const std::string& user() const { + return _user; } + +private: + std::string _user = ""; }; } #else --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org