diff --git a/.clang-tidy b/.clang-tidy index d8964d471..3bca51b43 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: '*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-cppcoreguidelines-*,-darwin-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,google-explicit-constructor,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-redundant-member-init,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-readability-const-return-type,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-misc-non-private-member-variables-in-classes,-clang-analyzer-*,-bugprone-signed-char-misuse,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer,-bugprone-assignment-in-if-condition,-misc-const-correctness,-portability-std-allocator-const,-modernize-deprecated-ios-base-aliases,-bugprone-unchecked-optional-access,-modernize-replace-auto-ptr,-readability-identifier-naming,-portability-simd-intrinsics' +Checks: '*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-cppcoreguidelines-*,-darwin-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,google-explicit-constructor,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-redundant-member-init,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-readability-const-return-type,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-misc-non-private-member-variables-in-classes,-clang-analyzer-*,-bugprone-signed-char-misuse,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer,-bugprone-assignment-in-if-condition,-misc-const-correctness,-portability-std-allocator-const,-modernize-deprecated-ios-base-aliases,-bugprone-unchecked-optional-access,-modernize-replace-auto-ptr,-readability-identifier-naming,-portability-simd-intrinsics,-misc-use-anonymous-namespace' WarningsAsErrors: '*' HeaderFilterRegex: '(cli|gui|lib|oss-fuzz|test|triage)\/[a-z]+\.h' CheckOptions: diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 2019a8d93..343e89401 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -33,14 +33,14 @@ jobs: run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 15 + sudo ./llvm.sh 16 - name: CMake run: | cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On env: - CC: clang-15 - CXX: clang++-15 + CC: clang-16 + CXX: clang++-16 - name: Build cppcheck run: | diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index b33bc44f2..5352c2811 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -29,8 +29,8 @@ jobs: run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 15 - sudo apt-get install -y clang-tidy-15 + sudo ./llvm.sh 16 + sudo apt-get install -y clang-tidy-16 - name: Install Qt ${{ env.QT_VERSION }} uses: jurplel/install-qt-action@v3 @@ -41,14 +41,14 @@ jobs: - name: Verify clang-tidy configuration run: | - clang-tidy-15 --verify-config + clang-tidy-16 --verify-config - name: Prepare CMake run: | cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off env: - CC: clang-15 - CXX: clang++-15 + CC: clang-16 + CXX: clang++-16 - name: Prepare CMake dependencies run: | diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index 4eb7d9f0d..3e7cf819a 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -33,14 +33,14 @@ jobs: run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 15 + sudo ./llvm.sh 16 - name: CMake run: | cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DUSE_THREADS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On env: - CC: clang-15 - CXX: clang++-15 + CC: clang-16 + CXX: clang++-16 - name: Build cppcheck run: | diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml index a67a4659b..5bddbba85 100644 --- a/.github/workflows/ubsan.yml +++ b/.github/workflows/ubsan.yml @@ -33,14 +33,14 @@ jobs: run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 15 + sudo ./llvm.sh 16 - name: CMake run: | cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On env: - CC: clang-15 - CXX: clang++-15 + CC: clang-16 + CXX: clang++-16 - name: Build cppcheck run: | diff --git a/clang-tidy.md b/clang-tidy.md index d37a7e1b9..93deaa343 100644 --- a/clang-tidy.md +++ b/clang-tidy.md @@ -54,10 +54,13 @@ We are not interesting in the size/complexity of a function. These do not (always) increase readability. `bugprone-macro-parentheses`
-`readability-implicit-bool-conversion`
To be documented. +`readability-implicit-bool-conversion`
+ +This does not appear not to be useful as it is reported on very common code. + `bugprone-narrowing-conversions`
`performance-no-automatic-move`
@@ -78,11 +81,11 @@ Disabled because of false positives with Qt `slot` methods (see https://github.c `-clang-analyzer-*`
-Disable because of false positives (needs to file an upstream bug report). +Disabled because of false positives (needs to file an upstream bug report). `misc-non-private-member-variables-in-classes`
-We actively use this. +We intentionally use this. `misc-no-recursion`
@@ -114,9 +117,17 @@ Produces a lot of false positives since it is too vague in its analysis. `performance-inefficient-string-concatenation`
-Produces many warnings which very much look like false positives (needs to be reported upstream). +Produces warnings which might be considered false positives starting with C++11 - see https://github.com/llvm/llvm-project/issues/54526. + +`readability-redundant-access-specifiers`
+ +Reports warning with the Qt ` slots:` syntax in class declarations - see https://github.com/llvm/llvm-project/issues/60055. `modernize-avoid-c-arrays`
+ +Produces warnings when `const char[]` is being used which is quite common in our code. Does not make sense to enable before C++17 when `std::string_view` becomes available. +Also reports a false positive about templates which deduce the array length: https://github.com/llvm/llvm-project/issues/60053. + `readability-container-size-empty`
`bugprone-branch-clone`
`readability-const-return-type`
@@ -124,9 +135,9 @@ Produces many warnings which very much look like false positives (needs to be re `misc-throw-by-value-catch-by-reference`
`readability-avoid-const-params-in-decls`
`bugprone-signed-char-misuse`
-`readability-redundant-access-specifiers`
`performance-noexcept-move-constructor`
`concurrency-mt-unsafe`
+`misc-use-anonymous-namespace`
To be evaluated. diff --git a/cmake/clang_tidy.cmake b/cmake/clang_tidy.cmake index 5c3abbec2..07134ddaa 100644 --- a/cmake/clang_tidy.cmake +++ b/cmake/clang_tidy.cmake @@ -9,7 +9,7 @@ if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS) message(STATUS "Cannot use non-Clang compiler with clang-tidy when precompiled headers are enabled - skipping 'run-clang-tidy' target generation") endif() else() - set(RUN_CLANG_TIDY_NAMES run-clang-tidy run-clang-tidy-15 run-clang-tidy-14 run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8) + set(RUN_CLANG_TIDY_NAMES run-clang-tidy run-clang-tidy-16 run-clang-tidy-15 run-clang-tidy-14 run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8) endif() if (RUN_CLANG_TIDY_NAMES) diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index 4b9a703c9..e0643a135 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -101,6 +101,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options_safe(-Wno-tautological-type-limit-compare) add_compile_options(-Wno-disabled-macro-expansion) add_compile_options_safe(-Wno-bitwise-instead-of-logical) + add_compile_options_safe(-Wno-unsafe-buffer-usage) # warnings we are not interested in add_compile_options(-Wno-four-char-constants)