From 77bd2624ea2dea9560d1e9963388e623b9f77bf3 Mon Sep 17 00:00:00 2001 From: proller Date: Sun, 4 Aug 2019 03:19:03 +0300 Subject: [PATCH] Build fixes (#6016) * Fix building without submodules * Fix more gcc9 warnings * was wrong! ../dbms/src/IO/WriteBufferAIO.cpp:277:54: error: result of comparison 'ssize_t' (aka 'long') > 9223372036854775807 is always false [-Werror,-Wtautological-type-limit-compare] if ((static_cast(flush_buffer.offset()) > std::numeric_limits::max()) || ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * mimalloc off MI_OVERRIDE * Fix freebsd build * Fix shared build * Fix build in gcc9 * Fix split build * fix * fix * fix * fix * clean * zstd * Update CMakeLists.txt * Update Defines.h * Try fix -Wsign-compare * Freebsd fix * Add missing libs * Fix double-conversion include for copy-headers * Fix zlib link * Fix includes for arcadia * Fix includes for arcadia * Fix includes for arcadia * Freebsd fix * Arcadia fixes * Update QueryProfiler.cpp * Freebsd fix * clean * 19.11: Fixes for arcadia porting (#6223) * fix glibc-compatibility * M_LIBRARY fix * wip * Fix * Fix arm build * unwind fix * Update CMakeLists.txt --- CMakeLists.txt | 15 +++++++++++---- cmake/Modules/FindODBC.cmake | 2 +- cmake/print_include_directories.cmake | 7 ++++++- contrib/arrow-cmake/CMakeLists.txt | 1 + contrib/brotli-cmake/CMakeLists.txt | 4 ++++ contrib/double-conversion-cmake/CMakeLists.txt | 3 +-- contrib/h3-cmake/CMakeLists.txt | 3 +++ contrib/librdkafka-cmake/CMakeLists.txt | 4 ++-- contrib/libunwind-cmake/CMakeLists.txt | 3 ++- contrib/libxml2-cmake/CMakeLists.txt | 5 ++++- contrib/mariadb-connector-c-cmake/CMakeLists.txt | 5 +++++ contrib/unixodbc-cmake/CMakeLists.txt | 1 + dbms/CMakeLists.txt | 12 ++++-------- dbms/src/Common/Arena.h | 4 +++- dbms/src/Common/ArenaWithFreeLists.h | 5 ++++- dbms/src/Common/MiAllocator.cpp | 4 +--- dbms/src/Common/MiAllocator.h | 7 +++---- dbms/src/Common/QueryProfiler.cpp | 7 ++++++- dbms/src/Common/StackTrace.cpp | 5 +++-- dbms/src/Common/TraceCollector.cpp | 2 ++ dbms/src/Common/config.h.in | 2 +- dbms/src/Compression/CompressedReadBufferBase.cpp | 3 --- dbms/src/Compression/CompressedWriteBuffer.cpp | 3 --- dbms/src/Compression/ICompressionCodec.cpp | 1 - dbms/src/Core/Defines.h | 5 +++++ dbms/src/Formats/CapnProtoRowInputStream.cpp | 4 +--- dbms/src/Formats/ParquetBlockInputStream.cpp | 5 ++--- dbms/src/Formats/ParquetBlockOutputStream.cpp | 5 ++--- dbms/src/Formats/ProtobufColumnMatcher.cpp | 5 +---- dbms/src/Formats/ProtobufReader.h | 2 +- dbms/src/Formats/ProtobufRowInputStream.cpp | 4 +--- dbms/src/Formats/ProtobufWriter.h | 2 +- dbms/src/Functions/CMakeLists.txt | 1 + dbms/src/IO/ReadBufferAIO.cpp | 2 +- dbms/src/IO/ReadBufferFromHDFS.cpp | 4 +--- dbms/src/IO/ReadBufferFromHDFS.h | 2 ++ dbms/src/IO/WriteBufferAIO.cpp | 2 +- 37 files changed, 88 insertions(+), 63 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e664575b583..5f699a1cb74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -262,10 +262,10 @@ if (USE_STATIC_LIBRARIES AND HAVE_NO_PIE) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAG_NO_PIE}") endif () -if (NOT SANITIZE) +if (NOT SANITIZE AND NOT SPLIT_SHARED_LIBRARIES) set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined") set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") -endif() +endif () include (cmake/find_unwind.cmake) @@ -311,8 +311,11 @@ if (OS_LINUX AND NOT UNBUNDLED AND (GLIBC_COMPATIBILITY OR USE_INTERNAL_UNWIND_L # There are two variants of C++ library: libc++ (from LLVM compiler infrastructure) and libstdc++ (from GCC). if (USE_INTERNAL_UNWIND_LIBRARY_FOR_EXCEPTION_HANDLING) - # TODO: Allow to use non-static library as well. - set (EXCEPTION_HANDLING_LIBRARY "${ClickHouse_BINARY_DIR}/contrib/libunwind-cmake/libunwind_static${${CMAKE_POSTFIX_VARIABLE}}.a") + if (USE_STATIC_LIBRARIES) + set (EXCEPTION_HANDLING_LIBRARY "${ClickHouse_BINARY_DIR}/contrib/libunwind-cmake/libunwind_static${${CMAKE_POSTFIX_VARIABLE}}.a") + else () + set (EXCEPTION_HANDLING_LIBRARY "${ClickHouse_BINARY_DIR}/contrib/libunwind-cmake/libunwind_shared${${CMAKE_POSTFIX_VARIABLE}}.so") + endif () else () set (EXCEPTION_HANDLING_LIBRARY "-lgcc_eh") endif () @@ -352,6 +355,10 @@ if (OS_LINUX AND NOT UNBUNDLED AND (GLIBC_COMPATIBILITY OR USE_INTERNAL_UNWIND_L message(STATUS "Default libraries: ${DEFAULT_LIBS}") endif () +if (NOT GLIBC_COMPATIBILITY) + set (M_LIBRARY m) +endif () + if (DEFAULT_LIBS) # Add default libs to all targets as the last dependency. set(CMAKE_CXX_STANDARD_LIBRARIES ${DEFAULT_LIBS}) diff --git a/cmake/Modules/FindODBC.cmake b/cmake/Modules/FindODBC.cmake index 55318b52061..9e209c15777 100644 --- a/cmake/Modules/FindODBC.cmake +++ b/cmake/Modules/FindODBC.cmake @@ -129,7 +129,7 @@ find_package_handle_standard_args(ODBC ) if(ODBC_FOUND) - set(ODBC_LIBRARIES ${ODBC_LIBRARY} ${_odbc_required_libs_paths}) + set(ODBC_LIBRARIES ${ODBC_LIBRARY} ${_odbc_required_libs_paths} ${LTDL_LIBRARY}) set(ODBC_INCLUDE_DIRS ${ODBC_INCLUDE_DIR}) set(ODBC_DEFINITIONS ${PC_ODBC_CFLAGS_OTHER}) endif() diff --git a/cmake/print_include_directories.cmake b/cmake/print_include_directories.cmake index 05be8f909ee..fe5e9e8e6e9 100644 --- a/cmake/print_include_directories.cmake +++ b/cmake/print_include_directories.cmake @@ -16,7 +16,12 @@ list(APPEND dirs ${dirs1}) get_property (dirs1 TARGET roaring PROPERTY INCLUDE_DIRECTORIES) list(APPEND dirs ${dirs1}) -if (USE_INTERNAL_BOOST_LIBRARY) +if (TARGET double-conversion) + get_property (dirs1 TARGET double-conversion PROPERTY INCLUDE_DIRECTORIES) + list(APPEND dirs ${dirs1}) +endif () + +if (TARGET ${Boost_PROGRAM_OPTIONS_LIBRARY}) get_property (dirs1 TARGET ${Boost_PROGRAM_OPTIONS_LIBRARY} PROPERTY INCLUDE_DIRECTORIES) list(APPEND dirs ${dirs1}) endif () diff --git a/contrib/arrow-cmake/CMakeLists.txt b/contrib/arrow-cmake/CMakeLists.txt index c0b87efc63e..a7b6628ea4e 100644 --- a/contrib/arrow-cmake/CMakeLists.txt +++ b/contrib/arrow-cmake/CMakeLists.txt @@ -44,6 +44,7 @@ set( thriftcpp_threads_SOURCES add_library(${THRIFT_LIBRARY} ${thriftcpp_SOURCES} ${thriftcpp_threads_SOURCES}) set_target_properties(${THRIFT_LIBRARY} PROPERTIES CXX_STANDARD 14) # REMOVE after https://github.com/apache/thrift/pull/1641 target_include_directories(${THRIFT_LIBRARY} SYSTEM PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/thrift/lib/cpp/src PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(${THRIFT_LIBRARY} PRIVATE Threads::Threads) diff --git a/contrib/brotli-cmake/CMakeLists.txt b/contrib/brotli-cmake/CMakeLists.txt index 00fea50fc43..e22f4593c02 100644 --- a/contrib/brotli-cmake/CMakeLists.txt +++ b/contrib/brotli-cmake/CMakeLists.txt @@ -31,3 +31,7 @@ set(SRCS add_library(brotli ${SRCS}) target_include_directories(brotli PUBLIC ${BROTLI_SOURCE_DIR}/include) + +if(M_LIBRARY) + target_link_libraries(brotli PRIVATE ${M_LIBRARY}) +endif() diff --git a/contrib/double-conversion-cmake/CMakeLists.txt b/contrib/double-conversion-cmake/CMakeLists.txt index f91b0fb74c1..0690731e1b1 100644 --- a/contrib/double-conversion-cmake/CMakeLists.txt +++ b/contrib/double-conversion-cmake/CMakeLists.txt @@ -10,5 +10,4 @@ ${LIBRARY_DIR}/double-conversion/fast-dtoa.cc ${LIBRARY_DIR}/double-conversion/fixed-dtoa.cc ${LIBRARY_DIR}/double-conversion/strtod.cc) -target_include_directories(double-conversion SYSTEM PUBLIC "${LIBRARY_DIR}") - +target_include_directories(double-conversion SYSTEM BEFORE PUBLIC "${LIBRARY_DIR}") diff --git a/contrib/h3-cmake/CMakeLists.txt b/contrib/h3-cmake/CMakeLists.txt index 5df0a205a34..80e76311f70 100644 --- a/contrib/h3-cmake/CMakeLists.txt +++ b/contrib/h3-cmake/CMakeLists.txt @@ -25,3 +25,6 @@ add_library(h3 ${SRCS}) target_include_directories(h3 SYSTEM PUBLIC ${H3_SOURCE_DIR}/include) target_include_directories(h3 SYSTEM PUBLIC ${H3_BINARY_DIR}/include) target_compile_definitions(h3 PRIVATE H3_HAVE_VLA) +if(M_LIBRARY) + target_link_libraries(h3 PRIVATE ${M_LIBRARY}) +endif() diff --git a/contrib/librdkafka-cmake/CMakeLists.txt b/contrib/librdkafka-cmake/CMakeLists.txt index e0dc6fc2636..75cd3968204 100644 --- a/contrib/librdkafka-cmake/CMakeLists.txt +++ b/contrib/librdkafka-cmake/CMakeLists.txt @@ -65,7 +65,7 @@ add_library(rdkafka ${SRCS}) target_include_directories(rdkafka SYSTEM PUBLIC include) target_include_directories(rdkafka SYSTEM PUBLIC ${RDKAFKA_SOURCE_DIR}) # Because weird logic with "include_next" is used. target_include_directories(rdkafka SYSTEM PRIVATE ${ZSTD_INCLUDE_DIR}/common) # Because wrong path to "zstd_errors.h" is used. -target_link_libraries(rdkafka PUBLIC ${ZLIB_LIBRARIES} ${ZSTD_LIBRARY} ${LZ4_LIBRARY} ${LIBGSASL_LIBRARY}) +target_link_libraries(rdkafka PRIVATE ${ZLIB_LIBRARIES} ${ZSTD_LIBRARY} ${LZ4_LIBRARY} ${LIBGSASL_LIBRARY} Threads::Threads) if(OPENSSL_SSL_LIBRARY AND OPENSSL_CRYPTO_LIBRARY) - target_link_libraries(rdkafka PUBLIC ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) + target_link_libraries(rdkafka PRIVATE ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) endif() diff --git a/contrib/libunwind-cmake/CMakeLists.txt b/contrib/libunwind-cmake/CMakeLists.txt index 3d4cd319089..4f24fe249f5 100644 --- a/contrib/libunwind-cmake/CMakeLists.txt +++ b/contrib/libunwind-cmake/CMakeLists.txt @@ -26,6 +26,7 @@ set(LIBUNWIND_SOURCES add_library(unwind_static ${LIBUNWIND_SOURCES}) -target_include_directories(unwind_static PUBLIC ${LIBUNWIND_SOURCE_DIR}/include) +target_include_directories(unwind_static SYSTEM BEFORE PUBLIC ${LIBUNWIND_SOURCE_DIR}/include) target_compile_definitions(unwind_static PRIVATE -D_LIBUNWIND_NO_HEAP=1 -D_DEBUG -D_LIBUNWIND_IS_NATIVE_ONLY) target_compile_options(unwind_static PRIVATE -fno-exceptions -funwind-tables -fno-sanitize=all -nostdinc++ -fno-rtti) +target_link_libraries(unwind_static PRIVATE Threads::Threads ${CMAKE_DL_LIBS}) diff --git a/contrib/libxml2-cmake/CMakeLists.txt b/contrib/libxml2-cmake/CMakeLists.txt index 8783fca774e..71127fb9e35 100644 --- a/contrib/libxml2-cmake/CMakeLists.txt +++ b/contrib/libxml2-cmake/CMakeLists.txt @@ -52,7 +52,10 @@ set(SRCS ) add_library(libxml2 ${SRCS}) -target_link_libraries(libxml2 ${ZLIB_LIBRARIES}) +target_link_libraries(libxml2 PRIVATE ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS}) +if(M_LIBRARY) + target_link_libraries(libxml2 PRIVATE ${M_LIBRARY}) +endif() target_include_directories(libxml2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/include) target_include_directories(libxml2 PUBLIC ${LIBXML2_SOURCE_DIR}/include) diff --git a/contrib/mariadb-connector-c-cmake/CMakeLists.txt b/contrib/mariadb-connector-c-cmake/CMakeLists.txt index 1c9b7a5ec9c..a0582d89685 100644 --- a/contrib/mariadb-connector-c-cmake/CMakeLists.txt +++ b/contrib/mariadb-connector-c-cmake/CMakeLists.txt @@ -60,6 +60,11 @@ endif() add_library(mysqlclient ${SRCS}) +target_link_libraries(mysqlclient PRIVATE ${CMAKE_DL_LIBS} Threads::Threads) +if(M_LIBRARY) + target_link_libraries(mysqlclient PRIVATE ${M_LIBRARY}) +endif() + if(OPENSSL_LIBRARIES) target_link_libraries(mysqlclient PRIVATE ${OPENSSL_LIBRARIES}) target_compile_definitions(mysqlclient PRIVATE -D HAVE_OPENSSL -D HAVE_TLS) diff --git a/contrib/unixodbc-cmake/CMakeLists.txt b/contrib/unixodbc-cmake/CMakeLists.txt index 1715747191c..98c1e2268cc 100644 --- a/contrib/unixodbc-cmake/CMakeLists.txt +++ b/contrib/unixodbc-cmake/CMakeLists.txt @@ -32,6 +32,7 @@ target_include_directories(ltdl PUBLIC ${ODBC_SOURCE_DIR}/libltdl/libltdl) target_compile_definitions(ltdl PRIVATE -DHAVE_CONFIG_H -DLTDL -DLTDLOPEN=libltdlc) target_compile_options(ltdl PRIVATE -Wno-constant-logical-operand -Wno-unknown-warning-option -O2) +target_link_libraries(ltdl PRIVATE ${CMAKE_DL_LIBS}) set(SRCS diff --git a/dbms/CMakeLists.txt b/dbms/CMakeLists.txt index 1e7a7873bce..a9e276852c1 100644 --- a/dbms/CMakeLists.txt +++ b/dbms/CMakeLists.txt @@ -160,9 +160,6 @@ if (OS_FREEBSD) endif () if (USE_UNWIND) - target_compile_definitions (clickhouse_common_io PRIVATE USE_UNWIND=1) - target_include_directories (clickhouse_common_io SYSTEM BEFORE PRIVATE ${UNWIND_INCLUDE_DIR}) - if (NOT USE_INTERNAL_UNWIND_LIBRARY_FOR_EXCEPTION_HANDLING) target_link_libraries (clickhouse_common_io PRIVATE ${UNWIND_LIBRARY}) endif () @@ -253,10 +250,6 @@ target_link_libraries(clickhouse_common_io roaring ) -if(ZSTD_LIBRARY) - target_link_libraries(clickhouse_common_io PUBLIC ${ZSTD_LIBRARY}) -endif() - if (USE_RDKAFKA) target_link_libraries(dbms PRIVATE ${CPPKAFKA_LIBRARY} ${RDKAFKA_LIBRARY}) if(NOT USE_INTERNAL_RDKAFKA_LIBRARY) @@ -312,11 +305,14 @@ target_include_directories(dbms SYSTEM PUBLIC ${PCG_RANDOM_INCLUDE_DIR}) if (NOT USE_INTERNAL_LZ4_LIBRARY) target_include_directories(dbms SYSTEM BEFORE PRIVATE ${LZ4_INCLUDE_DIR}) endif () + +if (ZSTD_LIBRARY) + target_link_libraries(dbms PRIVATE ${ZSTD_LIBRARY}) +endif() if (NOT USE_INTERNAL_ZSTD_LIBRARY AND ZSTD_INCLUDE_DIR) target_include_directories(dbms SYSTEM BEFORE PRIVATE ${ZSTD_INCLUDE_DIR}) endif () - if (NOT USE_INTERNAL_BOOST_LIBRARY) target_include_directories (clickhouse_common_io SYSTEM BEFORE PUBLIC ${Boost_INCLUDE_DIRS}) endif () diff --git a/dbms/src/Common/Arena.h b/dbms/src/Common/Arena.h index 05154f56c19..e8b6ada44cb 100644 --- a/dbms/src/Common/Arena.h +++ b/dbms/src/Common/Arena.h @@ -5,7 +5,9 @@ #include #include #include -#include +#if __has_include() +# include +#endif #include #include #include diff --git a/dbms/src/Common/ArenaWithFreeLists.h b/dbms/src/Common/ArenaWithFreeLists.h index 2f1f0ddfb0b..6092f03ce19 100644 --- a/dbms/src/Common/ArenaWithFreeLists.h +++ b/dbms/src/Common/ArenaWithFreeLists.h @@ -1,6 +1,9 @@ #pragma once -#include +#if __has_include() +# include +#endif +#include #include #include diff --git a/dbms/src/Common/MiAllocator.cpp b/dbms/src/Common/MiAllocator.cpp index cafa6c135f7..04e61a5de16 100644 --- a/dbms/src/Common/MiAllocator.cpp +++ b/dbms/src/Common/MiAllocator.cpp @@ -1,8 +1,6 @@ -#include +#include "MiAllocator.h" #if USE_MIMALLOC - -#include "MiAllocator.h" #include #include diff --git a/dbms/src/Common/MiAllocator.h b/dbms/src/Common/MiAllocator.h index 48cfc6f9ab4..127be82434b 100644 --- a/dbms/src/Common/MiAllocator.h +++ b/dbms/src/Common/MiAllocator.h @@ -2,10 +2,7 @@ #include -#if !USE_MIMALLOC -#error "do not include this file until USE_MIMALLOC is set to 1" -#endif - +#if USE_MIMALLOC #include namespace DB @@ -26,3 +23,5 @@ struct MiAllocator }; } + +#endif diff --git a/dbms/src/Common/QueryProfiler.cpp b/dbms/src/Common/QueryProfiler.cpp index c908bebcc42..64ac6311065 100644 --- a/dbms/src/Common/QueryProfiler.cpp +++ b/dbms/src/Common/QueryProfiler.cpp @@ -114,7 +114,7 @@ namespace out.next(); } - const UInt32 TIMER_PRECISION = 1e9; + [[maybe_unused]] const UInt32 TIMER_PRECISION = 1e9; } namespace ErrorCodes @@ -158,7 +158,12 @@ QueryProfilerBase::QueryProfilerBase(const Int32 thread_id, const struct sigevent sev; sev.sigev_notify = SIGEV_THREAD_ID; sev.sigev_signo = pause_signal; + +#if defined(__FreeBSD__) + sev._sigev_un._threadid = thread_id; +#else sev._sigev_un._tid = thread_id; +#endif if (timer_create(clock_type, &sev, &timer_id)) throwFromErrno("Failed to create thread timer", ErrorCodes::CANNOT_CREATE_TIMER); diff --git a/dbms/src/Common/StackTrace.cpp b/dbms/src/Common/StackTrace.cpp index a39eaf484e4..debcd00b05c 100644 --- a/dbms/src/Common/StackTrace.cpp +++ b/dbms/src/Common/StackTrace.cpp @@ -1,11 +1,10 @@ #include #include - +#include #include #include #include #include - #include #include #include @@ -31,6 +30,8 @@ std::string signalToErrorMessage(int sig, const siginfo_t & info, const ucontext error << " Access: write."; else error << " Access: read."; +#else + UNUSED(context); #endif switch (info.si_code) diff --git a/dbms/src/Common/TraceCollector.cpp b/dbms/src/Common/TraceCollector.cpp index aad69fa4d40..ff5de756886 100644 --- a/dbms/src/Common/TraceCollector.cpp +++ b/dbms/src/Common/TraceCollector.cpp @@ -46,6 +46,7 @@ TraceCollector::TraceCollector(std::shared_ptr & trace_log) if (-1 == fcntl(trace_pipe.fds_rw[1], F_SETFL, flags | O_NONBLOCK)) throwFromErrno("Cannot set non-blocking mode of pipe", ErrorCodes::CANNOT_FCNTL); +#if !defined(__FreeBSD__) /** Increase pipe size to avoid slowdown during fine-grained trace collection. */ constexpr int max_pipe_capacity_to_set = 1048576; @@ -57,6 +58,7 @@ TraceCollector::TraceCollector(std::shared_ptr & trace_log) throwFromErrno("Cannot increase pipe capacity to " + toString(pipe_size * 2), ErrorCodes::CANNOT_FCNTL); LOG_TRACE(log, "Pipe capacity is " << formatReadableSizeWithBinarySuffix(std::min(pipe_size, max_pipe_capacity_to_set))); +#endif thread = ThreadFromGlobalPool(&TraceCollector::run, this); } diff --git a/dbms/src/Common/config.h.in b/dbms/src/Common/config.h.in index 9b38dd9fc04..b6a5b6de2b8 100644 --- a/dbms/src/Common/config.h.in +++ b/dbms/src/Common/config.h.in @@ -9,5 +9,5 @@ #cmakedefine01 USE_CPUINFO #cmakedefine01 USE_BROTLI #cmakedefine01 USE_MIMALLOC - +#cmakedefine01 USE_UNWIND #cmakedefine01 CLICKHOUSE_SPLIT_BINARY diff --git a/dbms/src/Compression/CompressedReadBufferBase.cpp b/dbms/src/Compression/CompressedReadBufferBase.cpp index bd2078175dc..9f3664b4c9f 100644 --- a/dbms/src/Compression/CompressedReadBufferBase.cpp +++ b/dbms/src/Compression/CompressedReadBufferBase.cpp @@ -1,11 +1,8 @@ #include "CompressedReadBufferBase.h" #include - #include #include -#include - #include #include #include diff --git a/dbms/src/Compression/CompressedWriteBuffer.cpp b/dbms/src/Compression/CompressedWriteBuffer.cpp index 1285949c863..9dd3c23100f 100644 --- a/dbms/src/Compression/CompressedWriteBuffer.cpp +++ b/dbms/src/Compression/CompressedWriteBuffer.cpp @@ -1,8 +1,5 @@ #include #include -#include -#include -#include #include #include diff --git a/dbms/src/Compression/ICompressionCodec.cpp b/dbms/src/Compression/ICompressionCodec.cpp index ddedf8a4c9c..a50001238da 100644 --- a/dbms/src/Compression/ICompressionCodec.cpp +++ b/dbms/src/Compression/ICompressionCodec.cpp @@ -7,7 +7,6 @@ #include #include #include -#include namespace ProfileEvents { diff --git a/dbms/src/Core/Defines.h b/dbms/src/Core/Defines.h index b9f3563a9db..397495d800e 100644 --- a/dbms/src/Core/Defines.h +++ b/dbms/src/Core/Defines.h @@ -140,6 +140,11 @@ /// It could be any magic number. #define DBMS_DISTRIBUTED_SENDS_MAGIC_NUMBER 0xCAFECABE +#if !__has_include() +# define ASAN_UNPOISON_MEMORY_REGION(a, b) +# define ASAN_POISON_MEMORY_REGION(a, b) +#endif + /// A macro for suppressing warnings about unused variables or function results. /// Useful for structured bindings which have no standard way to declare this. #define UNUSED(...) (void)(__VA_ARGS__) diff --git a/dbms/src/Formats/CapnProtoRowInputStream.cpp b/dbms/src/Formats/CapnProtoRowInputStream.cpp index 96c3c5fded3..89d652ebb12 100644 --- a/dbms/src/Formats/CapnProtoRowInputStream.cpp +++ b/dbms/src/Formats/CapnProtoRowInputStream.cpp @@ -1,8 +1,6 @@ -#include "config_formats.h" -#if USE_CAPNP - #include "CapnProtoRowInputStream.h" +#if USE_CAPNP #include #include #include diff --git a/dbms/src/Formats/ParquetBlockInputStream.cpp b/dbms/src/Formats/ParquetBlockInputStream.cpp index deba953bab4..e75d5e1d455 100644 --- a/dbms/src/Formats/ParquetBlockInputStream.cpp +++ b/dbms/src/Formats/ParquetBlockInputStream.cpp @@ -1,7 +1,6 @@ -#include "config_formats.h" -#if USE_PARQUET -# include "ParquetBlockInputStream.h" +#include "ParquetBlockInputStream.h" +#if USE_PARQUET # include # include # include diff --git a/dbms/src/Formats/ParquetBlockOutputStream.cpp b/dbms/src/Formats/ParquetBlockOutputStream.cpp index f03aa181bc3..b0d4cd7818c 100644 --- a/dbms/src/Formats/ParquetBlockOutputStream.cpp +++ b/dbms/src/Formats/ParquetBlockOutputStream.cpp @@ -1,7 +1,6 @@ -#include "config_formats.h" -#if USE_PARQUET -# include "ParquetBlockOutputStream.h" +#include "ParquetBlockOutputStream.h" +#if USE_PARQUET // TODO: clean includes # include # include diff --git a/dbms/src/Formats/ProtobufColumnMatcher.cpp b/dbms/src/Formats/ProtobufColumnMatcher.cpp index 317b6388ea5..ed9bd27bb34 100644 --- a/dbms/src/Formats/ProtobufColumnMatcher.cpp +++ b/dbms/src/Formats/ProtobufColumnMatcher.cpp @@ -1,8 +1,5 @@ -#include "config_formats.h" -#if USE_PROTOBUF - #include "ProtobufColumnMatcher.h" - +#if USE_PROTOBUF #include #include #include diff --git a/dbms/src/Formats/ProtobufReader.h b/dbms/src/Formats/ProtobufReader.h index bc5b1fc4b6c..c2660369c67 100644 --- a/dbms/src/Formats/ProtobufReader.h +++ b/dbms/src/Formats/ProtobufReader.h @@ -9,7 +9,7 @@ #if USE_PROTOBUF #include -#include +#include "ProtobufColumnMatcher.h" #include #include diff --git a/dbms/src/Formats/ProtobufRowInputStream.cpp b/dbms/src/Formats/ProtobufRowInputStream.cpp index 799b53c9d6e..8dcff7bda36 100644 --- a/dbms/src/Formats/ProtobufRowInputStream.cpp +++ b/dbms/src/Formats/ProtobufRowInputStream.cpp @@ -1,8 +1,6 @@ -#include "config_formats.h" -#if USE_PROTOBUF - #include "ProtobufRowInputStream.h" +#if USE_PROTOBUF #include #include #include diff --git a/dbms/src/Formats/ProtobufWriter.h b/dbms/src/Formats/ProtobufWriter.h index d133a8b1214..f11fbcbc391 100644 --- a/dbms/src/Formats/ProtobufWriter.h +++ b/dbms/src/Formats/ProtobufWriter.h @@ -7,7 +7,7 @@ #include "config_formats.h" #if USE_PROTOBUF -#include +#include "ProtobufColumnMatcher.h" #include #include #include diff --git a/dbms/src/Functions/CMakeLists.txt b/dbms/src/Functions/CMakeLists.txt index 13b294197cf..5b8bfca2cd6 100644 --- a/dbms/src/Functions/CMakeLists.txt +++ b/dbms/src/Functions/CMakeLists.txt @@ -22,6 +22,7 @@ target_link_libraries(clickhouse_functions ${BASE64_LIBRARY} PRIVATE + ${ZLIB_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ) diff --git a/dbms/src/IO/ReadBufferAIO.cpp b/dbms/src/IO/ReadBufferAIO.cpp index f47e04bff75..50845330587 100644 --- a/dbms/src/IO/ReadBufferAIO.cpp +++ b/dbms/src/IO/ReadBufferAIO.cpp @@ -254,7 +254,7 @@ void ReadBufferAIO::prepare() /// Region of the disk from which we want to read data. const off_t region_begin = first_unread_pos_in_file; - if ((requested_byte_count > std::numeric_limits::max()) || + if ((requested_byte_count > static_cast(std::numeric_limits::max())) || (first_unread_pos_in_file > (std::numeric_limits::max() - static_cast(requested_byte_count)))) throw Exception("An overflow occurred during file operation", ErrorCodes::LOGICAL_ERROR); diff --git a/dbms/src/IO/ReadBufferFromHDFS.cpp b/dbms/src/IO/ReadBufferFromHDFS.cpp index daedd9b0481..9c44048d4ce 100644 --- a/dbms/src/IO/ReadBufferFromHDFS.cpp +++ b/dbms/src/IO/ReadBufferFromHDFS.cpp @@ -1,8 +1,6 @@ -#include +#include "ReadBufferFromHDFS.h" #if USE_HDFS - -#include #include #include #include diff --git a/dbms/src/IO/ReadBufferFromHDFS.h b/dbms/src/IO/ReadBufferFromHDFS.h index 81a1d4b75dc..6d00c8b2310 100644 --- a/dbms/src/IO/ReadBufferFromHDFS.h +++ b/dbms/src/IO/ReadBufferFromHDFS.h @@ -1,5 +1,7 @@ #pragma once +#include + #if USE_HDFS #include #include diff --git a/dbms/src/IO/WriteBufferAIO.cpp b/dbms/src/IO/WriteBufferAIO.cpp index 2fe7da27809..a558768c64a 100644 --- a/dbms/src/IO/WriteBufferAIO.cpp +++ b/dbms/src/IO/WriteBufferAIO.cpp @@ -274,7 +274,7 @@ void WriteBufferAIO::prepare() /// Region of the disk in which we want to write data. const off_t region_begin = pos_in_file; - if ((flush_buffer.offset() > std::numeric_limits::max()) || + if ((flush_buffer.offset() > static_cast(std::numeric_limits::max())) || (pos_in_file > (std::numeric_limits::max() - static_cast(flush_buffer.offset())))) throw Exception("An overflow occurred during file operation", ErrorCodes::LOGICAL_ERROR);