gcc8 fixes (memset, uncaught_exception)

This commit is contained in:
proller 2018-05-08 22:44:54 +03:00
parent 378c06120b
commit eb772b8001
14 changed files with 33 additions and 21 deletions

View File

@ -22,6 +22,10 @@ if (NOT MSVC)
set (NOT_MSVC 1) set (NOT_MSVC 1)
endif () endif ()
if (NOT APPLE)
set (NOT_APPLE 1)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (COMPILER_GCC 1) set (COMPILER_GCC 1)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

View File

@ -1,4 +1,4 @@
option (ENABLE_EMBEDDED_COMPILER "Set to TRUE to enable support for 'compile' option for query execution" 1) option (ENABLE_EMBEDDED_COMPILER "Set to TRUE to enable support for 'compile' option for query execution" ${NOT_APPLE})
if (ENABLE_EMBEDDED_COMPILER) if (ENABLE_EMBEDDED_COMPILER)
# Based on source code of YT. # Based on source code of YT.

View File

@ -1088,7 +1088,7 @@ class sparsegroup {
// This is equivalent to memmove(), but faster on my Intel P4, // This is equivalent to memmove(), but faster on my Intel P4,
// at least with gcc4.1 -O2 / glibc 2.3.6. // at least with gcc4.1 -O2 / glibc 2.3.6.
for (size_type i = settings.num_buckets; i > offset; --i) for (size_type i = settings.num_buckets; i > offset; --i)
memcpy(group + i, group + i-1, sizeof(*group)); memcpy(static_cast<void*>(group + i), group + i-1, sizeof(*group));
} }
// Create space at group[offset], without special assumptions about value_type // Create space at group[offset], without special assumptions about value_type
@ -1154,7 +1154,7 @@ class sparsegroup {
// at lesat with gcc4.1 -O2 / glibc 2.3.6. // at lesat with gcc4.1 -O2 / glibc 2.3.6.
assert(settings.num_buckets > 0); assert(settings.num_buckets > 0);
for (size_type i = offset; i < settings.num_buckets-1; ++i) for (size_type i = offset; i < settings.num_buckets-1; ++i)
memcpy(group + i, group + i+1, sizeof(*group)); // hopefully inlined! memcpy(static_cast<void*>(group + i), group + i+1, sizeof(*group)); // hopefully inlined!
group = settings.realloc_or_die(group, settings.num_buckets-1); group = settings.realloc_or_die(group, settings.num_buckets-1);
} }

View File

@ -408,7 +408,7 @@ protected:
/// Copy to a new location and zero the old one. /// Copy to a new location and zero the old one.
x.setHash(hash_value); x.setHash(hash_value);
memcpy(&buf[place_value], &x, sizeof(x)); memcpy(static_cast<void*>(&buf[place_value]), &x, sizeof(x));
x.setZero(); x.setZero();
/// Then the elements that previously were in collision with this can move to the old place. /// Then the elements that previously were in collision with this can move to the old place.
@ -726,7 +726,7 @@ public:
{ {
size_t place_value = findEmptyCell(grower.place(hash_value)); size_t place_value = findEmptyCell(grower.place(hash_value));
memcpy(&buf[place_value], cell, sizeof(*cell)); memcpy(static_cast<void*>(&buf[place_value]), cell, sizeof(*cell));
++m_size; ++m_size;
if (unlikely(grower.overflow(m_size))) if (unlikely(grower.overflow(m_size)))
@ -897,7 +897,7 @@ public:
this->clearHasZero(); this->clearHasZero();
m_size = 0; m_size = 0;
memset(buf, 0, grower.bufSize() * sizeof(*buf)); memset(static_cast<void*>(buf), 0, grower.bufSize() * sizeof(*buf));
} }
/// After executing this function, the table can only be destroyed, /// After executing this function, the table can only be destroyed,

View File

