mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Resolve issues
This commit is contained in:
commit
8459148313
@ -16,6 +16,9 @@ Checks: [
|
||||
|
||||
'-android-*',
|
||||
|
||||
'-boost-use-ranges',
|
||||
'-modernize-use-ranges',
|
||||
|
||||
'-bugprone-assignment-in-if-condition',
|
||||
'-bugprone-branch-clone',
|
||||
'-bugprone-easily-swappable-parameters',
|
||||
@ -28,7 +31,6 @@ Checks: [
|
||||
'-bugprone-reserved-identifier', # useful but too slow, TODO retry when https://reviews.llvm.org/rG1c282052624f9d0bd273bde0b47b30c96699c6c7 is merged
|
||||
'-bugprone-unchecked-optional-access',
|
||||
'-bugprone-crtp-constructor-accessibility',
|
||||
'-bugprone-suspicious-stringview-data-usage',
|
||||
|
||||
'-cert-dcl16-c',
|
||||
'-cert-dcl37-c',
|
||||
@ -42,6 +44,8 @@ Checks: [
|
||||
|
||||
'-clang-analyzer-optin.performance.Padding',
|
||||
|
||||
'-clang-analyzer-cplusplus.PlacementNew',
|
||||
|
||||
'-clang-analyzer-unix.Malloc',
|
||||
|
||||
'-cppcoreguidelines-*', # impractical in a codebase as large as ClickHouse, also slow
|
||||
@ -90,6 +94,7 @@ Checks: [
|
||||
'-misc-non-private-member-variables-in-classes',
|
||||
'-misc-confusable-identifiers', # useful but slooo
|
||||
'-misc-use-anonymous-namespace',
|
||||
'-misc-use-internal-linkage',
|
||||
|
||||
'-modernize-avoid-c-arrays',
|
||||
'-modernize-concat-nested-namespaces',
|
||||
@ -137,6 +142,7 @@ Checks: [
|
||||
'-readability-suspicious-call-argument',
|
||||
'-readability-uppercase-literal-suffix',
|
||||
'-readability-use-anyofallof',
|
||||
'-readability-math-missing-parentheses',
|
||||
|
||||
'-zircon-*'
|
||||
]
|
||||
|
@ -30,8 +30,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
double preciseExp10(double x)
|
||||
{
|
||||
|
@ -4,8 +4,9 @@ FROM ubuntu:22.04
|
||||
# ARG for quick switch to a given ubuntu mirror
|
||||
ARG apt_archive="http://archive.ubuntu.com"
|
||||
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list
|
||||
ARG LLVM_APT_VERSION="1:19.1.4~*"
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=18
|
||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=19
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install \
|
||||
@ -26,7 +27,7 @@ RUN apt-get update \
|
||||
&& echo "deb https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \
|
||||
/etc/apt/sources.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends --verbose-versions llvm-${LLVM_VERSION} \
|
||||
&& apt-get install --yes --no-install-recommends --verbose-versions llvm-${LLVM_VERSION}>=${LLVM_APT_VERSION} \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
|
||||
|
||||
@ -72,10 +73,6 @@ RUN ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/ld.lld
|
||||
# https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commit/992e52c0b156a5ba9c6a8a54f8c4857ddd3d371d
|
||||
RUN sed -i '/_IMPORT_CHECK_FILES_FOR_\(mlir-\|llvm-bolt\|merge-fdata\|MLIR\)/ {s|^|#|}' /usr/lib/llvm-${LLVM_VERSION}/lib/cmake/llvm/LLVMExports-*.cmake
|
||||
|
||||
# LLVM changes paths for compiler-rt libraries. For some reason clang-18.1.8 cannot catch up libraries from default install path.
|
||||
# It's very dirty workaround, better to build compiler and LLVM ourself and use it. Details: https://github.com/llvm/llvm-project/issues/95792
|
||||
RUN test ! -d /usr/lib/llvm-18/lib/clang/18/lib/x86_64-pc-linux-gnu || ln -s /usr/lib/llvm-18/lib/clang/18/lib/x86_64-pc-linux-gnu /usr/lib/llvm-18/lib/clang/18/lib/x86_64-unknown-linux-gnu
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG SCCACHE_VERSION=v0.7.7
|
||||
ENV SCCACHE_IGNORE_SERVER_IO_ERROR=1
|
||||
|
@ -5,14 +5,14 @@ if (ENABLE_CLANG_TIDY)
|
||||
|
||||
find_program (CLANG_TIDY_CACHE_PATH NAMES "clang-tidy-cache")
|
||||
if (CLANG_TIDY_CACHE_PATH)
|
||||
find_program (_CLANG_TIDY_PATH NAMES "clang-tidy-18" "clang-tidy-17" "clang-tidy-16" "clang-tidy")
|
||||
find_program (_CLANG_TIDY_PATH NAMES "clang-tidy-19" "clang-tidy-18" "clang-tidy-17" "clang-tidy")
|
||||
|
||||
# Why do we use ';' here?
|
||||
# It's a cmake black magic: https://cmake.org/cmake/help/latest/prop_tgt/LANG_CLANG_TIDY.html#prop_tgt:%3CLANG%3E_CLANG_TIDY
|
||||
# The CLANG_TIDY_PATH is passed to CMAKE_CXX_CLANG_TIDY, which follows CXX_CLANG_TIDY syntax.
|
||||
set (CLANG_TIDY_PATH "${CLANG_TIDY_CACHE_PATH};${_CLANG_TIDY_PATH}" CACHE STRING "A combined command to run clang-tidy with caching wrapper")
|
||||
else ()
|
||||
find_program (CLANG_TIDY_PATH NAMES "clang-tidy-18" "clang-tidy-17" "clang-tidy-16" "clang-tidy")
|
||||
find_program (CLANG_TIDY_PATH NAMES "clang-tidy-19" "clang-tidy-18" "clang-tidy-17" "clang-tidy")
|
||||
endif ()
|
||||
|
||||
if (CLANG_TIDY_PATH)
|
||||
|
@ -17,9 +17,4 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --gcc-toolchain=${TOOLCHAIN_PATH}")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${TOOLCHAIN_PATH}")
|
||||
set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} --gcc-toolchain=${TOOLCHAIN_PATH}")
|
||||
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=bfd")
|
||||
|
||||
# Currently, lld does not work with the error:
|
||||
# ld.lld: error: section size decrease is too large
|
||||
# But GNU BinUtils work.
|
||||
set (LINKER_NAME "riscv64-linux-gnu-ld.bfd" CACHE STRING "Linker name" FORCE)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
|
||||
|
@ -3,10 +3,10 @@ compilers and build settings. Correctly configured Docker daemon is single depen
|
||||
|
||||
Usage:
|
||||
|
||||
Build deb package with `clang-18` in `debug` mode:
|
||||
Build deb package with `clang-19` in `debug` mode:
|
||||
```
|
||||
$ mkdir deb/test_output
|
||||
$ ./packager --output-dir deb/test_output/ --package-type deb --compiler=clang-18 --debug-build
|
||||
$ ./packager --output-dir deb/test_output/ --package-type deb --compiler=clang-19 --debug-build
|
||||
$ ls -l deb/test_output
|
||||
-rw-r--r-- 1 root root 3730 clickhouse-client_22.2.2+debug_all.deb
|
||||
-rw-r--r-- 1 root root 84221888 clickhouse-common-static_22.2.2+debug_amd64.deb
|
||||
@ -17,11 +17,11 @@ $ ls -l deb/test_output
|
||||
|
||||
```
|
||||
|
||||
Build ClickHouse binary with `clang-18` and `address` sanitizer in `relwithdebuginfo`
|
||||
Build ClickHouse binary with `clang-19` and `address` sanitizer in `relwithdebuginfo`
|
||||
mode:
|
||||
```
|
||||
$ mkdir $HOME/some_clickhouse
|
||||
$ ./packager --output-dir=$HOME/some_clickhouse --package-type binary --compiler=clang-18 --sanitizer=address
|
||||
$ ./packager --output-dir=$HOME/some_clickhouse --package-type binary --compiler=clang-19 --sanitizer=address
|
||||
$ ls -l $HOME/some_clickhouse
|
||||
-rwxr-xr-x 1 root root 787061952 clickhouse
|
||||
lrwxrwxrwx 1 root root 10 clickhouse-benchmark -> clickhouse
|
||||
|
@ -407,20 +407,20 @@ def parse_args() -> argparse.Namespace:
|
||||
parser.add_argument(
|
||||
"--compiler",
|
||||
choices=(
|
||||
"clang-18",
|
||||
"clang-18-darwin",
|
||||
"clang-18-darwin-aarch64",
|
||||
"clang-18-aarch64",
|
||||
"clang-18-aarch64-v80compat",
|
||||
"clang-18-ppc64le",
|
||||
"clang-18-riscv64",
|
||||
"clang-18-s390x",
|
||||
"clang-18-loongarch64",
|
||||
"clang-18-amd64-compat",
|
||||
"clang-18-amd64-musl",
|
||||
"clang-18-freebsd",
|
||||
"clang-19",
|
||||
"clang-19-darwin",
|
||||
"clang-19-darwin-aarch64",
|
||||
"clang-19-aarch64",
|
||||
"clang-19-aarch64-v80compat",
|
||||
"clang-19-ppc64le",
|
||||
"clang-19-riscv64",
|
||||
"clang-19-s390x",
|
||||
"clang-19-loongarch64",
|
||||
"clang-19-amd64-compat",
|
||||
"clang-19-amd64-musl",
|
||||
"clang-19-freebsd",
|
||||
),
|
||||
default="clang-18",
|
||||
default="clang-19",
|
||||
help="a compiler to use",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -40,10 +40,6 @@ RUN ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/ld.lld
|
||||
# https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commit/992e52c0b156a5ba9c6a8a54f8c4857ddd3d371d
|
||||
RUN sed -i '/_IMPORT_CHECK_FILES_FOR_\(mlir-\|llvm-bolt\|merge-fdata\|MLIR\)/ {s|^|#|}' /usr/lib/llvm-${LLVM_VERSION}/lib/cmake/llvm/LLVMExports-*.cmake
|
||||
|
||||
# LLVM changes paths for compiler-rt libraries. For some reason clang-18.1.8 cannot catch up libraries from default install path.
|
||||
# It's very dirty workaround, better to build compiler and LLVM ourself and use it. Details: https://github.com/llvm/llvm-project/issues/95792
|
||||
RUN test ! -d /usr/lib/llvm-18/lib/clang/18/lib/x86_64-pc-linux-gnu || ln -s /usr/lib/llvm-18/lib/clang/18/lib/x86_64-pc-linux-gnu /usr/lib/llvm-18/lib/clang/18/lib/x86_64-unknown-linux-gnu
|
||||
|
||||
ARG CCACHE_VERSION=4.6.1
|
||||
RUN mkdir /tmp/ccache \
|
||||
&& cd /tmp/ccache \
|
||||
|
@ -27,7 +27,6 @@ pandas==1.5.3
|
||||
pip==24.1.1
|
||||
pipdeptree==2.23.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
python-dateutil==2.9.0.post0
|
||||
pytz==2024.1
|
||||
requests==2.32.3
|
||||
|
@ -18,7 +18,6 @@ pip==24.1.1
|
||||
pipdeptree==2.23.0
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
SecretStorage==3.3.1
|
||||
setuptools==59.6.0
|
||||
six==1.16.0
|
||||
|
@ -17,7 +17,7 @@ stage=${stage:-}
|
||||
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
echo "$script_dir"
|
||||
repo_dir=ch
|
||||
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-18_debug_none_unsplitted_disable_False_binary"}
|
||||
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-19_debug_none_unsplitted_disable_False_binary"}
|
||||
BINARY_URL_TO_DOWNLOAD=${BINARY_URL_TO_DOWNLOAD:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/$BINARY_TO_DOWNLOAD/clickhouse"}
|
||||
|
||||
function git_clone_with_retry
|
||||
|
@ -17,7 +17,6 @@ pipdeptree==2.23.0
|
||||
pycurl==7.45.3
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
SecretStorage==3.3.1
|
||||
setuptools==59.6.0
|
||||
six==1.16.0
|
||||
|
@ -2,7 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-18_relwithdebuginfo_none_unsplitted_disable_False_binary/clickhouse"}
|
||||
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-19_relwithdebuginfo_none_unsplitted_disable_False_binary/clickhouse"}
|
||||
CLICKHOUSE_REPO_PATH=${CLICKHOUSE_REPO_PATH:=""}
|
||||
|
||||
|
||||
|
@ -18,7 +18,6 @@ pip==24.1.1
|
||||
pipdeptree==2.23.0
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
SecretStorage==3.3.1
|
||||
setuptools==59.6.0
|
||||
six==1.16.0
|
||||
|
@ -19,7 +19,6 @@ pipdeptree==2.23.0
|
||||
Pygments==2.11.2
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
pytz==2023.4
|
||||
PyYAML==6.0.1
|
||||
scipy==1.12.0
|
||||
|
@ -2,7 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-18_relwithdebuginfo_none_unsplitted_disable_False_binary/clickhouse"}
|
||||
CLICKHOUSE_PACKAGE=${CLICKHOUSE_PACKAGE:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/clang-19_relwithdebuginfo_none_unsplitted_disable_False_binary/clickhouse"}
|
||||
CLICKHOUSE_REPO_PATH=${CLICKHOUSE_REPO_PATH:=""}
|
||||
|
||||
|
||||
|
@ -20,7 +20,6 @@ pipdeptree==2.23.0
|
||||
PyJWT==2.3.0
|
||||
pyodbc==5.1.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
SecretStorage==3.3.1
|
||||
setuptools==59.6.0
|
||||
six==1.16.0
|
||||
|
@ -17,7 +17,6 @@ pip==24.1.1
|
||||
pipdeptree==2.23.0
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
pytz==2024.1
|
||||
PyYAML==6.0.1
|
||||
SecretStorage==3.3.1
|
||||
|
@ -6,7 +6,7 @@ set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-18_debug_none_unsplitted_disable_False_binary"}
|
||||
BINARY_TO_DOWNLOAD=${BINARY_TO_DOWNLOAD:="clang-19_debug_none_unsplitted_disable_False_binary"}
|
||||
BINARY_URL_TO_DOWNLOAD=${BINARY_URL_TO_DOWNLOAD:="https://clickhouse-builds.s3.amazonaws.com/$PR_TO_TEST/$SHA_TO_TEST/clickhouse_build_check/$BINARY_TO_DOWNLOAD/clickhouse"}
|
||||
|
||||
function wget_with_retry
|
||||
|
@ -34,7 +34,6 @@ pyarrow==15.0.0
|
||||
pyasn1==0.4.8
|
||||
PyJWT==2.3.0
|
||||
pyparsing==2.4.7
|
||||
python-apt==2.4.0+ubuntu3
|
||||
python-dateutil==2.8.1
|
||||
pytz==2024.1
|
||||
PyYAML==6.0.1
|
||||
|
@ -4,8 +4,9 @@ FROM ubuntu:22.04
|
||||
# ARG for quick switch to a given ubuntu mirror
|
||||
ARG apt_archive="http://archive.ubuntu.com"
|
||||
RUN sed -i "s|http://archive.ubuntu.com|$apt_archive|g" /etc/apt/sources.list
|
||||
ARG LLVM_APT_VERSION="1:19.1.4~*"
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=18
|
||||
ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=19
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install \
|
||||
@ -28,7 +29,7 @@ RUN apt-get update \
|
||||
&& echo "deb https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \
|
||||
/etc/apt/sources.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends --verbose-versions llvm-${LLVM_VERSION} \
|
||||
&& apt-get install --yes --no-install-recommends --verbose-versions llvm-${LLVM_VERSION}>=${LLVM_APT_VERSION} \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
|
||||
|
||||
|
@ -11,7 +11,7 @@ This is for the case when you have Linux machine and want to use it to build `cl
|
||||
|
||||
The cross-build for LoongArch64 is based on the [Build instructions](../development/build.md), follow them first.
|
||||
|
||||
## Install Clang-18
|
||||
## Install Clang-19
|
||||
|
||||
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup or do
|
||||
```
|
||||
@ -21,11 +21,11 @@ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
|
||||
## Build ClickHouse {#build-clickhouse}
|
||||
|
||||
|
||||
The llvm version required for building must be greater than or equal to 18.1.0.
|
||||
The llvm version required for building must be greater than or equal to 19.1.0.
|
||||
``` bash
|
||||
cd ClickHouse
|
||||
mkdir build-loongarch64
|
||||
CC=clang-18 CXX=clang++-18 cmake . -Bbuild-loongarch64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-loongarch64.cmake
|
||||
CC=clang-19 CXX=clang++-19 cmake . -Bbuild-loongarch64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-loongarch64.cmake
|
||||
ninja -C build-loongarch64
|
||||
```
|
||||
|
||||
|
@ -13,14 +13,14 @@ The cross-build for macOS is based on the [Build instructions](../development/bu
|
||||
|
||||
The following sections provide a walk-through for building ClickHouse for `x86_64` macOS. If you’re targeting ARM architecture, simply substitute all occurrences of `x86_64` with `aarch64`. For example, replace `x86_64-apple-darwin` with `aarch64-apple-darwin` throughout the steps.
|
||||
|
||||
## Install clang-18
|
||||
## Install clang-19
|
||||
|
||||
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup.
|
||||
For example the commands for Bionic are like:
|
||||
|
||||
``` bash
|
||||
sudo echo "deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-17 main" >> /etc/apt/sources.list
|
||||
sudo apt-get install clang-18
|
||||
sudo apt-get install clang-19
|
||||
```
|
||||
|
||||
## Install Cross-Compilation Toolset {#install-cross-compilation-toolset}
|
||||
@ -59,7 +59,7 @@ curl -L 'https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11
|
||||
cd ClickHouse
|
||||
mkdir build-darwin
|
||||
cd build-darwin
|
||||
CC=clang-18 CXX=clang++-18 cmake -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar -DCMAKE_INSTALL_NAME_TOOL=${CCTOOLS}/bin/x86_64-apple-darwin-install_name_tool -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake ..
|
||||
CC=clang-19 CXX=clang++-19 cmake -DCMAKE_AR:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ar -DCMAKE_INSTALL_NAME_TOOL=${CCTOOLS}/bin/x86_64-apple-darwin-install_name_tool -DCMAKE_RANLIB:FILEPATH=${CCTOOLS}/bin/x86_64-apple-darwin-ranlib -DLINKER_NAME=${CCTOOLS}/bin/x86_64-apple-darwin-ld -DCMAKE_TOOLCHAIN_FILE=cmake/darwin/toolchain-x86_64.cmake ..
|
||||
ninja
|
||||
```
|
||||
|
||||
|
@ -11,7 +11,7 @@ This is for the case when you have Linux machine and want to use it to build `cl
|
||||
|
||||
The cross-build for RISC-V 64 is based on the [Build instructions](../development/build.md), follow them first.
|
||||
|
||||
## Install Clang-18
|
||||
## Install Clang-19
|
||||
|
||||
Follow the instructions from https://apt.llvm.org/ for your Ubuntu or Debian setup or do
|
||||
```
|
||||
@ -23,7 +23,7 @@ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
|
||||
``` bash
|
||||
cd ClickHouse
|
||||
mkdir build-riscv64
|
||||
CC=clang-18 CXX=clang++-18 cmake . -Bbuild-riscv64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-riscv64.cmake -DGLIBC_COMPATIBILITY=OFF -DENABLE_LDAP=OFF -DOPENSSL_NO_ASM=ON -DENABLE_JEMALLOC=ON -DENABLE_PARQUET=OFF -DENABLE_GRPC=OFF -DENABLE_HDFS=OFF -DENABLE_MYSQL=OFF
|
||||
CC=clang-19 CXX=clang++-19 cmake . -Bbuild-riscv64 -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-riscv64.cmake -DGLIBC_COMPATIBILITY=OFF -DENABLE_LDAP=OFF -DOPENSSL_NO_ASM=ON -DENABLE_JEMALLOC=ON -DENABLE_PARQUET=OFF -DENABLE_GRPC=OFF -DENABLE_HDFS=OFF -DENABLE_MYSQL=OFF
|
||||
ninja -C build-riscv64
|
||||
```
|
||||
|
||||
|
@ -54,8 +54,8 @@ to see what version you have installed before setting this environment variable.
|
||||
:::
|
||||
|
||||
``` bash
|
||||
export CC=clang-18
|
||||
export CXX=clang++-18
|
||||
export CC=clang-19
|
||||
export CXX=clang++-19
|
||||
```
|
||||
|
||||
### Install Rust compiler
|
||||
@ -109,7 +109,7 @@ The build requires the following components:
|
||||
|
||||
- Git (used to checkout the sources, not needed for the build)
|
||||
- CMake 3.20 or newer
|
||||
- Compiler: clang-18 or newer
|
||||
- Compiler: clang-19 or newer
|
||||
- Linker: lld-17 or newer
|
||||
- Ninja
|
||||
- Yasm
|
||||
|
@ -156,7 +156,7 @@ Builds ClickHouse in various configurations for use in further steps. You have t
|
||||
|
||||
### Report Details
|
||||
|
||||
- **Compiler**: `clang-18`, optionally with the name of a target platform
|
||||
- **Compiler**: `clang-19`, optionally with the name of a target platform
|
||||
- **Build type**: `Debug` or `RelWithDebInfo` (cmake).
|
||||
- **Sanitizer**: `none` (without sanitizers), `address` (ASan), `memory` (MSan), `undefined` (UBSan), or `thread` (TSan).
|
||||
- **Status**: `success` or `fail`
|
||||
@ -180,7 +180,7 @@ Performs static analysis and code style checks using `clang-tidy`. The report is
|
||||
There is a convenience `packager` script that runs the clang-tidy build in docker
|
||||
```sh
|
||||
mkdir build_tidy
|
||||
./docker/packager/packager --output-dir=./build_tidy --package-type=binary --compiler=clang-18 --debug-build --clang-tidy
|
||||
./docker/packager/packager --output-dir=./build_tidy --package-type=binary --compiler=clang-19 --debug-build --clang-tidy
|
||||
```
|
||||
|
||||
|
||||
|
@ -121,7 +121,7 @@ While inside the `build` directory, configure your build by running CMake. Befor
|
||||
export CC=clang CXX=clang++
|
||||
cmake ..
|
||||
|
||||
If you installed clang using the automatic installation script above, also specify the version of clang installed in the first command, e.g. `export CC=clang-18 CXX=clang++-18`. The clang version will be in the script output.
|
||||
If you installed clang using the automatic installation script above, also specify the version of clang installed in the first command, e.g. `export CC=clang-19 CXX=clang++-19`. The clang version will be in the script output.
|
||||
|
||||
The `CC` variable specifies the compiler for C (short for C Compiler), and `CXX` variable instructs which C++ compiler is to be used for building.
|
||||
|
||||
|
@ -468,7 +468,7 @@ SELECT JSONLength('{"a": "hello", "b": [-100, 200.0, 300]}') = 2
|
||||
|
||||
### JSONType
|
||||
|
||||
Return the type of a JSON value. If the value does not exist, `Null` will be returned.
|
||||
Return the type of a JSON value. If the value does not exist, `Null=0` will be returned (not usual [Null](../data-types/nullable.md), but `Null=0` of `Enum8('Null' = 0, 'String' = 34,...`). .
|
||||
|
||||
**Syntax**
|
||||
|
||||
@ -488,7 +488,7 @@ JSONType(json [, indices_or_keys]...)
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns the type of a JSON value as a string, otherwise if the value doesn't exists it returns `Null`. [String](../data-types/string.md).
|
||||
- Returns the type of a JSON value as a string, otherwise if the value doesn't exists it returns `Null=0`. [Enum](../data-types/enum.md).
|
||||
|
||||
**Examples**
|
||||
|
||||
@ -520,7 +520,7 @@ JSONExtractUInt(json [, indices_or_keys]...)
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns a UInt value if it exists, otherwise it returns `Null`. [UInt64](../data-types/string.md).
|
||||
- Returns a UInt value if it exists, otherwise it returns `0`. [UInt64](../data-types/int-uint.md).
|
||||
|
||||
**Examples**
|
||||
|
||||
@ -560,7 +560,7 @@ JSONExtractInt(json [, indices_or_keys]...)
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns an Int value if it exists, otherwise it returns `Null`. [Int64](../data-types/int-uint.md).
|
||||
- Returns an Int value if it exists, otherwise it returns `0`. [Int64](../data-types/int-uint.md).
|
||||
|
||||
**Examples**
|
||||
|
||||
@ -600,7 +600,7 @@ JSONExtractFloat(json [, indices_or_keys]...)
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns an Float value if it exists, otherwise it returns `Null`. [Float64](../data-types/float.md).
|
||||
- Returns an Float value if it exists, otherwise it returns `0`. [Float64](../data-types/float.md).
|
||||
|
||||
**Examples**
|
||||
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions &, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
std::cout << "Disk: " << disk.getDisk()->getName() << "\nPath: " << disk.getCurrentPath() << std::endl;
|
||||
}
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
|
||||
const String & path_from = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path-from"));
|
||||
const String & path_to = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path-to"));
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
{
|
||||
bool recursive = options.count("recursive");
|
||||
bool show_hidden = options.count("all");
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
String path = getValueFromCommandLineOptionsWithDefault<String>(options, "path", ".");
|
||||
|
||||
if (recursive)
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
bool recursive = options.count("parents");
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
|
||||
String path = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path"));
|
||||
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
String path_from = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path-from"));
|
||||
std::optional<String> path_to = getValueFromCommandLineOptionsWithOptional<String>(options, "path-to");
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
const String & path = disk.getRelativeFromRoot(getValueFromCommandLineOptionsThrow<String>(options, "path"));
|
||||
bool recursive = options.count("recursive");
|
||||
if (disk.getDisk()->existsDirectory(path))
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
void executeImpl(const CommandLineOptions & options, DisksClient & client) override
|
||||
{
|
||||
auto disk = client.getCurrentDiskWithPath();
|
||||
const auto & disk = client.getCurrentDiskWithPath();
|
||||
String path = getValueFromCommandLineOptionsThrow<String>(options, "path");
|
||||
|
||||
disk.getDisk()->createFile(disk.getRelativeFromRoot(path));
|
||||
|
@ -129,7 +129,7 @@ std::vector<String> DisksApp::getCompletions(const String & prefix) const
|
||||
}
|
||||
if (arguments.size() == 1)
|
||||
{
|
||||
String command_prefix = arguments[0];
|
||||
const String & command_prefix = arguments[0];
|
||||
return getCommandsToComplete(command_prefix);
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ enum class FileChangeType : uint8_t
|
||||
Type,
|
||||
};
|
||||
|
||||
void writeText(FileChangeType type, WriteBuffer & out)
|
||||
static void writeText(FileChangeType type, WriteBuffer & out)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -299,7 +299,7 @@ enum class LineType : uint8_t
|
||||
Code,
|
||||
};
|
||||
|
||||
void writeText(LineType type, WriteBuffer & out)
|
||||
static void writeText(LineType type, WriteBuffer & out)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -429,7 +429,7 @@ using CommitDiff = std::map<std::string /* path */, FileDiff>;
|
||||
|
||||
/** Parsing helpers */
|
||||
|
||||
void skipUntilWhitespace(ReadBuffer & buf)
|
||||
static void skipUntilWhitespace(ReadBuffer & buf)
|
||||
{
|
||||
while (!buf.eof())
|
||||
{
|
||||
@ -444,7 +444,7 @@ void skipUntilWhitespace(ReadBuffer & buf)
|
||||
}
|
||||
}
|
||||
|
||||
void skipUntilNextLine(ReadBuffer & buf)
|
||||
static void skipUntilNextLine(ReadBuffer & buf)
|
||||
{
|
||||
while (!buf.eof())
|
||||
{
|
||||
@ -462,7 +462,7 @@ void skipUntilNextLine(ReadBuffer & buf)
|
||||
}
|
||||
}
|
||||
|
||||
void readStringUntilNextLine(std::string & s, ReadBuffer & buf)
|
||||
static void readStringUntilNextLine(std::string & s, ReadBuffer & buf)
|
||||
{
|
||||
s.clear();
|
||||
while (!buf.eof())
|
||||
@ -680,7 +680,7 @@ using Snapshot = std::map<std::string /* path */, FileBlame>;
|
||||
* - the author, time and commit of the previous change to every found line (blame).
|
||||
* And update the snapshot.
|
||||
*/
|
||||
void updateSnapshot(Snapshot & snapshot, const Commit & commit, CommitDiff & file_changes)
|
||||
static void updateSnapshot(Snapshot & snapshot, const Commit & commit, CommitDiff & file_changes)
|
||||
{
|
||||
/// Renames and copies.
|
||||
for (auto & elem : file_changes)
|
||||
@ -755,7 +755,7 @@ void updateSnapshot(Snapshot & snapshot, const Commit & commit, CommitDiff & fil
|
||||
*/
|
||||
using DiffHashes = std::unordered_set<UInt128>;
|
||||
|
||||
UInt128 diffHash(const CommitDiff & file_changes)
|
||||
static UInt128 diffHash(const CommitDiff & file_changes)
|
||||
{
|
||||
SipHash hasher;
|
||||
|
||||
@ -791,7 +791,7 @@ UInt128 diffHash(const CommitDiff & file_changes)
|
||||
* :100644 100644 828dedf6b5 828dedf6b5 R100 dbms/src/Functions/GeoUtils.h dbms/src/Functions/PolygonUtils.h
|
||||
* according to the output of 'git show --raw'
|
||||
*/
|
||||
void processFileChanges(
|
||||
static void processFileChanges(
|
||||
ReadBuffer & in,
|
||||
const Options & options,
|
||||
Commit & commit,
|
||||
@ -883,7 +883,7 @@ void processFileChanges(
|
||||
* - we expect some specific format of the diff; but it may actually depend on git config;
|
||||
* - non-ASCII file names are not processed correctly (they will not be found and will be ignored).
|
||||
*/
|
||||
void processDiffs(
|
||||
static void processDiffs(
|
||||
ReadBuffer & in,
|
||||
std::optional<size_t> size_limit,
|
||||
Commit & commit,
|
||||
@ -1055,7 +1055,7 @@ void processDiffs(
|
||||
|
||||
/** Process the "git show" result for a single commit. Append the result to tables.
|
||||
*/
|
||||
void processCommit(
|
||||
static void processCommit(
|
||||
ReadBuffer & in,
|
||||
const Options & options,
|
||||
size_t commit_num,
|
||||
@ -1123,7 +1123,7 @@ void processCommit(
|
||||
/** Runs child process and allows to read the result.
|
||||
* Multiple processes can be run for parallel processing.
|
||||
*/
|
||||
auto gitShow(const std::string & hash)
|
||||
static auto gitShow(const std::string & hash)
|
||||
{
|
||||
std::string command = fmt::format(
|
||||
"git show --raw --pretty='format:%ct%x00%aN%x00%P%x00%s%x00' --patch --unified=0 {}",
|
||||
@ -1135,7 +1135,7 @@ auto gitShow(const std::string & hash)
|
||||
|
||||
/** Obtain the list of commits and process them.
|
||||
*/
|
||||
void processLog(const Options & options)
|
||||
static void processLog(const Options & options)
|
||||
{
|
||||
ResultWriter result;
|
||||
|
||||
|
@ -63,7 +63,7 @@ int printHelp(int, char **)
|
||||
}
|
||||
|
||||
|
||||
bool isClickhouseApp(std::string_view app_suffix, std::vector<char *> & argv)
|
||||
static bool isClickhouseApp(std::string_view app_suffix, std::vector<char *> & argv)
|
||||
{
|
||||
/// Use app if the first arg 'app' is passed (the arg should be quietly removed)
|
||||
if (argv.size() >= 2)
|
||||
@ -132,7 +132,7 @@ __attribute__((constructor(0))) void init_je_malloc_message() { malloc_message =
|
||||
///
|
||||
/// extern bool inside_main;
|
||||
/// class C { C() { assert(inside_main); } };
|
||||
bool inside_main = false;
|
||||
static bool inside_main = false;
|
||||
|
||||
int main(int argc_, char ** argv_)
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ using ModelPtr = std::unique_ptr<IModel>;
|
||||
|
||||
|
||||
template <typename... Ts>
|
||||
UInt64 hash(Ts... xs)
|
||||
static UInt64 hash(Ts... xs)
|
||||
{
|
||||
SipHash hash;
|
||||
(hash.update(xs), ...);
|
||||
@ -271,7 +271,7 @@ public:
|
||||
|
||||
/// Pseudorandom permutation of mantissa.
|
||||
template <typename Float>
|
||||
Float transformFloatMantissa(Float x, UInt64 seed)
|
||||
static Float transformFloatMantissa(Float x, UInt64 seed)
|
||||
{
|
||||
using UInt = std::conditional_t<std::is_same_v<Float, Float32>, UInt32, UInt64>;
|
||||
constexpr size_t mantissa_num_bits = std::is_same_v<Float, Float32> ? 23 : 52;
|
||||
|
@ -32,7 +32,7 @@ namespace ErrorCodes
|
||||
* If test-mode option is added, files will be put by given url via PUT request.
|
||||
*/
|
||||
|
||||
void processFile(const fs::path & file_path, const fs::path & dst_path, bool test_mode, bool link, WriteBuffer & metadata_buf)
|
||||
static void processFile(const fs::path & file_path, const fs::path & dst_path, bool test_mode, bool link, WriteBuffer & metadata_buf)
|
||||
{
|
||||
String remote_path;
|
||||
RE2::FullMatch(file_path.string(), EXTRACT_PATH_PATTERN, &remote_path);
|
||||
@ -77,7 +77,7 @@ void processFile(const fs::path & file_path, const fs::path & dst_path, bool tes
|
||||
}
|
||||
|
||||
|
||||
void processTableFiles(const fs::path & data_path, fs::path dst_path, bool test_mode, bool link)
|
||||
static void processTableFiles(const fs::path & data_path, fs::path dst_path, bool test_mode, bool link)
|
||||
{
|
||||
std::cerr << "Data path: " << data_path << ", destination path: " << dst_path << std::endl;
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace ErrorCodes
|
||||
extern const int SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
void setUserAndGroup(std::string arg_uid, std::string arg_gid)
|
||||
static void setUserAndGroup(std::string arg_uid, std::string arg_gid)
|
||||
{
|
||||
static constexpr size_t buf_size = 16384; /// Linux man page says it is enough. Nevertheless, we will check if it's not enough and throw.
|
||||
std::unique_ptr<char[]> buf(new char[buf_size]);
|
||||
|
@ -53,7 +53,7 @@ String serializeAccessEntity(const IAccessEntity & entity)
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
AccessEntityPtr deserializeAccessEntityImpl(const String & definition)
|
||||
static AccessEntityPtr deserializeAccessEntityImpl(const String & definition)
|
||||
{
|
||||
ASTs queries;
|
||||
ParserAttachAccessEntity parser;
|
||||
|
@ -80,7 +80,7 @@ AuthenticationData::Digest AuthenticationData::Util::encodeBcrypt(std::string_vi
|
||||
if (ret != 0)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BCrypt library failed: bcrypt_gensalt returned {}", ret);
|
||||
|
||||
ret = bcrypt_hashpw(text.data(), salt, reinterpret_cast<char *>(hash.data()));
|
||||
ret = bcrypt_hashpw(text.data(), salt, reinterpret_cast<char *>(hash.data())); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
if (ret != 0)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BCrypt library failed: bcrypt_hashpw returned {}", ret);
|
||||
|
||||
@ -95,7 +95,7 @@ AuthenticationData::Digest AuthenticationData::Util::encodeBcrypt(std::string_vi
|
||||
bool AuthenticationData::Util::checkPasswordBcrypt(std::string_view password [[maybe_unused]], const Digest & password_bcrypt [[maybe_unused]])
|
||||
{
|
||||
#if USE_BCRYPT
|
||||
int ret = bcrypt_checkpw(password.data(), reinterpret_cast<const char *>(password_bcrypt.data()));
|
||||
int ret = bcrypt_checkpw(password.data(), reinterpret_cast<const char *>(password_bcrypt.data())); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
/// Before 24.6 we didn't validate hashes on creation, so it could be that the stored hash is invalid
|
||||
/// and it could not be decoded by the library
|
||||
if (ret == -1)
|
||||
|
@ -371,7 +371,7 @@ void ExternalAuthenticators::setConfiguration(const Poco::Util::AbstractConfigur
|
||||
}
|
||||
}
|
||||
|
||||
UInt128 computeParamsHash(const LDAPClient::Params & params, const LDAPClient::RoleSearchParamsList * role_search_params)
|
||||
static UInt128 computeParamsHash(const LDAPClient::Params & params, const LDAPClient::RoleSearchParamsList * role_search_params)
|
||||
{
|
||||
SipHash hash;
|
||||
params.updateHash(hash);
|
||||
|
@ -36,7 +36,7 @@ void SettingsProfileElement::init(const ASTSettingsProfileElement & ast, const A
|
||||
if (id_mode)
|
||||
return parse<UUID>(name_);
|
||||
assert(access_control);
|
||||
return access_control->getID<SettingsProfile>(name_);
|
||||
return access_control->getID<SettingsProfile>(name_); /// NOLINT(clang-analyzer-core.CallAndMessage)
|
||||
};
|
||||
|
||||
if (!ast.parent_profile.empty())
|
||||
|
@ -139,7 +139,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
AggregateFunctionPtr createAggregateFunctionDistinctDynamicTypes(
|
||||
static AggregateFunctionPtr createAggregateFunctionDistinctDynamicTypes(
|
||||
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
|
||||
{
|
||||
assertNoParameters(name, parameters);
|
||||
|
@ -327,7 +327,7 @@ private:
|
||||
};
|
||||
|
||||
template <typename Data>
|
||||
AggregateFunctionPtr createAggregateFunctionDistinctJSONPathsAndTypes(
|
||||
static AggregateFunctionPtr createAggregateFunctionDistinctJSONPathsAndTypes(
|
||||
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
|
||||
{
|
||||
assertNoParameters(name, parameters);
|
||||
|
@ -217,7 +217,7 @@ static void fillColumn(DB::PaddedPODArray<UInt8> & chars, DB::PaddedPODArray<UIn
|
||||
insertData(chars, offsets, str.data() + start, end - start);
|
||||
}
|
||||
|
||||
void dumpFlameGraph(
|
||||
static void dumpFlameGraph(
|
||||
const AggregateFunctionFlameGraphTree::Traces & traces,
|
||||
DB::PaddedPODArray<UInt8> & chars,
|
||||
DB::PaddedPODArray<UInt64> & offsets)
|
||||
@ -630,7 +630,7 @@ static void check(const std::string & name, const DataTypes & argument_types, co
|
||||
name, argument_types[2]->getName());
|
||||
}
|
||||
|
||||
AggregateFunctionPtr createAggregateFunctionFlameGraph(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings * settings)
|
||||
static AggregateFunctionPtr createAggregateFunctionFlameGraph(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings * settings)
|
||||
{
|
||||
if (!(*settings)[Setting::allow_introspection_functions])
|
||||
throw Exception(ErrorCodes::FUNCTION_NOT_ALLOWED,
|
||||
|
@ -95,7 +95,7 @@ struct GroupArraySamplerData
|
||||
|
||||
/// With a large number of values, we will generate random numbers several times slower.
|
||||
if (lim <= static_cast<UInt64>(pcg32_fast::max()))
|
||||
return rng() % lim;
|
||||
return rng() % lim; /// NOLINT(clang-analyzer-core.DivideZero)
|
||||
return (static_cast<UInt64>(rng()) * (static_cast<UInt64>(pcg32::max()) + 1ULL) + static_cast<UInt64>(rng())) % lim;
|
||||
}
|
||||
|
||||
@ -494,7 +494,7 @@ class GroupArrayGeneralImpl final
|
||||
{
|
||||
static constexpr bool limit_num_elems = Trait::has_limit;
|
||||
using Data = GroupArrayGeneralData<Node, Trait::sampler != Sampler::NONE>;
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); }
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); } /// NOLINT(readability-non-const-parameter)
|
||||
static const Data & data(ConstAggregateDataPtr __restrict place) { return *reinterpret_cast<const Data *>(place); }
|
||||
|
||||
DataTypePtr & data_type;
|
||||
|
@ -179,7 +179,7 @@ class SequenceNextNodeImpl final
|
||||
using Self = SequenceNextNodeImpl<T, Node>;
|
||||
|
||||
using Data = SequenceNextNodeGeneralData<Node>;
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); }
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); } /// NOLINT(readability-non-const-parameter)
|
||||
static const Data & data(ConstAggregateDataPtr __restrict place) { return *reinterpret_cast<const Data *>(place); }
|
||||
|
||||
static constexpr size_t base_cond_column_idx = 2;
|
||||
|
@ -694,7 +694,7 @@ class IAggregateFunctionDataHelper : public IAggregateFunctionHelper<Derived>
|
||||
protected:
|
||||
using Data = T;
|
||||
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); }
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); } /// NOLINT(readability-non-const-parameter)
|
||||
static const Data & data(ConstAggregateDataPtr __restrict place) { return *reinterpret_cast<const Data *>(place); }
|
||||
|
||||
public:
|
||||
|
@ -259,7 +259,7 @@ private:
|
||||
|
||||
/// With a large number of values, we will generate random numbers several times slower.
|
||||
if (limit <= static_cast<UInt64>(pcg32_fast::max()))
|
||||
return rng() % limit;
|
||||
return rng() % limit; /// NOLINT(clang-analyzer-core.DivideZero)
|
||||
return (static_cast<UInt64>(rng()) * (static_cast<UInt64>(pcg32_fast::max()) + 1ULL) + static_cast<UInt64>(rng())) % limit;
|
||||
}
|
||||
|
||||
|
@ -100,13 +100,13 @@ replxx::Replxx::completions_t LineReader::Suggest::getCompletions(const String &
|
||||
range = std::equal_range(
|
||||
to_search.begin(), to_search.end(), last_word, [prefix_length](std::string_view s, std::string_view prefix_searched)
|
||||
{
|
||||
return strncasecmp(s.data(), prefix_searched.data(), prefix_length) < 0;
|
||||
return strncasecmp(s.data(), prefix_searched.data(), prefix_length) < 0; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
});
|
||||
else
|
||||
range = std::equal_range(
|
||||
to_search.begin(), to_search.end(), last_word, [prefix_length](std::string_view s, std::string_view prefix_searched)
|
||||
{
|
||||
return strncmp(s.data(), prefix_searched.data(), prefix_length) < 0;
|
||||
return strncmp(s.data(), prefix_searched.data(), prefix_length) < 0; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
});
|
||||
|
||||
return replxx::Replxx::completions_t(range.first, range.second);
|
||||
|
@ -121,7 +121,7 @@ void TerminalKeystrokeInterceptor::runImpl(const DB::TerminalKeystrokeIntercepto
|
||||
if (available <= 0)
|
||||
return;
|
||||
|
||||
if (read(fd, &ch, 1) > 0)
|
||||
if (read(fd, &ch, 1) > 0) /// NOLINT(clang-analyzer-unix.BlockInCriticalSection)
|
||||
{
|
||||
auto it = map.find(ch);
|
||||
if (it != map.end())
|
||||
|
@ -440,7 +440,7 @@ bool ColumnObject::tryInsert(const Field & x)
|
||||
column->popBack(column->size() - prev_size);
|
||||
}
|
||||
|
||||
if (shared_data_paths->size() != prev_paths_size)
|
||||
if (shared_data_paths->size() != prev_paths_size) /// NOLINT(clang-analyzer-core.NullDereference)
|
||||
shared_data_paths->popBack(shared_data_paths->size() - prev_paths_size);
|
||||
if (shared_data_values->size() != prev_values_size)
|
||||
shared_data_values->popBack(shared_data_values->size() - prev_values_size);
|
||||
|
@ -815,6 +815,15 @@ bool isColumnNullableOrLowCardinalityNullable(const IColumn & column);
|
||||
template <typename Derived, typename Parent = IColumn>
|
||||
class IColumnHelper : public Parent
|
||||
{
|
||||
private:
|
||||
using Self = IColumnHelper<Derived, Parent>;
|
||||
|
||||
friend Derived;
|
||||
friend class COWHelper<Self, Derived>;
|
||||
|
||||
IColumnHelper() = default;
|
||||
IColumnHelper(const IColumnHelper &) = default;
|
||||
|
||||
/// Devirtualize insertFrom.
|
||||
MutableColumns scatter(IColumn::ColumnIndex num_columns, const IColumn::Selector & selector) const override;
|
||||
|
||||
|
@ -13,6 +13,7 @@ TEST(IColumn, dumpStructure)
|
||||
String expected_structure = "LowCardinality(size = 0, UInt8(size = 0), Unique(size = 1, String(size = 1)))";
|
||||
|
||||
std::vector<std::thread> threads;
|
||||
threads.reserve(6);
|
||||
for (size_t i = 0; i < 6; ++i)
|
||||
{
|
||||
threads.emplace_back([&]
|
||||
|
@ -724,14 +724,14 @@ void AsyncLoader::enqueue(Info & info, const LoadJobPtr & job, std::unique_lock<
|
||||
// (when high-priority job A function waits for a lower-priority job B, and B never starts due to its priority)
|
||||
// 4) Resolve "blocked pool" deadlocks -- spawn more workers
|
||||
// (when job A in pool P waits for another ready job B in P, but B never starts because there are no free workers in P)
|
||||
thread_local LoadJob * current_load_job = nullptr;
|
||||
static thread_local LoadJob * current_load_job = nullptr;
|
||||
|
||||
size_t currentPoolOr(size_t pool)
|
||||
{
|
||||
return current_load_job ? current_load_job->executionPool() : pool;
|
||||
}
|
||||
|
||||
bool detectWaitDependentDeadlock(const LoadJobPtr & waited)
|
||||
bool static detectWaitDependentDeadlock(const LoadJobPtr & waited)
|
||||
{
|
||||
if (waited.get() == current_load_job)
|
||||
return true;
|
||||
|
@ -75,10 +75,15 @@
|
||||
template <typename Derived>
|
||||
class COW : public boost::intrusive_ref_counter<Derived>
|
||||
{
|
||||
friend Derived;
|
||||
|
||||
private:
|
||||
Derived * derived() { return static_cast<Derived *>(this); }
|
||||
const Derived * derived() const { return static_cast<const Derived *>(this); }
|
||||
|
||||
COW() = default;
|
||||
COW(const COW&) = default;
|
||||
|
||||
protected:
|
||||
template <typename T>
|
||||
class mutable_ptr : public boost::intrusive_ptr<T> /// NOLINT
|
||||
@ -271,10 +276,15 @@ public:
|
||||
template <typename Base, typename Derived>
|
||||
class COWHelper : public Base
|
||||
{
|
||||
friend Derived;
|
||||
|
||||
private:
|
||||
Derived * derived() { return static_cast<Derived *>(this); }
|
||||
const Derived * derived() const { return static_cast<const Derived *>(this); }
|
||||
|
||||
COWHelper() = default;
|
||||
COWHelper(const COWHelper &) = default;
|
||||
|
||||
public:
|
||||
using Ptr = typename Base::template immutable_ptr<Derived>;
|
||||
using MutablePtr = typename Base::template mutable_ptr<Derived>;
|
||||
|
@ -161,7 +161,7 @@ public:
|
||||
|
||||
FindResultImpl(Mapped * value_, bool found_, size_t off)
|
||||
: FindResultImplBase(found_), FindResultImplOffsetBase<need_offset>(off), value(value_) {}
|
||||
Mapped & getMapped() const { return *value; }
|
||||
Mapped & getMapped() const { return *value; } /// NOLINT(clang-analyzer-core.uninitialized.UndefReturn)
|
||||
};
|
||||
|
||||
template <bool need_offset>
|
||||
|
@ -377,7 +377,7 @@ String DNSResolver::getHostName()
|
||||
return *impl->host_name;
|
||||
}
|
||||
|
||||
static const String & cacheElemToString(const String & str) { return str; }
|
||||
static String cacheElemToString(String str) { return str; }
|
||||
static String cacheElemToString(const Poco::Net::IPAddress & addr) { return addr.toString(); }
|
||||
|
||||
template <typename UpdateF, typename ElemsT>
|
||||
|
@ -22,7 +22,7 @@ namespace ErrorCodes
|
||||
}
|
||||
|
||||
/// Embedded timezones.
|
||||
std::string_view getTimeZone(const char * name);
|
||||
std::string_view getTimeZone(const char * name); /// NOLINT(misc-use-internal-linkage)
|
||||
|
||||
|
||||
namespace
|
||||
|
@ -256,7 +256,7 @@ uint64_t readOffset(std::string_view & sp, bool is64_bit)
|
||||
std::string_view readBytes(std::string_view & sp, uint64_t len)
|
||||
{
|
||||
SAFE_CHECK(len <= sp.size(), "invalid string length: {} vs. {}", len, sp.size());
|
||||
std::string_view ret(sp.data(), len);
|
||||
std::string_view ret(sp.data(), len); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
sp.remove_prefix(len);
|
||||
return ret;
|
||||
}
|
||||
@ -266,7 +266,7 @@ std::string_view readNullTerminated(std::string_view & sp)
|
||||
{
|
||||
const char * p = static_cast<const char *>(memchr(sp.data(), 0, sp.size()));
|
||||
SAFE_CHECK(p, "invalid null-terminated string");
|
||||
std::string_view ret(sp.data(), p - sp.data());
|
||||
std::string_view ret(sp.data(), p - sp.data()); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
sp = std::string_view(p + 1, sp.size());
|
||||
return ret;
|
||||
}
|
||||
@ -442,7 +442,7 @@ bool Dwarf::Section::next(std::string_view & chunk)
|
||||
is64_bit = (initial_length == uint32_t(-1));
|
||||
auto length = is64_bit ? read<uint64_t>(chunk) : initial_length;
|
||||
SAFE_CHECK(length <= chunk.size(), "invalid DWARF section");
|
||||
chunk = std::string_view(chunk.data(), length);
|
||||
chunk = std::string_view(chunk.data(), length); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
data = std::string_view(chunk.end(), data.end() - chunk.end());
|
||||
return true;
|
||||
}
|
||||
@ -937,7 +937,7 @@ bool Dwarf::findDebugInfoOffset(uintptr_t address, std::string_view aranges, uin
|
||||
// Padded to a multiple of 2 addresses.
|
||||
// Strangely enough, this is the only place in the DWARF spec that requires
|
||||
// padding.
|
||||
skipPadding(chunk, aranges.data(), 2 * sizeof(uintptr_t));
|
||||
skipPadding(chunk, aranges.data(), 2 * sizeof(uintptr_t)); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
for (;;)
|
||||
{
|
||||
auto start = read<uintptr_t>(chunk);
|
||||
@ -1681,7 +1681,7 @@ struct LineNumberAttribute
|
||||
std::variant<uint64_t, std::string_view> attr_value;
|
||||
};
|
||||
|
||||
LineNumberAttribute readLineNumberAttribute(
|
||||
LineNumberAttribute static readLineNumberAttribute(
|
||||
bool is64_bit, std::string_view & format, std::string_view & entries, std::string_view debugStr, std::string_view debugLineStr)
|
||||
{
|
||||
uint64_t content_type_code = readULEB(format);
|
||||
@ -1817,7 +1817,7 @@ void Dwarf::LineNumberVM::init()
|
||||
}
|
||||
uint64_t header_length = readOffset(data_, is64Bit_);
|
||||
SAFE_CHECK(header_length <= data_.size(), "invalid line number VM header length");
|
||||
std::string_view header(data_.data(), header_length);
|
||||
std::string_view header(data_.data(), header_length); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
data_ = std::string_view(header.end(), data_.end() - header.end());
|
||||
|
||||
minLength_ = read<uint8_t>(header);
|
||||
@ -1846,7 +1846,7 @@ void Dwarf::LineNumberVM::init()
|
||||
{
|
||||
++v4_.includeDirectoryCount;
|
||||
}
|
||||
v4_.includeDirectories = {tmp, header.data()};
|
||||
v4_.includeDirectories = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
|
||||
tmp = header.data();
|
||||
FileName fn;
|
||||
@ -1855,7 +1855,7 @@ void Dwarf::LineNumberVM::init()
|
||||
{
|
||||
++v4_.fileNameCount;
|
||||
}
|
||||
v4_.fileNames = {tmp, header.data()};
|
||||
v4_.fileNames = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
}
|
||||
else if (version_ == 5)
|
||||
{
|
||||
@ -1868,7 +1868,7 @@ void Dwarf::LineNumberVM::init()
|
||||
readULEB(header); // A content type code
|
||||
readULEB(header); // A form code using the attribute form codes
|
||||
}
|
||||
v5_.directoryEntryFormat = {tmp, header.data()};
|
||||
v5_.directoryEntryFormat = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
v5_.directoriesCount = readULEB(header);
|
||||
tmp = header.data();
|
||||
for (uint64_t i = 0; i < v5_.directoriesCount; i++)
|
||||
@ -1879,7 +1879,7 @@ void Dwarf::LineNumberVM::init()
|
||||
readLineNumberAttribute(is64Bit_, format, header, debugStr_, debugLineStr_);
|
||||
}
|
||||
}
|
||||
v5_.directories = {tmp, header.data()};
|
||||
v5_.directories = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
|
||||
v5_.fileNameEntryFormatCount = read<uint8_t>(header);
|
||||
tmp = header.data();
|
||||
@ -1890,7 +1890,7 @@ void Dwarf::LineNumberVM::init()
|
||||
readULEB(header); // A content type code
|
||||
readULEB(header); // A form code using the attribute form codes
|
||||
}
|
||||
v5_.fileNameEntryFormat = {tmp, header.data()};
|
||||
v5_.fileNameEntryFormat = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
v5_.fileNamesCount = readULEB(header);
|
||||
tmp = header.data();
|
||||
for (uint64_t i = 0; i < v5_.fileNamesCount; i++)
|
||||
@ -1901,7 +1901,7 @@ void Dwarf::LineNumberVM::init()
|
||||
readLineNumberAttribute(is64Bit_, format, header, debugStr_, debugLineStr_);
|
||||
}
|
||||
}
|
||||
v5_.fileNames = {tmp, header.data()};
|
||||
v5_.fileNames = {tmp, header.data()}; /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ namespace ErrorCodes
|
||||
APPLY_FOR_ERROR_CODES(M)
|
||||
#undef M
|
||||
}
|
||||
} error_codes_names;
|
||||
} static error_codes_names;
|
||||
|
||||
std::string_view getName(ErrorCode error_code)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ std::function<void(const std::string & msg, int code, bool remote, const Excepti
|
||||
|
||||
/// - Aborts the process if error code is LOGICAL_ERROR.
|
||||
/// - Increments error codes statistics.
|
||||
void handle_error_code(const std::string & msg, int code, bool remote, const Exception::FramePointers & trace)
|
||||
static void handle_error_code(const std::string & msg, int code, bool remote, const Exception::FramePointers & trace)
|
||||
{
|
||||
// In debug builds and builds with sanitizers, treat LOGICAL_ERROR as an assertion failure.
|
||||
// Log the message before we fail.
|
||||
|
@ -94,7 +94,7 @@ namespace ErrorCodes
|
||||
}
|
||||
|
||||
|
||||
IHTTPConnectionPoolForEndpoint::Metrics getMetricsForStorageConnectionPool()
|
||||
static IHTTPConnectionPoolForEndpoint::Metrics getMetricsForStorageConnectionPool()
|
||||
{
|
||||
return IHTTPConnectionPoolForEndpoint::Metrics{
|
||||
.created = ProfileEvents::StorageConnectionsCreated,
|
||||
@ -110,7 +110,7 @@ IHTTPConnectionPoolForEndpoint::Metrics getMetricsForStorageConnectionPool()
|
||||
}
|
||||
|
||||
|
||||
IHTTPConnectionPoolForEndpoint::Metrics getMetricsForDiskConnectionPool()
|
||||
static IHTTPConnectionPoolForEndpoint::Metrics getMetricsForDiskConnectionPool()
|
||||
{
|
||||
return IHTTPConnectionPoolForEndpoint::Metrics{
|
||||
.created = ProfileEvents::DiskConnectionsCreated,
|
||||
@ -126,7 +126,7 @@ IHTTPConnectionPoolForEndpoint::Metrics getMetricsForDiskConnectionPool()
|
||||
}
|
||||
|
||||
|
||||
IHTTPConnectionPoolForEndpoint::Metrics getMetricsForHTTPConnectionPool()
|
||||
static IHTTPConnectionPoolForEndpoint::Metrics getMetricsForHTTPConnectionPool()
|
||||
{
|
||||
return IHTTPConnectionPoolForEndpoint::Metrics{
|
||||
.created = ProfileEvents::HTTPConnectionsCreated,
|
||||
@ -142,7 +142,7 @@ IHTTPConnectionPoolForEndpoint::Metrics getMetricsForHTTPConnectionPool()
|
||||
}
|
||||
|
||||
|
||||
IHTTPConnectionPoolForEndpoint::Metrics getConnectionPoolMetrics(HTTPConnectionGroupType type)
|
||||
static IHTTPConnectionPoolForEndpoint::Metrics getConnectionPoolMetrics(HTTPConnectionGroupType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -779,7 +779,7 @@ struct Hasher
|
||||
}
|
||||
};
|
||||
|
||||
IExtendedPool::Ptr
|
||||
static IExtendedPool::Ptr
|
||||
createConnectionPool(ConnectionGroup::Ptr group, std::string host, UInt16 port, bool secure, ProxyConfiguration proxy_configuration)
|
||||
{
|
||||
if (secure)
|
||||
|
@ -172,7 +172,7 @@ struct HashTableCell
|
||||
const value_type & getValue() const { return key; }
|
||||
|
||||
/// Get the key (internally).
|
||||
static const Key & getKey(const value_type & value) { return value; }
|
||||
static const Key & getKey(const value_type & value) { return value; } /// NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
|
||||
/// Are the keys at the cells equal?
|
||||
bool keyEquals(const Key & key_) const { return bitEquals(key, key_); }
|
||||
|
@ -50,7 +50,7 @@
|
||||
* After the call to keyHolderPersistKey(), must return the persistent key.
|
||||
*/
|
||||
template <typename Key>
|
||||
inline Key & ALWAYS_INLINE keyHolderGetKey(Key && key) { return key; }
|
||||
inline Key & ALWAYS_INLINE keyHolderGetKey(Key && key) { return key; } /// NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
|
||||
/**
|
||||
* Make the key persistent. keyHolderGetKey() must return the persistent key
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
auto it = case_insensitive_name_mapping.find(Poco::toLower(name));
|
||||
if (it != case_insensitive_name_mapping.end())
|
||||
return it->second;
|
||||
return name;
|
||||
return name; /// NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
}
|
||||
|
||||
~IFactoryWithAliases() override = default;
|
||||
|
@ -633,7 +633,7 @@ private:
|
||||
static const Interval & getInterval(const IntervalWithValue & interval_with_value)
|
||||
{
|
||||
if constexpr (is_empty_value)
|
||||
return interval_with_value;
|
||||
return interval_with_value; /// NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
else
|
||||
return interval_with_value.first;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
|
||||
// At least for long strings, the following should be fast. We could
|
||||
// do better by integrating the checks and the insertion.
|
||||
buffer.insert(unescaped.data(), unescaped.data() + i);
|
||||
buffer.insert(unescaped.data(), unescaped.data() + i); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
// We caught a control character if we enter this loop (slow).
|
||||
// Note that we are do not restart from the beginning, but rather we continue
|
||||
// from the point where we encountered something that requires escaping.
|
||||
|
@ -24,7 +24,7 @@ namespace OpenTelemetry
|
||||
{
|
||||
|
||||
/// This code can be executed inside fibers, we should use fiber local tracing context.
|
||||
thread_local FiberLocal<TracingContextOnThread> current_trace_context;
|
||||
thread_local static FiberLocal<TracingContextOnThread> current_trace_context;
|
||||
|
||||
bool Span::addAttribute(std::string_view name, UInt64 value) noexcept
|
||||
{
|
||||
|
@ -525,7 +525,7 @@ PageChunk * PageCache::getFreeChunk()
|
||||
PageChunk * chunk = &lru.front();
|
||||
lru.erase(lru.iterator_to(*chunk));
|
||||
|
||||
size_t prev_pin_count = chunk->pin_count.fetch_add(1);
|
||||
size_t prev_pin_count = chunk->pin_count.fetch_add(1); /// NOLINT(clang-analyzer-deadcode.DeadStores)
|
||||
chassert(prev_pin_count == 0);
|
||||
|
||||
evictChunk(chunk);
|
||||
@ -537,7 +537,7 @@ void PageCache::evictChunk(PageChunk * chunk)
|
||||
{
|
||||
if (chunk->key.has_value())
|
||||
{
|
||||
size_t erased = chunk_by_key.erase(chunk->key.value());
|
||||
size_t erased = chunk_by_key.erase(chunk->key.value()); /// NOLINT(clang-analyzer-deadcode.DeadStores)
|
||||
chassert(erased);
|
||||
chunk->key.reset();
|
||||
}
|
||||
|
@ -922,7 +922,7 @@ namespace ProfileEvents
|
||||
constexpr Event END = Event(__COUNTER__);
|
||||
|
||||
/// Global variable, initialized by zeros.
|
||||
Counter global_counters_array[END] {};
|
||||
static Counter global_counters_array[END] {};
|
||||
/// Initialize global counters statically
|
||||
Counters global_counters(global_counters_array);
|
||||
|
||||
|
@ -1287,9 +1287,9 @@ void QueryFuzzer::addTableLike(ASTPtr ast)
|
||||
if (table_like_map.size() > AST_FUZZER_PART_TYPE_CAP)
|
||||
{
|
||||
const auto iter = std::next(table_like.begin(), fuzz_rand() % table_like.size());
|
||||
const auto ast_del = *iter;
|
||||
table_like.erase(iter);
|
||||
const auto & ast_del = *iter;
|
||||
table_like_map.erase(ast_del.first);
|
||||
table_like.erase(iter);
|
||||
}
|
||||
|
||||
const auto name = ast->formatForErrorMessage();
|
||||
@ -1308,9 +1308,9 @@ void QueryFuzzer::addColumnLike(ASTPtr ast)
|
||||
if (column_like_map.size() > AST_FUZZER_PART_TYPE_CAP)
|
||||
{
|
||||
const auto iter = std::next(column_like.begin(), fuzz_rand() % column_like.size());
|
||||
const auto ast_del = *iter;
|
||||
column_like.erase(iter);
|
||||
const auto & ast_del = *iter;
|
||||
column_like_map.erase(ast_del.first);
|
||||
column_like.erase(iter);
|
||||
}
|
||||
|
||||
const auto name = ast->formatForErrorMessage();
|
||||
|
@ -53,13 +53,15 @@ private:
|
||||
template <typename ProfilerImpl>
|
||||
class QueryProfilerBase
|
||||
{
|
||||
friend ProfilerImpl;
|
||||
|
||||
public:
|
||||
QueryProfilerBase(UInt64 thread_id, int clock_type, UInt64 period, int pause_signal_);
|
||||
~QueryProfilerBase();
|
||||
|
||||
void setPeriod(UInt64 period_);
|
||||
|
||||
private:
|
||||
QueryProfilerBase(UInt64 thread_id, int clock_type, UInt64 period, int pause_signal_);
|
||||
void cleanup();
|
||||
|
||||
LoggerPtr log;
|
||||
|
@ -42,6 +42,11 @@ namespace DB
|
||||
template <typename Derived, typename MutexType = SharedMutex>
|
||||
class TSA_CAPABILITY("SharedMutexHelper") SharedMutexHelper
|
||||
{
|
||||
friend Derived;
|
||||
private:
|
||||
SharedMutexHelper() = default;
|
||||
SharedMutexHelper(const SharedMutexHelper&) = default;
|
||||
|
||||
public:
|
||||
// Exclusive ownership
|
||||
void lock() TSA_ACQUIRE() /// NOLINT
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include <sys/wait.h>
|
||||
#include <dlfcn.h>
|
||||
#include <unistd.h>
|
||||
#include <csignal>
|
||||
|
||||
#include <Common/logger_useful.h>
|
||||
#include <base/errnoToString.h>
|
||||
@ -154,6 +153,9 @@ std::unique_ptr<ShellCommand> ShellCommand::executeImpl(
|
||||
std::vector<std::unique_ptr<PipeFDs>> read_pipe_fds;
|
||||
std::vector<std::unique_ptr<PipeFDs>> write_pipe_fds;
|
||||
|
||||
read_pipe_fds.reserve(config.read_fds.size());
|
||||
write_pipe_fds.reserve(config.write_fds.size());
|
||||
|
||||
for (size_t i = 0; i < config.read_fds.size(); ++i)
|
||||
read_pipe_fds.emplace_back(std::make_unique<PipeFDs>());
|
||||
|
||||
|
@ -632,7 +632,7 @@ void HandledSignals::setupCommonDeadlySignalHandlers()
|
||||
{
|
||||
/// SIGTSTP is added for debugging purposes. To output a stack trace of any running thread at anytime.
|
||||
/// NOTE: that it is also used by clickhouse-test wrapper
|
||||
addSignalHandler({SIGABRT, SIGSEGV, SIGILL, SIGBUS, SIGSYS, SIGFPE, SIGPIPE, SIGTSTP, SIGTRAP}, signalHandler, true);
|
||||
addSignalHandler({SIGABRT, SIGSEGV, SIGILL, SIGBUS, SIGSYS, SIGFPE, SIGTSTP, SIGTRAP}, signalHandler, true);
|
||||
|
||||
#if defined(SANITIZER)
|
||||
__sanitizer_set_death_callback(sanitizerDeathCallback);
|
||||
|
@ -60,7 +60,7 @@ void StackTrace::setShowAddresses(bool show)
|
||||
show_addresses.store(show, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
std::string SigsegvErrorString(const siginfo_t & info, [[maybe_unused]] const ucontext_t & context)
|
||||
static std::string SigsegvErrorString(const siginfo_t & info, [[maybe_unused]] const ucontext_t & context)
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
std::string address
|
||||
@ -99,7 +99,7 @@ std::string SigsegvErrorString(const siginfo_t & info, [[maybe_unused]] const uc
|
||||
return fmt::format("Address: {}. Access: {}. {}.", std::move(address), access, message);
|
||||
}
|
||||
|
||||
constexpr std::string_view SigbusErrorString(int si_code)
|
||||
static constexpr std::string_view SigbusErrorString(int si_code)
|
||||
{
|
||||
switch (si_code)
|
||||
{
|
||||
@ -124,7 +124,7 @@ constexpr std::string_view SigbusErrorString(int si_code)
|
||||
}
|
||||
}
|
||||
|
||||
constexpr std::string_view SigfpeErrorString(int si_code)
|
||||
static constexpr std::string_view SigfpeErrorString(int si_code)
|
||||
{
|
||||
switch (si_code)
|
||||
{
|
||||
@ -149,7 +149,7 @@ constexpr std::string_view SigfpeErrorString(int si_code)
|
||||
}
|
||||
}
|
||||
|
||||
constexpr std::string_view SigillErrorString(int si_code)
|
||||
static constexpr std::string_view SigillErrorString(int si_code)
|
||||
{
|
||||
switch (si_code)
|
||||
{
|
||||
@ -436,7 +436,7 @@ struct StackTraceTriple
|
||||
template <class T>
|
||||
concept MaybeRef = std::is_same_v<T, StackTraceTriple> || std::is_same_v<T, StackTraceRefTriple>;
|
||||
|
||||
constexpr bool operator<(const MaybeRef auto & left, const MaybeRef auto & right)
|
||||
static constexpr bool operator<(const MaybeRef auto & left, const MaybeRef auto & right)
|
||||
{
|
||||
return std::tuple{left.pointers, left.size, left.offset} < std::tuple{right.pointers, right.size, right.offset};
|
||||
}
|
||||
@ -542,7 +542,7 @@ static StackTraceCache cache;
|
||||
|
||||
static DB::SharedMutex stacktrace_cache_mutex;
|
||||
|
||||
String toStringCached(const StackTrace::FramePointers & pointers, size_t offset, size_t size)
|
||||
static String toStringCached(const StackTrace::FramePointers & pointers, size_t offset, size_t size)
|
||||
{
|
||||
const StackTraceRefTriple key{pointers, offset, size};
|
||||
|
||||
|
@ -23,7 +23,7 @@ bool endsWith(const std::string & s, const char * suffix, size_t suffix_size)
|
||||
}
|
||||
|
||||
DECLARE_DEFAULT_CODE(
|
||||
bool isAllASCII(const UInt8 * data, size_t size)
|
||||
static bool isAllASCII(const UInt8 * data, size_t size)
|
||||
{
|
||||
UInt8 mask = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
@ -34,7 +34,7 @@ bool isAllASCII(const UInt8 * data, size_t size)
|
||||
|
||||
DECLARE_SSE42_SPECIFIC_CODE(
|
||||
/// Copy from https://github.com/lemire/fastvalidate-utf-8/blob/master/include/simdasciicheck.h
|
||||
bool isAllASCII(const UInt8 * data, size_t size)
|
||||
static bool isAllASCII(const UInt8 * data, size_t size)
|
||||
{
|
||||
__m128i masks = _mm_setzero_si128();
|
||||
|
||||
@ -55,7 +55,7 @@ bool isAllASCII(const UInt8 * data, size_t size)
|
||||
})
|
||||
|
||||
DECLARE_AVX2_SPECIFIC_CODE(
|
||||
bool isAllASCII(const UInt8 * data, size_t size)
|
||||
static bool isAllASCII(const UInt8 * data, size_t size)
|
||||
{
|
||||
__m256i masks = _mm256_setzero_si256();
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
UInt32 getSupportedArchs()
|
||||
static UInt32 getSupportedArchs()
|
||||
{
|
||||
UInt32 result = 0;
|
||||
if (CPU::CPUFlagsCache::have_SSE42)
|
||||
|
@ -132,7 +132,7 @@ void TimerDescriptor::drain() const
|
||||
throw ErrnoException(ErrorCodes::CANNOT_READ_FROM_SOCKET, "Cannot drain timer_fd {}", timer_fd);
|
||||
}
|
||||
|
||||
chassert(res == sizeof(buf));
|
||||
chassert(res == sizeof(buf)); /// NOLINT(bugprone-sizeof-expression)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,12 @@ namespace DB
|
||||
template <class Base>
|
||||
class TypePromotion
|
||||
{
|
||||
friend Base;
|
||||
|
||||
private:
|
||||
TypePromotion() = default;
|
||||
// TypePromotion(const TypePromotion &) = default;
|
||||
|
||||
/// Need a helper-struct to fight the lack of the function-template partial specialization.
|
||||
template <class T, bool is_const, bool is_ref = std::is_reference_v<T>>
|
||||
struct CastHelper;
|
||||
|
@ -159,7 +159,7 @@ protected:
|
||||
};
|
||||
|
||||
template <typename Derived, typename Base, typename Visitor>
|
||||
class Visitable : public Base
|
||||
class Visitable : public Base /// NOLINT(bugprone-crtp-constructor-accessibility)
|
||||
{
|
||||
public:
|
||||
void accept(Visitor & visitor) override { visitor.visit(*static_cast<Derived *>(this)); }
|
||||
|
@ -17,6 +17,8 @@ try
|
||||
|
||||
size_t num_threads = DB::parse<size_t>(argv[1]);
|
||||
std::vector<std::thread> threads;
|
||||
threads.reserve(num_threads);
|
||||
|
||||
for (size_t i = 0; i < num_threads; ++i)
|
||||
{
|
||||
threads.emplace_back([&]
|
||||
|
@ -54,6 +54,7 @@ int main(int argc, char ** argv)
|
||||
Cache cache(cache_size);
|
||||
|
||||
std::vector<std::thread> threads;
|
||||
threads.reserve(num_threads);
|
||||
for (size_t i = 0; i < num_threads; ++i)
|
||||
{
|
||||
threads.emplace_back([&]
|
||||
|
@ -223,7 +223,7 @@ bool pathStartsWith(const std::filesystem::path & path, const std::filesystem::p
|
||||
return absolute_path.starts_with(absolute_prefix_path);
|
||||
}
|
||||
|
||||
bool fileOrSymlinkPathStartsWith(const std::filesystem::path & path, const std::filesystem::path & prefix_path)
|
||||
static bool fileOrSymlinkPathStartsWith(const std::filesystem::path & path, const std::filesystem::path & prefix_path)
|
||||
{
|
||||
/// Differs from pathStartsWith in how `path` is normalized before comparison.
|
||||
/// Make `path` absolute if it was relative and put it into normalized form: remove
|
||||
|
@ -40,7 +40,7 @@ namespace detail
|
||||
struct NumToString : Decompose<num> {};
|
||||
|
||||
template <class T, T... ints>
|
||||
consteval std::array<std::pair<const char *, size_t>, sizeof...(ints)> str_make_array_impl(std::integer_sequence<T, ints...>)
|
||||
static consteval std::array<std::pair<const char *, size_t>, sizeof...(ints)> str_make_array_impl(std::integer_sequence<T, ints...>)
|
||||
{
|
||||
return std::array<std::pair<const char *, size_t>, sizeof...(ints)> { std::pair<const char *, size_t> {NumToString<ints>::value, NumToString<ints>::size}... };
|
||||
}
|
||||
@ -51,7 +51,7 @@ namespace detail
|
||||
* second - size of the string as would returned by strlen()
|
||||
*/
|
||||
template <size_t N>
|
||||
consteval std::array<std::pair<const char *, size_t>, N> str_make_array()
|
||||
static consteval std::array<std::pair<const char *, size_t>, N> str_make_array()
|
||||
{
|
||||
return detail::str_make_array_impl(std::make_integer_sequence<int, N>{});
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace DB
|
||||
{
|
||||
|
||||
MULTITARGET_FUNCTION_AVX2_SSE42(
|
||||
MULTITARGET_FUNCTION_HEADER(template <iota_supported_types T> void NO_INLINE),
|
||||
MULTITARGET_FUNCTION_HEADER(template <iota_supported_types T> static void NO_INLINE),
|
||||
iotaImpl, MULTITARGET_FUNCTION_BODY((T * begin, size_t count, T first_value) /// NOLINT
|
||||
{
|
||||
for (size_t i = 0; i < count; i++)
|
||||
@ -28,7 +28,7 @@ void iota(T * begin, size_t count, T first_value)
|
||||
}
|
||||
|
||||
MULTITARGET_FUNCTION_AVX2_SSE42(
|
||||
MULTITARGET_FUNCTION_HEADER(template <iota_supported_types T> void NO_INLINE),
|
||||
MULTITARGET_FUNCTION_HEADER(template <iota_supported_types T> static void NO_INLINE),
|
||||
iotaWithStepImpl, MULTITARGET_FUNCTION_BODY((T * begin, size_t count, T first_value, T step) /// NOLINT
|
||||
{
|
||||
for (size_t i = 0; i < count; i++)
|
||||
|
@ -150,6 +150,7 @@ TEST(Logger, SharedLoggersThreadSafety)
|
||||
size_t loggers_size_before = names.size();
|
||||
|
||||
std::vector<std::thread> threads;
|
||||
threads.reserve(threads_count);
|
||||
|
||||
for (size_t thread_index = 0; thread_index < threads_count; ++thread_index)
|
||||
{
|
||||
|
@ -123,8 +123,11 @@ std::vector<uint8_t> CompressionCodecMultiple::getCodecsBytesFromData(const char
|
||||
{
|
||||
std::vector<uint8_t> result;
|
||||
uint8_t compression_methods_size = source[0];
|
||||
result.reserve(compression_methods_size);
|
||||
|
||||
for (size_t i = 0; i < compression_methods_size; ++i)
|
||||
result.push_back(source[1 + i]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -848,7 +848,7 @@ void LogEntryStorage::startCommitLogsPrefetch(uint64_t last_committed_index) con
|
||||
LOG_TRACE(log, "Will prefetch {} commit log entries [{} - {}]", prefetch_to - prefetch_from + 1, prefetch_from, prefetch_to);
|
||||
|
||||
current_prefetch_info->file_infos = std::move(file_infos);
|
||||
auto inserted = prefetch_queue.push(current_prefetch_info);
|
||||
auto inserted = prefetch_queue.push(current_prefetch_info); /// NOLINT(clang-analyzer-deadcode.DeadStores)
|
||||
chassert(inserted);
|
||||
}
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ void KeeperServer::launchRaftServer(const Poco::Util::AbstractConfiguration & co
|
||||
nuraft::raft_server::limits raft_limits;
|
||||
raft_limits.reconnect_limit_ = getValueOrMaxInt32AndLogWarning(coordination_settings[CoordinationSetting::raft_limits_reconnect_limit], "raft_limits_reconnect_limit", log);
|
||||
raft_limits.response_limit_ = getValueOrMaxInt32AndLogWarning(coordination_settings[CoordinationSetting::raft_limits_response_limit], "response_limit", log);
|
||||
raft_instance->set_raft_limits(raft_limits);
|
||||
KeeperRaftServer::set_raft_limits(raft_limits);
|
||||
|
||||
raft_instance->start_server(init_options.skip_initial_election_timeout_);
|
||||
|
||||
|
@ -538,7 +538,7 @@ struct Overloaded : Ts...
|
||||
// explicit deduction guide
|
||||
// https://en.cppreference.com/w/cpp/language/class_template_argument_deduction
|
||||
template <class... Ts>
|
||||
Overloaded(Ts...) -> Overloaded<Ts...>;
|
||||
Overloaded(Ts...) -> Overloaded<Ts...>; /// NOLINT(misc-use-internal-linkage)
|
||||
|
||||
template<typename Container>
|
||||
std::shared_ptr<typename Container::Node> KeeperStorage<Container>::UncommittedState::tryGetNodeFromStorage(StringRef path, bool should_lock_storage) const
|
||||
|
@ -14,12 +14,12 @@ void addProgramOptionAsMultitoken(T &cmd_settings, boost::program_options::optio
|
||||
if (field.getTypeName() == "Bool")
|
||||
{
|
||||
options.add(boost::shared_ptr<boost::program_options::option_description>(new boost::program_options::option_description(
|
||||
name.data(), boost::program_options::value<Strings>()->multitoken()->composing()->implicit_value(std::vector<std::string>{"1"}, "1")->notifier(on_program_option), field.getDescription())));
|
||||
name.data(), boost::program_options::value<Strings>()->multitoken()->composing()->implicit_value(std::vector<std::string>{"1"}, "1")->notifier(on_program_option), field.getDescription()))); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
}
|
||||
else
|
||||
{
|
||||
options.add(boost::shared_ptr<boost::program_options::option_description>(new boost::program_options::option_description(
|
||||
name.data(), boost::program_options::value<Strings>()->multitoken()->composing()->notifier(on_program_option), field.getDescription())));
|
||||
name.data(), boost::program_options::value<Strings>()->multitoken()->composing()->notifier(on_program_option), field.getDescription()))); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6164,7 +6164,7 @@ void SettingsImpl::applyCompatibilitySetting(const String & compatibility_value)
|
||||
|
||||
namespace Setting
|
||||
{
|
||||
LIST_OF_SETTINGS(INITIALIZE_SETTING_EXTERN, SKIP_ALIAS)
|
||||
LIST_OF_SETTINGS(INITIALIZE_SETTING_EXTERN, SKIP_ALIAS) /// NOLINT (misc-use-internal-linkage)
|
||||
}
|
||||
|
||||
#undef INITIALIZE_SETTING_EXTERN
|
||||
|
@ -630,8 +630,8 @@ void BaseDaemon::setupWatchdog()
|
||||
logger().setChannel(log);
|
||||
}
|
||||
|
||||
/// Cuncurrent writing logs to the same file from two threads is questionable on its own,
|
||||
/// but rotating them from two threads is disastrous.
|
||||
/// Concurrent writing logs to the same file from two threads is questionable on its own,
|
||||
/// but rotating them from two threads is disastrous.
|
||||
if (auto * channel = dynamic_cast<OwnSplitChannel *>(logger().getChannel()))
|
||||
{
|
||||
channel->setChannelProperty("log", Poco::FileChannel::PROP_ROTATION, "never");
|
||||
|
@ -180,7 +180,7 @@ void SentryWriter::sendError(Type type, int sig_or_error, const std::string & er
|
||||
{
|
||||
int code = sig_or_error;
|
||||
/// Can be only LOGICAL_ERROR, but just in case.
|
||||
sentry_set_tag("exception", DB::ErrorCodes::getName(code).data());
|
||||
sentry_set_tag("exception", DB::ErrorCodes::getName(code).data()); /// NOLINT(bugprone-suspicious-stringview-data-usage)
|
||||
sentry_set_extra("exception_code", sentry_value_new_int32(code));
|
||||
break;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ std::unique_ptr<ISerialization::SubstreamData> DataTypeArray::getDynamicSubcolum
|
||||
nested_data->type = nested_type;
|
||||
nested_data->column = data.column ? assert_cast<const ColumnArray &>(*data.column).getDataPtr() : nullptr;
|
||||
|
||||
auto nested_subcolumn_data = nested_type->getSubcolumnData(subcolumn_name, *nested_data, throw_if_null);
|
||||
auto nested_subcolumn_data = DB::IDataType::getSubcolumnData(subcolumn_name, *nested_data, throw_if_null);
|
||||
if (!nested_subcolumn_data)
|
||||
return nullptr;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user