From efeaf4bbe1fe8854ab7f17ab373124a0c2c03c0f Mon Sep 17 00:00:00 2001 From: firewave Date: Mon, 11 Apr 2022 19:26:49 +0200 Subject: [PATCH 01/14] updated CI to latest ubuntu and clang --- .github/workflows/CI-unixish-docker.yml | 6 +++--- .github/workflows/asan.yml | 8 ++++---- .github/workflows/clang-tidy.yml | 10 +++++----- .github/workflows/ubsan.yml | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index eda91e35d5e..6749c1794d3 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:21.10"] + image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:22.04"] fail-fast: false # Prefer quick result runs-on: ubuntu-20.04 @@ -35,7 +35,7 @@ jobs: # tests require CMake 3.4 - name: Test CMake build (no tests) - if: matrix.image != 'ubuntu:21.10' + if: matrix.image != 'ubuntu:22.04' run: | mkdir cmake.output cd cmake.output @@ -44,7 +44,7 @@ jobs: cd .. - name: Test CMake build - if: matrix.image == 'ubuntu:21.10' + if: matrix.image == 'ubuntu:22.04' run: | mkdir cmake.output cd cmake.output diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 3d8caab7ec2..34a322f8833 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: "ubuntu:21.10" + image: "ubuntu:22.04" env: ASAN_OPTIONS: detect_stack_use_after_return=1 @@ -27,13 +27,13 @@ jobs: run: | apt-get update apt-get install -y make libpcre3-dev - apt-get install -y clang-13 + apt-get install -y clang-14 - name: Build run: make -j$(nproc) cppcheck testrunner HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1 env: - CC: clang-13 - CXX: clang++-13 + CC: clang-14 + CXX: clang++-14 CXXFLAGS: "-fsanitize=address -O2 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS: "-DCHECK_INTERNAL" diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 484eed2e4c0..1222aa22aac 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: "ubuntu:21.10" + image: "ubuntu:22.04" env: QT_VERSION: 5.15.2 @@ -21,10 +21,10 @@ jobs: - name: Install missing software run: | apt-get update - apt-get install -y cmake clang-13 make + apt-get install -y cmake clang-14 make apt-get install -y libpcre3-dev apt-get install -y libffi7 # work around missing dependency for Qt install step - apt-get install -y clang-tidy-13 + apt-get install -y clang-tidy-14 - name: Cache Qt ${{ env.QT_VERSION }} id: cache-qt @@ -48,8 +48,8 @@ jobs: cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off .. cd .. env: - CC: clang-13 - CXX: clang++-13 + CC: clang-14 + CXX: clang++-14 - name: Prepare CMake dependencies run: | diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml index 65ec76357ae..6480cfeb41f 100644 --- a/.github/workflows/ubsan.yml +++ b/.github/workflows/ubsan.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: "ubuntu:21.10" + image: "ubuntu:22.04" env: UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 @@ -27,13 +27,13 @@ jobs: run: | apt-get update apt-get install -y make libpcre3-dev - apt-get install -y clang-13 + apt-get install -y clang-14 - name: Build run: make -j$(nproc) cppcheck testrunner HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1 env: - CC: clang-13 - CXX: clang++-13 + CC: clang-14 + CXX: clang++-14 CXXFLAGS: "-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow -O2 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS: "-DCHECK_INTERNAL" From 5abe89a92a561d48672e2d79ad1f0420f8d65879 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 12 Apr 2022 07:38:09 +0200 Subject: [PATCH 02/14] .clang-tidy: disabled readability-identifier-length warning which we are not interested in --- .clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 960abc5335f..5a5304a9498 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-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-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument' +Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-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-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length' WarningsAsErrors: '*' CheckOptions: - key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic From fe233cfe5228bee6f8dee1aef737684eed327d06 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 12 Apr 2022 07:40:15 +0200 Subject: [PATCH 03/14] clang_tidy.cmake: added `run-clang-tidy-14` as program to look for --- cmake/clang_tidy.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/clang_tidy.cmake b/cmake/clang_tidy.cmake index d2c16170e21..73c1203a10c 100644 --- a/cmake/clang_tidy.cmake +++ b/cmake/clang_tidy.cmake @@ -7,7 +7,7 @@ if (NOT NPROC) endif() message(STATUS "NPROC=${NPROC}") -find_program(RUN_CLANG_TIDY NAMES run-clang-tidy run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8) +find_program(RUN_CLANG_TIDY NAMES run-clang-tidy 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) message(STATUS "RUN_CLANG_TIDY=${RUN_CLANG_TIDY}") if (RUN_CLANG_TIDY) # disable all compiler warnings since we are just interested in the tidy ones From dec2cbc08982f13829fb46d10fa7a82168a18e31 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 12 Apr 2022 07:42:31 +0200 Subject: [PATCH 04/14] CI-unixish-docker.yml: install the `python3` package for ubuntu instead --- .github/workflows/CI-unixish-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index 6749c1794d3..54f9c699c33 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -30,7 +30,7 @@ jobs: if: matrix.image != 'centos:7' run: | apt-get update - apt-get install -y cmake g++ make python libxml2-utils + apt-get install -y cmake g++ make python3 libxml2-utils apt-get install -y libpcre3-dev # tests require CMake 3.4 From eb78d4abc206d5362f9a1d0babfac072d6ba46e7 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 12 Apr 2022 07:51:09 +0200 Subject: [PATCH 05/14] run_more_tests.sh: explicitly use `python3` --- tools/run_more_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_more_tests.sh b/tools/run_more_tests.sh index 2a5e17c420e..9bc32952701 100755 --- a/tools/run_more_tests.sh +++ b/tools/run_more_tests.sh @@ -11,7 +11,7 @@ if test -f ./bin/cppcheck; then CPPCHECK=$(pwd)/bin/cppcheck fi -python $DIR/extracttests.py --code=$(pwd)/test1 $1 +python3 $DIR/extracttests.py --code=$(pwd)/test1 $1 cd test1 From ef5c4ef8c8e6ba65206bec8dbde3710e8fa1cbae Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 12 Apr 2022 07:58:05 +0200 Subject: [PATCH 06/14] .clang-tidy: disabled `readability-container-data-pointer` since it has false positives and the results are inconsistent --- .clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 5a5304a9498..4e769dbd16f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-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-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length' +Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-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-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer' WarningsAsErrors: '*' CheckOptions: - key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic From 6c279bbd7e46cb9d7d4eca798770643478936c9a Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 12 Apr 2022 08:46:13 +0200 Subject: [PATCH 07/14] use `PYTHON_INTERPRETER` in `checkCWEEntries` make target --- Makefile | 5 ++++- tools/dmake.cpp | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 00cb1352cc0..f1c7523ec2f 100644 --- a/Makefile +++ b/Makefile @@ -383,7 +383,10 @@ validateXML: createXMLExamples xmllint --noout --relaxng cppcheck-errors.rng /tmp/example.xml checkCWEEntries: /tmp/errorlist.xml - ./tools/listErrorsWithoutCWE.py -F /tmp/errorlist.xml + $(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python3))) + $(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python))) + $(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(error Did not find a Python interpreter))) + $(PYTHON_INTERPRETER) tools/listErrorsWithoutCWE.py -F /tmp/errorlist.xml .PHONY: validateRules validateRules: xmllint --noout rules/*.xml diff --git a/tools/dmake.cpp b/tools/dmake.cpp index cc17cc0fafc..cd535d71833 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -242,6 +242,7 @@ int main(int argc, char **argv) << " $(warning Usage of SRCDIR to activate match compiler is deprecated. Use MATCHCOMPILER=yes instead.)\n" << " MATCHCOMPILER:=yes\n" << "endif\n"; + // TODO: bail out when matchcompiler.py fails (i.e. invalid PYTHON_INTERPRETER specified) fout << "ifeq ($(MATCHCOMPILER),yes)\n" << " # Find available Python interpreter\n" << " ifndef PYTHON_INTERPRETER\n" @@ -494,7 +495,10 @@ int main(int argc, char **argv) fout << "\txmllint --noout --relaxng cppcheck-errors.rng /tmp/errorlist.xml\n"; fout << "\txmllint --noout --relaxng cppcheck-errors.rng /tmp/example.xml\n"; fout << "\ncheckCWEEntries: /tmp/errorlist.xml\n"; - fout << "\t./tools/listErrorsWithoutCWE.py -F /tmp/errorlist.xml\n"; + fout << "\t$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python3)))\n"; + fout << "\t$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python)))\n"; + fout << "\t$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(error Did not find a Python interpreter)))\n"; + fout << "\t$(PYTHON_INTERPRETER) tools/listErrorsWithoutCWE.py -F /tmp/errorlist.xml\n"; fout << ".PHONY: validateRules\n"; fout << "validateRules:\n"; fout << "\txmllint --noout rules/*.xml\n"; From 36eae2f98fd7ca52abc5713cf5f2d33cee6dcedc Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 12 Apr 2022 08:46:59 +0200 Subject: [PATCH 08/14] CI-unixish-docker.yml: install `which` and `python3` packages for CentOS --- .github/workflows/CI-unixish-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index 54f9c699c33..b177d5d095c 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -23,7 +23,7 @@ jobs: - name: Install missing software on CentOS 7 if: matrix.image == 'centos:7' run: | - yum install -y cmake gcc-c++ make + yum install -y cmake gcc-c++ make which python3 yum install -y pcre-devel - name: Install missing software on ubuntu From 6d89ebb6b4ba524cfc445c8593f228b2e5e35942 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 5 Feb 2022 15:04:04 +0100 Subject: [PATCH 09/14] compileroptions.cmake: added workaround for current performance regression in clang-14 --- cmake/compileroptions.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index 684c93ce076..43e98de456a 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -51,6 +51,12 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") add_compile_options(-Wsuggest-attribute=noreturn) add_compile_options(-Wno-shadow) # whenever a local variable or type declaration shadows another one elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 14) + if (CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") + # work around performance regression - see https://github.com/llvm/llvm-project/issues/53555 + add_compile_options(-mllvm -inline-deferral) + endif() + endif() add_compile_options_safe(-Wno-documentation-unknown-command) From 99714c513c989f08849972295cbdffffd6567b2c Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 5 Feb 2022 15:06:08 +0100 Subject: [PATCH 10/14] compileroptions.cmake: force the usage of DWARF 4 for clang-14 --- cmake/compileroptions.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index 43e98de456a..03ca2e50a49 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -56,6 +56,9 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # work around performance regression - see https://github.com/llvm/llvm-project/issues/53555 add_compile_options(-mllvm -inline-deferral) endif() + + # use force DWARF 4 debug format since not all tools might be able to handle DWARF 5 yet - e.g. valgrind on ubuntu 20.04 + add_compile_options(-gdwarf-4) endif() add_compile_options_safe(-Wno-documentation-unknown-command) From f66cf74ea36f993c39149e30c13f56e5a7a2ff69 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 5 Feb 2022 15:07:32 +0100 Subject: [PATCH 11/14] fixed some clang-tidy-14 warnings --- tools/triage/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/triage/mainwindow.cpp b/tools/triage/mainwindow.cpp index 48cf58fb979..f6ac96621db 100644 --- a/tools/triage/mainwindow.cpp +++ b/tools/triage/mainwindow.cpp @@ -263,7 +263,7 @@ void MainWindow::showResult(QListWidgetItem *item) const QStringList lines = item->text().split("\n"); if (lines.size() < 2) return; - const QString url = lines[0]; + const QString &url = lines[0]; QString msg = lines[1]; const QRegularExpressionMatch matchRes = mVersionRe.match(msg); if (matchRes.hasMatch()) From 14a464a6e76adccf141efe02afbe1d8f6b3b08b0 Mon Sep 17 00:00:00 2001 From: firewave Date: Sun, 8 May 2022 22:28:58 +0200 Subject: [PATCH 12/14] compileroptions.cmake: disabled Clang warning `-Wbitwise-instead-of-logical` for now --- cmake/compileroptions.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index 03ca2e50a49..f5d4281ee9e 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -95,6 +95,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options_safe(-Wno-tautological-type-limit-compare) add_compile_options_safe(-Wno-unused-member-function) add_compile_options(-Wno-disabled-macro-expansion) + add_compile_options_safe(-Wno-bitwise-instead-of-logical) # TODO: fix these # warnings we are not interested in add_compile_options(-Wno-four-char-constants) From f2ead23afc8751ba451609ca1d189f4662c1322c Mon Sep 17 00:00:00 2001 From: firewave Date: Sun, 15 May 2022 19:00:52 +0200 Subject: [PATCH 13/14] remove matchcompiled source files with `make clean` --- Makefile | 2 +- tools/dmake.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f1c7523ec2f..5e4e302cfec 100644 --- a/Makefile +++ b/Makefile @@ -304,7 +304,7 @@ run-dmake: dmake ./dmake clean: - rm -f build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1 + rm -f build/*.cpp build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1 man: man/cppcheck.1 diff --git a/tools/dmake.cpp b/tools/dmake.cpp index cd535d71833..87dc494e276 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -425,7 +425,7 @@ int main(int argc, char **argv) fout << "run-dmake: dmake\n"; fout << "\t./dmake\n\n"; fout << "clean:\n"; - fout << "\trm -f build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1\n\n"; + fout << "\trm -f build/*.cpp build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1\n\n"; fout << "man:\tman/cppcheck.1\n\n"; fout << "man/cppcheck.1:\t$(MAN_SOURCE)\n\n"; fout << "\t$(XP) $(DB2MAN) $(MAN_SOURCE)\n\n"; From a1a5bad06e70e43627e49e937d1b0a623f45c833 Mon Sep 17 00:00:00 2001 From: firewave Date: Sun, 15 May 2022 19:04:17 +0200 Subject: [PATCH 14/14] adjusted `PYTHON_INTERPRETER` checks --- Makefile | 6 +++--- tools/dmake.cpp | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5e4e302cfec..9e6face80b2 100644 --- a/Makefile +++ b/Makefile @@ -12,13 +12,13 @@ ifeq ($(SRCDIR),build) endif ifeq ($(MATCHCOMPILER),yes) # Find available Python interpreter - ifndef PYTHON_INTERPRETER + ifeq ($(PYTHON_INTERPRETER),) PYTHON_INTERPRETER := $(shell which python3) endif - ifndef PYTHON_INTERPRETER + ifeq ($(PYTHON_INTERPRETER),) PYTHON_INTERPRETER := $(shell which python) endif - ifndef PYTHON_INTERPRETER + ifeq ($(PYTHON_INTERPRETER),) $(error Did not find a Python interpreter) endif ifdef VERIFY diff --git a/tools/dmake.cpp b/tools/dmake.cpp index 87dc494e276..a7d0df3b466 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -243,15 +243,16 @@ int main(int argc, char **argv) << " MATCHCOMPILER:=yes\n" << "endif\n"; // TODO: bail out when matchcompiler.py fails (i.e. invalid PYTHON_INTERPRETER specified) + // TODO: handle "PYTHON_INTERPRETER=" fout << "ifeq ($(MATCHCOMPILER),yes)\n" << " # Find available Python interpreter\n" - << " ifndef PYTHON_INTERPRETER\n" + << " ifeq ($(PYTHON_INTERPRETER),)\n" << " PYTHON_INTERPRETER := $(shell which python3)\n" << " endif\n" - << " ifndef PYTHON_INTERPRETER\n" + << " ifeq ($(PYTHON_INTERPRETER),)\n" << " PYTHON_INTERPRETER := $(shell which python)\n" << " endif\n" - << " ifndef PYTHON_INTERPRETER\n" + << " ifeq ($(PYTHON_INTERPRETER),)\n" << " $(error Did not find a Python interpreter)\n" << " endif\n" << " ifdef VERIFY\n" @@ -495,6 +496,7 @@ int main(int argc, char **argv) fout << "\txmllint --noout --relaxng cppcheck-errors.rng /tmp/errorlist.xml\n"; fout << "\txmllint --noout --relaxng cppcheck-errors.rng /tmp/example.xml\n"; fout << "\ncheckCWEEntries: /tmp/errorlist.xml\n"; + // TODO: handle "PYTHON_INTERPRETER=" fout << "\t$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python3)))\n"; fout << "\t$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python)))\n"; fout << "\t$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(error Did not find a Python interpreter)))\n";