From 6d90b5a010ad8f9ca2ec11419cc32ebad8814068 Mon Sep 17 00:00:00 2001 From: chrchr Date: Thu, 23 Jun 2022 12:34:20 +0200 Subject: [PATCH 01/38] Fix crash on Windows with -j option --- lib/programmemory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index 165f41cd494..977dbd52981 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -845,8 +845,8 @@ ValueFlow::Value evaluateLibraryFunction(const std::unordered_map& arg)>> + thread_local static std::unordered_map& arg)>> functions = {}; if (functions.count(returnValue) == 0) { From be493b794e40fff5c1a3f1f44b6e1000fa6c1b9d Mon Sep 17 00:00:00 2001 From: chrchr Date: Thu, 30 Jun 2022 20:58:04 +0200 Subject: [PATCH 02/38] Disable CI-cygwin workflow --- .github/workflows/CI-cygwin.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index abc14bc5872..08e82047376 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -4,7 +4,8 @@ name: CI-cygwin -on: [push,pull_request] +#on: [push,pull_request] +on: workflow_dispatch defaults: run: From 32c474b98f28ef9ea0dad941f42537c68e83cc0f Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 18:08:03 +0200 Subject: [PATCH 03/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 08e82047376..ca368625491 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -4,8 +4,7 @@ name: CI-cygwin -#on: [push,pull_request] -on: workflow_dispatch +on: [push,pull_request] defaults: run: @@ -27,7 +26,11 @@ jobs: - name: Set up Cygwin uses: egor-tensin/setup-cygwin@v3 with: - platform: ${{ matrix.arch }} + platform: ${{ matrix.arch }} + + - name: Defines + run: | + C:\tools\cygwin\bin\bash.exe -l -c gcc -xc++ -dM -E - < /dev/null | egrep '(cplus|WIN32|CYGWIN|MINGW|VERSION)' - name: Build cppcheck run: | From 8485468e3daa927f0f667549a33818d8174dcca9 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 19:18:59 +0200 Subject: [PATCH 04/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index ca368625491..59e54259f68 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -30,7 +30,7 @@ jobs: - name: Defines run: | - C:\tools\cygwin\bin\bash.exe -l -c gcc -xc++ -dM -E - < /dev/null | egrep '(cplus|WIN32|CYGWIN|MINGW|VERSION)' + C:\tools\cygwin\bin\bash.exe -l -c "gcc -xc++ -dM -E - < /dev/null | egrep '(cplus|WIN32|CYGWIN|MINGW|VERSION)'" - name: Build cppcheck run: | From 251470d28c049708b7c49a8098c7f3fb21d5b9f1 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 20:15:01 +0200 Subject: [PATCH 05/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 59e54259f68..0acde06bced 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -24,13 +24,9 @@ jobs: - uses: actions/checkout@v2 - name: Set up Cygwin - uses: egor-tensin/setup-cygwin@v3 + uses: cygwin/cygwin-install-action@master with: - platform: ${{ matrix.arch }} - - - name: Defines - run: | - C:\tools\cygwin\bin\bash.exe -l -c "gcc -xc++ -dM -E - < /dev/null | egrep '(cplus|WIN32|CYGWIN|MINGW|VERSION)'" + platform: ${{ matrix.arch }} - name: Build cppcheck run: | From fa8fe1fa6ce88321b3b3ec9105f1880021bda109 Mon Sep 17 00:00:00 2001 From: chrchr Date: Thu, 7 Jul 2022 20:45:31 +0200 Subject: [PATCH 06/38] Try to fix Cygwin build --- .github/workflows/CI-cygwin.yml | 10 +- .github/workflows/CI-mingw.yml | 41 ---- .github/workflows/CI-unixish-docker.yml | 79 ------- .github/workflows/CI-unixish.yml | 287 ------------------------ .github/workflows/CI-windows.yml | 206 ----------------- .github/workflows/asan.yml | 60 ----- .github/workflows/buildman.yml | 25 --- .github/workflows/clang-tidy.yml | 61 ----- .github/workflows/codeql-analysis.yml | 43 ---- .github/workflows/coverage.yml | 49 ---- .github/workflows/format.yml | 39 ---- .github/workflows/iwyu.yml | 60 ----- .github/workflows/release-windows.yml | 132 ----------- .github/workflows/scriptcheck.yml | 139 ------------ .github/workflows/selfcheck.yml | 81 ------- .github/workflows/ubsan.yml | 58 ----- .github/workflows/valgrind.yml | 52 ----- Makefile | 2 +- lib/config.h | 2 +- 19 files changed, 7 insertions(+), 1419 deletions(-) delete mode 100644 .github/workflows/CI-mingw.yml delete mode 100644 .github/workflows/CI-unixish-docker.yml delete mode 100644 .github/workflows/CI-unixish.yml delete mode 100644 .github/workflows/CI-windows.yml delete mode 100644 .github/workflows/asan.yml delete mode 100644 .github/workflows/buildman.yml delete mode 100644 .github/workflows/clang-tidy.yml delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/coverage.yml delete mode 100644 .github/workflows/format.yml delete mode 100644 .github/workflows/iwyu.yml delete mode 100644 .github/workflows/release-windows.yml delete mode 100644 .github/workflows/scriptcheck.yml delete mode 100644 .github/workflows/selfcheck.yml delete mode 100644 .github/workflows/ubsan.yml delete mode 100644 .github/workflows/valgrind.yml diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 0acde06bced..57f3f1d2180 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -30,20 +30,20 @@ jobs: - name: Build cppcheck run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 + C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 - name: Build test run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 testrunner + C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 testrunner - name: Run test run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 check + C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 check - name: Extra test for misra run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test + C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% + C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% .\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c diff --git a/.github/workflows/CI-mingw.yml b/.github/workflows/CI-mingw.yml deleted file mode 100644 index 1a6b23cfeec..00000000000 --- a/.github/workflows/CI-mingw.yml +++ /dev/null @@ -1,41 +0,0 @@ -# Some convenient links: -# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md -# - -name: CI-mingw - -on: [push,pull_request] - -defaults: - run: - shell: cmd - -jobs: - build_mingw: - strategy: - matrix: - os: [windows-2019] - arch: [x64] # TODO: fix x86 build? - fail-fast: false - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - - - name: Set up MinGW - uses: egor-tensin/setup-mingw@v2 - with: - platform: ${{ matrix.arch }} - - - name: Build cppcheck - run: | - mingw32-make -j2 - - - name: Build test - run: | - mingw32-make -j2 testrunner - - - name: Run test - run: | - mingw32-make -j2 check diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml deleted file mode 100644 index d87ac3c59bb..00000000000 --- a/.github/workflows/CI-unixish-docker.yml +++ /dev/null @@ -1,79 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: CI-unixish-docker - -on: [push, pull_request] - -jobs: - build: - - strategy: - matrix: - image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04"] - fail-fast: false # Prefer quick result - - runs-on: ubuntu-22.04 - - container: - image: ${{ matrix.image }} - - steps: - - uses: actions/checkout@v2 - - - name: Install missing software on CentOS 7 - if: matrix.image == 'centos:7' - run: | - yum install -y cmake gcc-c++ make which python3 - yum install -y pcre-devel - - - name: Install missing software on ubuntu - if: matrix.image != 'centos:7' - run: | - apt-get update - apt-get install -y cmake g++ make python3 libxml2-utils - apt-get install -y libpcre3-dev - - # tests require CMake 3.4 - - name: Test CMake build (no tests) - if: matrix.image != 'ubuntu:22.10' - run: | - mkdir cmake.output - cd cmake.output - cmake -G "Unix Makefiles" -DHAVE_RULES=On .. - cmake --build . -- -j$(nproc) - cd .. - - - name: Test CMake build - if: matrix.image == 'ubuntu:22.10' - run: | - mkdir cmake.output - cd cmake.output - cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On .. - cmake --build . --target check -- -j$(nproc) - cd .. - - - name: Build cppcheck - run: | - make clean - make -j$(nproc) HAVE_RULES=yes - - - name: Build test - run: | - make -j$(nproc) testrunner HAVE_RULES=yes - - - name: Run test - run: | - make -j$(nproc) check HAVE_RULES=yes - - - name: Run extra tests - run: | - tools/generate_and_run_more_tests.sh - - - name: Validate - run: | - make -j$(nproc) checkCWEEntries validateXML - - - name: Test addons - run: | - ./cppcheck --addon=threadsafety addons/test/threadsafety - ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml deleted file mode 100644 index 80780b830d2..00000000000 --- a/.github/workflows/CI-unixish.yml +++ /dev/null @@ -1,287 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: CI-unixish - -on: [push, pull_request] - -jobs: - build: - - strategy: - matrix: - os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-10.15, macos-11, macos-12] - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - - - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - sudo apt-get install libtinyxml2-dev - sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser - - # required so a default Qt installation is configured - - name: Install missing software on ubuntu 18.04 - if: matrix.os == 'ubuntu-18.04' - run: | - sudo apt-get install qt5-default - - # packages for strict cfg checks - - name: Install missing software on ubuntu 22.04 - if: matrix.os == 'ubuntu-22.04' - run: | - sudo apt-get install libcairo2-dev libcurl4-openssl-dev liblua5.3-dev libssl-dev libsqlite3-dev libcppunit-dev libsigc++-2.0-dev libgtk-3-dev libboost-all-dev libwxgtk3.0-gtk3-dev xmlstarlet - - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - brew install coreutils python3 qt@5 - - - name: Install missing Python packages - run: | - python3 -m pip install pip --upgrade - python3 -m pip install pytest - - - name: CMake build on ubuntu (with GUI / system tinyxml2) - if: contains(matrix.os, 'ubuntu') - run: | - mkdir cmake.output.tinyxml2 - cd cmake.output.tinyxml2 - cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off .. - cmake --build . -- -j$(nproc) - cd .. - - - name: Run CMake test (system tinyxml2) - if: contains(matrix.os, 'ubuntu') - run: | - cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc) - - - name: CMake build on ubuntu (with GUI) - if: contains(matrix.os, 'ubuntu') - run: | - mkdir cmake.output - pushd cmake.output - cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On .. - cmake --build . -- -j$(nproc) - - - name: CMake build on macos (with GUI) - if: contains(matrix.os, 'macos') - run: | - mkdir cmake.output - pushd cmake.output - cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 .. - cmake --build . -- -j$(nproc) - - - name: Run CMake test - run: | - cmake --build cmake.output --target check -- -j$(nproc) - - - name: Run CTest - run: | - pushd cmake.output - ctest -j$(nproc) - - - name: Build with Unsigned char - run: | - make clean - make -j$(nproc) CXXFLAGS=-funsigned-char testrunner - - - name: Test with Unsigned char - run: | - ./testrunner TestSymbolDatabase - - - name: Build with TEST_MATHLIB_VALUE - run: | - make clean - touch lib/mathlib.cpp test/testmathlib.cpp - make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE all - - - name: Test with TEST_MATHLIB_VALUE - run: | - make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE check - - - name: Check syntax with NONNEG - run: | - ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG - - - name: Build cppcheck - run: | - make clean - make -j$(nproc) HAVE_RULES=yes - - - name: Build test - run: | - make -j$(nproc) testrunner HAVE_RULES=yes - - - name: Run test - run: | - make -j$(nproc) check HAVE_RULES=yes - - # the script uses sed parameters not supported by MacOS - - name: Run extra tests - if: contains(matrix.os, 'ubuntu') - run: | - tools/generate_and_run_more_tests.sh - - # do not use pushd in this step since we go below the working directory - - name: Run test/cli - run: | - cd test/cli - python3 -m pytest test-*.py - cd ../../.. - ln -s cppcheck 'cpp check' - cd 'cpp check/test/cli' - python3 -m pytest test-*.py - - # fails on macos since some includes (e.g. sys/epoll.h) are not available - - name: Run cfg tests - if: contains(matrix.os, 'ubuntu') && matrix.os != 'ubuntu-22.04' - run: | - make -j$(nproc) checkcfg - - - name: Run cfg tests (strict) - if: matrix.os == 'ubuntu-22.04' - run: | - make -j$(nproc) checkcfg - env: - STRICT: 1 - - # it seems macos has no "wc" command - - name: Run showtimetop5 tests - if: contains(matrix.os, 'ubuntu') - run: | - ./tools/test_showtimetop5.sh - - - name: Run --dump test - run: | - ./cppcheck test/testpreprocessor.cpp --dump - xmllint --noout test/testpreprocessor.cpp.dump - - - name: Validate - run: | - make -j$(nproc) checkCWEEntries validateXML - - # TODO: move to scriptcheck.yml so these are tested with all Python versions? - - name: Test addons - run: | - ./cppcheck --addon=threadsafety addons/test/threadsafety - ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety - ./cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c - pushd addons/test - # We'll force C89 standard to enable an additional verification for - # rules 5.4 and 5.5 which have standard-dependent options. - ../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64 - python3 ../misra.py -verify misra/misra-test.c.dump - # TODO: do we need to verify something here? - ../../cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.h - ../../cppcheck --dump misra/misra-test.cpp - python3 ../misra.py -verify misra/misra-test.cpp.dump - python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump - python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump - python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump - ../../cppcheck --addon=misra --platform=avr8 --error-exitcode=1 misra/misra-test-avr8.c - ../../cppcheck --dump misc-test.cpp - python3 ../misc.py -verify misc-test.cpp.dump - ../../cppcheck --dump naming_test.c - python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump - ../../cppcheck --dump naming_test.cpp - python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump - ../../cppcheck --dump namingng_test.c - python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump - - - name: Ensure misra addon does not crash - if: contains(matrix.os, 'ubuntu') - run: | - ./cppcheck --addon=misra addons/test/misra/crash1.c | ( ! grep 'Bailing out from checking' ) - - - name: Build GUI on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - pushd gui - qmake CONFIG+=debug HAVE_QCHART=yes - make -j$(nproc) - - - name: Run GUI tests on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - pushd gui/test/cppchecklibrarydata - qmake CONFIG+=debug - make -j$(nproc) - ./test-cppchecklibrarydata - popd - pushd gui/test/filelist - qmake CONFIG+=debug - make -j$(nproc) - # TODO: requires X session - #./test-filelist - popd - pushd gui/test/projectfile - qmake CONFIG+=debug - make -j$(nproc) - ./test-projectfile - popd - pushd gui/test/translationhandler - qmake CONFIG+=debug - make -j$(nproc) - # TODO: requires X session - #./test-translationhandler - popd - pushd gui/test/xmlreportv2 - qmake CONFIG+=debug - make -j$(nproc) - # TODO: requires X session - #./test-xmlreportv2 - - - name: Generate Qt help file on ubuntu 18.04 - if: matrix.os == 'ubuntu-18.04' - run: | - pushd gui/help - qcollectiongenerator online-help.qhcp -o online-help.qhc - - - name: Generate Qt help file on ubuntu 20.04 - if: matrix.os == 'ubuntu-22.04' - run: | - pushd gui/help - qhelpgenerator online-help.qhcp -o online-help.qhc - - - name: Build triage on ubuntu - if: matrix.os == 'ubuntu-22.04' - run: | - pushd tools/triage - qmake CONFIG+=debug - make -j$(nproc) - - - name: Build Fuzzer - if: matrix.os == 'ubuntu-22.04' - run: | - pushd oss-fuzz - make -j$(nproc) CXX=clang++ CXXFLAGS="-fsanitize=address" fuzz-client translate - - - name: Self check (build) - if: matrix.os == 'ubuntu-22.04' - run: | - # compile with verification and ast matchers - make clean - make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2" MATCHCOMPILER=yes VERIFY=1 - - # Run self check after "Build GUI" to include generated headers in analysis - - name: Self check - if: matrix.os == 'ubuntu-22.04' - run: | - ec=0 - # self check lib/cli - mkdir b1 - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings cli lib || ec=1 - # check gui with qt settings - mkdir b2 - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1 - # self check test and tools - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1 - # triage - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1 - exit $ec diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml deleted file mode 100644 index 8466c5dfb43..00000000000 --- a/.github/workflows/CI-windows.yml +++ /dev/null @@ -1,206 +0,0 @@ -# Some convenient links: -# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md -# - -name: CI-windows - -on: [push,pull_request] - -defaults: - run: - shell: cmd - -jobs: - - build: - strategy: - matrix: - os: [windows-2019, windows-2022] - arch: [x64, x86] - qt_ver: ['', 5.15.2, 6.2.4, 6.3.0] - fail-fast: false - - runs-on: ${{ matrix.os }} - - env: - # see https://www.pcre.org/original/changelog.txt - PCRE_VERSION: 8.45 - - steps: - - uses: actions/checkout@v2 - if: matrix.arch == 'x64' || matrix.qt_ver == '' - - - name: Set up Python 3.10 - if: matrix.qt_ver == '' - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - - name: Set up Visual Studio environment - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: ${{ matrix.arch }} - - - name: Cache PCRE - id: cache-pcre - uses: actions/cache@v2 - if: matrix.arch == 'x64' || matrix.qt_ver == '' - with: - path: pcre-${{ env.PCRE_VERSION }}.zip - key: pcre-${{ env.PCRE_VERSION }} - - - name: Download PCRE - if: (matrix.arch == 'x64' || matrix.qt_ver == '') && steps.cache-pcre.outputs.cache-hit != 'true' - run: | - curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - - - name: Install PCRE - if: matrix.arch == 'x64' || matrix.qt_ver == '' - run: | - 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - cd pcre-%PCRE_VERSION% || exit /b !errorlevel! - cmake . -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DPCRE_BUILD_PCRECPP=Off -DPCRE_BUILD_TESTS=Off -DPCRE_BUILD_PCREGREP=Off || exit /b !errorlevel! - nmake || exit /b !errorlevel! - copy pcre.h ..\externals || exit /b !errorlevel! - if "${{ matrix.arch }}" == "x86" ( - copy pcre.lib ..\externals\pcre.lib || exit /b !errorlevel! - ) else ( - copy pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! - ) - env: - CL: /MP - - - name: Cache Qt ${{ matrix.qt_ver }} - if: matrix.qt_ver != '' && matrix.arch == 'x64' - id: cache-qt - uses: actions/cache@v1 # not v2! - with: - path: ../Qt - key: Windows-QtCache-${{ matrix.qt_ver }}-qtcharts - - # no 32-bit Qt available - - name: Install Qt ${{ matrix.qt_ver }} - if: matrix.qt_ver != '' && matrix.arch == 'x64' - uses: jurplel/install-qt-action@v3 - with: - aqtversion: '==2.0.6' - version: ${{ matrix.qt_ver }} - modules: 'qtcharts' - cached: ${{ steps.cache-qt.outputs.cache-hit }} - - - name: Install missing Python packages - if: matrix.qt_ver == '' - run: | - python -m pip install pip --upgrade || exit /b !errorlevel! - python -m pip install pytest || exit /b !errorlevel! - python -m pip install pytest-custom_exit_code || exit /b !errorlevel! - - - name: Build GUI release (qmake) - if: startsWith(matrix.qt_ver, '5') && matrix.arch == 'x64' - run: | - cd gui || exit /b !errorlevel! - qmake HAVE_QCHART=yes || exit /b !errorlevel! - nmake release || exit /b !errorlevel! - env: - CL: /MP - - - name: Deploy GUI - if: startsWith(matrix.qt_ver, '5') && matrix.arch == 'x64' - run: | - windeployqt Build\gui || exit /b !errorlevel! - del Build\gui\cppcheck-gui.ilk || exit /b !errorlevel! - del Build\gui\cppcheck-gui.pdb || exit /b !errorlevel! - - - name: Build GUI release (CMake) - if: startsWith(matrix.qt_ver, '6') && matrix.arch == 'x64' - run: | - md build || exit /b !errorlevel! - cd build || exit /b !errorlevel! - cmake -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_QT6=On .. || exit /b !errorlevel! - cmake --build . --target cppcheck-gui || exit /b !errorlevel! - - # TODO: deploy with Qt6 - - - name: Run CMake - if: false && matrix.qt_ver == '' - run: | - set ARCH=${{ matrix.arch }} - if "${{ matrix.arch }}" == "x86" ( - set ARCH=Win32 - ) - md build || exit /b !errorlevel! - cd build || exit /b !errorlevel! - cmake -DBUILD_TESTS=On .. || exit /b !errorlevel! - - - name: Build CLI debug configuration using MSBuild - if: matrix.qt_ver == '' - run: | - set ARCH=${{ matrix.arch }} - if "${{ matrix.arch }}" == "x86" ( - set ARCH=Win32 - ) - :: cmake --build build --target check --config Debug || exit /b !errorlevel! - msbuild -m cppcheck.sln /p:Configuration=Debug-PCRE;Platform=%ARCH% -maxcpucount || exit /b !errorlevel! - - - name: Run Debug test - if: matrix.qt_ver == '' - run: .\bin\debug\testrunner.exe || exit /b !errorlevel! - - - name: Build CLI release configuration using MSBuild - if: matrix.qt_ver == '' - run: | - set ARCH=${{ matrix.arch }} - if "${{ matrix.arch }}" == "x86" ( - set ARCH=Win32 - ) - :: cmake --build build --target check --config Release || exit /b !errorlevel! - msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=%ARCH% -maxcpucount || exit /b !errorlevel! - - - name: Run Release test - if: matrix.qt_ver == '' - run: .\bin\testrunner.exe || exit /b !errorlevel! - - - name: Run test/cli - if: matrix.qt_ver == '' - run: | - :: since FILESDIR is not set copy the binary to the root so the addons are found - :: copy .\build\bin\Release\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel! - copy .\bin\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel! - copy .\bin\cppcheck-core.dll .\cppcheck-core.dll || exit /b !errorlevel! - cd test/cli || exit /b !errorlevel! - :: python -m pytest --suppress-no-test-exit-code test-clang-import.py || exit /b !errorlevel! - python -m pytest test-helloworld.py || exit /b !errorlevel! - python -m pytest test-inline-suppress.py || exit /b !errorlevel! - python -m pytest test-more-projects.py || exit /b !errorlevel! - python -m pytest test-proj2.py || exit /b !errorlevel! - python -m pytest test-suppress-syntaxError.py || exit /b !errorlevel! - - - name: Test addons - if: matrix.qt_ver == '' - run: | - .\cppcheck --addon=threadsafety addons\test\threadsafety || exit /b !errorlevel! - .\cppcheck --addon=threadsafety --std=c++03 addons\test\threadsafety || exit /b !errorlevel! - .\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c || exit /b !errorlevel! - cd addons\test - rem We'll force C89 standard to enable an additional verification for - rem rules 5.4 and 5.5 which have standard-dependent options. - ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 || exit /b !errorlevel! - python3 ..\misra.py -verify misra\misra-test.c.dump || exit /b !errorlevel! - rem TODO: do we need to verify something here? - ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra\misra-test.h || exit /b !errorlevel! - ..\..\cppcheck --dump misra\misra-test.cpp || exit /b !errorlevel! - python3 ..\misra.py -verify misra\misra-test.cpp.dump || exit /b !errorlevel! - python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_ascii.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! - python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_utf8.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! - python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_windows1250.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! - ..\..\cppcheck --addon=misra --platform=avr8 --error-exitcode=1 misra\misra-test-avr8.c || exit /b !errorlevel! - ..\..\cppcheck --dump misc-test.cpp || exit /b !errorlevel! - python3 ..\misc.py -verify misc-test.cpp.dump || exit /b !errorlevel! - ..\..\cppcheck --dump naming_test.c || exit /b !errorlevel! - rem TODO: fix this - does not fail on Linux - rem python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump || exit /b !errorlevel! - ..\..\cppcheck --dump naming_test.cpp || exit /b !errorlevel! - python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump || exit /b !errorlevel! - ..\..\cppcheck --dump namingng_test.c || exit /b !errorlevel! - python3 ..\namingng.py --configfile ..\naming.json --verify namingng_test.c.dump || exit /b !errorlevel! - diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml deleted file mode 100644 index 3d2862ddc48..00000000000 --- a/.github/workflows/asan.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: address sanitizer - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-22.04 - - container: - image: "ubuntu:22.04" - - env: - ASAN_OPTIONS: detect_stack_use_after_return=1 - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - - name: Install missing software on ubuntu - run: | - apt-get update - apt-get install -y cmake make libpcre3-dev - apt-get install -y clang-14 - - - 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 -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On - env: - CC: clang-14 - CXX: clang++-14 - - - name: Build cppcheck - run: | - cmake --build cmake.output --target cppcheck -- -j $(nproc) - - - name: Build test - run: | - cmake --build cmake.output --target testrunner -- -j $(nproc) - - - name: Run tests - run: ./cmake.output/bin/testrunner - - # TODO: re-enable - was being killed because of incresaed memory usage - # TODO: no gui/temp/*.cpp files available - - name: Self check - if: false - run: | - ec=0 - ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1 - ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1 - ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1 - ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1 - exit $ec diff --git a/.github/workflows/buildman.yml b/.github/workflows/buildman.yml deleted file mode 100644 index dfaf313840b..00000000000 --- a/.github/workflows/buildman.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Build manual - -on: [push, pull_request] - -jobs: - convert_via_pandoc: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v2 - - - run: | - mkdir output - - - uses: docker://pandoc/latex:2.9 - with: - args: --output=output/manual.html man/manual.md - - - uses: docker://pandoc/latex:2.9 - with: - args: --output=output/manual.pdf man/manual.md - - - uses: actions/upload-artifact@v2 - with: - name: output - path: output diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml deleted file mode 100644 index 6d5636696d5..00000000000 --- a/.github/workflows/clang-tidy.yml +++ /dev/null @@ -1,61 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: clang-tidy - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-22.04 - - container: - image: "ubuntu:22.04" - - env: - QT_VERSION: 5.15.2 - - steps: - - uses: actions/checkout@v2 - - - name: Install missing software - run: | - apt-get update - 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-14 - - - name: Cache Qt ${{ env.QT_VERSION }} - id: cache-qt - uses: actions/cache@v1 # not v2! - with: - path: ../Qt - key: Linux-QtCache-${{ env.QT_VERSION }}-qtcharts - - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v2 - with: - install-deps: 'nosudo' - version: ${{ env.QT_VERSION }} - modules: 'qtcharts' - cached: ${{ steps.cache-qt.outputs.cache-hit }} - - - name: Prepare CMake - run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off - env: - CC: clang-14 - CXX: clang++-14 - - - name: Prepare CMake dependencies - run: | - # make sure the precompiled headers exist - make -C cmake.output/lib cmake_pch.hxx.pch - make -C cmake.output/test cmake_pch.hxx.pch - # make sure the auto-generated GUI sources exist - make -C cmake.output autogen - - - name: Clang-Tidy - run: | - cmake --build cmake.output --target run-clang-tidy 2> /dev/null diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index a1a69e6c143..00000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: "CodeQL" - -on: [push, pull_request] - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - # Override automatic language detection by changing the below list - # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ['cpp', 'python'] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - setup-python-dependencies: false - - - run: | - make -j$(nproc) HAVE_RULES=yes cppcheck - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 67828acfbac..00000000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: Coverage - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v2 - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - sudo apt-get install lcov - sudo apt-get install libcppunit-dev - python -m pip install pip --upgrade - python -m pip install lcov_cobertura - - - name: Compile instrumented - run: | - make -j$(nproc) test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" HAVE_RULES=yes - - - name: Generate coverage report - run: | - rm -rf coverage_report - ./testrunner - test/cfg/runtests.sh - gcov lib/*.cpp -o lib/ - lcov --directory ./ --capture --output-file lcov_tmp.info -b ./ - lcov --extract lcov_tmp.info "$(pwd)/*" --output-file lcov.info - genhtml lcov.info -o coverage_report --frame --legend --demangle-cpp - - - uses: actions/upload-artifact@v2 - with: - name: Coverage results - path: coverage_report - - - uses: codecov/codecov-action@v1.2.1 - with: - # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos - # file: ./coverage.xml # optional - flags: unittests # optional - name: ${{ github.repository }} # optional - fail_ci_if_error: true # optional (default = false): diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 38381020511..00000000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: format - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v2 - - - name: Cache uncrustify - uses: actions/cache@v2 - id: cache-uncrustify - with: - path: | - ~/uncrustify - key: ${{ runner.os }}-uncrustify - - - name: build uncrustify - if: steps.cache-uncrustify.outputs.cache-hit != 'true' - run: | - wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.72.0.tar.gz - tar xzvf uncrustify-0.72.0.tar.gz && cd uncrustify-uncrustify-0.72.0 - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release .. - cmake --build . -- -j$(nproc) -s - mkdir ~/uncrustify - cp uncrustify ~/uncrustify/ - - - name: Uncrustify check - run: | - ~/uncrustify/uncrustify -c .uncrustify.cfg -l CPP --no-backup --replace */*.cpp */*.h - git diff - git diff | diff - /dev/null &> /dev/null diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml deleted file mode 100644 index f87f21ee4c6..00000000000 --- a/.github/workflows/iwyu.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: include-what-you-use - -on: workflow_dispatch - -jobs: - build: - - runs-on: ubuntu-22.04 - - container: - image: "kalilinux/kali-rolling" - - steps: - - uses: actions/checkout@v2 - - # TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image - - name: Install missing software - run: | - apt-get update - apt-get install -y cmake g++ make libpcre3-dev - apt-get install -y qtbase5-dev qttools5-dev libqt5charts5-dev - apt-get install -y wget iwyu - - - name: Prepare CMake - run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off - - - name: Prepare CMake dependencies - run: | - # make sure the precompiled headers exist - #make -C cmake.output lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx - #make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx - # make sure the auto-generated GUI sources exist - make -C cmake.output autogen - # make sure the auto-generated GUI dependencies exist - make -C cmake.output gui-build-deps - - - name: Build Qt mappings - run: | - wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-qt.py - python3 iwyu-mapgen-qt.py /usr/include/x86_64-linux-gnu/qt5/ > qt5.imp - - # TODO: the mapping file causes a massive slowdown so we cannot use it at the moment. - # add "-Xiwyu --mapping_file=qt5.imp" at the end of the whole command if we can use them. - - name: iwyu_tool - run: | - # do not fail for now so the output is being saved - iwyu_tool -p cmake.output -j $(nproc) -- -w > iwyu.log || true - - - uses: actions/upload-artifact@v2 - with: - name: Qt Mappings - path: ./qt5.imp - - - uses: actions/upload-artifact@v2 - with: - name: Logs - path: ./*.log diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml deleted file mode 100644 index b250fc9a4fd..00000000000 --- a/.github/workflows/release-windows.yml +++ /dev/null @@ -1,132 +0,0 @@ -# Some convenient links: -# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md -# - -name: release-windows - -on: - push: - tags: - - '2.*' - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -defaults: - run: - shell: cmd - -jobs: - - build: - - runs-on: windows-2022 - - env: - # see https://www.pcre.org/original/changelog.txt - PCRE_VERSION: 8.45 - QT_VERSION: 5.15.2 - - steps: - - uses: actions/checkout@v2 - - - name: Set up Visual Studio environment - uses: ilammy/msvc-dev-cmd@v1 - - - name: Cache PCRE - id: cache-pcre - uses: actions/cache@v2 - with: - path: pcre-${{ env.PCRE_VERSION }}.zip - key: pcre-${{ env.PCRE_VERSION }} - - - name: Download PCRE - if: steps.cache-pcre.outputs.cache-hit != 'true' - run: | - curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - - - name: Install PCRE - run: | - 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - cd pcre-%PCRE_VERSION% || exit /b !errorlevel! - cmake . -G "Visual Studio 17 2022" -A x64 -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_BUILD_TESTS=OFF || exit /b !errorlevel! - msbuild -m PCRE.sln -p:Configuration=Release -p:Platform=x64 || exit /b !errorlevel! - copy pcre.h ..\externals || exit /b !errorlevel! - copy Release\pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! - - - name: Cache Qt ${{ env.QT_VERSION }} - id: cache-qt - uses: actions/cache@v1 # not v2! - with: - path: ../Qt - key: Windows-QtCache-${{ env.QT_VERSION }}-qtcharts-qthelp - - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v2 - with: - version: ${{ env.QT_VERSION }} - modules: 'qtcharts qthelp' - cached: ${{ steps.cache-qt.outputs.cache-hit }} - - - name: Create .qm - run: | - cd gui || exit /b !errorlevel! - lupdate gui.pro -no-obsolete || exit /b !errorlevel! - lrelease gui.pro -removeidentical || exit /b !errorlevel! - - - name: Matchcompiler - run: python tools\matchcompiler.py --write-dir lib || exit /b !errorlevel! - - - name: Build x64 release GUI - run: | - cd gui || exit /b !errorlevel! - qmake HAVE_QCHART=yes || exit /b !errorlevel! - nmake release || exit /b !errorlevel! - env: - CL: /MP - - - name: Deploy app - run: | - windeployqt Build\gui || exit /b !errorlevel! - del Build\gui\cppcheck-gui.ilk || exit /b !errorlevel! - del Build\gui\cppcheck-gui.pdb || exit /b !errorlevel! - - - name: Build CLI x64 release configuration using MSBuild - run: msbuild -m cppcheck.sln -t:cli -p:Configuration=Release-PCRE -p:Platform=x64 || exit /b !errorlevel! - - - name: Collect files - run: | - move Build\gui win_installer\files || exit /b !errorlevel! - mkdir win_installer\files\addons || exit /b !errorlevel! - copy addons\*.* win_installer\files\addons || exit /b !errorlevel! - mkdir win_installer\files\cfg || exit /b !errorlevel! - copy cfg\*.cfg win_installer\files\cfg || exit /b !errorlevel! - :: "platforms" is a folder used by Qt as well so it already exists - :: mkdir win_installer\files\platforms || exit /b !errorlevel! - copy platforms\*.xml win_installer\files\platforms || exit /b !errorlevel! - copy bin\cppcheck.exe win_installer\files || exit /b !errorlevel! - copy bin\cppcheck-core.dll win_installer\files || exit /b !errorlevel! - mkdir win_installer\files\help || exit /b !errorlevel! - xcopy /s gui\help win_installer\files\help || exit /b !errorlevel! - del win_installer\files\translations\*.qm || exit /b !errorlevel! - move gui\*.qm win_installer\files\translations || exit /b !errorlevel! - - - name: Build Installer - run: | - cd win_installer || exit /b !errorlevel! - REM Read ProductVersion - for /f "tokens=4 delims= " %%a in ('find "ProductVersion" productInfo.wxi') do set PRODUCTVER=%%a - REM Remove double quotes - set PRODUCTVER=%PRODUCTVER:"=% - echo ProductVersion="%PRODUCTVER%" || exit /b !errorlevel! - msbuild -m cppcheck.wixproj -p:Platform=x64,ProductVersion=%PRODUCTVER%.${{ github.run_number }} || exit /b !errorlevel! - - - uses: actions/upload-artifact@v2 - with: - name: installer - path: win_installer/Build/ - - - uses: actions/upload-artifact@v2 - with: - name: deploy - path: win_installer\files diff --git a/.github/workflows/scriptcheck.yml b/.github/workflows/scriptcheck.yml deleted file mode 100644 index 6b2f0c09489..00000000000 --- a/.github/workflows/scriptcheck.yml +++ /dev/null @@ -1,139 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: scriptcheck - -on: [push, pull_request] - -jobs: - build: - - # 'ubuntu-22.04' removes Python 2.7, 3.6 and 3.6 so keep the previous LTS version - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2 - - - name: Cache Cppcheck - uses: actions/cache@v2 - with: - path: cppcheck - key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }} - - - name: build cppcheck - run: | - make -j$(nproc) -s - strip -s ./cppcheck - - scriptcheck: - - needs: build - # 'ubuntu-22.04' removes Python 2.7, 3.5 and 3.6 so keep the previous LTS version - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10'] - fail-fast: false - - steps: - - uses: actions/checkout@v2 - - - name: Restore Cppcheck - uses: actions/cache@v2 - with: - path: cppcheck - key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }} - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install tidy libxml2-utils - - - name: Install missing software on ubuntu (Python 2) - if: matrix.python-version == '2.7' - run: | - python -m pip install pip --upgrade - python -m pip install pathlib - python -m pip install pytest - python -m pip install pygments - - - name: Install missing software on ubuntu (Python 3) - if: matrix.python-version != '2.7' - run: | - sudo apt-get install shellcheck - python -m pip install pip --upgrade - python -m pip install natsort - python -m pip install pexpect - python -m pip install pylint - python -m pip install unittest2 - python -m pip install pytest - python -m pip install pygments - python -m pip install requests - python -m pip install psutil - - - name: run Shellcheck - if: matrix.python-version == '3.10' - run: | - find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231 - - - name: run pylint - if: matrix.python-version == '3.10' - run: | - echo "FIXME pylint is disabled for now because it fails to import files:" - echo "FIXME addons/runaddon.py:1:0: E0401: Unable to import 'cppcheckdata' (import-error)" - echo "FIXME addons/runaddon.py:1:0: E0401: Unable to import 'cppcheck' (import-error)" - # pylint --rcfile=pylintrc_travis --jobs $(nproc) addons/*.py htmlreport/cppcheck-htmlreport htmlreport/*.py tools/*.py - - - name: check .json files - if: matrix.python-version == '3.10' - run: | - find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null - - - name: Validate - if: matrix.python-version == '3.10' - run: | - make -j$(nproc) validateCFG validatePlatforms validateRules - - - name: check python syntax - if: matrix.python-version != '2.7' - run: | - python -m py_compile addons/*.py - python -m py_compile htmlreport/cppcheck-htmlreport - python -m py_compile htmlreport/*.py - python -m py_compile tools/*.py - - - name: compile addons - run: | - python -m compileall ./addons - - - name: test matchcompiler - run: | - python tools/test_matchcompiler.py - - - name: test addons - run: | - python -m pytest addons/test/test-*.py - env: - PYTHONPATH: ./addons - - - name: test htmlreport - run: | - htmlreport/test_htmlreport.py - cd htmlreport - ./check.sh - - - name: test reduce - run: | - python -m pytest tools/test_reduce.py - env: - PYTHONPATH: ./tools - - - name: dmake - if: matrix.python-version == '3.10' - run: | - make -j$(nproc) run-dmake - git diff --exit-code diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml deleted file mode 100644 index 8501fd9d08a..00000000000 --- a/.github/workflows/selfcheck.yml +++ /dev/null @@ -1,81 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: selfcheck - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-22.04 - - env: - QT_VERSION: 5.15.2 - - steps: - - uses: actions/checkout@v2 - - - name: Cache Qt ${{ env.QT_VERSION }} - id: cache-qt - uses: actions/cache@v1 # not v2! - with: - path: ../Qt - key: Linux-QtCache-${{ env.QT_VERSION }}-qtcharts - - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v2 - with: - version: ${{ env.QT_VERSION }} - modules: 'qtcharts' - cached: ${{ steps.cache-qt.outputs.cache-hit }} - - # TODO: cache this - perform same build as for the other self check - - name: Self check (build) - run: | - make clean - make -j$(nproc) -s CXXFLAGS="-O2 -w" MATCHCOMPILER=yes - - - name: CMake - run: | - mkdir cmake.output - pushd cmake.output - cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DCMAKE_GLOBAL_AUTOGEN_TARGET=On .. - - - name: Generate dependencies - run: | - # make sure the precompiled headers exist - make -C cmake.output lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx - make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx - # make sure auto-generated GUI files exist - make -C cmake.output autogen - make -C cmake.output gui-build-deps - - # TODO: find a way to report unmatched suppressions without need to add information checks - - name: Self check (unusedFunction) - if: false # TODO: fails with preprocessorErrorDirective - see #10667 - run: | - ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --inconclusive --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr - env: - DISABLE_VALUEFLOW: 1 - - # the following steps are duplicated from above since setting up the build node in a parallel step takes longer than the actual steps - - name: CMake (no test) - run: | - mkdir cmake.output.notest - pushd cmake.output.notest - cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=0 -DBUILD_GUI=ON -DWITH_QCHART=ON -DCMAKE_GLOBAL_AUTOGEN_TARGET=On .. - - - name: Generate dependencies (no test) - run: | - # make sure the precompiled headers exist - make -C cmake.output.notest lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx - # make sure auto-generated GUI files exist - make -C cmake.output.notest autogen - make -C cmake.output.notest gui-build-deps - - # TODO: find a way to report unmatched suppressions without need to add information checks - - name: Self check (unusedFunction / no test) - run: | - ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --inconclusive --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr - env: - DISABLE_VALUEFLOW: 1 diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml deleted file mode 100644 index bf1c30d36a3..00000000000 --- a/.github/workflows/ubsan.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: undefined behaviour sanitizers - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-22.04 - - container: - image: "ubuntu:22.04" - - env: - UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - - name: Install missing software on ubuntu - run: | - apt-get update - apt-get install -y cmake make libpcre3-dev - apt-get install -y clang-14 - - - 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 -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On - env: - CC: clang-14 - CXX: clang++-14 - - - name: Build cppcheck - run: | - cmake --build cmake.output --target cppcheck -- -j $(nproc) - - - name: Build test - run: | - cmake --build cmake.output --target testrunner -- -j $(nproc) - - - name: Run tests - run: ./cmake.output/bin/testrunner - - # TODO: no gui/temp/*.cpp files available - - name: Self check - run: | - ec=0 - ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1 - ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1 - ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1 - ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1 - exit $ec diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml deleted file mode 100644 index 70e59d84fd1..00000000000 --- a/.github/workflows/valgrind.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: valgrind - -# on: [push, pull_request] -on: workflow_dispatch - -jobs: - build: - - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v2 - - - name: Prepare - run: | - sudo apt-get update - sudo apt-get install debian-goodies ubuntu-dbgsym-keyring - # the key expired and the ubuntu-dbgsym-keyring package does not yet include the latest one - see https://bugs.launchpad.net/ubuntu/+source/ubuntu-keyring/+bug/1920640 - wget -O - http://ddebs.ubuntu.com/dbgsym-release-key.asc | sudo apt-key add - - - - name: Add debug repos on ubuntu - run: | - echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list - echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list - echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list - - - name: Install missing software - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - sudo apt-get install valgrind - sudo apt-get install libc6-dbg-amd64-cross - - - name: Build cppcheck - run: | - CXXFLAGS="-O1 -g" make -j$(nproc) HAVE_RULES=yes MATCHCOMPILER=yes - - - name: Build test - run: | - CXXFLAGS="-O1 -g" make -j$(nproc) testrunner HAVE_RULES=yes MATCHCOMPILER=yes - - - name: Run valgrind - run: | - valgrind --error-limit=yes --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --suppressions=valgrind/testrunner.supp --gen-suppressions=all --log-fd=9 --error-exitcode=42 ./testrunner TestGarbage TestOther TestSimplifyTemplate 9>memcheck.log - cat memcheck.log - - - uses: actions/upload-artifact@v2 - with: - name: Logs - path: ./*.log diff --git a/Makefile b/Makefile index 22cb89c9e8b..750c86c7610 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ ifndef CXXFLAGS endif ifeq (g++, $(findstring g++,$(CXX))) - override CXXFLAGS += -std=c++0x + override CXXFLAGS += -std=gnu++0x else ifeq (clang++, $(findstring clang++,$(CXX))) override CXXFLAGS += -std=c++0x else ifeq ($(CXX), c++) diff --git a/lib/config.h b/lib/config.h index dbe3aa9088c..3a0f63d4f87 100644 --- a/lib/config.h +++ b/lib/config.h @@ -110,7 +110,7 @@ static const std::string emptyString; #elif defined(USE_THREADS) #define THREADING_MODEL_THREAD #define STDCALL -#elif ((defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__) && !defined(__CYGWIN__)) || defined(__CPPCHECK__) +#elif ((defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__)) || defined(__CPPCHECK__) #define THREADING_MODEL_FORK #else #error "No threading model defined" From 15aa454c068d274067de25dc960b720f31a346c6 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 22:14:01 +0200 Subject: [PATCH 07/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 57f3f1d2180..bf2bd7abc62 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -28,6 +28,10 @@ jobs: with: platform: ${{ matrix.arch }} + - name: Defines + run: | + C:\cygwin\bin\bash.exe -l -c "gcc -xc++ -dM -E - < /dev/null | egrep '(cplus|WIN32|CYGWIN|MINGW|VERSION)'" + - name: Build cppcheck run: | C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 From f4fcd414cc7cbea29b2e65a98adc2929f0cb1ce0 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 22:48:04 +0200 Subject: [PATCH 08/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index bf2bd7abc62..407127c94bd 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -16,6 +16,8 @@ jobs: matrix: os: [windows-2019] arch: [x64, x86] + packages: | + gcc-g++-11.3.0-1 fail-fast: false runs-on: ${{ matrix.os }} @@ -27,6 +29,7 @@ jobs: uses: cygwin/cygwin-install-action@master with: platform: ${{ matrix.arch }} + packages: ${{ matrix.packages }} - name: Defines run: | From ec68b6482dd952abb0fe9ee1b87a4e3ac21fafd4 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 22:49:14 +0200 Subject: [PATCH 09/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 407127c94bd..d9bf614c1af 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -16,8 +16,7 @@ jobs: matrix: os: [windows-2019] arch: [x64, x86] - packages: | - gcc-g++-11.3.0-1 + packages: 'gcc-g++-11.3.0-1' fail-fast: false runs-on: ${{ matrix.os }} From 60421849256f72c8d48369b257eb46134f3a4eeb Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 22:50:00 +0200 Subject: [PATCH 10/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index d9bf614c1af..8ed6a62d2fd 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -16,7 +16,8 @@ jobs: matrix: os: [windows-2019] arch: [x64, x86] - packages: 'gcc-g++-11.3.0-1' + packages: | + 'gcc-g++-11.3.0-1' fail-fast: false runs-on: ${{ matrix.os }} From 149915cd83fb870b8a555ba1d91bc3cde18bf81a Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 22:52:00 +0200 Subject: [PATCH 11/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 8ed6a62d2fd..b70173dda9f 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -17,7 +17,7 @@ jobs: os: [windows-2019] arch: [x64, x86] packages: | - 'gcc-g++-11.3.0-1' + "gcc-g++-11.3.0-1" fail-fast: false runs-on: ${{ matrix.os }} From e46177a01ecc50d7f77acae1cf45d4144f2a7599 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 23:39:21 +0200 Subject: [PATCH 12/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index b70173dda9f..f492422b38c 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -17,7 +17,7 @@ jobs: os: [windows-2019] arch: [x64, x86] packages: | - "gcc-g++-11.3.0-1" + gcc\-g\+\+-11\.3\.0\-1 fail-fast: false runs-on: ${{ matrix.os }} From 95922a242bf959c0770c7cd8945c9a40b0c12a81 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 23:40:14 +0200 Subject: [PATCH 13/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index f492422b38c..d4ee95445de 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -17,7 +17,7 @@ jobs: os: [windows-2019] arch: [x64, x86] packages: | - gcc\-g\+\+-11\.3\.0\-1 + gcc\-g\+\+\-11\.3\.0\-1 fail-fast: false runs-on: ${{ matrix.os }} From d70dfa8bf477057db8dc4ec6756065c3018ed957 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 23:41:56 +0200 Subject: [PATCH 14/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index d4ee95445de..3c00a85adeb 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -17,7 +17,7 @@ jobs: os: [windows-2019] arch: [x64, x86] packages: | - gcc\-g\+\+\-11\.3\.0\-1 + moreutils fail-fast: false runs-on: ${{ matrix.os }} From 253484f0c9a7450ba848cc8ec8467a47283dbdd9 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 23:44:09 +0200 Subject: [PATCH 15/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 3c00a85adeb..93e8c53a349 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -16,7 +16,7 @@ jobs: matrix: os: [windows-2019] arch: [x64, x86] - packages: | + packages: >- moreutils fail-fast: false From 25def30a68b2c1b3a8d0f2782b40b83d43a8d892 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 23:46:14 +0200 Subject: [PATCH 16/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 93e8c53a349..f3bc3561a73 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -16,8 +16,10 @@ jobs: matrix: os: [windows-2019] arch: [x64, x86] - packages: >- - moreutils + include: + - platform: 'amd64' + packages: >- + moreutils fail-fast: false runs-on: ${{ matrix.os }} From 79813053c8d119dc890a73ec375ef052433a111b Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 7 Jul 2022 23:48:02 +0200 Subject: [PATCH 17/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index f3bc3561a73..12fe1c25327 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -19,7 +19,7 @@ jobs: include: - platform: 'amd64' packages: >- - moreutils + gcc-g++-11.3.0-1 fail-fast: false runs-on: ${{ matrix.os }} From 7d36d5840a819782e39d2298fcccec9bd9ccd0fb Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 00:06:02 +0200 Subject: [PATCH 18/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 12fe1c25327..4f8ad288d18 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -17,7 +17,7 @@ jobs: os: [windows-2019] arch: [x64, x86] include: - - platform: 'amd64' + - platform: 'x86_64' packages: >- gcc-g++-11.3.0-1 fail-fast: false From f18a6790f977331e0b8da7fb0411612aaa09bf2f Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 00:12:55 +0200 Subject: [PATCH 19/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 4f8ad288d18..17df46ed7e6 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -19,7 +19,7 @@ jobs: include: - platform: 'x86_64' packages: >- - gcc-g++-11.3.0-1 + gcc-g++ fail-fast: false runs-on: ${{ matrix.os }} From 392174b1b1ae4838b5f3c73abfbd8f9b8c4186de Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 00:32:24 +0200 Subject: [PATCH 20/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 17df46ed7e6..4f54c275fde 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -18,7 +18,7 @@ jobs: arch: [x64, x86] include: - platform: 'x86_64' - packages: >- + packages: | gcc-g++ fail-fast: false @@ -33,10 +33,6 @@ jobs: platform: ${{ matrix.arch }} packages: ${{ matrix.packages }} - - name: Defines - run: | - C:\cygwin\bin\bash.exe -l -c "gcc -xc++ -dM -E - < /dev/null | egrep '(cplus|WIN32|CYGWIN|MINGW|VERSION)'" - - name: Build cppcheck run: | C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 @@ -52,7 +48,7 @@ jobs: - name: Extra test for misra run: | C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test - ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump + ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - .\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c + .\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c From ccac2c9804b51a3dc94d9bbf8123b7f609fc75eb Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 00:53:37 +0200 Subject: [PATCH 21/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 4f54c275fde..77184640596 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -48,7 +48,7 @@ jobs: - name: Extra test for misra run: | C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test - ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump + ../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - .\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c + ./cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c From 206bae1d65e634d10cd85558f07526eb251a9113 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 01:11:38 +0200 Subject: [PATCH 22/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 77184640596..20109f9d108 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -48,7 +48,8 @@ jobs: - name: Extra test for misra run: | C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test - ../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump + dir ..\.. + ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - ./cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c + .\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c From 544099fec4e2be9f6fdba6370ea0fd1b6e3b23b6 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 01:29:51 +0200 Subject: [PATCH 23/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 20109f9d108..0e42572ce98 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -48,8 +48,7 @@ jobs: - name: Extra test for misra run: | C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test - dir ..\.. - ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump + ..\..\cppcheck\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - .\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c + .\cppcheck\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c From deddb2e6cdd9ac7c8888ee51173edb41b996ceb2 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 01:48:12 +0200 Subject: [PATCH 24/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 0e42572ce98..62e086572a6 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -48,7 +48,8 @@ jobs: - name: Extra test for misra run: | C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test - ..\..\cppcheck\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump + dir ..\..\cppcheck + ..\..\cppcheck\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - .\cppcheck\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c + .\cppcheck\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c From a34d6cd3464e2cbb8191a23e8635cbf11cf9d696 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 02:06:21 +0200 Subject: [PATCH 25/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 62e086572a6..ef0a39ceb9c 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -48,8 +48,8 @@ jobs: - name: Extra test for misra run: | C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test - dir ..\..\cppcheck - ..\..\cppcheck\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump + dir ..\..\cppcheck\cppcheck + ..\..\cppcheck\cppcheck\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - .\cppcheck\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c + .\cppcheck\cppcheck\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c From fc0ec26cb7476230b6a7525c931ed24e55f925d3 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 11:10:14 +0200 Subject: [PATCH 26/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index ef0a39ceb9c..b81d2d4ce4f 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -49,7 +49,7 @@ jobs: run: | C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test dir ..\..\cppcheck\cppcheck - ..\..\cppcheck\cppcheck\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump + ..\..\cppcheck\cppcheck\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr ..\..\cppcheck\cppcheck\misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\..\cppcheck\cppcheck\addons\misra.py -verify ..\..\cppcheck\cppcheck\misra\misra-test.c.dump C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - .\cppcheck\cppcheck\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c + .\cppcheck\cppcheck\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 .\cppcheck\cppcheck\addons\test\misra\misra-ctu-*-test.c From cbb606fa2637c29952c654b7bb762904dc1c339d Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 13:59:52 +0200 Subject: [PATCH 27/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index b81d2d4ce4f..0c9b6e4fa90 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -47,9 +47,9 @@ jobs: - name: Extra test for misra run: | - C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test - dir ..\..\cppcheck\cppcheck - ..\..\cppcheck\cppcheck\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr ..\..\cppcheck\cppcheck\misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\..\cppcheck\cppcheck\addons\misra.py -verify ..\..\cppcheck\cppcheck\misra\misra-test.c.dump - C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - .\cppcheck\cppcheck\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 .\cppcheck\cppcheck\addons\test\misra\misra-ctu-*-test.c + cd %GITHUB_WORKSPACE%\addons\test + dir + ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump + cd %GITHUB_WORKSPACE% + .\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c From a4617fd94e8f5c116eeb126190726762e522d63a Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 14:34:36 +0200 Subject: [PATCH 28/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 0c9b6e4fa90..38e1cee0072 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -48,8 +48,6 @@ jobs: - name: Extra test for misra run: | cd %GITHUB_WORKSPACE%\addons\test - dir - ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump - cd %GITHUB_WORKSPACE% - .\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c + ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify %GITHUB_WORKSPACE%\addons\test\misra\misra-test.c.dump + ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-*-test.c From 6873e046d849d78f2bf3fba0089704b668b8709f Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 15:53:31 +0200 Subject: [PATCH 29/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 38e1cee0072..2a62f7fca2e 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -48,6 +48,8 @@ jobs: - name: Extra test for misra run: | cd %GITHUB_WORKSPACE%\addons\test - ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify %GITHUB_WORKSPACE%\addons\test\misra\misra-test.c.dump + ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 + dir misra + python3 ..\misra.py -verify misra\misra-test.c.dump ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-*-test.c From 6368442954c12ba32784513b13f90ece9acbe180 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 16:28:35 +0200 Subject: [PATCH 30/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 2a62f7fca2e..401ccb1ee71 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -48,8 +48,8 @@ jobs: - name: Extra test for misra run: | cd %GITHUB_WORKSPACE%\addons\test - ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 - dir misra - python3 ..\misra.py -verify misra\misra-test.c.dump - ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-*-test.c + #..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 + #dir misra + #python3 ..\misra.py -verify misra\misra-test.c.dump + ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c From c202eb713b1dacaeca9743b1115267a87ab7f4c5 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 17:07:41 +0200 Subject: [PATCH 31/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 401ccb1ee71..7aaa8cd83ab 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -48,8 +48,7 @@ jobs: - name: Extra test for misra run: | cd %GITHUB_WORKSPACE%\addons\test - #..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 - #dir misra - #python3 ..\misra.py -verify misra\misra-test.c.dump + ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 + python3 ..\misra.py -verify misra\misra-test.c.dump ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c From 5dd44d3a277bc4747a7ab924e39ea3d3320d3472 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 8 Jul 2022 17:45:42 +0200 Subject: [PATCH 32/38] Update CI-cygwin.yml --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 7aaa8cd83ab..90049cf3abc 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -50,5 +50,5 @@ jobs: cd %GITHUB_WORKSPACE%\addons\test ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 python3 ..\misra.py -verify misra\misra-test.c.dump - ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c + ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c # From 6b7538fb096cf246834f6b899cbd59a8ef94e585 Mon Sep 17 00:00:00 2001 From: chrchr Date: Fri, 8 Jul 2022 19:00:35 +0200 Subject: [PATCH 33/38] Cygwin uses THREADING_MODEL_FORK --- cli/processexecutor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index a248e078d9c..439fac18799 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -18,7 +18,7 @@ #include "processexecutor.h" -#if !defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) +#if !defined(WIN32) && !defined(__MINGW32__) #include "color.h" #include "config.h" From c0cddbff33b7acde042cbe874dea2cf32b8dbdc7 Mon Sep 17 00:00:00 2001 From: chrchr Date: Fri, 8 Jul 2022 19:35:14 +0200 Subject: [PATCH 34/38] Restore workflows --- .github/workflows/CI-mingw.yml | 41 ++++ .github/workflows/CI-unixish-docker.yml | 79 +++++++ .github/workflows/CI-unixish.yml | 287 ++++++++++++++++++++++++ .github/workflows/CI-windows.yml | 206 +++++++++++++++++ .github/workflows/asan.yml | 60 +++++ .github/workflows/buildman.yml | 25 +++ .github/workflows/clang-tidy.yml | 61 +++++ .github/workflows/codeql-analysis.yml | 43 ++++ .github/workflows/coverage.yml | 49 ++++ .github/workflows/format.yml | 39 ++++ .github/workflows/iwyu.yml | 60 +++++ .github/workflows/release-windows.yml | 132 +++++++++++ .github/workflows/scriptcheck.yml | 139 ++++++++++++ .github/workflows/selfcheck.yml | 81 +++++++ .github/workflows/ubsan.yml | 58 +++++ .github/workflows/valgrind.yml | 52 +++++ 16 files changed, 1412 insertions(+) create mode 100644 .github/workflows/CI-mingw.yml create mode 100644 .github/workflows/CI-unixish-docker.yml create mode 100644 .github/workflows/CI-unixish.yml create mode 100644 .github/workflows/CI-windows.yml create mode 100644 .github/workflows/asan.yml create mode 100644 .github/workflows/buildman.yml create mode 100644 .github/workflows/clang-tidy.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/format.yml create mode 100644 .github/workflows/iwyu.yml create mode 100644 .github/workflows/release-windows.yml create mode 100644 .github/workflows/scriptcheck.yml create mode 100644 .github/workflows/selfcheck.yml create mode 100644 .github/workflows/ubsan.yml create mode 100644 .github/workflows/valgrind.yml diff --git a/.github/workflows/CI-mingw.yml b/.github/workflows/CI-mingw.yml new file mode 100644 index 00000000000..1a6b23cfeec --- /dev/null +++ b/.github/workflows/CI-mingw.yml @@ -0,0 +1,41 @@ +# Some convenient links: +# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md +# + +name: CI-mingw + +on: [push,pull_request] + +defaults: + run: + shell: cmd + +jobs: + build_mingw: + strategy: + matrix: + os: [windows-2019] + arch: [x64] # TODO: fix x86 build? + fail-fast: false + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Set up MinGW + uses: egor-tensin/setup-mingw@v2 + with: + platform: ${{ matrix.arch }} + + - name: Build cppcheck + run: | + mingw32-make -j2 + + - name: Build test + run: | + mingw32-make -j2 testrunner + + - name: Run test + run: | + mingw32-make -j2 check diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml new file mode 100644 index 00000000000..d87ac3c59bb --- /dev/null +++ b/.github/workflows/CI-unixish-docker.yml @@ -0,0 +1,79 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: CI-unixish-docker + +on: [push, pull_request] + +jobs: + build: + + strategy: + matrix: + image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04"] + fail-fast: false # Prefer quick result + + runs-on: ubuntu-22.04 + + container: + image: ${{ matrix.image }} + + steps: + - uses: actions/checkout@v2 + + - name: Install missing software on CentOS 7 + if: matrix.image == 'centos:7' + run: | + yum install -y cmake gcc-c++ make which python3 + yum install -y pcre-devel + + - name: Install missing software on ubuntu + if: matrix.image != 'centos:7' + run: | + apt-get update + apt-get install -y cmake g++ make python3 libxml2-utils + apt-get install -y libpcre3-dev + + # tests require CMake 3.4 + - name: Test CMake build (no tests) + if: matrix.image != 'ubuntu:22.10' + run: | + mkdir cmake.output + cd cmake.output + cmake -G "Unix Makefiles" -DHAVE_RULES=On .. + cmake --build . -- -j$(nproc) + cd .. + + - name: Test CMake build + if: matrix.image == 'ubuntu:22.10' + run: | + mkdir cmake.output + cd cmake.output + cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On .. + cmake --build . --target check -- -j$(nproc) + cd .. + + - name: Build cppcheck + run: | + make clean + make -j$(nproc) HAVE_RULES=yes + + - name: Build test + run: | + make -j$(nproc) testrunner HAVE_RULES=yes + + - name: Run test + run: | + make -j$(nproc) check HAVE_RULES=yes + + - name: Run extra tests + run: | + tools/generate_and_run_more_tests.sh + + - name: Validate + run: | + make -j$(nproc) checkCWEEntries validateXML + + - name: Test addons + run: | + ./cppcheck --addon=threadsafety addons/test/threadsafety + ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml new file mode 100644 index 00000000000..80780b830d2 --- /dev/null +++ b/.github/workflows/CI-unixish.yml @@ -0,0 +1,287 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: CI-unixish + +on: [push, pull_request] + +jobs: + build: + + strategy: + matrix: + os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-10.15, macos-11, macos-12] + fail-fast: false # Prefer quick result + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Install missing software on ubuntu + if: contains(matrix.os, 'ubuntu') + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + sudo apt-get install libtinyxml2-dev + sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser + + # required so a default Qt installation is configured + - name: Install missing software on ubuntu 18.04 + if: matrix.os == 'ubuntu-18.04' + run: | + sudo apt-get install qt5-default + + # packages for strict cfg checks + - name: Install missing software on ubuntu 22.04 + if: matrix.os == 'ubuntu-22.04' + run: | + sudo apt-get install libcairo2-dev libcurl4-openssl-dev liblua5.3-dev libssl-dev libsqlite3-dev libcppunit-dev libsigc++-2.0-dev libgtk-3-dev libboost-all-dev libwxgtk3.0-gtk3-dev xmlstarlet + + - name: Install missing software on macos + if: contains(matrix.os, 'macos') + run: | + brew install coreutils python3 qt@5 + + - name: Install missing Python packages + run: | + python3 -m pip install pip --upgrade + python3 -m pip install pytest + + - name: CMake build on ubuntu (with GUI / system tinyxml2) + if: contains(matrix.os, 'ubuntu') + run: | + mkdir cmake.output.tinyxml2 + cd cmake.output.tinyxml2 + cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off .. + cmake --build . -- -j$(nproc) + cd .. + + - name: Run CMake test (system tinyxml2) + if: contains(matrix.os, 'ubuntu') + run: | + cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc) + + - name: CMake build on ubuntu (with GUI) + if: contains(matrix.os, 'ubuntu') + run: | + mkdir cmake.output + pushd cmake.output + cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On .. + cmake --build . -- -j$(nproc) + + - name: CMake build on macos (with GUI) + if: contains(matrix.os, 'macos') + run: | + mkdir cmake.output + pushd cmake.output + cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 .. + cmake --build . -- -j$(nproc) + + - name: Run CMake test + run: | + cmake --build cmake.output --target check -- -j$(nproc) + + - name: Run CTest + run: | + pushd cmake.output + ctest -j$(nproc) + + - name: Build with Unsigned char + run: | + make clean + make -j$(nproc) CXXFLAGS=-funsigned-char testrunner + + - name: Test with Unsigned char + run: | + ./testrunner TestSymbolDatabase + + - name: Build with TEST_MATHLIB_VALUE + run: | + make clean + touch lib/mathlib.cpp test/testmathlib.cpp + make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE all + + - name: Test with TEST_MATHLIB_VALUE + run: | + make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE check + + - name: Check syntax with NONNEG + run: | + ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG + + - name: Build cppcheck + run: | + make clean + make -j$(nproc) HAVE_RULES=yes + + - name: Build test + run: | + make -j$(nproc) testrunner HAVE_RULES=yes + + - name: Run test + run: | + make -j$(nproc) check HAVE_RULES=yes + + # the script uses sed parameters not supported by MacOS + - name: Run extra tests + if: contains(matrix.os, 'ubuntu') + run: | + tools/generate_and_run_more_tests.sh + + # do not use pushd in this step since we go below the working directory + - name: Run test/cli + run: | + cd test/cli + python3 -m pytest test-*.py + cd ../../.. + ln -s cppcheck 'cpp check' + cd 'cpp check/test/cli' + python3 -m pytest test-*.py + + # fails on macos since some includes (e.g. sys/epoll.h) are not available + - name: Run cfg tests + if: contains(matrix.os, 'ubuntu') && matrix.os != 'ubuntu-22.04' + run: | + make -j$(nproc) checkcfg + + - name: Run cfg tests (strict) + if: matrix.os == 'ubuntu-22.04' + run: | + make -j$(nproc) checkcfg + env: + STRICT: 1 + + # it seems macos has no "wc" command + - name: Run showtimetop5 tests + if: contains(matrix.os, 'ubuntu') + run: | + ./tools/test_showtimetop5.sh + + - name: Run --dump test + run: | + ./cppcheck test/testpreprocessor.cpp --dump + xmllint --noout test/testpreprocessor.cpp.dump + + - name: Validate + run: | + make -j$(nproc) checkCWEEntries validateXML + + # TODO: move to scriptcheck.yml so these are tested with all Python versions? + - name: Test addons + run: | + ./cppcheck --addon=threadsafety addons/test/threadsafety + ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety + ./cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c + pushd addons/test + # We'll force C89 standard to enable an additional verification for + # rules 5.4 and 5.5 which have standard-dependent options. + ../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64 + python3 ../misra.py -verify misra/misra-test.c.dump + # TODO: do we need to verify something here? + ../../cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.h + ../../cppcheck --dump misra/misra-test.cpp + python3 ../misra.py -verify misra/misra-test.cpp.dump + python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump + python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump + python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump + ../../cppcheck --addon=misra --platform=avr8 --error-exitcode=1 misra/misra-test-avr8.c + ../../cppcheck --dump misc-test.cpp + python3 ../misc.py -verify misc-test.cpp.dump + ../../cppcheck --dump naming_test.c + python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump + ../../cppcheck --dump naming_test.cpp + python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump + ../../cppcheck --dump namingng_test.c + python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump + + - name: Ensure misra addon does not crash + if: contains(matrix.os, 'ubuntu') + run: | + ./cppcheck --addon=misra addons/test/misra/crash1.c | ( ! grep 'Bailing out from checking' ) + + - name: Build GUI on ubuntu + if: contains(matrix.os, 'ubuntu') + run: | + pushd gui + qmake CONFIG+=debug HAVE_QCHART=yes + make -j$(nproc) + + - name: Run GUI tests on ubuntu + if: contains(matrix.os, 'ubuntu') + run: | + pushd gui/test/cppchecklibrarydata + qmake CONFIG+=debug + make -j$(nproc) + ./test-cppchecklibrarydata + popd + pushd gui/test/filelist + qmake CONFIG+=debug + make -j$(nproc) + # TODO: requires X session + #./test-filelist + popd + pushd gui/test/projectfile + qmake CONFIG+=debug + make -j$(nproc) + ./test-projectfile + popd + pushd gui/test/translationhandler + qmake CONFIG+=debug + make -j$(nproc) + # TODO: requires X session + #./test-translationhandler + popd + pushd gui/test/xmlreportv2 + qmake CONFIG+=debug + make -j$(nproc) + # TODO: requires X session + #./test-xmlreportv2 + + - name: Generate Qt help file on ubuntu 18.04 + if: matrix.os == 'ubuntu-18.04' + run: | + pushd gui/help + qcollectiongenerator online-help.qhcp -o online-help.qhc + + - name: Generate Qt help file on ubuntu 20.04 + if: matrix.os == 'ubuntu-22.04' + run: | + pushd gui/help + qhelpgenerator online-help.qhcp -o online-help.qhc + + - name: Build triage on ubuntu + if: matrix.os == 'ubuntu-22.04' + run: | + pushd tools/triage + qmake CONFIG+=debug + make -j$(nproc) + + - name: Build Fuzzer + if: matrix.os == 'ubuntu-22.04' + run: | + pushd oss-fuzz + make -j$(nproc) CXX=clang++ CXXFLAGS="-fsanitize=address" fuzz-client translate + + - name: Self check (build) + if: matrix.os == 'ubuntu-22.04' + run: | + # compile with verification and ast matchers + make clean + make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2" MATCHCOMPILER=yes VERIFY=1 + + # Run self check after "Build GUI" to include generated headers in analysis + - name: Self check + if: matrix.os == 'ubuntu-22.04' + run: | + ec=0 + # self check lib/cli + mkdir b1 + ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings cli lib || ec=1 + # check gui with qt settings + mkdir b2 + ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1 + # self check test and tools + ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1 + # triage + ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1 + exit $ec diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml new file mode 100644 index 00000000000..8466c5dfb43 --- /dev/null +++ b/.github/workflows/CI-windows.yml @@ -0,0 +1,206 @@ +# Some convenient links: +# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md +# + +name: CI-windows + +on: [push,pull_request] + +defaults: + run: + shell: cmd + +jobs: + + build: + strategy: + matrix: + os: [windows-2019, windows-2022] + arch: [x64, x86] + qt_ver: ['', 5.15.2, 6.2.4, 6.3.0] + fail-fast: false + + runs-on: ${{ matrix.os }} + + env: + # see https://www.pcre.org/original/changelog.txt + PCRE_VERSION: 8.45 + + steps: + - uses: actions/checkout@v2 + if: matrix.arch == 'x64' || matrix.qt_ver == '' + + - name: Set up Python 3.10 + if: matrix.qt_ver == '' + uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Set up Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + + - name: Cache PCRE + id: cache-pcre + uses: actions/cache@v2 + if: matrix.arch == 'x64' || matrix.qt_ver == '' + with: + path: pcre-${{ env.PCRE_VERSION }}.zip + key: pcre-${{ env.PCRE_VERSION }} + + - name: Download PCRE + if: (matrix.arch == 'x64' || matrix.qt_ver == '') && steps.cache-pcre.outputs.cache-hit != 'true' + run: | + curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! + + - name: Install PCRE + if: matrix.arch == 'x64' || matrix.qt_ver == '' + run: | + 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! + cd pcre-%PCRE_VERSION% || exit /b !errorlevel! + cmake . -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DPCRE_BUILD_PCRECPP=Off -DPCRE_BUILD_TESTS=Off -DPCRE_BUILD_PCREGREP=Off || exit /b !errorlevel! + nmake || exit /b !errorlevel! + copy pcre.h ..\externals || exit /b !errorlevel! + if "${{ matrix.arch }}" == "x86" ( + copy pcre.lib ..\externals\pcre.lib || exit /b !errorlevel! + ) else ( + copy pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! + ) + env: + CL: /MP + + - name: Cache Qt ${{ matrix.qt_ver }} + if: matrix.qt_ver != '' && matrix.arch == 'x64' + id: cache-qt + uses: actions/cache@v1 # not v2! + with: + path: ../Qt + key: Windows-QtCache-${{ matrix.qt_ver }}-qtcharts + + # no 32-bit Qt available + - name: Install Qt ${{ matrix.qt_ver }} + if: matrix.qt_ver != '' && matrix.arch == 'x64' + uses: jurplel/install-qt-action@v3 + with: + aqtversion: '==2.0.6' + version: ${{ matrix.qt_ver }} + modules: 'qtcharts' + cached: ${{ steps.cache-qt.outputs.cache-hit }} + + - name: Install missing Python packages + if: matrix.qt_ver == '' + run: | + python -m pip install pip --upgrade || exit /b !errorlevel! + python -m pip install pytest || exit /b !errorlevel! + python -m pip install pytest-custom_exit_code || exit /b !errorlevel! + + - name: Build GUI release (qmake) + if: startsWith(matrix.qt_ver, '5') && matrix.arch == 'x64' + run: | + cd gui || exit /b !errorlevel! + qmake HAVE_QCHART=yes || exit /b !errorlevel! + nmake release || exit /b !errorlevel! + env: + CL: /MP + + - name: Deploy GUI + if: startsWith(matrix.qt_ver, '5') && matrix.arch == 'x64' + run: | + windeployqt Build\gui || exit /b !errorlevel! + del Build\gui\cppcheck-gui.ilk || exit /b !errorlevel! + del Build\gui\cppcheck-gui.pdb || exit /b !errorlevel! + + - name: Build GUI release (CMake) + if: startsWith(matrix.qt_ver, '6') && matrix.arch == 'x64' + run: | + md build || exit /b !errorlevel! + cd build || exit /b !errorlevel! + cmake -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_QT6=On .. || exit /b !errorlevel! + cmake --build . --target cppcheck-gui || exit /b !errorlevel! + + # TODO: deploy with Qt6 + + - name: Run CMake + if: false && matrix.qt_ver == '' + run: | + set ARCH=${{ matrix.arch }} + if "${{ matrix.arch }}" == "x86" ( + set ARCH=Win32 + ) + md build || exit /b !errorlevel! + cd build || exit /b !errorlevel! + cmake -DBUILD_TESTS=On .. || exit /b !errorlevel! + + - name: Build CLI debug configuration using MSBuild + if: matrix.qt_ver == '' + run: | + set ARCH=${{ matrix.arch }} + if "${{ matrix.arch }}" == "x86" ( + set ARCH=Win32 + ) + :: cmake --build build --target check --config Debug || exit /b !errorlevel! + msbuild -m cppcheck.sln /p:Configuration=Debug-PCRE;Platform=%ARCH% -maxcpucount || exit /b !errorlevel! + + - name: Run Debug test + if: matrix.qt_ver == '' + run: .\bin\debug\testrunner.exe || exit /b !errorlevel! + + - name: Build CLI release configuration using MSBuild + if: matrix.qt_ver == '' + run: | + set ARCH=${{ matrix.arch }} + if "${{ matrix.arch }}" == "x86" ( + set ARCH=Win32 + ) + :: cmake --build build --target check --config Release || exit /b !errorlevel! + msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=%ARCH% -maxcpucount || exit /b !errorlevel! + + - name: Run Release test + if: matrix.qt_ver == '' + run: .\bin\testrunner.exe || exit /b !errorlevel! + + - name: Run test/cli + if: matrix.qt_ver == '' + run: | + :: since FILESDIR is not set copy the binary to the root so the addons are found + :: copy .\build\bin\Release\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel! + copy .\bin\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel! + copy .\bin\cppcheck-core.dll .\cppcheck-core.dll || exit /b !errorlevel! + cd test/cli || exit /b !errorlevel! + :: python -m pytest --suppress-no-test-exit-code test-clang-import.py || exit /b !errorlevel! + python -m pytest test-helloworld.py || exit /b !errorlevel! + python -m pytest test-inline-suppress.py || exit /b !errorlevel! + python -m pytest test-more-projects.py || exit /b !errorlevel! + python -m pytest test-proj2.py || exit /b !errorlevel! + python -m pytest test-suppress-syntaxError.py || exit /b !errorlevel! + + - name: Test addons + if: matrix.qt_ver == '' + run: | + .\cppcheck --addon=threadsafety addons\test\threadsafety || exit /b !errorlevel! + .\cppcheck --addon=threadsafety --std=c++03 addons\test\threadsafety || exit /b !errorlevel! + .\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c || exit /b !errorlevel! + cd addons\test + rem We'll force C89 standard to enable an additional verification for + rem rules 5.4 and 5.5 which have standard-dependent options. + ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 || exit /b !errorlevel! + python3 ..\misra.py -verify misra\misra-test.c.dump || exit /b !errorlevel! + rem TODO: do we need to verify something here? + ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra\misra-test.h || exit /b !errorlevel! + ..\..\cppcheck --dump misra\misra-test.cpp || exit /b !errorlevel! + python3 ..\misra.py -verify misra\misra-test.cpp.dump || exit /b !errorlevel! + python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_ascii.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! + python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_utf8.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! + python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_windows1250.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! + ..\..\cppcheck --addon=misra --platform=avr8 --error-exitcode=1 misra\misra-test-avr8.c || exit /b !errorlevel! + ..\..\cppcheck --dump misc-test.cpp || exit /b !errorlevel! + python3 ..\misc.py -verify misc-test.cpp.dump || exit /b !errorlevel! + ..\..\cppcheck --dump naming_test.c || exit /b !errorlevel! + rem TODO: fix this - does not fail on Linux + rem python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump || exit /b !errorlevel! + ..\..\cppcheck --dump naming_test.cpp || exit /b !errorlevel! + python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump || exit /b !errorlevel! + ..\..\cppcheck --dump namingng_test.c || exit /b !errorlevel! + python3 ..\namingng.py --configfile ..\naming.json --verify namingng_test.c.dump || exit /b !errorlevel! + diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml new file mode 100644 index 00000000000..3d2862ddc48 --- /dev/null +++ b/.github/workflows/asan.yml @@ -0,0 +1,60 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: address sanitizer + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-22.04 + + container: + image: "ubuntu:22.04" + + env: + ASAN_OPTIONS: detect_stack_use_after_return=1 + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Install missing software on ubuntu + run: | + apt-get update + apt-get install -y cmake make libpcre3-dev + apt-get install -y clang-14 + + - 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 -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On + env: + CC: clang-14 + CXX: clang++-14 + + - name: Build cppcheck + run: | + cmake --build cmake.output --target cppcheck -- -j $(nproc) + + - name: Build test + run: | + cmake --build cmake.output --target testrunner -- -j $(nproc) + + - name: Run tests + run: ./cmake.output/bin/testrunner + + # TODO: re-enable - was being killed because of incresaed memory usage + # TODO: no gui/temp/*.cpp files available + - name: Self check + if: false + run: | + ec=0 + ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1 + ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1 + ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1 + ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1 + exit $ec diff --git a/.github/workflows/buildman.yml b/.github/workflows/buildman.yml new file mode 100644 index 00000000000..dfaf313840b --- /dev/null +++ b/.github/workflows/buildman.yml @@ -0,0 +1,25 @@ +name: Build manual + +on: [push, pull_request] + +jobs: + convert_via_pandoc: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v2 + + - run: | + mkdir output + + - uses: docker://pandoc/latex:2.9 + with: + args: --output=output/manual.html man/manual.md + + - uses: docker://pandoc/latex:2.9 + with: + args: --output=output/manual.pdf man/manual.md + + - uses: actions/upload-artifact@v2 + with: + name: output + path: output diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml new file mode 100644 index 00000000000..6d5636696d5 --- /dev/null +++ b/.github/workflows/clang-tidy.yml @@ -0,0 +1,61 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: clang-tidy + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-22.04 + + container: + image: "ubuntu:22.04" + + env: + QT_VERSION: 5.15.2 + + steps: + - uses: actions/checkout@v2 + + - name: Install missing software + run: | + apt-get update + 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-14 + + - name: Cache Qt ${{ env.QT_VERSION }} + id: cache-qt + uses: actions/cache@v1 # not v2! + with: + path: ../Qt + key: Linux-QtCache-${{ env.QT_VERSION }}-qtcharts + + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v2 + with: + install-deps: 'nosudo' + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + cached: ${{ steps.cache-qt.outputs.cache-hit }} + + - name: Prepare CMake + run: | + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off + env: + CC: clang-14 + CXX: clang++-14 + + - name: Prepare CMake dependencies + run: | + # make sure the precompiled headers exist + make -C cmake.output/lib cmake_pch.hxx.pch + make -C cmake.output/test cmake_pch.hxx.pch + # make sure the auto-generated GUI sources exist + make -C cmake.output autogen + + - name: Clang-Tidy + run: | + cmake --build cmake.output --target run-clang-tidy 2> /dev/null diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000000..a1a69e6c143 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,43 @@ +name: "CodeQL" + +on: [push, pull_request] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + # Override automatic language detection by changing the below list + # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] + language: ['cpp', 'python'] + # Learn more... + # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + setup-python-dependencies: false + + - run: | + make -j$(nproc) HAVE_RULES=yes cppcheck + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..67828acfbac --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,49 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: Coverage + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v2 + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + sudo apt-get install lcov + sudo apt-get install libcppunit-dev + python -m pip install pip --upgrade + python -m pip install lcov_cobertura + + - name: Compile instrumented + run: | + make -j$(nproc) test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" HAVE_RULES=yes + + - name: Generate coverage report + run: | + rm -rf coverage_report + ./testrunner + test/cfg/runtests.sh + gcov lib/*.cpp -o lib/ + lcov --directory ./ --capture --output-file lcov_tmp.info -b ./ + lcov --extract lcov_tmp.info "$(pwd)/*" --output-file lcov.info + genhtml lcov.info -o coverage_report --frame --legend --demangle-cpp + + - uses: actions/upload-artifact@v2 + with: + name: Coverage results + path: coverage_report + + - uses: codecov/codecov-action@v1.2.1 + with: + # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + # file: ./coverage.xml # optional + flags: unittests # optional + name: ${{ github.repository }} # optional + fail_ci_if_error: true # optional (default = false): diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000000..38381020511 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,39 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: format + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v2 + + - name: Cache uncrustify + uses: actions/cache@v2 + id: cache-uncrustify + with: + path: | + ~/uncrustify + key: ${{ runner.os }}-uncrustify + + - name: build uncrustify + if: steps.cache-uncrustify.outputs.cache-hit != 'true' + run: | + wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.72.0.tar.gz + tar xzvf uncrustify-0.72.0.tar.gz && cd uncrustify-uncrustify-0.72.0 + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + cmake --build . -- -j$(nproc) -s + mkdir ~/uncrustify + cp uncrustify ~/uncrustify/ + + - name: Uncrustify check + run: | + ~/uncrustify/uncrustify -c .uncrustify.cfg -l CPP --no-backup --replace */*.cpp */*.h + git diff + git diff | diff - /dev/null &> /dev/null diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml new file mode 100644 index 00000000000..f87f21ee4c6 --- /dev/null +++ b/.github/workflows/iwyu.yml @@ -0,0 +1,60 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: include-what-you-use + +on: workflow_dispatch + +jobs: + build: + + runs-on: ubuntu-22.04 + + container: + image: "kalilinux/kali-rolling" + + steps: + - uses: actions/checkout@v2 + + # TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image + - name: Install missing software + run: | + apt-get update + apt-get install -y cmake g++ make libpcre3-dev + apt-get install -y qtbase5-dev qttools5-dev libqt5charts5-dev + apt-get install -y wget iwyu + + - name: Prepare CMake + run: | + cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off + + - name: Prepare CMake dependencies + run: | + # make sure the precompiled headers exist + #make -C cmake.output lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx + #make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx + # make sure the auto-generated GUI sources exist + make -C cmake.output autogen + # make sure the auto-generated GUI dependencies exist + make -C cmake.output gui-build-deps + + - name: Build Qt mappings + run: | + wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-qt.py + python3 iwyu-mapgen-qt.py /usr/include/x86_64-linux-gnu/qt5/ > qt5.imp + + # TODO: the mapping file causes a massive slowdown so we cannot use it at the moment. + # add "-Xiwyu --mapping_file=qt5.imp" at the end of the whole command if we can use them. + - name: iwyu_tool + run: | + # do not fail for now so the output is being saved + iwyu_tool -p cmake.output -j $(nproc) -- -w > iwyu.log || true + + - uses: actions/upload-artifact@v2 + with: + name: Qt Mappings + path: ./qt5.imp + + - uses: actions/upload-artifact@v2 + with: + name: Logs + path: ./*.log diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml new file mode 100644 index 00000000000..b250fc9a4fd --- /dev/null +++ b/.github/workflows/release-windows.yml @@ -0,0 +1,132 @@ +# Some convenient links: +# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md +# + +name: release-windows + +on: + push: + tags: + - '2.*' + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +defaults: + run: + shell: cmd + +jobs: + + build: + + runs-on: windows-2022 + + env: + # see https://www.pcre.org/original/changelog.txt + PCRE_VERSION: 8.45 + QT_VERSION: 5.15.2 + + steps: + - uses: actions/checkout@v2 + + - name: Set up Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + + - name: Cache PCRE + id: cache-pcre + uses: actions/cache@v2 + with: + path: pcre-${{ env.PCRE_VERSION }}.zip + key: pcre-${{ env.PCRE_VERSION }} + + - name: Download PCRE + if: steps.cache-pcre.outputs.cache-hit != 'true' + run: | + curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! + + - name: Install PCRE + run: | + 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! + cd pcre-%PCRE_VERSION% || exit /b !errorlevel! + cmake . -G "Visual Studio 17 2022" -A x64 -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_BUILD_TESTS=OFF || exit /b !errorlevel! + msbuild -m PCRE.sln -p:Configuration=Release -p:Platform=x64 || exit /b !errorlevel! + copy pcre.h ..\externals || exit /b !errorlevel! + copy Release\pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! + + - name: Cache Qt ${{ env.QT_VERSION }} + id: cache-qt + uses: actions/cache@v1 # not v2! + with: + path: ../Qt + key: Windows-QtCache-${{ env.QT_VERSION }}-qtcharts-qthelp + + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v2 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts qthelp' + cached: ${{ steps.cache-qt.outputs.cache-hit }} + + - name: Create .qm + run: | + cd gui || exit /b !errorlevel! + lupdate gui.pro -no-obsolete || exit /b !errorlevel! + lrelease gui.pro -removeidentical || exit /b !errorlevel! + + - name: Matchcompiler + run: python tools\matchcompiler.py --write-dir lib || exit /b !errorlevel! + + - name: Build x64 release GUI + run: | + cd gui || exit /b !errorlevel! + qmake HAVE_QCHART=yes || exit /b !errorlevel! + nmake release || exit /b !errorlevel! + env: + CL: /MP + + - name: Deploy app + run: | + windeployqt Build\gui || exit /b !errorlevel! + del Build\gui\cppcheck-gui.ilk || exit /b !errorlevel! + del Build\gui\cppcheck-gui.pdb || exit /b !errorlevel! + + - name: Build CLI x64 release configuration using MSBuild + run: msbuild -m cppcheck.sln -t:cli -p:Configuration=Release-PCRE -p:Platform=x64 || exit /b !errorlevel! + + - name: Collect files + run: | + move Build\gui win_installer\files || exit /b !errorlevel! + mkdir win_installer\files\addons || exit /b !errorlevel! + copy addons\*.* win_installer\files\addons || exit /b !errorlevel! + mkdir win_installer\files\cfg || exit /b !errorlevel! + copy cfg\*.cfg win_installer\files\cfg || exit /b !errorlevel! + :: "platforms" is a folder used by Qt as well so it already exists + :: mkdir win_installer\files\platforms || exit /b !errorlevel! + copy platforms\*.xml win_installer\files\platforms || exit /b !errorlevel! + copy bin\cppcheck.exe win_installer\files || exit /b !errorlevel! + copy bin\cppcheck-core.dll win_installer\files || exit /b !errorlevel! + mkdir win_installer\files\help || exit /b !errorlevel! + xcopy /s gui\help win_installer\files\help || exit /b !errorlevel! + del win_installer\files\translations\*.qm || exit /b !errorlevel! + move gui\*.qm win_installer\files\translations || exit /b !errorlevel! + + - name: Build Installer + run: | + cd win_installer || exit /b !errorlevel! + REM Read ProductVersion + for /f "tokens=4 delims= " %%a in ('find "ProductVersion" productInfo.wxi') do set PRODUCTVER=%%a + REM Remove double quotes + set PRODUCTVER=%PRODUCTVER:"=% + echo ProductVersion="%PRODUCTVER%" || exit /b !errorlevel! + msbuild -m cppcheck.wixproj -p:Platform=x64,ProductVersion=%PRODUCTVER%.${{ github.run_number }} || exit /b !errorlevel! + + - uses: actions/upload-artifact@v2 + with: + name: installer + path: win_installer/Build/ + + - uses: actions/upload-artifact@v2 + with: + name: deploy + path: win_installer\files diff --git a/.github/workflows/scriptcheck.yml b/.github/workflows/scriptcheck.yml new file mode 100644 index 00000000000..6b2f0c09489 --- /dev/null +++ b/.github/workflows/scriptcheck.yml @@ -0,0 +1,139 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: scriptcheck + +on: [push, pull_request] + +jobs: + build: + + # 'ubuntu-22.04' removes Python 2.7, 3.6 and 3.6 so keep the previous LTS version + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + + - name: Cache Cppcheck + uses: actions/cache@v2 + with: + path: cppcheck + key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }} + + - name: build cppcheck + run: | + make -j$(nproc) -s + strip -s ./cppcheck + + scriptcheck: + + needs: build + # 'ubuntu-22.04' removes Python 2.7, 3.5 and 3.6 so keep the previous LTS version + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10'] + fail-fast: false + + steps: + - uses: actions/checkout@v2 + + - name: Restore Cppcheck + uses: actions/cache@v2 + with: + path: cppcheck + key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install tidy libxml2-utils + + - name: Install missing software on ubuntu (Python 2) + if: matrix.python-version == '2.7' + run: | + python -m pip install pip --upgrade + python -m pip install pathlib + python -m pip install pytest + python -m pip install pygments + + - name: Install missing software on ubuntu (Python 3) + if: matrix.python-version != '2.7' + run: | + sudo apt-get install shellcheck + python -m pip install pip --upgrade + python -m pip install natsort + python -m pip install pexpect + python -m pip install pylint + python -m pip install unittest2 + python -m pip install pytest + python -m pip install pygments + python -m pip install requests + python -m pip install psutil + + - name: run Shellcheck + if: matrix.python-version == '3.10' + run: | + find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231 + + - name: run pylint + if: matrix.python-version == '3.10' + run: | + echo "FIXME pylint is disabled for now because it fails to import files:" + echo "FIXME addons/runaddon.py:1:0: E0401: Unable to import 'cppcheckdata' (import-error)" + echo "FIXME addons/runaddon.py:1:0: E0401: Unable to import 'cppcheck' (import-error)" + # pylint --rcfile=pylintrc_travis --jobs $(nproc) addons/*.py htmlreport/cppcheck-htmlreport htmlreport/*.py tools/*.py + + - name: check .json files + if: matrix.python-version == '3.10' + run: | + find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null + + - name: Validate + if: matrix.python-version == '3.10' + run: | + make -j$(nproc) validateCFG validatePlatforms validateRules + + - name: check python syntax + if: matrix.python-version != '2.7' + run: | + python -m py_compile addons/*.py + python -m py_compile htmlreport/cppcheck-htmlreport + python -m py_compile htmlreport/*.py + python -m py_compile tools/*.py + + - name: compile addons + run: | + python -m compileall ./addons + + - name: test matchcompiler + run: | + python tools/test_matchcompiler.py + + - name: test addons + run: | + python -m pytest addons/test/test-*.py + env: + PYTHONPATH: ./addons + + - name: test htmlreport + run: | + htmlreport/test_htmlreport.py + cd htmlreport + ./check.sh + + - name: test reduce + run: | + python -m pytest tools/test_reduce.py + env: + PYTHONPATH: ./tools + + - name: dmake + if: matrix.python-version == '3.10' + run: | + make -j$(nproc) run-dmake + git diff --exit-code diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml new file mode 100644 index 00000000000..8501fd9d08a --- /dev/null +++ b/.github/workflows/selfcheck.yml @@ -0,0 +1,81 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: selfcheck + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-22.04 + + env: + QT_VERSION: 5.15.2 + + steps: + - uses: actions/checkout@v2 + + - name: Cache Qt ${{ env.QT_VERSION }} + id: cache-qt + uses: actions/cache@v1 # not v2! + with: + path: ../Qt + key: Linux-QtCache-${{ env.QT_VERSION }}-qtcharts + + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v2 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + cached: ${{ steps.cache-qt.outputs.cache-hit }} + + # TODO: cache this - perform same build as for the other self check + - name: Self check (build) + run: | + make clean + make -j$(nproc) -s CXXFLAGS="-O2 -w" MATCHCOMPILER=yes + + - name: CMake + run: | + mkdir cmake.output + pushd cmake.output + cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DCMAKE_GLOBAL_AUTOGEN_TARGET=On .. + + - name: Generate dependencies + run: | + # make sure the precompiled headers exist + make -C cmake.output lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx + make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx + # make sure auto-generated GUI files exist + make -C cmake.output autogen + make -C cmake.output gui-build-deps + + # TODO: find a way to report unmatched suppressions without need to add information checks + - name: Self check (unusedFunction) + if: false # TODO: fails with preprocessorErrorDirective - see #10667 + run: | + ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --inconclusive --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr + env: + DISABLE_VALUEFLOW: 1 + + # the following steps are duplicated from above since setting up the build node in a parallel step takes longer than the actual steps + - name: CMake (no test) + run: | + mkdir cmake.output.notest + pushd cmake.output.notest + cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=0 -DBUILD_GUI=ON -DWITH_QCHART=ON -DCMAKE_GLOBAL_AUTOGEN_TARGET=On .. + + - name: Generate dependencies (no test) + run: | + # make sure the precompiled headers exist + make -C cmake.output.notest lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx + # make sure auto-generated GUI files exist + make -C cmake.output.notest autogen + make -C cmake.output.notest gui-build-deps + + # TODO: find a way to report unmatched suppressions without need to add information checks + - name: Self check (unusedFunction / no test) + run: | + ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --inconclusive --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr + env: + DISABLE_VALUEFLOW: 1 diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml new file mode 100644 index 00000000000..bf1c30d36a3 --- /dev/null +++ b/.github/workflows/ubsan.yml @@ -0,0 +1,58 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: undefined behaviour sanitizers + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-22.04 + + container: + image: "ubuntu:22.04" + + env: + UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Install missing software on ubuntu + run: | + apt-get update + apt-get install -y cmake make libpcre3-dev + apt-get install -y clang-14 + + - 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 -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On + env: + CC: clang-14 + CXX: clang++-14 + + - name: Build cppcheck + run: | + cmake --build cmake.output --target cppcheck -- -j $(nproc) + + - name: Build test + run: | + cmake --build cmake.output --target testrunner -- -j $(nproc) + + - name: Run tests + run: ./cmake.output/bin/testrunner + + # TODO: no gui/temp/*.cpp files available + - name: Self check + run: | + ec=0 + ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1 + ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1 + ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1 + ./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1 + exit $ec diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml new file mode 100644 index 00000000000..70e59d84fd1 --- /dev/null +++ b/.github/workflows/valgrind.yml @@ -0,0 +1,52 @@ +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners +name: valgrind + +# on: [push, pull_request] +on: workflow_dispatch + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v2 + + - name: Prepare + run: | + sudo apt-get update + sudo apt-get install debian-goodies ubuntu-dbgsym-keyring + # the key expired and the ubuntu-dbgsym-keyring package does not yet include the latest one - see https://bugs.launchpad.net/ubuntu/+source/ubuntu-keyring/+bug/1920640 + wget -O - http://ddebs.ubuntu.com/dbgsym-release-key.asc | sudo apt-key add - + + - name: Add debug repos on ubuntu + run: | + echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list + echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list + echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list + + - name: Install missing software + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + sudo apt-get install valgrind + sudo apt-get install libc6-dbg-amd64-cross + + - name: Build cppcheck + run: | + CXXFLAGS="-O1 -g" make -j$(nproc) HAVE_RULES=yes MATCHCOMPILER=yes + + - name: Build test + run: | + CXXFLAGS="-O1 -g" make -j$(nproc) testrunner HAVE_RULES=yes MATCHCOMPILER=yes + + - name: Run valgrind + run: | + valgrind --error-limit=yes --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --suppressions=valgrind/testrunner.supp --gen-suppressions=all --log-fd=9 --error-exitcode=42 ./testrunner TestGarbage TestOther TestSimplifyTemplate 9>memcheck.log + cat memcheck.log + + - uses: actions/upload-artifact@v2 + with: + name: Logs + path: ./*.log From f1fe470ce810aa61696a4303733521afcaab7012 Mon Sep 17 00:00:00 2001 From: chrchr Date: Fri, 8 Jul 2022 19:35:29 +0200 Subject: [PATCH 35/38] Remove comment --- .github/workflows/CI-cygwin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index 90049cf3abc..7aaa8cd83ab 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -50,5 +50,5 @@ jobs: cd %GITHUB_WORKSPACE%\addons\test ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 python3 ..\misra.py -verify misra\misra-test.c.dump - ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c # + ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c From 0af441a6564ac852eed1e7641e52f5e16f7146bf Mon Sep 17 00:00:00 2001 From: chrchr Date: Fri, 8 Jul 2022 20:17:06 +0200 Subject: [PATCH 36/38] Fix dmake --- tools/dmake.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dmake.cpp b/tools/dmake.cpp index 4c03bab4138..89336abae1d 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -374,7 +374,7 @@ int main(int argc, char **argv) } fout << "ifeq (g++, $(findstring g++,$(CXX)))\n" - << " override CXXFLAGS += -std=c++0x\n" + << " override CXXFLAGS += -std=gnu++0x\n" << "else ifeq (clang++, $(findstring clang++,$(CXX)))\n" << " override CXXFLAGS += -std=c++0x\n" << "else ifeq ($(CXX), c++)\n" From dd5d3e67c6cf08cf5b377b991c31dcd06c1bbb79 Mon Sep 17 00:00:00 2001 From: chrchr Date: Mon, 11 Jul 2022 11:34:59 +0200 Subject: [PATCH 37/38] Fix #11179 FP invalidFunctionArgStr --- lib/checkfunctions.cpp | 3 ++- test/testfunctions.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/checkfunctions.cpp b/lib/checkfunctions.cpp index e831fb5d86a..ed67e1e6e34 100644 --- a/lib/checkfunctions.cpp +++ b/lib/checkfunctions.cpp @@ -141,7 +141,8 @@ void CheckFunctions::invalidFunctionUsage() const Variable* const variable = argtok->variable(); // Is non-null terminated local variable of type char (e.g. char buf[] = {'x'};) ? if (variable && variable->isLocal() - && valueType && (valueType->type == ValueType::Type::CHAR || valueType->type == ValueType::Type::WCHAR_T)) { + && valueType && (valueType->type == ValueType::Type::CHAR || valueType->type == ValueType::Type::WCHAR_T) && + !isVariablesChanged(variable->declEndToken(), functionToken, 0 /*indirect*/, { variable }, mSettings, mTokenizer->isCPP())) { const Token* varTok = variable->declEndToken(); auto count = -1; // Find out explicitly set count, e.g.: char buf[3] = {...}. Variable 'count' is set to 3 then. if (varTok && Token::simpleMatch(varTok->astOperand1(), "[")) diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index 1503ae27f7c..7690311df97 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -735,6 +735,14 @@ class TestFunctions : public TestFixture { " return strlen(c);\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + check("void f(int n) {\n" // #11179 + " char s[8] = \" \";\n" + " n = (n + 1) % 100;\n" + " sprintf(s, \"lwip%02d\", n);\n" + " s[strlen(s)] = ' ';\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void mathfunctionCall_sqrt() { From aaaaf16bd4c4e9ea4218f824a918ff032eb8564a Mon Sep 17 00:00:00 2001 From: chrchr Date: Mon, 11 Jul 2022 11:39:54 +0200 Subject: [PATCH 38/38] Revert "Fix #11179 FP invalidFunctionArgStr" This reverts commit dd5d3e67c6cf08cf5b377b991c31dcd06c1bbb79. --- lib/checkfunctions.cpp | 3 +-- test/testfunctions.cpp | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/checkfunctions.cpp b/lib/checkfunctions.cpp index ed67e1e6e34..e831fb5d86a 100644 --- a/lib/checkfunctions.cpp +++ b/lib/checkfunctions.cpp @@ -141,8 +141,7 @@ void CheckFunctions::invalidFunctionUsage() const Variable* const variable = argtok->variable(); // Is non-null terminated local variable of type char (e.g. char buf[] = {'x'};) ? if (variable && variable->isLocal() - && valueType && (valueType->type == ValueType::Type::CHAR || valueType->type == ValueType::Type::WCHAR_T) && - !isVariablesChanged(variable->declEndToken(), functionToken, 0 /*indirect*/, { variable }, mSettings, mTokenizer->isCPP())) { + && valueType && (valueType->type == ValueType::Type::CHAR || valueType->type == ValueType::Type::WCHAR_T)) { const Token* varTok = variable->declEndToken(); auto count = -1; // Find out explicitly set count, e.g.: char buf[3] = {...}. Variable 'count' is set to 3 then. if (varTok && Token::simpleMatch(varTok->astOperand1(), "[")) diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index 7690311df97..1503ae27f7c 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -735,14 +735,6 @@ class TestFunctions : public TestFixture { " return strlen(c);\n" "}\n"); ASSERT_EQUALS("", errout.str()); - - check("void f(int n) {\n" // #11179 - " char s[8] = \" \";\n" - " n = (n + 1) % 100;\n" - " sprintf(s, \"lwip%02d\", n);\n" - " s[strlen(s)] = ' ';\n" - "}\n"); - ASSERT_EQUALS("", errout.str()); } void mathfunctionCall_sqrt() {