@ -86,8 +86,8 @@ public:
if (*needle < 0x80u) if (*needle < 0x80u)
{ {
first_needle_symbol_is_ascii = true; first_needle_symbol_is_ascii = true;
l = static_cast<const UInt8>(std::tolower(*needle)); l = std::tolower(*needle);
u = static_cast<const UInt8>(std::toupper(*needle)); u = std::toupper(*needle);
} }
else else
{ {

View File

@ -150,7 +150,7 @@ private:
--ptr->refcount; --ptr->refcount;
if (!ptr->refcount) if (!ptr->refcount)
{ {
if (std::uncaught_exception()) if (std::uncaught_exceptions())
delete ptr; delete ptr;
else else
ptr->output_blocks->push_back(ptr); ptr->output_blocks->push_back(ptr);

View File

@ -147,8 +147,12 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
} }
size_t recommended_rows = estimateNumRows(*task, task->range_reader); size_t recommended_rows = estimateNumRows(*task, task->range_reader);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
size_t rows_to_read = std::max(static_cast<decltype(max_block_size_rows)>(1), size_t rows_to_read = std::max(static_cast<decltype(max_block_size_rows)>(1),
std::min(max_block_size_rows, recommended_rows)); std::min(max_block_size_rows, recommended_rows));
#pragma GCC diagnostic pop
auto read_result = task->range_reader.read(rows_to_read, task->mark_ranges); auto read_result = task->range_reader.read(rows_to_read, task->mark_ranges);

View File

@ -69,8 +69,8 @@ public:
readIntBinary(mrk_mark.offset_in_decompressed_block, mrk_hashing_buf); readIntBinary(mrk_mark.offset_in_decompressed_block, mrk_hashing_buf);
bool has_alternative_mark = false; bool has_alternative_mark = false;
MarkInCompressedFile alternative_data_mark; MarkInCompressedFile alternative_data_mark = {};
MarkInCompressedFile data_mark; MarkInCompressedFile data_mark = {};
/// If the mark should be exactly at the border of blocks, we can also use a mark pointing to the end of previous block, /// If the mark should be exactly at the border of blocks, we can also use a mark pointing to the end of previous block,
/// and the beginning of next. /// and the beginning of next.

View File

@ -71,6 +71,7 @@
</shard> </shard>
</test_shard_localhost_secure> </test_shard_localhost_secure>
</remote_servers> </remote_servers>
<include_from/>
<zookeeper incl="zookeeper-servers" optional="true" /> <zookeeper incl="zookeeper-servers" optional="true" />
<macros incl="macros" optional="true" /> <macros incl="macros" optional="true" />
<builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval> <builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>

5
debian/.pbuilderrc vendored
View File

@ -173,9 +173,12 @@ else
export CMAKE_FLAGS="-DENABLE_EMBEDDED_COMPILER=0 $CMAKE_FLAGS" export CMAKE_FLAGS="-DENABLE_EMBEDDED_COMPILER=0 $CMAKE_FLAGS"
fi fi
# will test symbols # Will test symbols
#EXTRAPACKAGES+=" gdb " #EXTRAPACKAGES+=" gdb "
# For killall in pbuilder-hooks:
EXTRAPACKAGES+=" psmisc "
[[ $CCACHE_PREFIX == 'distcc' ]] && EXTRAPACKAGES+=" $CCACHE_PREFIX " [[ $CCACHE_PREFIX == 'distcc' ]] && EXTRAPACKAGES+=" $CCACHE_PREFIX "
export DEB_BUILD_OPTIONS=parallel=`nproc` export DEB_BUILD_OPTIONS=parallel=`nproc`

View File

@ -2,6 +2,6 @@
mkdir -p /server/build_docker mkdir -p /server/build_docker
cd /server/build_docker cd /server/build_docker
cmake /server -DENABLE_EMBEDDED_COMPILER=1 -DENABLE_TESTS=0 cmake /server -DENABLE_TESTS=0
make -j $(nproc || grep -c ^processor /proc/cpuinfo) make -j $(nproc || grep -c ^processor /proc/cpuinfo)
#ctest -V -j $(nproc || grep -c ^processor /proc/cpuinfo) #ctest -V -j $(nproc || grep -c ^processor /proc/cpuinfo)

View File

@ -14,7 +14,7 @@ namespace ext
std::decay_t<To> bit_cast(const From & from) std::decay_t<To> bit_cast(const From & from)
{ {
To res {}; To res {};
memcpy(&res, &from, std::min(sizeof(res), sizeof(from))); memcpy(static_cast<void*>(&res), &from, std::min(sizeof(res), sizeof(from)));
return res; return res;
}; };

12
release
View File

@ -6,7 +6,7 @@
# Clang6 build: # Clang6 build:
# env DIST=bionic EXTRAPACKAGES="clang-6.0 libstdc++-8-dev lld-6.0 liblld-6.0-dev libclang-6.0-dev liblld-6.0" DEB_CC=clang-6.0 DEB_CXX=clang++-6.0 CMAKE_FLAGS=" -DLLVM_VERSION_POSTFIX=-6.0 -DNO_WERROR=1 " ./release # env DIST=bionic EXTRAPACKAGES="clang-6.0 libstdc++-8-dev lld-6.0 liblld-6.0-dev libclang-6.0-dev liblld-6.0" DEB_CC=clang-6.0 DEB_CXX=clang++-6.0 CMAKE_FLAGS=" -DLLVM_VERSION_POSTFIX=-6.0 -DNO_WERROR=1 " ./release
# Clang7 build: # Clang7 build:
# env DIST=unstable EXTRAPACKAGES="clang-7 libstdc++-8-dev lld-7 liblld-7-dev libclang-7-dev llvm-7-dev liblld-7" DEB_CC=clang-7 DEB_CXX=clang++-7 CMAKE_FLAGS=" -DLLVM_VERSION_POSTFIX=-7 -DNO_WERROR=1 " ./release # env DIST=unstable EXTRAPACKAGES="clang-7 libstdc++-8-dev lld-7 liblld-7-dev libclang-7-dev liblld-7" DEB_CC=clang-7 DEB_CXX=clang++-7 CMAKE_FLAGS=" -DLLVM_VERSION_POSTFIX=-7 -DNO_WERROR=1 " ./release
# Clang6 without internal compiler (for low memory arm64): # Clang6 without internal compiler (for low memory arm64):
# env DIST=bionic DISABLE_PARALLEL=1 EXTRAPACKAGES="clang-6.0 libstdc++-8-dev" DEB_CC=clang-6.0 DEB_CXX=clang++-6.0 CMAKE_FLAGS=" -DNO_WERROR=1 " ./release # env DIST=bionic DISABLE_PARALLEL=1 EXTRAPACKAGES="clang-6.0 libstdc++-8-dev" DEB_CC=clang-6.0 DEB_CXX=clang++-6.0 CMAKE_FLAGS=" -DNO_WERROR=1 " ./release
@ -33,7 +33,7 @@ while [[ $1 == --* ]]
do do
if [[ $1 == '--test' ]]; then if [[ $1 == '--test' ]]; then
TEST='yes' TEST='yes'
VERSION_POSTFIX+=-test VERSION_POSTFIX+=+test
shift shift
elif [[ $1 == '--check-build-dependencies' ]]; then elif [[ $1 == '--check-build-dependencies' ]]; then
DEBUILD_NODEPS_OPTIONS="" DEBUILD_NODEPS_OPTIONS=""
@ -66,7 +66,7 @@ done
if [ -n "$SANITIZER" ] if [ -n "$SANITIZER" ]
then then
CMAKE_BUILD_TYPE=$SANITIZER CMAKE_BUILD_TYPE=$SANITIZER
VERSION_POSTFIX+=-${SANITIZER,,} VERSION_POSTFIX+=+${SANITIZER,,}
# todo: нужно ли отключить libtcmalloc? # todo: нужно ли отключить libtcmalloc?
LIBTCMALLOC_OPTS="-DENABLE_TCMALLOC=0" LIBTCMALLOC_OPTS="-DENABLE_TCMALLOC=0"
# GLIBC_COMPATIBILITY отключен по умолчанию # GLIBC_COMPATIBILITY отключен по умолчанию
@ -75,14 +75,14 @@ then
EXTRAPACKAGES="$EXTRAPACKAGES clang-5.0 lld-5.0" EXTRAPACKAGES="$EXTRAPACKAGES clang-5.0 lld-5.0"
elif [[ $BUILD_TYPE == 'valgrind' ]]; then elif [[ $BUILD_TYPE == 'valgrind' ]]; then
LIBTCMALLOC_OPTS="-DENABLE_TCMALLOC=0" LIBTCMALLOC_OPTS="-DENABLE_TCMALLOC=0"
VERSION_POSTFIX+=-$BUILD_TYPE VERSION_POSTFIX+=+$BUILD_TYPE
elif [[ $BUILD_TYPE == 'debug' ]]; then elif [[ $BUILD_TYPE == 'debug' ]]; then
CMAKE_BUILD_TYPE=Debug CMAKE_BUILD_TYPE=Debug
LIBTCMALLOC_OPTS="-DDEBUG_TCMALLOC=1" LIBTCMALLOC_OPTS="-DDEBUG_TCMALLOC=1"
VERSION_POSTFIX+=-$BUILD_TYPE VERSION_POSTFIX+=+$BUILD_TYPE
fi fi
CMAKE_FLAGS=" $LIBTCMALLOC_OPTS -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DENABLE_EMBEDDED_COMPILER=1 $CMAKE_FLAGS" CMAKE_FLAGS=" $LIBTCMALLOC_OPTS -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE $CMAKE_FLAGS"
export CMAKE_FLAGS export CMAKE_FLAGS
export EXTRAPACKAGES export EXTRAPACKAGES

View File

@ -24,7 +24,7 @@ env TEST_RUN=${TEST_RUN=1} \
DEB_CC=${DEB_CC=$CC} DEB_CXX=${DEB_CXX=$CXX} \ DEB_CC=${DEB_CC=$CC} DEB_CXX=${DEB_CXX=$CXX} \
CCACHE_SIZE=${CCACHE_SIZE:=4G} \ CCACHE_SIZE=${CCACHE_SIZE:=4G} \
`# Disable all features` \ `# Disable all features` \
CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DUNBUNDLED=1 -DENABLE_UNWIND=0 -DENABLE_MYSQL=0 -DENABLE_CAPNP=0 -DENABLE_RDKAFKA=0 -DENABLE_EMBEDDED_COMPILER=1 -DCMAKE_C_FLAGS_ADD='-O0 -g0' -DCMAKE_CXX_FLAGS_ADD='-O0 -g0' $CMAKE_FLAGS" \ CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DUNBUNDLED=1 -DENABLE_UNWIND=0 -DENABLE_MYSQL=0 -DENABLE_CAPNP=0 -DENABLE_RDKAFKA=0 -DCMAKE_C_FLAGS_ADD='-O0 -g0' -DCMAKE_CXX_FLAGS_ADD='-O0 -g0' $CMAKE_FLAGS" \
`# Use all possible contrib libs from system` \ `# Use all possible contrib libs from system` \
`# psmisc - killall` \ `# psmisc - killall` \
EXTRAPACKAGES="psmisc clang-5.0 lld-5.0 liblld-5.0-dev libclang-5.0-dev liblld-5.0 libc++abi-dev libc++-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev zlib1g-dev liblz4-dev libdouble-conversion-dev libsparsehash-dev librdkafka-dev libpoco-dev libsparsehash-dev libgoogle-perftools-dev libzstd-dev libre2-dev $EXTRAPACKAGES" \ EXTRAPACKAGES="psmisc clang-5.0 lld-5.0 liblld-5.0-dev libclang-5.0-dev liblld-5.0 libc++abi-dev libc++-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev zlib1g-dev liblz4-dev libdouble-conversion-dev libsparsehash-dev librdkafka-dev libpoco-dev libsparsehash-dev libgoogle-perftools-dev libzstd-dev libre2-dev $EXTRAPACKAGES" \