Compare commits

..

3 Commits

Author SHA1 Message Date
Daniel Marjamäki b01c9267f0 2.4.1: Set version 2021-03-22 21:53:27 +01:00
Oliver Stöneberg d0afc4bf02 valgrind.yml: added workaround for expired dbgsym release key (#3178) 2021-03-22 21:16:35 +01:00
Georgiy Komarov 488084b40e win_installer: Add misra_9.py (#3180) 2021-03-22 21:14:37 +01:00
835 changed files with 160557 additions and 140886 deletions

20
.astylerc Executable file
View File

@ -0,0 +1,20 @@
##############################################################
# Documentation is available from #
# http://astyle.sourceforge.net/astyle.html #
##############################################################
### Options ###
--pad-header
--unpad-paren
--suffix=none
--convert-tabs
--attach-inlines
--attach-classes
--attach-namespaces
### Settings ###
--style=kr
--indent=spaces=4
--indent-namespaces
--lineend=linux
--min-conditional-indent=0

View File

@ -1,78 +1,5 @@
--- ---
Checks: > Checks: '*,-abseil-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-performance-for-range-copy,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-readability-misleading-indentation,-misc-unused-parameters-,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle'
*,
-abseil-*,
-altera-*,
-android-*,
-boost-*,
-cert-*,
-cppcoreguidelines-*,
-darwin-*,
-fuchsia-*,
-google-*,
-hicpp-*,
-linuxkernel-*,
-llvm-*,
-llvmlibc-*,
-mpi-*,
-objc-*,
-openmp-*,
-zircon-*,
cert-err34-c,
google-explicit-constructor,
cppcoreguidelines-rvalue-reference-param-not-moved,
-bugprone-assignment-in-if-condition,
-bugprone-branch-clone,
-bugprone-easily-swappable-parameters,
-bugprone-empty-catch,
-bugprone-macro-parentheses,
-bugprone-narrowing-conversions,
-bugprone-signed-char-misuse,
-bugprone-switch-missing-default-case,
-bugprone-unchecked-optional-access,
-clang-analyzer-*,
-concurrency-mt-unsafe,
-misc-const-correctness,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-misc-throw-by-value-catch-by-reference,
-misc-use-anonymous-namespace,
-modernize-avoid-c-arrays,
-modernize-deprecated-ios-base-aliases,
-modernize-use-nullptr,
-misc-include-cleaner,
-misc-unused-using-decls,
-modernize-loop-convert,
-modernize-macro-to-enum,
-modernize-raw-string-literal,
-modernize-replace-auto-ptr,
-modernize-return-braced-init-list,
-modernize-type-traits,
-modernize-use-auto,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-performance-avoid-endl,
-performance-inefficient-string-concatenation,
-performance-no-automatic-move,
-performance-noexcept-swap,
-portability-simd-intrinsics,
-portability-std-allocator-const,
-readability-avoid-const-params-in-decls,
-readability-braces-around-statements,
-readability-container-data-pointer,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-identifier-naming,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-suspicious-call-argument,
-readability-uppercase-literal-suffix
WarningsAsErrors: '*'
HeaderFilterRegex: '(cli|gui|lib|oss-fuzz|test|triage)\/[a-z]+\.h'
CheckOptions: CheckOptions:
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1' value: '1'
- key: readability-simplify-boolean-expr.SimplifyDeMorgan
value: '0'

View File

@ -4,5 +4,7 @@ exclude_paths:
- htmlreport/example.cc - htmlreport/example.cc
- samples/**/bad.c - samples/**/bad.c
- samples/**/bad.cpp - samples/**/bad.cpp
- test/test.cxx
- test/cfg/*.c - test/cfg/*.c
- test/cfg/*.cpp - test/cfg/*.cpp
- test/synthetic/*.c

19
.gitattributes vendored
View File

@ -1,19 +0,0 @@
## standard default enconding
* text=auto
## UNIX specific files
*.sh text eol=lf
## Windows specific files
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
*.vcxproj text eol=crlf
*.vcxproj.filters text eol=crlf
*.sln text eol=crlf
*.wixproj text eol=crlf
*.wxi text eol=crlf
*.wxs text eol=crlf
## Binary resources
*.pdf binary

View File

@ -1,58 +0,0 @@
# Some convenient links:
# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
#
name: CI-cygwin
on:
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
defaults:
run:
shell: cmd
jobs:
build_cygwin:
strategy:
matrix:
os: [windows-2022]
arch: [x64]
include:
- platform: 'x86_64'
packages: |
gcc-g++
python3
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Cygwin
uses: cygwin/cygwin-install-action@master
with:
platform: ${{ matrix.arch }}
packages: ${{ matrix.packages }}
# Cygwin will always link the binaries even if they already exist. The linking is also extremely slow. So just run the "check" target which includes all the binaries.
- name: Build all and run test
run: |
C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make VERBOSE=1 -j2 check
- 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 misra\misra-test.c.dump
..\..\cppcheck.exe --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c

View File

@ -1,73 +0,0 @@
# Some convenient links:
# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
#
name: CI-mingw
on:
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
defaults:
run:
shell: msys2 {0}
jobs:
build_mingw:
strategy:
matrix:
# the MinGW installation in windows-2019 is supposed to be 8.1 but it is 12.2
# the MinGW installation in windows-2022 is not including all necessary packages by default, so just use the older image instead - package versions are he same
os: [windows-2019]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
release: false # use pre-installed
install: >-
mingw-w64-x86_64-lld
mingw-w64-x86_64-ccache
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
# TODO: bail out on warning
- name: Build cppcheck
run: |
export PATH="/mingw64/lib/ccache/bin:$PATH"
# set RDYNAMIC to work around broken MinGW detection
make VERBOSE=1 RDYNAMIC=-lshlwapi -j2 cppcheck
env:
LDFLAGS: -fuse-ld=lld # use lld for faster linking
- name: Build test
run: |
export PATH="/mingw64/lib/ccache/bin:$PATH"
# set RDYNAMIC to work around broken MinGW detection
make VERBOSE=1 RDYNAMIC=-lshlwapi -j2 testrunner
env:
LDFLAGS: -fuse-ld=lld # use lld for faster linking
- name: Run test
run: |
export PATH="/mingw64/lib/ccache/bin:$PATH"
# set RDYNAMIC to work around broken MinGW detection
make VERBOSE=1 RDYNAMIC=-lshlwapi -j2 check
env:
LDFLAGS: -fuse-ld=lld # use lld for faster linking

View File

@ -2,166 +2,69 @@
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: CI-unixish-docker name: CI-unixish-docker
on: on: [push, pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs: jobs:
build_cmake: build:
strategy: strategy:
matrix: matrix:
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:18.04", "ubuntu:23.10"] image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:21.04"]
include:
- build_gui: false
- image: "ubuntu:23.10"
build_gui: true
fail-fast: false # Prefer quick result fail-fast: false # Prefer quick result
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
# TODO: is this actually applied to the guest?
env:
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
container: container:
image: ${{ matrix.image }} image: ${{ matrix.image }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Install missing software on CentOS 7 - name: Install missing software on CentOS 7
if: matrix.image == 'centos:7' if: matrix.image == 'centos:7'
run: | run: |
yum install -y cmake gcc-c++ make pcre-devel yum install -y cmake gcc-c++ make
yum --enablerepo=extras install -y epel-release yum install -y pcre-devel
yum install -y ccache
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
if: contains(matrix.image, 'ubuntu') if: matrix.image != 'centos:7'
run: | run: |
apt-get update apt-get update
apt-get install -y cmake g++ make libxml2-utils libpcre3-dev apt-get install -y cmake g++ make python libxml2-utils
apt-get install -y libpcre3-dev
- name: Install missing software (gui) on latest ubuntu # tests require CMake 3.4
if: matrix.build_gui - name: Test CMake build (no tests)
run: | if: matrix.image != 'ubuntu:21.04'
apt-get install -y qt6-base-dev qt6-charts-dev qt6-tools-dev
# needs to be called after the package installation since
# - it doesn't call "apt-get update"
# - it doesn't support centos
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
if: matrix.image != 'ubuntu:14.04' # no support for --set-config
with:
key: ${{ github.workflow }}-${{ matrix.image }}
# tests require CMake 3.9 - no ccache available
- name: CMake build (no tests / no ccache)
if: matrix.image == 'ubuntu:14.04'
run: | run: |
mkdir cmake.output mkdir cmake.output
cd cmake.output cd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On .. cmake -G "Unix Makefiles" -DHAVE_RULES=On ..
cmake --build . -- -j$(nproc) make -j$(nproc)
cd ..
# tests require CMake 3.9 - ccache available - name: Test CMake build
- name: CMake build (no tests) if: matrix.image == 'ubuntu:21.04'
if: matrix.image == 'centos:7' || matrix.image == 'ubuntu:16.04'
run: | run: |
mkdir cmake.output mkdir cmake.output
cd cmake.output cd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On ..
cmake --build . -- -j$(nproc) make -j$(nproc) check
cd ..
- name: CMake build
if: ${{ !matrix.build_gui && matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04' }}
run: |
mkdir cmake.output
cd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
cmake --build . -- -j$(nproc)
- name: CMake build (with GUI)
if: matrix.build_gui
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build cmake.output -- -j$(nproc)
- name: Run CMake test
if: matrix.image != 'centos:7' && matrix.image != 'ubuntu:14.04' && matrix.image != 'ubuntu:16.04'
run: |
cmake --build cmake.output --target check -- -j$(nproc)
build_make:
strategy:
matrix:
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:18.04", "ubuntu:23.10"]
fail-fast: false # Prefer quick result
runs-on: ubuntu-22.04
container:
image: ${{ matrix.image }}
steps:
- uses: actions/checkout@v3
- name: Install missing software on CentOS 7
if: matrix.image == 'centos:7'
run: |
yum install -y gcc-c++ make which python3 pcre-devel
yum --enablerepo=extras install -y epel-release
yum install -y ccache
- name: Install missing software on ubuntu
if: contains(matrix.image, 'ubuntu')
run: |
apt-get update
apt-get install -y g++ make python3 libxml2-utils libpcre3-dev
# needs to be called after the package installation since
# - it doesn't call "apt-get update"
# - it doesn't support centos
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
if: matrix.image != 'ubuntu:14.04' # no support for --set-config
with:
key: ${{ github.workflow }}-${{ matrix.image }}
- name: Build cppcheck - name: Build cppcheck
run: | run: |
# "/usr/lib64" for centos / "/usr/lib" for ubuntu make clean
export PATH="/usr/lib64/ccache:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" make -j$(nproc) HAVE_RULES=yes
make -j$(nproc) HAVE_RULES=yes CXXFLAGS="-w"
- name: Build test - name: Build test
run: | run: |
# "/usr/lib64" for centos / "/usr/lib" for ubuntu make -j$(nproc) testrunner HAVE_RULES=yes
export PATH="/usr/lib64/ccache:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) testrunner HAVE_RULES=yes CXXFLAGS="-w"
- name: Run test - name: Run test
run: | run: |
make -j$(nproc) check HAVE_RULES=yes make -j$(nproc) check HAVE_RULES=yes
# requires python3
- name: Run extra tests
run: |
tools/generate_and_run_more_tests.sh
# requires which
- name: Validate - name: Validate
run: | run: |
make -j$(nproc) checkCWEEntries validateXML make -j$(nproc) checkCWEEntries validateXML
@ -170,10 +73,3 @@ jobs:
run: | run: |
./cppcheck --addon=threadsafety addons/test/threadsafety ./cppcheck --addon=threadsafety addons/test/threadsafety
./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety
- name: Generate Qt help file on ubuntu 18.04
if: false # matrix.os == 'ubuntu-18.04'
run: |
pushd gui/help
qcollectiongenerator online-help.qhcp -o online-help.qhc

View File

@ -2,517 +2,149 @@
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: CI-unixish name: CI-unixish
on: on: [push, pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs: jobs:
build_cmake_tinyxml2: build:
strategy: strategy:
matrix: matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-12] os: [ubuntu-18.04, ubuntu-20.04, macos-10.15]
include:
- use_qt6: On
- os: ubuntu-20.04
use_qt6: Off
fail-fast: false # Prefer quick result fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env:
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: ccache - name: Install missing software on ubuntu 18.04
uses: hendrikmuhs/ccache-action@v1.2 if: matrix.os == 'ubuntu-18.04'
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Install missing software on ubuntu
if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'Off'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install libxml2-utils libtinyxml2-dev qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser sudo apt-get install libxml2-utils
sudo apt-get install z3 libz3-dev
cp externals/z3_version_old.h externals/z3_version.h
sudo apt-get install python3-pytest
- name: Install missing software on ubuntu - name: Install missing software on ubuntu 20.04
if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'On' if: matrix.os == 'ubuntu-20.04'
run: | run: |
sudo apt-get update sudo apt-get update
# qt6-tools-dev-tools for lprodump sudo apt-get install libxml2-utils
# qt6-l10n-tools for lupdate sudo apt-get install z3 libz3-dev
sudo apt-get install libxml2-utils libtinyxml2-dev qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev sudo apt-get install python3-pytest
# coreutils contains "nproc"
- name: Install missing software on macos - name: Install missing software on macos
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | run: |
# pcre was removed from runner images in November 2022 brew install coreutils z3
brew install coreutils qt@6 tinyxml2 pcre cp externals/z3_version_old.h externals/z3_version.h
- name: CMake build on ubuntu (with GUI / system tinyxml2) - name: Install Qt
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | uses: jurplel/install-qt-action@v2
cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=${{ matrix.use_qt6 }} -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build cmake.output.tinyxml2 -- -j$(nproc)
- name: CMake build on macos (with GUI / system tinyxml2)
if: contains(matrix.os, 'macos')
run: |
cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6
cmake --build cmake.output.tinyxml2 -- -j$(nproc)
- name: Run CMake test (system tinyxml2)
run: |
cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc)
build_cmake:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-12]
include:
- use_qt6: On
- os: ubuntu-20.04
use_qt6: Off
fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }}
env:
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
steps:
- uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with: with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} modules: 'qtcharts'
- name: Install missing software on ubuntu - name: Test CMake build
if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'Off'
run: | run: |
sudo apt-get update mkdir cmake.output
sudo apt-get install libxml2-utils qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser cd cmake.output
cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On ..
make -j$(nproc) check
cd ..
# TODO: move latest compiler to separate step - name: Build and test with Unsigned char
# TODO: bail out on warnings with latest GCC
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
if: matrix.os == 'ubuntu-22.04'
with:
version: 13
platform: x64
- name: Select compiler
if: matrix.os == 'ubuntu-22.04'
run: | run: |
echo "CXX=g++-13" >> $GITHUB_ENV make clean
- name: Install missing software on ubuntu
if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'On'
run: |
sudo apt-get update
# qt6-tools-dev-tools for lprodump
# qt6-l10n-tools for lupdate
sudo apt-get install libxml2-utils qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev
# coreutils contains "nproc"
- name: Install missing software on macos
if: contains(matrix.os, 'macos')
run: |
# pcre was removed from runner images in November 2022
brew install coreutils qt@6 pcre
- name: CMake build on ubuntu (with GUI)
if: contains(matrix.os, 'ubuntu')
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=${{ matrix.use_qt6 }} -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build cmake.output -- -j$(nproc)
- name: CMake build on macos (with GUI)
if: contains(matrix.os, 'macos')
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6
cmake --build cmake.output -- -j$(nproc)
- name: Run CMake test
run: |
cmake --build cmake.output --target check -- -j$(nproc)
- name: Run CTest
run: |
pushd cmake.output
ctest --output-on-failure -j$(nproc)
build_uchar:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-12]
fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
# coreutils contains "nproc"
- name: Install missing software on macos
if: contains(matrix.os, 'macos')
run: |
brew install coreutils
- name: Build with Unsigned char
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) CXXFLAGS=-funsigned-char testrunner make -j$(nproc) CXXFLAGS=-funsigned-char testrunner
- name: Test with Unsigned char
run: |
./testrunner TestSymbolDatabase ./testrunner TestSymbolDatabase
build_mathlib:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-12]
fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
# coreutils contains "nproc"
- name: Install missing software on macos
if: contains(matrix.os, 'macos')
run: |
brew install coreutils
- name: Build with TEST_MATHLIB_VALUE
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE all
- name: Test with TEST_MATHLIB_VALUE
run: |
make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE check
check_nonneg:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-12]
fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
# coreutils contains "g++" (default is "c++") and "nproc"
- name: Install missing software on macos
if: contains(matrix.os, 'macos')
run: |
brew install coreutils
- name: Check syntax with NONNEG - name: Check syntax with NONNEG
run: | run: |
ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG
build_qmake:
strategy:
matrix:
# no longer build with qmake on MacOS as brew might lack pre-built Qt5 packages causing the step to run for hours
os: [ubuntu-20.04, ubuntu-22.04]
fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install missing software on ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser
# coreutils contains "nproc"
- name: Install missing software on macos
if: contains(matrix.os, 'macos')
run: |
brew install coreutils qt@5
# expose qmake
brew link qt@5 --force
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Build GUI
run: |
export PATH="$(brew --prefix)/opt/ccache/libexec:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
pushd gui
qmake CONFIG+=debug CONFIG+=ccache HAVE_QCHART=yes
make -j$(nproc)
# TODO: binaries are in a different location on macos
- name: Build and Run GUI tests
if: contains(matrix.os, 'ubuntu')
run: |
export PATH="$(brew --prefix)/opt/ccache/libexec:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
pushd gui/test/cppchecklibrarydata
qmake CONFIG+=debug CONFIG+=ccache
make -j$(nproc)
./test-cppchecklibrarydata
popd
pushd gui/test/filelist
qmake CONFIG+=debug CONFIG+=ccache
make -j$(nproc)
./test-filelist
popd
pushd gui/test/projectfile
qmake CONFIG+=debug CONFIG+=ccache
make -j$(nproc)
./test-projectfile
popd
pushd gui/test/translationhandler
qmake CONFIG+=debug CONFIG+=ccache
make -j$(nproc)
# TODO: requires X session because of QApplication dependency in translationhandler.cpp
#./test-translationhandler
popd
pushd gui/test/xmlreportv2
qmake CONFIG+=debug CONFIG+=ccache
make -j$(nproc)
./test-xmlreportv2
- name: Generate Qt help file
run: |
pushd gui/help
qhelpgenerator online-help.qhcp -o online-help.qhc
- name: Build triage
run: |
export PATH="$(brew --prefix)/opt/ccache/libexec:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
pushd tools/triage
qmake CONFIG+=debug CONFIG+=ccache
make -j$(nproc)
build:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-12]
fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Install missing software on ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install libxml2-utils
# packages for strict cfg checks
- name: Install missing software on ubuntu 22.04 (cfg)
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 qtbase5-dev
# coreutils contains "nproc"
- name: Install missing software on macos
if: contains(matrix.os, 'macos')
run: |
# pcre was removed from runner images in November 2022
brew install coreutils python3 pcre gnu-sed
- name: Install missing Python packages
run: |
python3 -m pip install pip --upgrade
python3 -m pip install pytest
python3 -m pip install pytest-timeout
- name: Build cppcheck - name: Build cppcheck
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" make clean
make -j$(nproc) HAVE_RULES=yes make -j$(nproc) USE_Z3=yes HAVE_RULES=yes
- name: Build test - name: Build test
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" make -j$(nproc) testrunner USE_Z3=yes HAVE_RULES=yes
make -j$(nproc) testrunner HAVE_RULES=yes
- name: Run test - name: Run test
run: | run: |
make -j$(nproc) check HAVE_RULES=yes make -j$(nproc) check USE_Z3=yes HAVE_RULES=yes
# requires "gnu-sed" installed on macos
- name: Run extra tests
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 - name: Run test/cli
if: contains(matrix.os, 'ubuntu')
run: | run: |
cd test/cli cd ..
python3 -m pytest -Werror --strict-markers -vv test-*.py ln -s cppcheck cpp\ check
cd ../../.. cd cpp\ check/test/cli
ln -s cppcheck 'cpp check' pytest-3 test-*.py
cd 'cpp check/test/cli'
python3 -m pytest -Werror --strict-markers -vv test-*.py
- name: Run cfg tests
if: 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
- name: Run --dump test
run: |
./cppcheck test/testpreprocessor.cpp --dump
xmllint --noout test/testpreprocessor.cpp.dump
- name: Validate - name: Validate
run: | run: |
make -j$(nproc) checkCWEEntries validateXML make -j$(nproc) checkCWEEntries validateXML
# TODO: move to scriptcheck.yml so these are tested with all Python versions?
- name: Test addons - name: Test addons
run: | run: |
./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety addons/test/threadsafety ./cppcheck --addon=threadsafety addons/test/threadsafety
./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety --std=c++03 addons/test/threadsafety ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety
./cppcheck --error-exitcode=1 --inline-suppr --addon=misra addons/test/misra/crash*.c
./cppcheck --error-exitcode=1 --inline-suppr --addon=misra --enable=information addons/test/misra/config*.c
./cppcheck --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c - name: Build GUI on ubuntu
pushd addons/test if: contains(matrix.os, 'ubuntu')
# 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 --enable=style --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: Build democlient
if: matrix.os == 'ubuntu-22.04'
run: | run: |
warnings="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar" pushd gui
g++ $warnings -c -Ilib -Iexternals/tinyxml2 democlient/democlient.cpp qmake HAVE_QCHART=yes
make -j$(nproc)
selfcheck: - name: Run GUI tests on ubuntu
needs: build # wait for all tests to be successful first if: contains(matrix.os, 'ubuntu')
runs-on: ubuntu-22.04 # run on the latest image only
steps:
- uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Install missing software on ubuntu
run: | run: |
sudo apt-get update pushd gui/test/projectfile
sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev libboost-container-dev qmake
make -j$(nproc)
./test-projectfile
popd
pushd gui/test/cppchecklibrarydata
qmake
make -j$(nproc)
./test-cppchecklibrarydata
- name: Self check (build) - name: Generate Qt help file on ubuntu
if: contains(matrix.os, 'ubuntu')
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" pushd gui/help
# compile with verification and ast matchers qhelpgenerator online-help.qhcp -o online-help.qhc
make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2 -w -DHAVE_BOOST" MATCHCOMPILER=yes VERIFY=1
# TODO: update to Qt6
- name: CMake
run: |
cmake -S . -B cmake.output -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_MATCHCOMPILER=Verify -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On
- name: Generate dependencies
run: |
# make sure auto-generated GUI files exist
make -C cmake.output autogen
make -C cmake.output gui-build-deps triage-build-ui-deps
# Run self check after "Build GUI" to include generated headers in analysis
- name: Self check - name: Self check
if: matrix.os == 'ubuntu-20.04'
run: | run: |
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings --check-level=exhaustive" # compile with verification and ast matchers
cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" make clean
ec=0 make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2" MATCHCOMPILER=yes VERIFY=1
# TODO: add --check-config
# early exit
if [ $ec -eq 1 ]; then
exit $ec
fi
# self check simplecpp
./cppcheck $selfcheck_options externals/simplecpp || ec=1
# self check lib/cli # self check lib/cli
mkdir b1 mkdir b1
./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b1 --addon=naming.json cli lib || ec=1 ./cppcheck -q -j$(nproc) --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,internal --exception-handling --debug-warnings cli lib
# check gui with qt settings # check gui with qt settings
mkdir b2 mkdir b2
./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b2 -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui || ec=1 ./cppcheck -q -j$(nproc) --template=selfcheck --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 --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
# self check test and tools # self check test and tools
./cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/*.cpp || ec=1 ./cppcheck -q -j$(nproc) --template=selfcheck -D__CPPCHECK__ --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
# triage
./cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1 - name: Build triage on ubuntu
exit $ec if: matrix.os == 'ubuntu-20.04'
run: |
pushd tools/triage
qmake
make -j$(nproc)
- name: Build Fuzzer
if: matrix.os == 'ubuntu-20.04'
run: |
pushd oss-fuzz
make -j$(nproc) CXX=clang++ CXXFLAGS="-fsanitize=address" fuzz-client translate

View File

@ -4,204 +4,100 @@
name: CI-windows name: CI-windows
on: on: [push,pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
defaults: defaults:
run: run:
shell: cmd shell: cmd
# TODO: choose/add a step to bail out on compiler warnings (maybe even the release build)
jobs: jobs:
build_qt:
strategy:
matrix:
os: [windows-2019, windows-2022]
qt_ver: [5.15.2, 6.6.0]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install Qt ${{ matrix.qt_ver }}
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
modules: 'qtcharts'
cache: true
- name: Build GUI release (qmake)
if: startsWith(matrix.qt_ver, '5')
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')
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')
run: |
cmake -S . -B build -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On || exit /b !errorlevel!
cmake --build build --target cppcheck-gui || exit /b !errorlevel!
# TODO: deploy with CMake/Qt6
build: build:
strategy: strategy:
matrix: matrix:
os: [windows-2019, windows-2022] # windows 2016 should default to VS 2017. Not supported by setup-msbuild
config: [debug, release] os: [windows-2019]
fail-fast: false arch: [x64, x86]
fail-fast: true
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env:
# see https://www.pcre.org/original/changelog.txt
PCRE_VERSION: 8.45
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Set up Python 3.12 - name: Setup msbuild.exe
if: matrix.config == 'release' uses: microsoft/setup-msbuild@v1.0.2
uses: actions/setup-python@v4
with:
python-version: '3.12'
check-latest: true
- name: Set up Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Cache PCRE
id: cache-pcre
uses: actions/cache@v3
with:
path: |
externals\pcre.h
externals\pcre.lib
externals\pcre64.lib
key: pcre-${{ env.PCRE_VERSION }}-x64-bin-win
- 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 - name: Install PCRE
if: steps.cache-pcre.outputs.cache-hit != 'true'
run: | run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} || exit /b !errorlevel!
curl -fsSL https://ftp.pcre.org/pub/pcre/pcre-%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel!
7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel!
cd pcre-%PCRE_VERSION% || 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! 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! nmake || exit /b !errorlevel!
copy pcre.h ..\externals || exit /b !errorlevel! copy pcre.h ..\externals || exit /b !errorlevel!
copy pcre.lib ..\externals\pcre64.lib || 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: env:
CL: /MP # see https://www.pcre.org/original/changelog.txt
PCRE_VERSION: 8.44
- name: Install missing Python packages - name: Install Z3 library
if: matrix.config == 'release'
run: | run: |
python -m pip install pip --upgrade || exit /b !errorlevel! curl -fsSL https://github.com/Z3Prover/z3/releases/download/z3-%Z3_VERSION%/z3-%Z3_VERSION%-${{ matrix.arch }}-win.zip -o z3-%Z3_VERSION%-win.zip || exit /b !errorlevel!
python -m pip install pytest || exit /b !errorlevel! 7z x z3-%Z3_VERSION%-win.zip -oexternals -r -y || exit /b !errorlevel!
python -m pip install pytest-custom_exit_code || exit /b !errorlevel! move externals\z3-%Z3_VERSION%-${{ matrix.arch }}-win externals\z3 || exit /b !errorlevel!
python -m pip install pytest-timeout || exit /b !errorlevel! env:
# see https://github.com/Z3Prover/z3/releases:
Z3_VERSION: 4.8.10
- name: Run CMake # no 32-bit Qt available
if: false # TODO: enable - name: Install Qt
if: matrix.os == 'x64'
uses: jurplel/install-qt-action@v2
with:
modules: 'qtcharts'
- name: Build GUI release
if: matrix.os == 'x64'
run: | run: |
cmake -S . -B build -DBUILD_TESTS=On || exit /b !errorlevel! call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} || exit /b !errorlevel!
cd gui || exit /b !errorlevel!
qmake HAVE_QCHART=yes || exit /b !errorlevel!
nmake release || exit /b !errorlevel!
- name: Deploy GUI
if: matrix.os == '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 CLI debug configuration using MSBuild - name: Build CLI debug configuration using MSBuild
if: matrix.config == 'debug'
run: | run: |
:: cmake --build build --target check --config Debug || exit /b !errorlevel! call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} || exit /b !errorlevel!
msbuild -m cppcheck.sln /p:Configuration=Debug-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel! set ARCH=${{ matrix.arch }}
if "${{ matrix.arch }}" == "x86" (
set ARCH=Win32
)
msbuild -m cppcheck.sln /p:Configuration=Debug-PCRE;Platform=%ARCH% -maxcpucount || exit /b !errorlevel!
- name: Run Debug test - name: Run Debug test
if: matrix.config == 'debug'
run: .\bin\debug\testrunner.exe || exit /b !errorlevel! run: .\bin\debug\testrunner.exe || exit /b !errorlevel!
- name: Build CLI release configuration using MSBuild - name: Build CLI release configuration using MSBuild
if: matrix.config == 'release'
run: | run: |
:: cmake --build build --target check --config Release || exit /b !errorlevel! call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} || exit /b !errorlevel!
msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel! set ARCH=${{ matrix.arch }}
if "${{ matrix.arch }}" == "x86" (
set ARCH=Win32
)
msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=%ARCH% -maxcpucount || exit /b !errorlevel!
- name: Run Release test - name: Run Release test
if: matrix.config == 'release'
run: .\bin\testrunner.exe || exit /b !errorlevel! run: .\bin\testrunner.exe || exit /b !errorlevel!
- name: Run test/cli
if: matrix.config == 'release'
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 -Werror --strict-markers -vv --suppress-no-test-exit-code test-clang-import.py || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv test-helloworld.py || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv test-inline-suppress.py || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv test-more-projects.py || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv test-other.py || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv test-proj2.py || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv test-suppress-syntaxError.py || exit /b !errorlevel!
- name: Test addons
if: matrix.config == 'release'
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 --enable=style --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 --enable=style --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!

View File

@ -2,122 +2,42 @@
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: address sanitizer name: address sanitizer
on: on: [push, pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
env: env:
QT_VERSION: 5.15.2
ASAN_OPTIONS: detect_stack_use_after_return=1 ASAN_OPTIONS: detect_stack_use_after_return=1
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
check-latest: true
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils sudo apt-get install libz3-4 libz3-dev
- name: Install clang - name: Build
run: | run: make -j$(nproc) cppcheck testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
- name: Install Qt ${{ env.QT_VERSION }}
if: false
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
modules: 'qtcharts'
cache: true
- name: Install missing Python packages
run: |
python3 -m pip install pip --upgrade
python3 -m pip install pytest
python3 -m pip install pytest-timeout
# TODO: disable all warnings
- name: CMake
run: |
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=Off -DWITH_QCHART=Off -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
env: env:
CC: clang-17 CC: clang
CXX: clang++-17 CXX: clang++
CXXFLAGS: "-fsanitize=address -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG"
- name: Build cppcheck CPPFLAGS: "-DCHECK_INTERNAL"
run: |
cmake --build cmake.output --target cppcheck -- -j $(nproc)
- name: Build test
run: |
cmake --build cmake.output --target testrunner -- -j $(nproc)
- name: Run tests - name: Run tests
run: ./cmake.output/bin/testrunner run: ./testrunner
- name: Run cfg tests
run: |
cmake --build cmake.output --target checkcfg -- -j $(nproc)
# TODO: we should use CTest instead to parallelize tests but the start-up overhead will slow things down
- name: Run CTest
if: false
run: |
ctest --test-dir cmake.output --output-on-failure -j$(nproc)
- name: Run test/cli
run: |
pwd=$(pwd)
cd test/cli
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test-*.py
- name: Generate dependencies
if: false
run: |
# make sure auto-generated GUI files exist
make -C cmake.output autogen
make -C cmake.output gui-build-deps triage-build-ui-deps
# TODO: this is currently way too slow (~60 minutes) to enable it
# TODO: only fail the step on sanitizer issues - since we use processes it will only fail the underlying process which will result in an cppcheckError
- name: Self check - name: Self check
if: false
run: | run: |
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings --check-level=exhaustive" ./cppcheck -q -j$(nproc) --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib
cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" ./cppcheck -q -j$(nproc) --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp
ec=0 ./cppcheck -q -j$(nproc) --template=selfcheck -D__CPPCHECK__ --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
./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json cli lib || ec=1 # This takes too long time right now
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 # - name: Bughunting lib
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/*.cpp || ec=1 # run: ./cppcheck -D__CPPCHECK__ --bug-hunting -j$(nproc) lib
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
exit $ec

View File

@ -1,22 +1,12 @@
name: Build manual name: Build manual
on: on: [push, pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs: jobs:
convert_via_pandoc: convert_via_pandoc:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- run: | - run: |
mkdir output mkdir output
@ -24,35 +14,12 @@ jobs:
- uses: docker://pandoc/latex:2.9 - uses: docker://pandoc/latex:2.9
with: with:
args: --output=output/manual.html man/manual.md args: --output=output/manual.html man/manual.md
- uses: docker://pandoc/latex:2.9 - uses: docker://pandoc/latex:2.9
with: with:
args: --output=output/manual.pdf man/manual.md args: --output=output/manual.pdf man/manual.md
- uses: docker://pandoc/latex:2.9 - uses: actions/upload-artifact@v2
with:
args: --output=output/manual-premium.pdf man/manual-premium.md
- uses: actions/upload-artifact@v3
with: with:
name: output name: output
path: output path: output
manpage:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install missing software on ubuntu
run: |
sudo apt-get update
sudo apt-get install -y xsltproc docbook-xsl
- name: build manpage
run: |
make man
- uses: actions/upload-artifact@v3
with:
name: cppcheck.1
path: cppcheck.1

View File

@ -1,26 +0,0 @@
name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'cppcheck'
dry-run: false
language: c++
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'cppcheck'
fuzz-seconds: 300
dry-run: false
language: c++
- name: Upload Crash
uses: actions/upload-artifact@v3
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts

View File

@ -1,73 +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:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04
env:
QT_VERSION: 6.6.0
steps:
- uses: actions/checkout@v3
- name: Install missing software
run: |
sudo apt-get update
sudo apt-get install -y cmake make
sudo apt-get install -y libpcre3-dev
sudo apt-get install -y libffi7 # work around missing dependency for Qt install step
- name: Install clang
run: |
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt-get install -y clang-tidy-17
- name: Install Qt ${{ env.QT_VERSION }}
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
modules: 'qtcharts'
cache: true
- name: Verify clang-tidy configuration
run: |
clang-tidy-17 --verify-config
- name: Prepare CMake
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off
env:
CC: clang-17
CXX: clang++-17
- name: Prepare CMake dependencies
run: |
# make sure the precompiled headers exist
make -C cmake.output/cli cmake_pch.hxx.pch
make -C cmake.output/gui cmake_pch.hxx.pch
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

View File

@ -1,22 +1,11 @@
name: "CodeQL" name: "CodeQL"
on: on: [push, pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
security-events: write
jobs: jobs:
analyze: analyze:
name: Analyze name: Analyze
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
strategy: strategy:
fail-fast: false fail-fast: false
@ -29,16 +18,17 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v2
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install libxml2-utils sudo apt-get install libxml2-utils
sudo apt-get install libz3-dev libz3-4
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 uses: github/codeql-action/init@v1
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@ -48,7 +38,7 @@ jobs:
setup-python-dependencies: false setup-python-dependencies: false
- run: | - run: |
make -j$(nproc) HAVE_RULES=yes cppcheck make -j$(nproc) USE_Z3=yes HAVE_RULES=yes cppcheck
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 uses: github/codeql-action/analyze@v1

View File

@ -2,64 +2,46 @@
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: Coverage name: Coverage
on: on: [push, pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install libxml2-utils lcov sudo apt-get install libxml2-utils
sudo apt-get install libz3-dev libz3-4
- name: Install missing Python packages on ubuntu sudo apt-get install lcov
run: | sudo apt-get install libcppunit-dev
python -m pip install pip --upgrade python -m pip install pip --upgrade
python -m pip install lcov_cobertura python -m pip install lcov_cobertura
- name: Compile instrumented - name: Compile instrumented
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" make -j$(nproc) test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" USE_Z3=yes HAVE_RULES=yes
make -j$(nproc) all CXXFLAGS="-g -fprofile-arcs -ftest-coverage" HAVE_RULES=yes
- name: Run instrumented tests
run: |
./testrunner
test/cfg/runtests.sh
- name: Generate coverage report - name: Generate coverage report
run: | run: |
rm -rf coverage_report
./testrunner
test/cfg/runtests.sh
gcov lib/*.cpp -o lib/ gcov lib/*.cpp -o lib/
lcov --directory ./ --capture --output-file lcov_tmp.info -b ./ lcov --directory ./ --capture --output-file lcov_tmp.info -b ./
lcov --extract lcov_tmp.info "$(pwd)/*" --output-file lcov.info lcov --extract lcov_tmp.info "$(pwd)/*" --output-file lcov.info
genhtml lcov.info -o coverage_report --frame --legend --demangle-cpp genhtml lcov.info -o coverage_report --frame --legend --demangle-cpp
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: Coverage results name: Coverage results
path: coverage_report path: coverage_report
- uses: codecov/codecov-action@v3 - uses: codecov/codecov-action@v1.2.1
with: with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# file: ./coverage.xml # optional # file: ./coverage.xml # optional

View File

@ -1,43 +0,0 @@
name: cppcheck-premium
on:
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04 # run on the latest image only
env:
PREMIUM_VERSION: devdrop-20231105
steps:
- uses: actions/checkout@v3
- name: Download cppcheckpremium
run: |
wget https://files.cppchecksolutions.com/cppcheckpremium-${{ env.PREMIUM_VERSION }}-amd64.tar.gz
tar xzf cppcheckpremium-${{ env.PREMIUM_VERSION }}-amd64.tar.gz
- name: Generate a license file
run: |
echo cppcheck > cppcheck.lic
echo 231231 >> cppcheck.lic
echo 80000 >> cppcheck.lic
echo 57e08c39523ab54d >> cppcheck.lic
echo path:lib >> cppcheck.lic
- name: Check
run: |
cppcheckpremium-${{ env.PREMIUM_VERSION }}/premiumaddon --check-loc-license cppcheck.lic > cppcheck-premium-loc
cppcheckpremium-${{ env.PREMIUM_VERSION }}/cppcheck -j$(nproc) -D__GNUC__ -D__CPPCHECK__ --suppressions-list=cppcheckpremium-suppressions --platform=unix64 --enable=style --premium=misra-c++-2008 --premium=cert-c++-2016 --inline-suppr --error-exitcode=1 lib

View File

@ -1,47 +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:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Cache uncrustify
uses: actions/cache@v3
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
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -- -j$(nproc) -s
mkdir ~/uncrustify
cd build && 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

24
.github/workflows/irc.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: "IRC Push Notification"
on: [pull_request, create]
jobs:
test:
if: github.repository == 'danmar/cppcheck'
runs-on: ubuntu-20.04
steps:
- name: irc pull request
uses: rectalogic/notify-irc@v1
if: github.event_name == 'pull_request'
with:
channel: "#cppcheck"
nickname: cppcheck-github-notifier
message: |
${{ github.actor }} opened PR ${{ github.event.html_url }}
- name: irc tag created
uses: rectalogic/notify-irc@v1
if: github.event_name == 'create' && github.event.ref_type == 'tag'
with:
channel: "#cppcheck"
nickname: cppcheck-github-notifier
message: |
${{ github.actor }} tagged ${{ github.repository }} ${{ github.event.ref }}

View File

@ -1,168 +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:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
permissions:
contents: read
jobs:
iwyu:
strategy:
matrix:
image: ["fedora:latest"] # "debian:unstable" / "archlinux:latest"
runs-on: ubuntu-22.04
container:
image: "fedora:latest"
steps:
- uses: actions/checkout@v3
# TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image
- name: Install missing software on debian/ubuntu
if: contains(matrix.image, 'debian')
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
ln -s ../x86_64-linux-gnu/qt5 /usr/include/qt
- name: Install missing software on archlinux
if: contains(matrix.image, 'archlinux')
run: |
set -x
pacman -Sy
pacman -S cmake make gcc qt5-base qt5-tools qt5-charts pcre wget --noconfirm
pacman-key --init
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
pacman-key --lsign-key 3056513887B78AEB
pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm
echo "[chaotic-aur]" >> /etc/pacman.conf
echo "Include = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf
pacman -Sy
pacman -S include-what-you-use --noconfirm
ln -s iwyu-tool /usr/sbin/iwyu_tool
# TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image
- name: Install missing software on Fedora
if: contains(matrix.image, 'fedora')
run: |
dnf install -y cmake gcc-c++ qt5-qtbase-devel qt5-linguist qt5-qttools-devel qt5-qtcharts-devel pcre-devel
dnf install -y wget iwyu
ln -s iwyu_tool.py /usr/bin/iwyu_tool
ln -s qt5 /usr/include/qt
# TODO: switch to Qt 6 after we enabled the Qt mappings again
- 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 -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=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/cli cmake_pch.hxx.pch
#make -C cmake.output/gui cmake_pch.hxx.pch
#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
# make sure the auto-generated GUI dependencies exist
make -C cmake.output gui-build-deps
make -C cmake.output triage-build-ui-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/qt/ > qt5.imp
- name: iwyu_tool
run: |
PWD=$(pwd)
iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments -Xiwyu --mapping_file=$PWD/qt5.imp -I/usr/lib/clang/17/include > iwyu.log
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: Compilation Database
path: ./cmake.output/compile_commands.json
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: Qt Mappings
path: ./qt5.imp
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: Logs (include-what-you-use)
path: ./*.log
clang-include-cleaner:
runs-on: ubuntu-22.04
env:
QT_VERSION: 5.15.2
steps:
- uses: actions/checkout@v3
- name: Install missing software
run: |
sudo apt-get update
sudo apt-get install -y cmake make
sudo apt-get install -y libpcre3-dev
sudo apt-get install -y libffi7 # work around missing dependency for Qt install step
- name: Install clang
run: |
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt-get install -y clang-tools-17
- name: Install Qt ${{ env.QT_VERSION }}
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
modules: 'qtcharts'
cache: true
- 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 -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off
env:
CC: clang-17
CXX: clang++-17
- name: Prepare CMake dependencies
run: |
# make sure the precompiled headers exist
#make -C cmake.output/cli cmake_pch.hxx.pch
#make -C cmake.output/gui cmake_pch.hxx.pch
#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
# make sure the auto-generated GUI dependencies exist
make -C cmake.output gui-build-deps
- name: clang-include-cleaner
run: |
# TODO: run multi-threaded
find $PWD/cli $PWD/lib $PWD/test -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-17 --print=changes --extra-arg=-w -p cmake.output > clang-include-cleaner.log 2>&1
- uses: actions/upload-artifact@v3
with:
name: Logs (clang-include-cleaner)
path: ./*.log

View File

@ -12,9 +12,6 @@ on:
- cron: '0 0 * * *' - cron: '0 0 * * *'
workflow_dispatch: workflow_dispatch:
permissions:
contents: read
defaults: defaults:
run: run:
shell: cmd shell: cmd
@ -23,147 +20,85 @@ jobs:
build: build:
runs-on: windows-2022 runs-on: windows-2019
env:
# see https://www.pcre.org/original/changelog.txt
PCRE_VERSION: 8.45
QT_VERSION: 5.15.2
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Set up Visual Studio environment - name: Setup msbuild.exe
uses: ilammy/msvc-dev-cmd@v1 uses: microsoft/setup-msbuild@v1.0.2
- name: Cache PCRE
id: cache-pcre
uses: actions/cache@v3
with:
path: |
externals\pcre.h
externals\pcre64.lib
key: pcre-${{ env.PCRE_VERSION }}-bin-x64-win-release-job
- 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 - name: Install PCRE
if: steps.cache-pcre.outputs.cache-hit != 'true'
run: | run: |
7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! curl -fsSL https://ftp.pcre.org/pub/pcre/pcre-8.44.zip -o pcre-8.44.zip
cd pcre-%PCRE_VERSION% || exit /b !errorlevel! 7z x pcre-8.44.zip
cmake . -G "Visual Studio 17 2022" -A x64 -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_BUILD_TESTS=OFF || exit /b !errorlevel! cd pcre-8.44
msbuild -m PCRE.sln -p:Configuration=Release -p:Platform=x64 || exit /b !errorlevel! cmake . -G "Visual Studio 16 2019" -A x64
copy pcre.h ..\externals || exit /b !errorlevel! msbuild -m PCRE.sln /p:Configuration=Release /p:Platform=x64
copy Release\pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! dir
dir Release
dir x64
dir x64\Release
copy pcre.h ..\externals
copy Release\pcre.lib ..\externals\pcre64.lib
# available modules: https://github.com/miurahr/aqtinstall/blob/master/docs/getting_started.rst#installing-modules - name: Install Z3 library
# available tools: https://github.com/miurahr/aqtinstall/blob/master/docs/getting_started.rst#installing-tools run: |
- name: Install Qt ${{ env.QT_VERSION }} curl -fsSL https://github.com/Z3Prover/z3/releases/download/z3-4.8.7/z3-4.8.7-x64-win.zip -o z3-4.8.7-win.zip
uses: jurplel/install-qt-action@v3 7z x z3-4.8.7-win.zip -oexternals -r -y
move externals\z3-4.8.7-x64-win externals\z3
- name: Install Qt
uses: jurplel/install-qt-action@v2
with: with:
version: ${{ env.QT_VERSION }} version: '5.15.2'
modules: 'qtcharts' modules: 'qtcharts qthelp'
tools: 'tools_opensslv3_x64' mirror: 'http://mirrors.ocf.berkeley.edu/qt/'
cache: true
- name: Create .qm - name: Create .qm
run: | run: |
cd gui || exit /b !errorlevel! cd gui
lupdate gui.pro -no-obsolete || exit /b !errorlevel! lupdate gui.pro
lrelease gui.pro -removeidentical || exit /b !errorlevel! lrelease gui.pro -removeidentical
- name: Matchcompiler - name: Matchcompiler
run: python tools\matchcompiler.py --write-dir lib || exit /b !errorlevel! run: python tools\matchcompiler.py --write-dir lib
- name: Build x64 release GUI - name: Build x64 release GUI
run: | run: |
cd gui || exit /b !errorlevel! call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
qmake HAVE_QCHART=yes || exit /b !errorlevel! cd gui
nmake release || exit /b !errorlevel! qmake HAVE_QCHART=yes
env: nmake release
CL: /MP
- name: Deploy app - name: Deploy app
run: | run: |
windeployqt Build\gui || exit /b !errorlevel! windeployqt Build\gui
del Build\gui\cppcheck-gui.ilk || exit /b !errorlevel! del Build\gui\cppcheck-gui.ilk
del Build\gui\cppcheck-gui.pdb || exit /b !errorlevel! del Build\gui\cppcheck-gui.pdb
# TODO: build with boost enabled
- name: Build CLI x64 release configuration using MSBuild - 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! run: msbuild -m cppcheck.sln /t:cli /p:Configuration=Release-PCRE /p:Platform=x64
- name: Compile misra.py executable
run: |
pip install -U pyinstaller || exit /b !errorlevel!
cd addons || exit /b !errorlevel!
pyinstaller --hidden-import xml --hidden-import xml.etree --hidden-import xml.etree.ElementTree misra.py || exit /b !errorlevel!
del *.spec || 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!
copy addons\dist\misra\*.* 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!
:: copy libcrypto-3-x64.dll and libssl-3-x64.dll
copy %RUNNER_WORKSPACE%\Qt\Tools\OpenSSLv3\Win_x64\bin\lib*.dll win_installer\files || exit /b !errorlevel!
- name: Build Installer - name: Build Installer
run: | run: |
cd win_installer || exit /b !errorlevel! call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
mkdir bin
xcopy /S Build\gui bin
cd win_installer
REM Read ProductVersion REM Read ProductVersion
for /f "tokens=4 delims= " %%a in ('find "ProductVersion" productInfo.wxi') do set PRODUCTVER=%%a for /f "tokens=4 delims= " %%a in ('find "ProductVersion" productInfo.wxi') do set PRODUCTVER=%%a
REM Remove double quotes REM Remove double quotes
set PRODUCTVER=%PRODUCTVER:"=% set PRODUCTVER=%PRODUCTVER:"=%
echo ProductVersion="%PRODUCTVER%" || exit /b !errorlevel! echo ProductVersion=%PRODUCTVER%
msbuild -m cppcheck.wixproj -p:Platform=x64,ProductVersion=%PRODUCTVER%.${{ github.run_number }} || exit /b !errorlevel! msbuild -m cppcheck.wixproj /p:Platform=x64,ProductVersion=%PRODUCTVER%.${{ github.run_number }}
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: installer name: installer
path: win_installer/Build/ path: win_installer/Build/
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: deploy name: deploy
path: win_installer\files path: Build\gui
- name: Clean up deploy
run: |
del win_installer\files\addons\*.dll || exit /b !errorlevel!
del win_installer\files\addons\*.pyd || exit /b !errorlevel!
del win_installer\files\addons\base_library.zip || exit /b !errorlevel!
rmdir /s /q win_installer\files\bearer || exit /b !errorlevel!
rmdir /s /q win_installer\files\help || exit /b !errorlevel!
rmdir /s /q win_installer\files\iconengines || exit /b !errorlevel!
rmdir /s /q win_installer\files\imageformats || exit /b !errorlevel!
rmdir /s /q win_installer\files\printsupport || exit /b !errorlevel!
rmdir /s /q win_installer\files\sqldrivers || exit /b !errorlevel!
ren win_installer\files\translations lang || exit /b !errorlevel!
del win_installer\files\d3dcompiler_47.dll || exit /b !errorlevel!
del win_installer\files\libEGL.dll || exit /b !errorlevel!
del win_installer\files\libGLESv2.dll || exit /b !errorlevel!
del win_installer\files\opengl32sw.dll || exit /b !errorlevel!
del win_installer\files\Qt5Svg.dll || exit /b !errorlevel!
del win_installer\files\vc_redist.x64.exe || exit /b !errorlevel!
- uses: actions/upload-artifact@v3
with:
name: portable
path: win_installer\files

View File

@ -2,94 +2,34 @@
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: scriptcheck name: scriptcheck
on: on: [push, pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs: jobs:
build: 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@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}
- name: Cache Cppcheck
uses: actions/cache@v3
with:
path: cppcheck
key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }}
- name: build cppcheck
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) -s CXXFLAGS="-w"
strip -s ./cppcheck
scriptcheck:
needs: build
# 'ubuntu-22.04' removes Python 2.7, 3.5 and 3.6 so keep the previous LTS version
# 'ubutunu-20.04' no longer works on 2.7 - TODO: re-added in a different way or remove support for it?
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12'] python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
include:
- python-version: '3.12'
python-latest: true
fail-fast: false
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Restore Cppcheck
uses: actions/cache@v3
with:
path: cppcheck
key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }}
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
check-latest: true
- 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) - name: Install missing software on ubuntu (Python 2)
if: matrix.python-version == '2.7' if: matrix.python-version == '2.7'
run: | run: |
python -m pip install pip --upgrade python -m pip install pip --upgrade
python -m pip install pathlib
python -m pip install pytest python -m pip install pytest
python -m pip install pygments
- name: Install missing software on ubuntu (Python 3) - name: Install missing software on ubuntu (Python 3)
if: matrix.python-version != '2.7' if: matrix.python-version != '2.7'
run: | run: |
# shellcheck cannot be installed via pip sudo apt-get install shellcheck libxml2-utils
# ERROR: Could not find a version that satisfies the requirement shellcheck (from versions: none)
# ERROR: No matching distribution found for shellcheck
sudo apt-get install shellcheck
python -m pip install pip --upgrade python -m pip install pip --upgrade
python -m pip install natsort python -m pip install natsort
python -m pip install pexpect python -m pip install pexpect
@ -101,100 +41,45 @@ jobs:
python -m pip install psutil python -m pip install psutil
- name: run Shellcheck - name: run Shellcheck
if: matrix.python-latest if: matrix.python-version == '3.8'
run: | run: |
find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231 find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231
- name: run pylint - name: run pylint
if: matrix.python-latest if: matrix.python-version == '3.8'
run: | run: |
echo "FIXME pylint is disabled for now because it fails to import files:" pylint --rcfile=pylintrc_travis addons/*.py
echo "FIXME addons/runaddon.py:1:0: E0401: Unable to import 'cppcheckdata' (import-error)" pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport
echo "FIXME addons/runaddon.py:1:0: E0401: Unable to import 'cppcheck' (import-error)" pylint --rcfile=pylintrc_travis htmlreport/*.py
# pylint --rcfile=pylintrc_travis --jobs $(nproc) addons/*.py htmlreport/cppcheck-htmlreport htmlreport/*.py tools/*.py pylint --rcfile=pylintrc_travis tools/*.py
- name: check .json files - name: check .json files
if: matrix.python-latest if: matrix.python-version == '3.8'
run: | run: |
find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null
- name: Validate - name: Validate
if: matrix.python-latest if: matrix.python-version == '3.8'
run: | run: |
make -j$(nproc) validateCFG validatePlatforms validateRules make -j$(nproc) validateCFG validatePlatforms validateRules
- name: check python syntax - name: check python syntax
if: matrix.python-version != '2.7' if: matrix.python-version != '2.7'
run: | run: |
python -m py_compile addons/*.py python -m py_compile ./tools/donate-cpu.py
python -m py_compile htmlreport/cppcheck-htmlreport python -m py_compile ./tools/donate-cpu-server.py
python -m py_compile htmlreport/*.py
python -m py_compile tools/*.py
- name: compile addons - name: compile addons
run: | run: |
python -m compileall ./addons python -m compileall ./addons
- name: test matchcompiler
run: |
python tools/test_matchcompiler.py
# we cannot specify -Werror since xml/etree/ElementTree.py in Python 3.9/3.10 contains an unclosed file
- name: test addons - name: test addons
if: matrix.python-version == '3.9' || matrix.python-version == '3.10'
run: | run: |
python -m pytest --strict-markers -vv addons/test/test-*.py make -j$(nproc) -s
env: PYTHONPATH=./addons python -m pytest addons/test/test-*.py
PYTHONPATH: ./addons
- name: test addons - name: dmake
if: matrix.python-version != '3.9' && matrix.python-version != '3.10' if: matrix.python-version == '3.8'
run: |
python -m pytest -Werror --strict-markers -vv 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 -Werror --strict-markers -vv tools/test_reduce.py
env:
PYTHONPATH: ./tools
- name: test donate_cpu_lib
if: matrix.python-version != '2.7'
run: |
python -m pytest -Werror --strict-markers -vv tools/test_donate_cpu_lib.py
env:
PYTHONPATH: ./tools
- name: test donate_cpu_server
if: matrix.python-version != '2.7'
run: |
python -m pytest -Werror --strict-markers -vv tools/test_donate_cpu_server.py
env:
PYTHONPATH: ./tools
dmake:
strategy:
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: run dmake
run: |
make -j2 CXXFLAGS="-w" run-dmake
- name: check diff
run: | run: |
make -j$(nproc) run-dmake
git diff --exit-code git diff --exit-code

View File

@ -1,135 +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:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04
env:
QT_VERSION: 6.6.0
steps:
- uses: actions/checkout@v3
- name: Install missing software
run: |
sudo apt-get update
sudo apt-get install libboost-container-dev
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}
- name: Install missing software
run: |
sudo apt-get update
sudo apt-get install clang-14 valgrind
- name: Install Qt ${{ env.QT_VERSION }}
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
modules: 'qtcharts'
cache: true
# TODO: cache this - perform same build as for the other self check
- name: Self check (build)
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
# valgrind cannot handle DWARF 5 yet so force version 4
# work around performance regression with -inline-deferral
make -j$(nproc) -s CXXFLAGS="-O2 -w -DHAVE_BOOST -gdwarf-4 -mllvm -inline-deferral" MATCHCOMPILER=yes
env:
CC: clang-14
CXX: clang++-14
- name: CMake
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On
- name: Generate dependencies
run: |
# make sure the precompiled headers exist
make -C cmake.output lib/CMakeFiles/cppcheck-core.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=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
env:
DISABLE_VALUEFLOW: 1
UNUSEDFUNCTION_ONLY: 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: |
cmake -S . -B cmake.output.notest -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=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/cppcheck-core.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=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
env:
DISABLE_VALUEFLOW: 1
UNUSEDFUNCTION_ONLY: 1
- name: Fetch corpus
run: |
wget https://github.com/danmar/cppcheck/archive/refs/tags/2.8.tar.gz
tar xvf 2.8.tar.gz
- name: CMake (corpus / no test)
run: |
cmake -S cppcheck-2.8 -B cmake.output.corpus -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On
- name: Generate dependencies (corpus)
run: |
# make sure the precompiled headers exist
make -C cmake.output.notest lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx
# make sure auto-generated GUI files exist
make -C cmake.output.corpus autogen
make -C cmake.output.corpus gui-build-deps
# TODO: find a way to report unmatched suppressions without need to add information checks
- name: Self check (unusedFunction / corpus / no test / callgrind)
run: |
# TODO: fix -rp so the suppressions actually work
valgrind --tool=callgrind ./cppcheck --template=selfcheck --error-exitcode=0 --library=cppcheck-lib --library=qt -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.corpus/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr 2>callgrind.log || (cat callgrind.log && false)
cat callgrind.log
callgrind_annotate --auto=no > callgrind.annotated.log
head -50 callgrind.annotated.log
env:
DISABLE_VALUEFLOW: 1
- uses: actions/upload-artifact@v3
with:
name: Callgrind Output
path: ./callgrind.*

View File

@ -1,122 +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: thread sanitizer
on:
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04
env:
QT_VERSION: 5.15.2
TSAN_OPTIONS: halt_on_error=1
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
steps:
- uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
check-latest: true
- name: Install missing software on ubuntu
run: |
sudo apt-get update
sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils
- name: Install clang
run: |
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
- name: Install Qt ${{ env.QT_VERSION }}
if: false
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
modules: 'qtcharts'
cache: true
- name: Install missing Python packages
run: |
python3 -m pip install pip --upgrade
python3 -m pip install pytest
python3 -m pip install pytest-timeout
- name: CMake
run: |
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=Off -DWITH_QCHART=Off -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DUSE_THREADS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
env:
CC: clang-17
CXX: clang++-17
- 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
- name: Run cfg tests
run: |
cmake --build cmake.output --target checkcfg -- -j $(nproc)
# TODO: we should use CTest instead to parallelize tests but the start-up overhead will slow things down
- name: Run CTest
if: false
run: |
ctest --test-dir cmake.output --output-on-failure -j$(nproc)
- name: Run test/cli
run: |
pwd=$(pwd)
cd test/cli
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test-*.py
- name: Generate dependencies
if: false
run: |
# make sure auto-generated GUI files exist
make -C cmake.output autogen
make -C cmake.output gui-build-deps triage-build-ui-deps
# TODO: disabled for now as it takes around 40 minutes to finish
# set --error-exitcode=0 so we only fail on sanitizer issues - since it uses threads for execution it will exit the whole process on the first issue
- name: Self check
if: false
run: |
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__GNUC__ --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings --check-level=exhaustive"
cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2"
ec=0
./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/*.cpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
exit $ec

View File

@ -2,118 +2,42 @@
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: undefined behaviour sanitizers name: undefined behaviour sanitizers
on: on: [push, pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
env: env:
QT_VERSION: 5.15.2 UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
check-latest: true
- name: Install missing software on ubuntu - name: Install missing software on ubuntu
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils sudo apt-get install libz3-4 libz3-dev
- name: Install clang - name: Build
run: | run: make -j$(nproc) cppcheck testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
- name: Install Qt ${{ env.QT_VERSION }}
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
modules: 'qtcharts'
cache: true
- name: Install missing Python packages
run: |
python3 -m pip install pip --upgrade
python3 -m pip install pytest
python3 -m pip install pytest-timeout
# TODO: disable warnings
- name: CMake
run: |
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
env: env:
CC: clang-17 CC: clang
CXX: clang++-17 CXX: clang++
CXXFLAGS: "-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG"
- name: Build cppcheck CPPFLAGS: "-DCHECK_INTERNAL"
run: |
cmake --build cmake.output --target cppcheck -- -j $(nproc)
- name: Build test
run: |
cmake --build cmake.output --target testrunner -- -j $(nproc)
- name: Run tests - name: Run tests
run: ./cmake.output/bin/testrunner run: ./testrunner
- name: Run cfg tests
run: |
cmake --build cmake.output --target checkcfg -- -j $(nproc)
# TODO: we should use CTest instead to parallelize tests but the start-up overhead will slow things down
- name: Run CTest
if: false
run: |
ctest --test-dir cmake.output --output-on-failure -j$(nproc)
- name: Run test/cli
run: |
pwd=$(pwd)
cd test/cli
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test-*.py
- name: Generate dependencies
run: |
# make sure auto-generated GUI files exist
make -C cmake.output autogen
make -C cmake.output gui-build-deps triage-build-ui-deps
# TODO: only fail the step on sanitizer issues - since we use processes it will only fail the underlying process which will result in an cppcheckError
- name: Self check - name: Self check
run: | run: |
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings --check-level=exhaustive" ./cppcheck -q -j$(nproc) --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib
cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" ./cppcheck -q -j$(nproc) --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp
ec=0 ./cppcheck -q -j$(nproc) --template=selfcheck -D__CPPCHECK__ --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
./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json cli lib || ec=1 # This takes too long time right now
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 # - name: Bughunting lib
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/*.cpp || ec=1 # run: ./cppcheck -D__CPPCHECK__ --bug-hunting -j$(nproc) lib
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
exit $ec

View File

@ -2,60 +2,51 @@
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: valgrind name: valgrind
on: on: [push, pull_request]
push:
branches:
- 'main'
- 'releases/**'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v3 - 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: ccache - name: Add debug repos on ubuntu
uses: hendrikmuhs/ccache-action@v1.2 run: |
with: echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list
key: ${{ github.workflow }}-${{ runner.os }} 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 - name: Install missing software
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install libxml2-utils sudo apt-get install libxml2-utils
sudo apt-get install valgrind sudo apt-get install valgrind
sudo apt-get install libboost-container-dev sudo apt-get install libz3-dev libz3-4 libz3-4-dbgsym
sudo apt-get install debuginfod sudo apt-get install libc6-dbg-amd64-cross
- name: Build cppcheck - name: Build cppcheck
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" CXXFLAGS="-O1 -g" make -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes
CXXFLAGS="-O1 -g -w -DHAVE_BOOST" make -j$(nproc) HAVE_RULES=yes MATCHCOMPILER=yes
- name: Build test - name: Build test
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" CXXFLAGS="-O1 -g" make -j$(nproc) testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes
CXXFLAGS="-O1 -g -w -DHAVE_BOOST" make -j$(nproc) testrunner HAVE_RULES=yes MATCHCOMPILER=yes
- name: Run valgrind - name: Run valgrind
run: | run: |
ec=0 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
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 || ec=1
cat memcheck.log cat memcheck.log
exit $ec
env:
DEBUGINFOD_URLS: https://debuginfod.ubuntu.com
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
if: success() || failure()
with: with:
name: Logs name: Logs
path: ./*.log path: ./*.log

100
.gitignore vendored
View File

@ -2,16 +2,15 @@
*.gcno *.gcno
*.o *.o
*.pyc *.pyc
/cppcheck cppcheck
/cppcheck.exe cppcheck.exe
cppcheck-core.dll dmake
/dmake dmake.exe
/dmake.exe
reduce reduce
reduce.exe reduce.exe
tags tags
/testrunner testrunner
/testrunner.exe testrunner.exe
tools/daca2*.html tools/daca2*.html
tools/dmake tools/dmake
tools/errmsg tools/errmsg
@ -20,9 +19,6 @@ tools/extracttests
# dump files generated by Cppcheck # dump files generated by Cppcheck
*.*.dump *.*.dump
# CTU info files generated by Cppcheck
*.*.ctu-info
# VS generated files # VS generated files
*.aps *.aps
*.idb *.idb
@ -34,17 +30,16 @@ tools/extracttests
*.sdf *.sdf
*.suo *.suo
*.user *.user
/.vs/ .vs/
UpgradeLog*.htm
# VS build folders # VS build folders
bin/ bin/
Build/ Build/
BuildTmp/ BuildTmp/
/cli/temp/ cli/temp/
ipch/ ipch/
/lib/temp/ lib/temp/
/test/temp/ test/temp/
# XCode build folders and files # XCode build folders and files
*.mode[0-9]v[0-9] *.mode[0-9]v[0-9]
@ -52,33 +47,30 @@ ipch/
build/ build/
# GUI build folders # GUI build folders
/gui/debug/ gui/debug/
/gui/release/ gui/release/
/gui/temp/ gui/temp/
/triage/temp
# Other (generated) GUI files # Other (generated) GUI files
/gui/*.qm gui/*.qm
/gui/cppcheck-gui gui/cppcheck-gui
/gui/cppcheck-gui.exe gui/cppcheck-gui.exe
/gui/gui.sln gui/gui.sln
/gui/gui.vcproj gui/gui.vcproj
/gui/help/online-help.qch gui/Makefile
/gui/help/online-help.qhc gui/Makefile.debug
/gui/Makefile gui/Makefile.release
/gui/Makefile.debug gui/qrc_gui.cpp
/gui/Makefile.release gui/test/Makefile
/gui/qrc_gui.cpp gui/test/*/Makefile
/gui/test/Makefile gui/test/*/*/Makefile
/gui/test/*/Makefile gui/test/benchmark/simple/benchmark-simple
/gui/test/*/*/Makefile gui/test/filelist/test-filelist
/gui/test/benchmark/simple/benchmark-simple gui/test/projectfile/test-projectfile
/gui/test/cppchecklibrarydata/qrc_resources.cpp gui/test/translationhandler/test-translationhandler
/gui/test/cppchecklibrarydata/test-cppchecklibrarydata gui/test/xmlreport/test-xmlreport
/gui/test/filelist/test-filelist gui/test/xmlreportv1/test-xmlreportv1
/gui/test/projectfile/test-projectfile gui/test/xmlreportv2/test-xmlreportv2
/gui/test/translationhandler/test-translationhandler
/gui/test/xmlreportv2/test-xmlreportv2
# Doxygen output folder # Doxygen output folder
doxyoutput/ doxyoutput/
@ -95,7 +87,7 @@ htmlreport/MANIFEST
*.kdev4 *.kdev4
# Common cmake build directories # Common cmake build directories
build**/ build*
# Temporal files # Temporal files
*.swp *.swp
@ -106,33 +98,25 @@ prime
parts parts
stage stage
*.snap *.snap
/snap/.snapcraft snap/.snapcraft
# Manual folder # Manual folder
/man/manual.log man/manual.log
/man/manual.tex man/manual.tex
/man/*.pdf man/*.pdf
/man/*.html man/*.html
# CLion # CLion
/.idea .idea
/.metadata/ /.metadata/
/cmake-build-* cmake-*
/.run
# clang tooling temporary files # clang tooling temporary files
.clangd/ .clangd/
.cache/
compile_commands.json compile_commands.json
# qmake # qmake
.qmake.stash /gui/.qmake.stash
#vs code #vs code
/.vscode .vscode
#debian build system
/debian
/release_files
*.lha

View File

@ -1,28 +0,0 @@
missingIncludeSystem
# temporary suppressions - fix the warnings!
simplifyUsing:lib/valueptr.h
varid0:gui/projectfile.cpp
naming-privateMemberVariable:gui/test/cppchecklibrarydata/testcppchecklibrarydata.h
symbolDatabaseWarning:*/moc_*.cpp
simplifyUsing:*/moc_*.cpp
# warnings in Qt generated code we cannot fix
funcArgNamesDifferent:*/moc_*.cpp
naming-varname:*/ui_*.h
functionStatic:*/ui_fileview.h
# --debug-warnings suppressions
valueFlowBailout
valueFlowBailoutIncompleteVar
autoNoType
naming-varname:externals/simplecpp/simplecpp.h
naming-privateMemberVariable:externals/simplecpp/simplecpp.h
# these warnings need to be addressed upstream
uninitMemberVar:externals/tinyxml2/tinyxml2.h
noExplicitConstructor:externals/tinyxml2/tinyxml2.h
missingOverride:externals/tinyxml2/tinyxml2.h
invalidPrintfArgType_sint:externals/tinyxml2/tinyxml2.h
naming-privateMemberVariable:externals/tinyxml2/tinyxml2.h

View File

@ -1,15 +0,0 @@
# we are not using all methods of their interfaces
unusedFunction:externals/*/*
# TODO: fix these
# false positive - # 10660
unusedFunction:gui/mainwindow.cpp
unusedFunction:gui/resultstree.cpp
unusedFunction:gui/codeeditor.*
# usage is disabled
unusedFunction:lib/symboldatabase.cpp
# false positive - #10661
unusedFunction:oss-fuzz/main.cpp
# Q_OBJECT functions which are not called in our code
unusedFunction:cmake.output.notest/gui/cppcheck-gui_autogen/*/moc_aboutdialog.cpp

View File

@ -18,7 +18,21 @@ env:
before_install: before_install:
# install needed deps # install needed deps
- travis_retry sudo apt-get update -qq - travis_retry sudo apt-get update -qq
- travis_retry sudo apt-get install -qq libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev tidy libopencv-dev - travis_retry sudo apt-get install -qq python3-pip libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev tidy libopencv-dev libz3-dev
# Python 2 modules
- travis_retry python2 -m pip install --user pytest==4.6.4
- travis_retry python2 -m pip install --user unittest2
- travis_retry python2 -m pip install --user pexpect # imported by tools/ci.py
- travis_retry python2 -m pip install --user pygments
# Python 3 modules
- travis_retry python3 -m pip install --user setuptools --upgrade
- travis_retry python3 -m pip install --user pytest
- travis_retry python3 -m pip install --user unittest2
- travis_retry python3 -m pip install --user pexpect # imported by tools/ci.py
- travis_retry python3 -m pip install --user requests # imported by tools/pr.py
- travis_retry python3 -m pip install --user pygments
- travis_retry python3 -m pip install --user natsort
- cp externals/z3_version_old.h externals/z3_version.h # because travis z3 version is old
matrix: matrix:
# do notify immediately about it when a job of a build fails. # do notify immediately about it when a job of a build fails.
@ -31,6 +45,21 @@ matrix:
compiler: clang compiler: clang
script: script:
- make -j$(nproc) -s - make -j$(nproc) -s
# run extra tests
- tools/generate_and_run_more_tests.sh
# check for missing CWE entries
- make checkCWEEntries
# check cfg files
- make checkcfg
# Validate Result XML
- make validateXML
# check htmlreport stuff
- python2 htmlreport/test_htmlreport.py
- python3 htmlreport/test_htmlreport.py
- cd htmlreport
- PYTHON=python2 ./check.sh
- PYTHON=python3 ./check.sh
- cd ../
# check if DESTDIR works TODO: actually execute this # check if DESTDIR works TODO: actually execute this
- mkdir install_test - mkdir install_test
- echo $CXXFLAGS - echo $CXXFLAGS
@ -41,3 +70,87 @@ matrix:
- echo $CXXFLAGS - echo $CXXFLAGS
- make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j$(nproc) - make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j$(nproc)
- sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install - sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install
# check if it actually works:
- /usr/bin/cppcheck ./cli
# check if showtime=top5 works
- ./tools/test_showtimetop5.sh
# check matchcompiler
- python2 tools/test_matchcompiler.py
- python3 tools/test_matchcompiler.py
# check --dump
- ${CPPCHECK} test/testpreprocessor.cpp --dump
- xmllint --noout test/testpreprocessor.cpp.dump
# check addons/misc.py
- cd addons/test
- ${CPPCHECK} --dump misc-test.cpp
- python3 ../misc.py -verify misc-test.cpp.dump
- cd ../../
# check addons/cert.py
- cd addons/test
- ${CPPCHECK} --dump cert-test.c
- python3 ../cert.py -verify cert-test.c.dump
- ${CPPCHECK} --dump cert-test.cpp
- python3 ../cert.py -verify cert-test.cpp.dump
- cd ../../
# check addons/misra.py
- cd 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 --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.c
- python3 ../misra.py -verify misra/misra-test.c.dump
- ${CPPCHECK} --dump misra/misra-test.cpp
- python3 ../misra.py -verify misra/misra-test.cpp.dump
- python ../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_ascii.txt -verify misra/misra-test.cpp.dump
- python ../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_utf8.txt -verify misra/misra-test.cpp.dump
- python ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump
- python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump
- cd ../../
# check addons/naming.py
- cd addons/test
- ${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
- cd ../..
# check addons/namingng.py
- cd addons/test
- ${CPPCHECK} --dump namingng_test.c
- python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump
- cd ../..
# bug hunting
- name: "bug hunting"
compiler: gcc
script:
- make clean
- make USE_Z3=yes -j$(nproc) all
- ./testrunner TestExprEngine
# FIXME: this is slowish
#- python3 test/bug-hunting/cve.py
#- git clone https://github.com/regehr/itc-benchmarks.git ~/itc
#- python3 test/bug-hunting/itc.py
- mkdir ~/juliet
- curl https://samate.nist.gov/SARD/testsuites/juliet/Juliet_Test_Suite_v1.3_for_C_Cpp.zip -o ~/juliet/juliet.zip
- cd ~/juliet
- unzip -qq ~/juliet/juliet.zip
- cd -
- python3 test/bug-hunting/juliet.py
script:
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
- set -e
# Determine CPU count. As of January 2019 it seems to be 2 - so use this for job count in suitable calls to make or cppcheck
- cat /proc/cpuinfo
# check with TEST_MATHLIB_VALUE enabled
- touch lib/mathlib.cpp test/testmathlib.cpp
- echo $CXXFLAGS
- make -s check -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE
- touch lib/mathlib.cpp test/testmathlib.cpp
# compile cppcheck, default build
- echo $CXXFLAGS
- make -s check -j$(nproc)
# Testing addons (disabled 2020-11-24 because Travis fails, TODO try to enable these)
# - PYTHONPATH=./addons python -m pytest addons/test/test-*.py
# - PYTHONPATH=./addons python3 -m pytest addons/test/test-*.py

View File

@ -0,0 +1,8 @@
unreadVariable
shadowVar
shadowFunction
unusedStructMember
nullPointer
uninitvar
noExplicitConstructor

21
.travis_suppressions Normal file
View File

@ -0,0 +1,21 @@
unusedPrivateFunction:test/testbufferoverrun.cpp
unusedPrivateFunction:test/testcmdlineparser.cpp
shadowFunction
functionConst
functionStatic
bitwiseOnBoolean
# temporary suppressions - fix the warnings!
unusedPrivateFunction:test/test*.cpp
useStlAlgorithm
# debug suppressions
valueFlowBailout
valueFlowBailoutIncompleteVar
debug
varid0
*:gui/test/*
*:test/test.cxx
*:test/cfg/*
*:externals/*/*

File diff suppressed because it is too large Load Diff

75
AUTHORS
View File

@ -12,16 +12,13 @@ Albert Aribaud
Aleksandr Pikalev Aleksandr Pikalev
Aleksey Palazhchenko Aleksey Palazhchenko
Alexander Alekseev Alexander Alekseev
Alexander Festini
Alexander Gushchin Alexander Gushchin
Alexander Mai Alexander Mai
Alexander Tkachev Alexander Tkachev
Alexandre Chouvellon Alexandre Chouvellon
Alexey Eryomenko Alexey Eryomenko
Alexey Zhikhartsev Alexey Zhikhartsev
Alfi Maulana
Ali Can Demiralp Ali Can Demiralp
Alon Alexander
Alon Liberman Alon Liberman
Ameen Ali Ameen Ali
Andreas Bacher Andreas Bacher
@ -31,14 +28,10 @@ Andreas Pokorny
Andreas Rönnquist Andreas Rönnquist
Andreas Vollenweider Andreas Vollenweider
Andrei Karas Andrei Karas
Andrew C Aitchison
Andrew C. Martin Andrew C. Martin
Andrew D. Bancroft
Andy Holmes
Andy Maloney Andy Maloney
Aneesh Azhakesan S Aneesh Azhakesan S
Ankita Gupta Ankita Gupta
Anton Lindqvist
Antti Tuppurainen Antti Tuppurainen
Anurag Garg Anurag Garg
Armin Müller Armin Müller
@ -47,7 +40,6 @@ August Sodora
Ayaz Salikhov Ayaz Salikhov
Balázs Tóth Balázs Tóth
Baris Demiray Baris Demiray
Bart vdr. Meulen
Bartlomiej Grzeskowiak Bartlomiej Grzeskowiak
bbennetts bbennetts
Benjamin Bannier Benjamin Bannier
@ -63,40 +55,30 @@ Björge Dijkstra
booga booga
Boris Barbulovski Boris Barbulovski
Boris Egorov Boris Egorov
Boussaffa Walid
Bo Rydberg Bo Rydberg
bzgec
Carl Michael Grüner Monzón Carl Michael Grüner Monzón
Carl Morgan
Carlo Marcelo Arenas Belón Carlo Marcelo Arenas Belón
Carlos Gomes Martinho Carlos Gomes Martinho
Carl-Oskar Larsson Carl-Oskar Larsson
Cary R Cary R
Changkyoon Kim Changkyoon Kim
Chris Lalancette
Christian Ehrlicher Christian Ehrlicher
Christian Franke Christian Franke
Christoph Grüninger
Christoph Schmidt Christoph Schmidt
Christoph Strehle Christoph Strehle
Chuck Larson Chuck Larson
Cilyan Olowen
Claus Jensby Madsen
Colomban Wendling Colomban Wendling
Conrado Gouvea Conrado Gouvea
daisuke-chiba daisuke-chiba
Daniel Friedrich Daniel Friedrich
David Korczynski
Daniel Marjamäki Daniel Marjamäki
David Hallas David Hallas
David Korth David Korth
Dávid Slivka
Debrard Sebastien Debrard Sebastien
Deepak Gupta Deepak Gupta
dencat dencat
Diego de las Heras Diego de las Heras
Dirk Jagdmann Dirk Jagdmann
Dirk Mueller
Dmitriy Dmitriy
Dmitry Marakasov Dmitry Marakasov
Dmitry-Me Dmitry-Me
@ -105,8 +87,6 @@ Edoardo Prezioso
Eivind Tagseth Eivind Tagseth
Elbert Pol Elbert Pol
Emmanuel Blot Emmanuel Blot
Eric Lemanissier
Eric Malenfant
Eric Sesterhenn Eric Sesterhenn
Erik Hovland Erik Hovland
Erik Lax Erik Lax
@ -120,30 +100,23 @@ Felix Wolff
Florin Iucha Florin Iucha
Francesc Elies Francesc Elies
Frank Zingsheim Frank Zingsheim
Frederik Schwarzer
fu7mu4 fu7mu4
Galimov Albert Galimov Albert
Garrett Bodily Garrett Bodily
Gary Leutheuser Gary Leutheuser
gaurav kaushik gaurav kaushik
Gennady Feldman Gennady Feldman
Georgi D. Sotirov
Georgy Komarov Georgy Komarov
Gerbo Engels
Gerhard Zlabinger Gerhard Zlabinger
Gerik Rhoden
Gianfranco Costamagna Gianfranco Costamagna
Gianluca Scacco Gianluca Scacco
Gleydson Soares Gleydson Soares
Goran Džaferi Goran Džaferi
Graham Whitted Graham Whitted
Greg Hewgill Greg Hewgill
Guillaume A.
Guillaume Chauvel
Guillaume Miossec Guillaume Miossec
Gustav Palmqvist Gustav Palmqvist
Günther Makulik Günther Makulik
Haowei Hsu
Harald Scheidl Harald Scheidl
Heiko Bauke Heiko Bauke
Heiko Eißfeldt Heiko Eißfeldt
@ -151,7 +124,6 @@ Heinrich Schuchardt
Henrik Nilsson Henrik Nilsson
He Yuqi He Yuqi
Hoang Tuan Su Hoang Tuan Su
Igor Rondarev
Igor Zhukov Igor Zhukov
Ivan Maidanski Ivan Maidanski
Iván Matellanes Iván Matellanes
@ -162,56 +134,44 @@ Jan Egil Ruud
Jan Hellwig Jan Hellwig
János Maros János Maros
Jay Sigbrandt Jay Sigbrandt
Jedrzej Klocek
Jens Bäckman Jens Bäckman
Jens Yllman
Jérémy Lefaure Jérémy Lefaure
Jes Ramsing Jes Ramsing
Jesse Boswell Jesse Boswell
Jim Kuhn
Jim Zhou Jim Zhou
jlguardi jlguardi
Johan Bertrand
Johan Samuelson Johan Samuelson
John Marshall John Marshall
John-Paul Ore John-Paul Ore
John Smits John Smits
Jonathan Clohessy Jonathan Clohessy
Jonathan Haehne
Jonathan Neuschäfer Jonathan Neuschäfer
Jonathan Thackray Jonathan Thackray
José Martins
Jose Roquette Jose Roquette
Joshua Beck Joshua Beck
Joshua Rogers Joshua Rogers
Julian Santander Julian Santander
Julien Marrec
Julien Peyregne Julien Peyregne
Jure Menart Jure Menart
Jussi Lehtola Jussi Lehtola
Jørgen Kvalsvik Jørgen Kvalsvik
Kamil Dudka Kamil Dudka
Kartik Bajaj Kartik Bajaj
keinflue
Ken-Patrick Lehrmann Ken-Patrick Lehrmann
Ketil Skjerve Ketil Skjerve
Kevin Christian Kevin Christian
Kevin Kendzia Kevin Kendzia
Kimmo Varis Kimmo Varis
Kleber Tarcísio
Konrad Grochowski Konrad Grochowski
Konrad Windszus Konrad Windszus
Kumar Ashwani Kumar Ashwani
Kushal Chandar
Kyle Chisholm Kyle Chisholm
Lars Even Almaas Lars Even Almaas
larudwer larudwer
Lau bakman Lau bakman
Lauri Nurmi Lauri Nurmi
Leandro Lisboa Penz Leandro Lisboa Penz
Leila F. Rahman
Lena Herscheid Lena Herscheid
Leon De Andrade
Lieven de Cock Lieven de Cock
lioncash lioncash
Lionel Gimbert Lionel Gimbert
@ -225,13 +185,10 @@ Maksim Derbasov
Malcolm Parsons Malcolm Parsons
Marc-Antoine Perennou Marc-Antoine Perennou
Marcel Raad Marcel Raad
Marco Trevisan
Marek Zmysłowski Marek Zmysłowski
Marian Klymov Marian Klymov
Mark de Wever Mark de Wever
Mark Hermeling
Markus Elfring Markus Elfring
Martin Delille
Martin Ettl Martin Ettl
Martin Exner Martin Exner
Martin Güthle Martin Güthle
@ -239,7 +196,6 @@ Martin Herren
Márton Csordás Márton Csordás
Masafumi Koba Masafumi Koba
Massimo Paladin Massimo Paladin
Mateusz Michalak
Mateusz Pusz Mateusz Pusz
Mathias De Maré Mathias De Maré
Mathias Schmid Mathias Schmid
@ -247,10 +203,7 @@ Matthias Krüger
Matthias Kuhn Matthias Kuhn
Matthias Schmieder Matthias Schmieder
Matt Johnson Matt Johnson
Maurice Gilden
Mavik Mavik
Michael Drake
Michael Løiten
Miika-Petteri Matikainen Miika-Petteri Matikainen
Mika Attila Mika Attila
Mike Tzou Mike Tzou
@ -275,30 +228,21 @@ Oleksandr Redko
Oliver Schode Oliver Schode
Oliver Stöneberg Oliver Stöneberg
Olivier Croquette Olivier Croquette
Patrick Oppenlander
Paul Aitken
Paul Bersee
Paul Fultz II Paul Fultz II
Pavel Bibergal Pavel Bibergal
Pavel Pimenov Pavel Pimenov
Pavel Roschin Pavel Roschin
Pavel Skipenes Pavel Skipenes
Pavel Šimovec
Pavol Misik Pavol Misik
Pete Johns Pete Johns
Peter Pentchev Peter Pentchev
Peter Schops
Philipp Kloke Philipp Kloke
Pierre Schweitzer Pierre Schweitzer
Pino Toscano Pino Toscano
Pranav Khanna Pranav Khanna
Radek Jarecki
Rainer Wiesenfarth
Ramzan Bekbulatov Ramzan Bekbulatov
Raphael Geissert Raphael Geissert
Razvan Ioan Alexe
Reijo Tomperi Reijo Tomperi
Rainer Wiesenfarth
Riccardo Ghetta Riccardo Ghetta
Richard A. Smith Richard A. Smith
Richard Quirk Richard Quirk
@ -311,28 +255,21 @@ Roberto Martelloni
Robert Reif Robert Reif
rofl0r rofl0r
Roman Zaytsev Borisovich Roman Zaytsev Borisovich
Ronald Hiemstra
root root
Rosen Penev Rosen Penev
Rudi Danner
Rudolf Grauberger Rudolf Grauberger
Ryan M. Lederman
Ryan Pavlik Ryan Pavlik
Samir Aguiar Samir Aguiar
Sam Truscott Sam Truscott
Samuel Degrande Samuel Degrande
Samuel Poláček
Sandeep Dutta Sandeep Dutta
Savvas Etairidis Savvas Etairidis
Scott Furry Scott Furry
Sebastian Held Sebastian Held
Sebastian Matuschka Sebastian Matuschka
Sébastien Debrard Sébastien Debrard
Sergei Chernykh
Sergei Trofimovich
Sergey Burgsdorf Sergey Burgsdorf
Shane Tapp Shane Tapp
Shohei YOSHIDA
Simon Cornell Simon Cornell
Simon Kagstrom Simon Kagstrom
Simon Large Simon Large
@ -341,9 +278,7 @@ Simon Shanks
Slava Semushin Slava Semushin
Stas Cymbalov Stas Cymbalov
Stefan Beller Stefan Beller
Stefan Hagen
Stefan Naewe Stefan Naewe
Stefan van Kessel
Stefan Weil Stefan Weil
Stéphane Michel Stéphane Michel
Steve Browne Steve Browne
@ -357,38 +292,30 @@ Sylvain Joubert
Tam Do Thanh Tam Do Thanh
Teddy Didé Teddy Didé
Thomas Arnhold Thomas Arnhold
Tomasz Edward Posluszny
Thomas Jarosch Thomas Jarosch
Thomas Niederberger Thomas Niederberger
Thomas Otto Thomas Otto
Thomas P. K. Healy
Thomas Sondergaard Thomas Sondergaard
Thorsten Sick Thorsten Sick
Tim Blume
Tim Gerundt Tim Gerundt
tititiou36 tititiou36
Tobias Weibel Tobias Weibel
Tomasz Kłoczko
Tom Pollok Tom Pollok
Tomo Dote
Toralf Förster Toralf Förster
Troshin V.S. Troshin V.S.
Tyson Nottingham Tyson Nottingham
Valentin Batz
Valerii Lashmanov Valerii Lashmanov
Vasily Maslyukov Vasily Maslyukov
Veli-Matti Visuri Veli-Matti Visuri
WenChung Chiu
Vesa Pikki Vesa Pikki
Ville-Pekka Vahteala Ville-Pekka Vahteala
Ville Skyttä Ville Skyttä
Vincent Le Garrec Vincent Le Garrec
Wang Haoyu
WenChung Chiu
Wolfgang Stöggl Wolfgang Stöggl
x29a x29a
XhmikosR XhmikosR
Xuecheng Zhang Xuecheng Zhang
Yichen Yan
Yurii Putin Yurii Putin
Zachary Blair Zachary Blair
Zhao Qifa Zhao Qifa

View File

@ -1,101 +1,50 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
project(Cppcheck) project(Cppcheck)
include(cmake/cxx11.cmake)
use_cxx11()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(GNUInstallDirs) include(GNUInstallDirs)
include(cmake/ccache.cmake)
include(cmake/compilerCheck.cmake)
include(cmake/versions.cmake) include(cmake/versions.cmake)
include(cmake/options.cmake) include(cmake/options.cmake)
include(cmake/findDependencies.cmake) include(cmake/findDependencies.cmake)
include(cmake/compileroptions.cmake) include(cmake/compileroptions.cmake)
include(cmake/compilerDefinitions.cmake) include(cmake/compilerDefinitions.cmake)
include(cmake/buildFiles.cmake) include(cmake/buildFiles.cmake)
include(cmake/printInfo.cmake) include(cmake/cxx11.cmake)
if(BUILD_GUI)
include(cmake/qtCompat.cmake)
endif()
use_cxx11()
file(GLOB addons "addons/*.py") file(GLOB addons "addons/*.py")
file(GLOB cfgs "cfg/*.cfg") file(GLOB cfgs "cfg/*.cfg")
file(GLOB platforms "platforms/*.xml") file(GLOB platforms "platforms/*.xml")
if(LIBXML2_XMLLINT_EXECUTABLE) find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint)
add_custom_target(validateCFG DEPENDS validateCFG-cmd) if (LIBXML2_XMLLINT_EXECUTABLE)
add_custom_command(OUTPUT validateCFG-cmd add_custom_target(validateCFG ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/cfg/cppcheck-cfg.rng)
COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/cfg/cppcheck-cfg.rng)
foreach(cfg ${cfgs}) foreach(cfg ${cfgs})
add_custom_command(OUTPUT validateCFG-cmd APPEND get_filename_component(cfgname ${cfg} NAME_WE)
COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --noout --relaxng ${CMAKE_SOURCE_DIR}/cfg/cppcheck-cfg.rng ${cfg}) add_custom_target(validateCFG-${cfgname} ${LIBXML2_XMLLINT_EXECUTABLE} --noout --relaxng ${CMAKE_SOURCE_DIR}/cfg/cppcheck-cfg.rng ${cfg})
add_dependencies(validateCFG validateCFG-${cfgname})
endforeach() endforeach()
# this is a symbolic name for a build rule and not an output file
set_source_files_properties(validateCFG-cmd PROPERTIES SYMBOLIC "true")
add_custom_target(validatePlatforms ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/platforms/cppcheck-platforms.rng)
foreach(platform ${platforms})
get_filename_component(platformname ${platform} NAME_WE)
add_custom_target(validatePlatforms-${platformname} ${LIBXML2_XMLLINT_EXECUTABLE} --noout --relaxng ${CMAKE_SOURCE_DIR}/platforms/cppcheck-platforms.rng ${platform})
add_dependencies(validatePlatforms validatePlatforms-${platformname})
endforeach()
add_custom_target(errorlist-xml $<TARGET_FILE:cppcheck> --errorlist > ${CMAKE_BINARY_DIR}/errorlist.xml
DEPENDS cppcheck)
add_custom_target(example-xml $<TARGET_FILE:cppcheck> --xml --enable=all --inconclusive --max-configs=1 ${CMAKE_SOURCE_DIR}/samples 2> ${CMAKE_BINARY_DIR}/example.xml
DEPENDS cppcheck)
add_custom_target(createXMLExamples DEPENDS errorlist-xml example-xml)
if(PYTHON_EXECUTABLE)
add_custom_target(checkCWEEntries ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/listErrorsWithoutCWE.py -F ${CMAKE_BINARY_DIR}/errorlist.xml
DEPENDS errorlist-xml)
endif()
add_custom_target(validateXML ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/cppcheck-errors.rng
COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --noout --relaxng ${CMAKE_SOURCE_DIR}/cppcheck-errors.rng ${CMAKE_BINARY_DIR}/errorlist.xml
COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --noout --relaxng ${CMAKE_SOURCE_DIR}/cppcheck-errors.rng ${CMAKE_BINARY_DIR}/example.xml
DEPENDS createXMLExamples
)
add_custom_target(validateRules ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/rules/*.xml)
endif() endif()
if(BUILD_TESTS) if (BUILD_TESTS)
enable_testing() enable_testing()
endif() endif()
add_custom_target(copy_cfg ALL
${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/cfg"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/cfg"
COMMENT "Copying cfg files to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}")
add_custom_target(copy_addons ALL
${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/addons"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/addons"
COMMENT "Copying addons files to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}")
add_custom_target(copy_platforms ALL
${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/platforms"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/platforms"
COMMENT "Copying platforms files to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}")
if(USE_BUNDLED_TINYXML2) if(USE_BUNDLED_TINYXML2)
message(STATUS "Using bundled version of tinyxml2") message(STATUS "Using bundled version of tinyxml2")
add_subdirectory(externals/tinyxml2) add_subdirectory(externals/tinyxml2)
endif() endif()
add_subdirectory(externals/simplecpp) add_subdirectory(externals/simplecpp)
add_subdirectory(lib) # CppCheck Library add_subdirectory(lib) # CppCheck Library
add_subdirectory(cli) # Client application add_subdirectory(cli) # Client application
add_subdirectory(test) # Tests add_subdirectory(test) # Tests
add_subdirectory(gui) # Graphical application add_subdirectory(gui) # Graphical application
add_subdirectory(tools/triage) # Triage tool add_subdirectory(tools/triage) # Triage tool
add_subdirectory(oss-fuzz) # OSS-Fuzz clients
add_subdirectory(tools) add_subdirectory(tools)
add_subdirectory(man)
include(cmake/printInfo.cmake)
include(cmake/clang_tidy.cmake) include(cmake/clang_tidy.cmake)

748
Makefile

File diff suppressed because it is too large Load Diff

View File

@ -1,918 +0,0 @@
# This file is generated by tools/dmake, do not edit.
ifndef VERBOSE
VERBOSE=
endif
# To compile with rules, use 'make HAVE_RULES=yes'
ifndef HAVE_RULES
HAVE_RULES=no
endif
ifdef SRCDIR
$(error Usage of SRCDIR to activate match compiler has been removed. Use MATCHCOMPILER=yes instead.)
endif
ifndef MATCHCOMPILER
MATCHCOMPILER=
endif
# use match compiler
ifeq ($(MATCHCOMPILER),yes)
# Find available Python interpreter
ifeq ($(PYTHON_INTERPRETER),)
PYTHON_INTERPRETER := $(shell which python3)
endif
ifeq ($(PYTHON_INTERPRETER),)
PYTHON_INTERPRETER := $(shell which python)
endif
ifeq ($(PYTHON_INTERPRETER),)
$(error Did not find a Python interpreter)
endif
ifdef VERIFY
matchcompiler_S := $(shell $(PYTHON_INTERPRETER) tools/matchcompiler.py --verify)
else
matchcompiler_S := $(shell $(PYTHON_INTERPRETER) tools/matchcompiler.py)
endif
libcppdir:=build
else
libcppdir:=lib
endif
ifndef CPPFLAGS
CPPFLAGS=
endif
ifdef FILESDIR
CPPFLAGS+=-DFILESDIR=\"$(FILESDIR)\"
endif
RDYNAMIC=-export-dynamic
# Set the CPPCHK_GLIBCXX_DEBUG flag. This flag is not used in release Makefiles.
# The _GLIBCXX_DEBUG define doesn't work in Cygwin or other Win32 systems.
ifndef COMSPEC
ifeq ($(VERBOSE),1)
$(info COMSPEC not found)
endif
ifdef ComSpec
ifeq ($(VERBOSE),1)
$(info ComSpec found)
endif
#### ComSpec is defined on some WIN32's.
WINNT=1
ifeq ($(VERBOSE),1)
$(info PATH=$(PATH))
endif
ifneq (,$(findstring /cygdrive/,$(PATH)))
ifeq ($(VERBOSE),1)
$(info /cygdrive/ found in PATH)
endif
CYGWIN=1
endif # CYGWIN
endif # ComSpec
endif # COMSPEC
ifdef WINNT
ifeq ($(VERBOSE),1)
$(info WINNT found)
endif
#### Maybe Windows
ifndef CPPCHK_GLIBCXX_DEBUG
CPPCHK_GLIBCXX_DEBUG=
endif # !CPPCHK_GLIBCXX_DEBUG
ifeq ($(VERBOSE),1)
$(info MSYSTEM=$(MSYSTEM))
endif
ifneq ($(MSYSTEM),MINGW32 MINGW64)
RDYNAMIC=
endif
LDFLAGS+=-lshlwapi
else # !WINNT
ifeq ($(VERBOSE),1)
$(info WINNT not found)
endif
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifeq ($(VERBOSE),1)
$(info uname_S=$(uname_S))
endif
ifeq ($(uname_S),Linux)
ifndef CPPCHK_GLIBCXX_DEBUG
CPPCHK_GLIBCXX_DEBUG=-D_GLIBCXX_DEBUG
endif # !CPPCHK_GLIBCXX_DEBUG
endif # Linux
ifeq ($(uname_S),GNU/kFreeBSD)
ifndef CPPCHK_GLIBCXX_DEBUG
CPPCHK_GLIBCXX_DEBUG=-D_GLIBCXX_DEBUG
endif # !CPPCHK_GLIBCXX_DEBUG
endif # GNU/kFreeBSD
LDFLAGS+=-lpthread
endif # WINNT
ifdef CYGWIN
ifeq ($(VERBOSE),1)
$(info CYGWIN found)
endif
# Set the flag to address compile time warnings
# with tinyxml2 and Cygwin.
CPPFLAGS+=-U__STRICT_ANSI__
# Increase stack size for Cygwin builds to avoid segmentation fault in limited recursive tests.
CXXFLAGS+=-Wl,--stack,8388608
endif # CYGWIN
ifndef CXX
CXX=g++
endif
ifeq (clang++, $(findstring clang++,$(CXX)))
CPPCHK_GLIBCXX_DEBUG=
endif
ifndef CXXFLAGS
CXXFLAGS=-std=c++0x -O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-multichar
endif
override CXXFLAGS +=-mcrt=newlib -O2 -athread=native -DNO_UNIX_SIGNAL_HANDLING -DUSE_THREADS
ifeq (g++, $(findstring g++,$(CXX)))
override CXXFLAGS += -std=gnu++0x -pipe
else ifeq (clang++, $(findstring clang++,$(CXX)))
override CXXFLAGS += -std=c++0x
else ifeq ($(CXX), c++)
ifeq ($(shell uname -s), Darwin)
override CXXFLAGS += -std=c++0x
endif
endif
ifeq ($(HAVE_RULES),yes)
PCRE_CONFIG = $(shell which pcre-config)
ifeq ($(PCRE_CONFIG),)
$(error Did not find pcre-config)
endif
override CXXFLAGS += -DHAVE_RULES $(shell $(PCRE_CONFIG) --cflags)
ifdef LIBS
LIBS += -lpcre
else
LIBS=-lpcre
endif
endif
ifndef PREFIX
PREFIX=/usr
endif
ifndef INCLUDE_FOR_LIB
INCLUDE_FOR_LIB=-Ilib -isystem externals -isystem externals/picojson -isystem externals/simplecpp -isystem externals/tinyxml2
endif
ifndef INCLUDE_FOR_CLI
INCLUDE_FOR_CLI=-Ilib -isystem externals/simplecpp -isystem externals/tinyxml2
endif
ifndef INCLUDE_FOR_TEST
INCLUDE_FOR_TEST=-Ilib -Icli -isystem externals/simplecpp -isystem externals/tinyxml2
endif
BIN=$(DESTDIR)$(PREFIX)/bin
# For 'make man': sudo apt-get install xsltproc docbook-xsl docbook-xml on Linux
DB2MAN?=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
XP=xsltproc -''-nonet -''-param man.charmap.use.subset "0"
MAN_SOURCE=man/cppcheck.1.xml
###### Object Files
LIBOBJ = $(libcppdir)/valueflow.o \
$(libcppdir)/tokenize.o \
$(libcppdir)/symboldatabase.o \
$(libcppdir)/addoninfo.o \
$(libcppdir)/analyzerinfo.o \
$(libcppdir)/astutils.o \
$(libcppdir)/check.o \
$(libcppdir)/check64bit.o \
$(libcppdir)/checkassert.o \
$(libcppdir)/checkautovariables.o \
$(libcppdir)/checkbool.o \
$(libcppdir)/checkboost.o \
$(libcppdir)/checkbufferoverrun.o \
$(libcppdir)/checkclass.o \
$(libcppdir)/checkcondition.o \
$(libcppdir)/checkers.o \
$(libcppdir)/checkersreport.o \
$(libcppdir)/checkexceptionsafety.o \
$(libcppdir)/checkfunctions.o \
$(libcppdir)/checkinternal.o \
$(libcppdir)/checkio.o \
$(libcppdir)/checkleakautovar.o \
$(libcppdir)/checkmemoryleak.o \
$(libcppdir)/checknullpointer.o \
$(libcppdir)/checkother.o \
$(libcppdir)/checkpostfixoperator.o \
$(libcppdir)/checksizeof.o \
$(libcppdir)/checkstl.o \
$(libcppdir)/checkstring.o \
$(libcppdir)/checktype.o \
$(libcppdir)/checkuninitvar.o \
$(libcppdir)/checkunusedfunctions.o \
$(libcppdir)/checkunusedvar.o \
$(libcppdir)/checkvaarg.o \
$(libcppdir)/clangimport.o \
$(libcppdir)/color.o \
$(libcppdir)/cppcheck.o \
$(libcppdir)/ctu.o \
$(libcppdir)/errorlogger.o \
$(libcppdir)/errortypes.o \
$(libcppdir)/forwardanalyzer.o \
$(libcppdir)/fwdanalysis.o \
$(libcppdir)/importproject.o \
$(libcppdir)/infer.o \
$(libcppdir)/keywords.o \
$(libcppdir)/library.o \
$(libcppdir)/mathlib.o \
$(libcppdir)/path.o \
$(libcppdir)/pathanalysis.o \
$(libcppdir)/pathmatch.o \
$(libcppdir)/platform.o \
$(libcppdir)/preprocessor.o \
$(libcppdir)/programmemory.o \
$(libcppdir)/reverseanalyzer.o \
$(libcppdir)/settings.o \
$(libcppdir)/summaries.o \
$(libcppdir)/suppressions.o \
$(libcppdir)/templatesimplifier.o \
$(libcppdir)/timer.o \
$(libcppdir)/token.o \
$(libcppdir)/tokenlist.o \
$(libcppdir)/utils.o \
$(libcppdir)/vfvalue.o
EXTOBJ = externals/simplecpp/simplecpp.o \
externals/tinyxml2/tinyxml2.o
CLIOBJ = cli/cmdlineparser.o \
cli/cppcheckexecutor.o \
cli/cppcheckexecutorseh.o \
cli/cppcheckexecutorsig.o \
cli/executor.o \
cli/filelister.o \
cli/main.o \
cli/processexecutor.o \
cli/singleexecutor.o \
cli/stacktrace.o \
cli/threadexecutor.o
TESTOBJ = test/fixture.o \
test/helpers.o \
test/main.o \
test/options.o \
test/test64bit.o \
test/testanalyzerinformation.o \
test/testassert.o \
test/testastutils.o \
test/testautovariables.o \
test/testbool.o \
test/testboost.o \
test/testbufferoverrun.o \
test/testcharvar.o \
test/testcheck.o \
test/testclangimport.o \
test/testclass.o \
test/testcmdlineparser.o \
test/testcolor.o \
test/testcondition.o \
test/testconstructors.o \
test/testcppcheck.o \
test/testerrorlogger.o \
test/testexceptionsafety.o \
test/testfilelister.o \
test/testfunctions.o \
test/testgarbage.o \
test/testimportproject.o \
test/testincompletestatement.o \
test/testinternal.o \
test/testio.o \
test/testleakautovar.o \
test/testlibrary.o \
test/testmathlib.o \
test/testmemleak.o \
test/testnullpointer.o \
test/testoptions.o \
test/testother.o \
test/testpath.o \
test/testpathmatch.o \
test/testplatform.o \
test/testpostfixoperator.o \
test/testpreprocessor.o \
test/testprocessexecutor.o \
test/testsettings.o \
test/testsimplifytemplate.o \
test/testsimplifytokens.o \
test/testsimplifytypedef.o \
test/testsimplifyusing.o \
test/testsingleexecutor.o \
test/testsizeof.o \
test/teststl.o \
test/teststring.o \
test/testsummaries.o \
test/testsuppressions.o \
test/testsymboldatabase.o \
test/testthreadexecutor.o \
test/testtimer.o \
test/testtoken.o \
test/testtokenize.o \
test/testtokenlist.o \
test/testtokenrange.o \
test/testtype.o \
test/testuninitvar.o \
test/testunusedfunctions.o \
test/testunusedprivfunc.o \
test/testunusedvar.o \
test/testutils.o \
test/testvaarg.o \
test/testvalueflow.o \
test/testvarid.o
.PHONY: run-dmake tags
###### Targets
cppcheck: $(EXTOBJ) $(LIBOBJ) $(CLIOBJ)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)
all: cppcheck testrunner
testrunner: $(EXTOBJ) $(TESTOBJ) $(LIBOBJ) cli/executor.o cli/processexecutor.o cli/singleexecutor.o cli/threadexecutor.o cli/cmdlineparser.o cli/cppcheckexecutor.o cli/cppcheckexecutorseh.o cli/cppcheckexecutorsig.o cli/stacktrace.o cli/filelister.o
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)
test: all
./testrunner
check: all
./testrunner -q
checkcfg: cppcheck validateCFG
./test/cfg/runtests.sh
dmake: tools/dmake.o cli/filelister.o $(libcppdir)/pathmatch.o $(libcppdir)/path.o $(libcppdir)/utils.o externals/simplecpp/simplecpp.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
run-dmake: dmake
./dmake --release
clean:
rm -f build/*.cpp build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1
man: man/cppcheck.1
man/cppcheck.1: $(MAN_SOURCE)
$(XP) $(DB2MAN) $(MAN_SOURCE)
tags:
ctags -R --exclude=doxyoutput --exclude=test/cfg cli externals gui lib test
install: cppcheck
install -d ${BIN}
install cppcheck ${BIN}
install htmlreport/cppcheck-htmlreport ${BIN}
ifdef FILESDIR
install -d ${DESTDIR}${FILESDIR}
install -d ${DESTDIR}${FILESDIR}/addons
install -m 644 addons/*.py ${DESTDIR}${FILESDIR}/addons
install -d ${DESTDIR}${FILESDIR}/cfg
install -m 644 cfg/*.cfg ${DESTDIR}${FILESDIR}/cfg
install -d ${DESTDIR}${FILESDIR}/platforms
install -m 644 platforms/*.xml ${DESTDIR}${FILESDIR}/platforms
else
$(error FILESDIR must be set!)
endif
uninstall:
@if test -d ${BIN}; then \
files="cppcheck cppcheck-htmlreport"; \
echo '(' cd ${BIN} '&&' rm -f $$files ')'; \
( cd ${BIN} && rm -f $$files ); \
fi
ifdef FILESDIR
@if test -d ${DESTDIR}${FILESDIR}; then \
echo rm -rf ${DESTDIR}${FILESDIR}; \
rm -rf ${DESTDIR}${FILESDIR}; \
fi
endif
ifdef CFGDIR
@if test -d ${DESTDIR}${CFGDIR}; then \
files="`cd cfg 2>/dev/null && ls`"; \
if test -n "$$files"; then \
echo '(' cd ${DESTDIR}${CFGDIR} '&&' rm -f $$files ')'; \
( cd ${DESTDIR}${CFGDIR} && rm -f $$files ); \
fi; \
fi
endif
# Validation of library files:
ConfigFiles := $(wildcard cfg/*.cfg)
ConfigFilesCHECKED := $(patsubst %.cfg,%.checked,$(ConfigFiles))
.PHONY: validateCFG
%.checked:%.cfg
xmllint --noout --relaxng cfg/cppcheck-cfg.rng $<
validateCFG: ${ConfigFilesCHECKED}
xmllint --noout cfg/cppcheck-cfg.rng
# Validation of platforms files:
PlatformFiles := $(wildcard platforms/*.xml)
PlatformFilesCHECKED := $(patsubst %.xml,%.checked,$(PlatformFiles))
.PHONY: validatePlatforms
%.checked:%.xml
xmllint --noout --relaxng platforms/cppcheck-platforms.rng $<
validatePlatforms: ${PlatformFilesCHECKED}
xmllint --noout platforms/cppcheck-platforms.rng
# Validate XML output (to detect regressions)
/tmp/errorlist.xml: cppcheck
./cppcheck --errorlist >$@
/tmp/example.xml: cppcheck
./cppcheck --xml --enable=all --inconclusive --max-configs=1 samples 2>/tmp/example.xml
createXMLExamples:/tmp/errorlist.xml /tmp/example.xml
.PHONY: validateXML
validateXML: createXMLExamples
xmllint --noout cppcheck-errors.rng
xmllint --noout --relaxng cppcheck-errors.rng /tmp/errorlist.xml
xmllint --noout --relaxng cppcheck-errors.rng /tmp/example.xml
checkCWEEntries: /tmp/errorlist.xml
$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python3)))
$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(shell which python)))
$(eval PYTHON_INTERPRETER := $(if $(PYTHON_INTERPRETER),$(PYTHON_INTERPRETER),$(error Did not find a Python interpreter)))
$(PYTHON_INTERPRETER) tools/listErrorsWithoutCWE.py -F /tmp/errorlist.xml
.PHONY: validateRules
validateRules:
xmllint --noout rules/*.xml
###### Build
$(libcppdir)/valueflow.o: lib/valueflow.cpp lib/addoninfo.h lib/analyzer.h lib/astutils.h lib/calculate.h lib/check.h lib/checkuninitvar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/findtoken.h lib/forwardanalyzer.h lib/infer.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/programmemory.h lib/reverseanalyzer.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/valueptr.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/valueflow.cpp
$(libcppdir)/tokenize.o: lib/tokenize.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/summaries.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/tokenize.cpp
$(libcppdir)/symboldatabase.o: lib/symboldatabase.cpp lib/addoninfo.h lib/astutils.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/keywords.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/symboldatabase.cpp
$(libcppdir)/addoninfo.o: lib/addoninfo.cpp externals/picojson/picojson.h lib/addoninfo.h lib/config.h lib/json.h lib/path.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/addoninfo.cpp
$(libcppdir)/analyzerinfo.o: lib/analyzerinfo.cpp externals/tinyxml2/tinyxml2.h lib/analyzerinfo.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/path.h lib/platform.h lib/standards.h lib/utils.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/analyzerinfo.cpp
$(libcppdir)/astutils.o: lib/astutils.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkclass.h lib/config.h lib/errortypes.h lib/findtoken.h lib/infer.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/valueptr.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/astutils.cpp
$(libcppdir)/check.o: lib/check.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/check.cpp
$(libcppdir)/check64bit.o: lib/check64bit.cpp lib/addoninfo.h lib/check.h lib/check64bit.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/check64bit.cpp
$(libcppdir)/checkassert.o: lib/checkassert.cpp lib/addoninfo.h lib/check.h lib/checkassert.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkassert.cpp
$(libcppdir)/checkautovariables.o: lib/checkautovariables.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkautovariables.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkautovariables.cpp
$(libcppdir)/checkbool.o: lib/checkbool.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkbool.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkbool.cpp
$(libcppdir)/checkboost.o: lib/checkboost.cpp lib/check.h lib/checkboost.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/sourcelocation.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkboost.cpp
$(libcppdir)/checkbufferoverrun.o: lib/checkbufferoverrun.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/astutils.h lib/check.h lib/checkbufferoverrun.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkbufferoverrun.cpp
$(libcppdir)/checkclass.o: lib/checkclass.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/astutils.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkclass.cpp
$(libcppdir)/checkcondition.o: lib/checkcondition.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkcondition.h lib/checkother.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkcondition.cpp
$(libcppdir)/checkers.o: lib/checkers.cpp lib/checkers.h lib/config.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkers.cpp
$(libcppdir)/checkersreport.o: lib/checkersreport.cpp lib/addoninfo.h lib/checkers.h lib/checkersreport.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkersreport.cpp
$(libcppdir)/checkexceptionsafety.o: lib/checkexceptionsafety.cpp lib/addoninfo.h lib/check.h lib/checkexceptionsafety.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkexceptionsafety.cpp
$(libcppdir)/checkfunctions.o: lib/checkfunctions.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkfunctions.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkfunctions.cpp
$(libcppdir)/checkinternal.o: lib/checkinternal.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkinternal.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkinternal.cpp
$(libcppdir)/checkio.o: lib/checkio.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkio.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkio.cpp
$(libcppdir)/checkleakautovar.o: lib/checkleakautovar.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkleakautovar.h lib/checkmemoryleak.h lib/checknullpointer.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkleakautovar.cpp
$(libcppdir)/checkmemoryleak.o: lib/checkmemoryleak.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkmemoryleak.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkmemoryleak.cpp
$(libcppdir)/checknullpointer.o: lib/checknullpointer.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checknullpointer.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checknullpointer.cpp
$(libcppdir)/checkother.o: lib/checkother.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkother.h lib/config.h lib/errortypes.h lib/fwdanalysis.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkother.cpp
$(libcppdir)/checkpostfixoperator.o: lib/checkpostfixoperator.cpp lib/addoninfo.h lib/check.h lib/checkpostfixoperator.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkpostfixoperator.cpp
$(libcppdir)/checksizeof.o: lib/checksizeof.cpp lib/addoninfo.h lib/check.h lib/checksizeof.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checksizeof.cpp
$(libcppdir)/checkstl.o: lib/checkstl.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checknullpointer.h lib/checkstl.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/pathanalysis.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkstl.cpp
$(libcppdir)/checkstring.o: lib/checkstring.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkstring.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkstring.cpp
$(libcppdir)/checktype.o: lib/checktype.cpp lib/addoninfo.h lib/check.h lib/checktype.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checktype.cpp
$(libcppdir)/checkuninitvar.o: lib/checkuninitvar.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checknullpointer.h lib/checkuninitvar.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkuninitvar.cpp
$(libcppdir)/checkunusedfunctions.o: lib/checkunusedfunctions.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/astutils.h lib/check.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkunusedfunctions.cpp
$(libcppdir)/checkunusedvar.o: lib/checkunusedvar.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/astutils.h lib/check.h lib/checkunusedvar.h lib/config.h lib/errortypes.h lib/fwdanalysis.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkunusedvar.cpp
$(libcppdir)/checkvaarg.o: lib/checkvaarg.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/checkvaarg.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/checkvaarg.cpp
$(libcppdir)/clangimport.o: lib/clangimport.cpp lib/addoninfo.h lib/clangimport.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/clangimport.cpp
$(libcppdir)/color.o: lib/color.cpp lib/color.h lib/config.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/color.cpp
$(libcppdir)/cppcheck.o: lib/cppcheck.cpp externals/picojson/picojson.h externals/simplecpp/simplecpp.h externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/checkunusedfunctions.h lib/clangimport.h lib/color.h lib/config.h lib/cppcheck.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/json.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/version.h lib/vfvalue.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/cppcheck.cpp
$(libcppdir)/ctu.o: lib/ctu.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/astutils.h lib/check.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/ctu.cpp
$(libcppdir)/errorlogger.o: lib/errorlogger.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/utils.h lib/vfvalue.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/errorlogger.cpp
$(libcppdir)/errortypes.o: lib/errortypes.cpp lib/config.h lib/errortypes.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/errortypes.cpp
$(libcppdir)/forwardanalyzer.o: lib/forwardanalyzer.cpp lib/addoninfo.h lib/analyzer.h lib/astutils.h lib/config.h lib/errortypes.h lib/forwardanalyzer.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/utils.h lib/valueptr.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/forwardanalyzer.cpp
$(libcppdir)/fwdanalysis.o: lib/fwdanalysis.cpp lib/astutils.h lib/config.h lib/errortypes.h lib/fwdanalysis.h lib/library.h lib/mathlib.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/fwdanalysis.cpp
$(libcppdir)/importproject.o: lib/importproject.cpp externals/picojson/picojson.h externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/config.h lib/errortypes.h lib/filesettings.h lib/importproject.h lib/json.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/importproject.cpp
$(libcppdir)/infer.o: lib/infer.cpp lib/calculate.h lib/config.h lib/errortypes.h lib/infer.h lib/mathlib.h lib/valueptr.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/infer.cpp
$(libcppdir)/keywords.o: lib/keywords.cpp lib/config.h lib/keywords.h lib/standards.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/keywords.cpp
$(libcppdir)/library.o: lib/library.cpp externals/tinyxml2/tinyxml2.h lib/astutils.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/vfvalue.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/library.cpp
$(libcppdir)/mathlib.o: lib/mathlib.cpp externals/simplecpp/simplecpp.h lib/config.h lib/errortypes.h lib/mathlib.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/mathlib.cpp
$(libcppdir)/path.o: lib/path.cpp externals/simplecpp/simplecpp.h lib/config.h lib/path.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/path.cpp
$(libcppdir)/pathanalysis.o: lib/pathanalysis.cpp lib/astutils.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/pathanalysis.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/pathanalysis.cpp
$(libcppdir)/pathmatch.o: lib/pathmatch.cpp lib/config.h lib/path.h lib/pathmatch.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/pathmatch.cpp
$(libcppdir)/platform.o: lib/platform.cpp externals/tinyxml2/tinyxml2.h lib/config.h lib/path.h lib/platform.h lib/standards.h lib/utils.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/platform.cpp
$(libcppdir)/preprocessor.o: lib/preprocessor.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/preprocessor.cpp
$(libcppdir)/programmemory.o: lib/programmemory.cpp lib/addoninfo.h lib/astutils.h lib/calculate.h lib/config.h lib/errortypes.h lib/infer.h lib/library.h lib/mathlib.h lib/platform.h lib/programmemory.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/utils.h lib/valueflow.h lib/valueptr.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/programmemory.cpp
$(libcppdir)/reverseanalyzer.o: lib/reverseanalyzer.cpp lib/addoninfo.h lib/analyzer.h lib/astutils.h lib/config.h lib/errortypes.h lib/forwardanalyzer.h lib/library.h lib/mathlib.h lib/platform.h lib/reverseanalyzer.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/utils.h lib/valueptr.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/reverseanalyzer.cpp
$(libcppdir)/settings.o: lib/settings.cpp externals/picojson/picojson.h lib/addoninfo.h lib/config.h lib/errortypes.h lib/json.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/summaries.h lib/suppressions.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/settings.cpp
$(libcppdir)/summaries.o: lib/summaries.cpp lib/addoninfo.h lib/analyzerinfo.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/summaries.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/summaries.cpp
$(libcppdir)/suppressions.o: lib/suppressions.cpp externals/tinyxml2/tinyxml2.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/mathlib.h lib/path.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h lib/xml.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/suppressions.cpp
$(libcppdir)/templatesimplifier.o: lib/templatesimplifier.cpp lib/addoninfo.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/templatesimplifier.cpp
$(libcppdir)/timer.o: lib/timer.cpp lib/config.h lib/timer.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/timer.cpp
$(libcppdir)/token.o: lib/token.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/astutils.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/tokenrange.h lib/utils.h lib/valueflow.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/token.cpp
$(libcppdir)/tokenlist.o: lib/tokenlist.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/astutils.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/keywords.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/tokenlist.cpp
$(libcppdir)/utils.o: lib/utils.cpp lib/config.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/utils.cpp
$(libcppdir)/vfvalue.o: lib/vfvalue.cpp lib/config.h lib/errortypes.h lib/mathlib.h lib/templatesimplifier.h lib/token.h lib/utils.h lib/vfvalue.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/vfvalue.cpp
cli/cmdlineparser.o: cli/cmdlineparser.cpp cli/cmdlinelogger.h cli/cmdlineparser.h cli/cppcheckexecutor.h cli/filelister.h externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/pathmatch.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h lib/xml.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/cmdlineparser.cpp
cli/cppcheckexecutor.o: cli/cppcheckexecutor.cpp cli/cmdlinelogger.h cli/cmdlineparser.h cli/cppcheckexecutor.h cli/cppcheckexecutorseh.h cli/cppcheckexecutorsig.h cli/executor.h cli/processexecutor.h cli/singleexecutor.h cli/threadexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/checkersreport.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/cppcheckexecutor.cpp
cli/cppcheckexecutorseh.o: cli/cppcheckexecutorseh.cpp cli/cppcheckexecutor.h cli/cppcheckexecutorseh.h lib/config.h lib/filesettings.h lib/platform.h lib/standards.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/cppcheckexecutorseh.cpp
cli/cppcheckexecutorsig.o: cli/cppcheckexecutorsig.cpp cli/cppcheckexecutor.h cli/cppcheckexecutorsig.h cli/stacktrace.h lib/config.h lib/filesettings.h lib/platform.h lib/standards.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/cppcheckexecutorsig.cpp
cli/executor.o: cli/executor.cpp cli/executor.h lib/addoninfo.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/executor.cpp
cli/filelister.o: cli/filelister.cpp cli/filelister.h lib/config.h lib/path.h lib/pathmatch.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/filelister.cpp
cli/main.o: cli/main.cpp cli/cppcheckexecutor.h lib/config.h lib/errortypes.h lib/filesettings.h lib/platform.h lib/standards.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/main.cpp
cli/processexecutor.o: cli/processexecutor.cpp cli/executor.h cli/processexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/processexecutor.cpp
cli/singleexecutor.o: cli/singleexecutor.cpp cli/executor.h cli/singleexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/singleexecutor.cpp
cli/stacktrace.o: cli/stacktrace.cpp cli/stacktrace.h lib/config.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/stacktrace.cpp
cli/threadexecutor.o: cli/threadexecutor.cpp cli/executor.h cli/threadexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h
$(CXX) ${INCLUDE_FOR_CLI} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ cli/threadexecutor.cpp
test/fixture.o: test/fixture.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h lib/xml.h test/fixture.h test/options.h test/redirect.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/fixture.cpp
test/helpers.o: test/helpers.cpp cli/filelister.h externals/simplecpp/simplecpp.h lib/addoninfo.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/pathmatch.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/helpers.cpp
test/main.o: test/main.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h test/options.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/main.cpp
test/options.o: test/options.cpp test/options.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/options.cpp
test/test64bit.o: test/test64bit.cpp lib/addoninfo.h lib/check.h lib/check64bit.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/test64bit.cpp
test/testanalyzerinformation.o: test/testanalyzerinformation.cpp lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testanalyzerinformation.cpp
test/testassert.o: test/testassert.cpp lib/addoninfo.h lib/check.h lib/checkassert.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testassert.cpp
test/testastutils.o: test/testastutils.cpp lib/addoninfo.h lib/astutils.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testastutils.cpp
test/testautovariables.o: test/testautovariables.cpp lib/addoninfo.h lib/check.h lib/checkautovariables.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testautovariables.cpp
test/testbool.o: test/testbool.cpp lib/addoninfo.h lib/check.h lib/checkbool.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testbool.cpp
test/testboost.o: test/testboost.cpp lib/addoninfo.h lib/check.h lib/checkboost.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testboost.cpp
test/testbufferoverrun.o: test/testbufferoverrun.cpp lib/addoninfo.h lib/check.h lib/checkbufferoverrun.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testbufferoverrun.cpp
test/testcharvar.o: test/testcharvar.cpp lib/addoninfo.h lib/check.h lib/checkother.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testcharvar.cpp
test/testcheck.o: test/testcheck.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testcheck.cpp
test/testclangimport.o: test/testclangimport.cpp lib/addoninfo.h lib/check.h lib/clangimport.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testclangimport.cpp
test/testclass.o: test/testclass.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testclass.cpp
test/testcmdlineparser.o: test/testcmdlineparser.cpp cli/cmdlinelogger.h cli/cmdlineparser.h cli/cppcheckexecutor.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testcmdlineparser.cpp
test/testcolor.o: test/testcolor.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testcolor.cpp
test/testcondition.o: test/testcondition.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/checkcondition.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testcondition.cpp
test/testconstructors.o: test/testconstructors.cpp lib/addoninfo.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testconstructors.cpp
test/testcppcheck.o: test/testcppcheck.cpp lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testcppcheck.cpp
test/testerrorlogger.o: test/testerrorlogger.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h lib/xml.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testerrorlogger.cpp
test/testexceptionsafety.o: test/testexceptionsafety.cpp lib/addoninfo.h lib/check.h lib/checkexceptionsafety.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testexceptionsafety.cpp
test/testfilelister.o: test/testfilelister.cpp cli/filelister.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/pathmatch.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testfilelister.cpp
test/testfunctions.o: test/testfunctions.cpp lib/addoninfo.h lib/check.h lib/checkfunctions.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testfunctions.cpp
test/testgarbage.o: test/testgarbage.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testgarbage.cpp
test/testimportproject.o: test/testimportproject.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h test/redirect.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testimportproject.cpp
test/testincompletestatement.o: test/testincompletestatement.cpp lib/addoninfo.h lib/check.h lib/checkother.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testincompletestatement.cpp
test/testinternal.o: test/testinternal.cpp lib/addoninfo.h lib/check.h lib/checkinternal.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testinternal.cpp
test/testio.o: test/testio.cpp lib/addoninfo.h lib/check.h lib/checkio.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testio.cpp
test/testleakautovar.o: test/testleakautovar.cpp lib/addoninfo.h lib/check.h lib/checkleakautovar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testleakautovar.cpp
test/testlibrary.o: test/testlibrary.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h lib/xml.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testlibrary.cpp
test/testmathlib.o: test/testmathlib.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testmathlib.cpp
test/testmemleak.o: test/testmemleak.cpp lib/addoninfo.h lib/check.h lib/checkmemoryleak.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testmemleak.cpp
test/testnullpointer.o: test/testnullpointer.cpp lib/addoninfo.h lib/check.h lib/checknullpointer.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testnullpointer.cpp
test/testoptions.o: test/testoptions.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h test/options.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testoptions.cpp
test/testother.o: test/testother.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/checkother.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testother.cpp
test/testpath.o: test/testpath.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testpath.cpp
test/testpathmatch.o: test/testpathmatch.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/pathmatch.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testpathmatch.cpp
test/testplatform.o: test/testplatform.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h lib/xml.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testplatform.cpp
test/testpostfixoperator.o: test/testpostfixoperator.cpp lib/addoninfo.h lib/check.h lib/checkpostfixoperator.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testpostfixoperator.cpp
test/testpreprocessor.o: test/testpreprocessor.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testpreprocessor.cpp
test/testprocessexecutor.o: test/testprocessexecutor.cpp cli/executor.h cli/processexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testprocessexecutor.cpp
test/testsettings.o: test/testsettings.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsettings.cpp
test/testsimplifytemplate.o: test/testsimplifytemplate.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsimplifytemplate.cpp
test/testsimplifytokens.o: test/testsimplifytokens.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsimplifytokens.cpp
test/testsimplifytypedef.o: test/testsimplifytypedef.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsimplifytypedef.cpp
test/testsimplifyusing.o: test/testsimplifyusing.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsimplifyusing.cpp
test/testsingleexecutor.o: test/testsingleexecutor.cpp cli/executor.h cli/singleexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsingleexecutor.cpp
test/testsizeof.o: test/testsizeof.cpp lib/addoninfo.h lib/check.h lib/checksizeof.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsizeof.cpp
test/teststl.o: test/teststl.cpp lib/addoninfo.h lib/check.h lib/checkstl.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/teststl.cpp
test/teststring.o: test/teststring.cpp lib/addoninfo.h lib/check.h lib/checkstring.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/teststring.cpp
test/testsummaries.o: test/testsummaries.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/summaries.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsummaries.cpp
test/testsuppressions.o: test/testsuppressions.cpp cli/cppcheckexecutor.h cli/executor.h cli/processexecutor.h cli/singleexecutor.h cli/threadexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsuppressions.cpp
test/testsymboldatabase.o: test/testsymboldatabase.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsymboldatabase.cpp
test/testthreadexecutor.o: test/testthreadexecutor.cpp cli/executor.h cli/threadexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testthreadexecutor.cpp
test/testtimer.o: test/testtimer.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testtimer.cpp
test/testtoken.o: test/testtoken.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testtoken.cpp
test/testtokenize.o: test/testtokenize.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testtokenize.cpp
test/testtokenlist.o: test/testtokenlist.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testtokenlist.cpp
test/testtokenrange.o: test/testtokenrange.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/tokenrange.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testtokenrange.cpp
test/testtype.o: test/testtype.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/checktype.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testtype.cpp
test/testuninitvar.o: test/testuninitvar.cpp lib/addoninfo.h lib/check.h lib/checkuninitvar.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testuninitvar.cpp
test/testunusedfunctions.o: test/testunusedfunctions.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testunusedfunctions.cpp
test/testunusedprivfunc.o: test/testunusedprivfunc.cpp lib/addoninfo.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testunusedprivfunc.cpp
test/testunusedvar.o: test/testunusedvar.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/checkunusedvar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testunusedvar.cpp
test/testutils.o: test/testutils.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testutils.cpp
test/testvaarg.o: test/testvaarg.cpp lib/addoninfo.h lib/check.h lib/checkvaarg.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testvaarg.cpp
test/testvalueflow.o: test/testvalueflow.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testvalueflow.cpp
test/testvarid.o: test/testvarid.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testvarid.cpp
externals/simplecpp/simplecpp.o: externals/simplecpp/simplecpp.cpp externals/simplecpp/simplecpp.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -w -c -o $@ externals/simplecpp/simplecpp.cpp
externals/tinyxml2/tinyxml2.o: externals/tinyxml2/tinyxml2.cpp externals/tinyxml2/tinyxml2.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -w -c -o $@ externals/tinyxml2/tinyxml2.cpp
tools/dmake.o: tools/dmake.cpp cli/filelister.h lib/config.h lib/pathmatch.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ tools/dmake.cpp
release: cppcheck
mkdir -p release/cppcheck
cp -r release_files/* release/cppcheck/
cp -r cfg release/cppcheck/
cp -r addons release/cppcheck/
cp -r platforms release/cppcheck/
cp cppcheck release/cppcheck/cppcheck
strip release/cppcheck/cppcheck
cp COPYING release/cppcheck/
cp AUTHORS release/cppcheck/
cp README-Amiga.md release/cppcheck/
lha -aeqr3 a cppcheck.lha release/
rm -rf release

View File

@ -1,37 +0,0 @@
# cppcheck
This is the port of cppcheck 2.8 to AmigaOS 4.
Cppcheck is a static analysis tool for C/C++ code. It provides unique code
analysis to detect bugs and focuses on detecting undefined behaviour and
dangerous coding constructs. The goal is to have very few false positives.
Cppcheck is designed to be able to analyze your C/C++ code even if it has
non-standard syntax (common in embedded projects).
### Installation
Extract the archive wherever you want and start using it. You might want
to add its folder at your system PATH, so that it can be accessed by
anywhere. Make sure that all the files that are contained in this archive
are available where you have the executable.
The simplest way to use it is by running it in a shell like
```bash
cppcheck Work:program/src
```
Please, read the manual on different ways to use it. There are many
different options to make it work better and faster for you.
### Support
If you like what I am doing and my ports and you would like to support me,
and my future releases please visit https://ko-fi.com/walkero where you
can find all the latest updates by me and you can donate.
### Changelog
2.8r1 (2022-09-22)
* First public release

View File

@ -4,54 +4,27 @@ Addons are scripts that analyses Cppcheck dump files to check compatibility with
## Supported addons ## Supported addons
+ [cert.py](https://github.com/danmar/cppcheck/blob/main/addons/cert.py)
Checks for compliance with the safe programming standard [CERT](http://www.cert.org/secure-coding/).
+ [misra.py](https://github.com/danmar/cppcheck/blob/main/addons/misra.py) + [misra.py](https://github.com/danmar/cppcheck/blob/main/addons/misra.py)
Used to verify compliance with MISRA C 2012 - a proprietary set of guidelines to avoid such questionable code, developed for embedded systems. Since this standard is proprietary, cppcheck does not display error text by specifying only the number of violated rules (for example, [c2012-21.3]). If you want to display full texts for violated rules, you will need to create a text file containing MISRA rules, which you will have to pass when calling the script with `--rule-texts` key. Some examples of rule texts files available in [tests directory](https://github.com/danmar/cppcheck/blob/main/addons/test/misra/). Used to verify compliance with MISRA C 2012 - a proprietary set of guidelines to avoid such questionable code, developed for embedded systems. Since this standard is proprietary, cppcheck does not display error text by specifying only the number of violated rules (for example, [c2012-21.3]). If you want to display full texts for violated rules, you will need to create a text file containing MISRA rules, which you will have to pass when calling the script with `--rule-texts` key. Some examples of rule texts files available in [tests directory](https://github.com/danmar/cppcheck/blob/main/addons/test/misra/).
+ [y2038.py](https://github.com/danmar/cppcheck/blob/main/addons/y2038.py) + [y2038.py](https://github.com/danmar/cppcheck/blob/main/addons/y2038.py)
Checks Linux system for [year 2038 problem](https://en.wikipedia.org/wiki/Year_2038_problem) safety. This required [modified environment](https://github.com/3adev/y2038). See complete description [here](https://github.com/danmar/cppcheck/blob/main/addons/doc/y2038.txt). Checks Linux system for [year 2038 problem](https://en.wikipedia.org/wiki/Year_2038_problem) safety. This required [modified environment](https://github.com/3adev/y2038). See complete description [here](https://github.com/danmar/cppcheck/blob/main/addons/doc/y2038.txt).
+ [threadsafety.py](https://github.com/danmar/cppcheck/blob/main/addons/threadsafety.py) + [threadsafety.py](https://github.com/danmar/cppcheck/blob/main/addons/threadsafety.py)
Analyse Cppcheck dump files to locate threadsafety issues like static local objects used by multiple threads. Analyse Cppcheck dump files to locate threadsafety issues like static local objects used by multiple threads.
+ [naming.py](https://github.com/danmar/cppcheck/blob/main/addons/naming.py)
Enforces naming conventions across the code.
+ [namingng.py](https://github.com/danmar/cppcheck/blob/main/addons/namingng.py)
Enforces naming conventions across the code. Enhanced version with support for type prefixes in variable and function names.
+ [findcasts.py](https://github.com/danmar/cppcheck/blob/main/addons/findcasts.py)
Locates casts in the code.
+ [misc.py](https://github.com/danmar/cppcheck/blob/main/addons/misc.py)
Performs miscellaneous checks.
### Other files
- doc
Additional files for documentation generation.
- tests
Contains various unit tests for the addons.
- cppcheck.py
Internal helper used by Cppcheck binary to run the addons.
- cppcheckdata.doxyfile
Configuration file for documentation generation.
- cppcheckdata.py
Helper class for reading Cppcheck dump files within an addon.
- misra_9.py
Implementation of the MISRA 9.x rules used by `misra` addon.
- naming.json
Example configuration for `namingng` addon.
- ROS_naming.json
Example configuration for the `namingng` addon enforcing the [ROS naming convention for C++ ](http://wiki.ros.org/CppStyleGuide#Files).
- runaddon.py
Internal helper used by Cppcheck binary to run the addons.
## Usage ## Usage
### Command line interface ### Command line interface
```bash ```bash
cppcheck --addon=misc src/test.c cppcheck --addon=cert --addon=y2038 src/test.c
``` ```
It is also possible to call scripts as follows: It is also possible to call scripts as follows:
```bash ```bash
cppcheck --dump --quiet src/test.c cppcheck --dump --quiet src/test.c
python misc.py src/test.c.dump python cert.py src/test.c.dump
python misra.py --rule-texts=~/misra_rules.txt src/test.c.dump python misra.py --rule-texts=~/misra_rules.txt src/test.c.dump
``` ```

440
addons/cert.py Executable file
View File

@ -0,0 +1,440 @@
#!/usr/bin/env python3
#
# Cert: Some extra CERT checkers
#
# Cppcheck itself handles many CERT rules. Cppcheck warns when there is undefined behaviour.
# CERT Homepage: https://www.cert.org/secure-coding/
#
# Example usage of this addon (scan a sourcefile main.cpp)
# cppcheck --dump main.cpp
# python cert.py main.cpp.dump
import argparse
import cppcheckdata
import sys
import re
VERIFY = ('-verify' in sys.argv)
VERIFY_EXPECTED = []
VERIFY_ACTUAL = []
def reportError(token, severity, msg, id):
if VERIFY:
VERIFY_ACTUAL.append(str(token.linenr) + ':cert-' + id)
else:
cppcheckdata.reportError(token, severity, msg, 'cert', id)
def simpleMatch(token, pattern):
return cppcheckdata.simpleMatch(token, pattern)
def isUnpackedStruct(token):
if token.valueType is None:
return False
if token.valueType.typeScope is None:
return False
if token.valueType.typeScope.type != "Struct":
return False
startToken = token.valueType.typeScope.bodyStart
linenr = int(startToken.linenr)
for line in open(startToken.file):
linenr -= 1
if linenr == 0:
return True
if linenr < 3 and re.match(r'#pragma\s+pack\s*\(', line):
return False
return True
def isLocalUnpackedStruct(arg):
if arg and arg.str == '&' and not arg.astOperand2:
arg = arg.astOperand1
return arg and arg.variable and (arg.variable.isLocal or arg.variable.isArgument) and isUnpackedStruct(arg)
def isBitwiseOp(token):
return token and (token.str in {'&', '|', '^'})
def isComparisonOp(token):
return token and (token.str in {'==', '!=', '>', '>=', '<', '<='})
def isCast(expr):
if not expr or expr.str != '(' or not expr.astOperand1 or expr.astOperand2:
return False
if simpleMatch(expr, '( )'):
return False
return True
def isStandardFunction(token):
if token.function:
return False
prev = token.previous
if prev:
if prev.str == '.':
return False
if prev.str == '::':
prevprev = prev.previous
if prevprev and not prevprev.str == 'std':
return False
return True
# Is this a function call
def isFunctionCall(token, function_names, number_of_arguments=None):
if not token.isName:
return False
if token.str not in function_names:
return False
if (token.next is None) or token.next.str != '(' or token.next != token.astParent:
return False
if number_of_arguments is None:
return True
return len(cppcheckdata.getArguments(token)) == number_of_arguments
# EXP05-C
# do not attempt to cast away const
def exp05(data):
# TODO Reuse code in misra rule 11.8
for token in data.tokenlist:
if isCast(token):
# C-style cast
if not token.valueType:
continue
if not token.astOperand1.valueType:
continue
if token.valueType.pointer == 0:
continue
if token.astOperand1.valueType.pointer == 0:
continue
const1 = token.valueType.constness
const2 = token.astOperand1.valueType.constness
if (const1 % 2) < (const2 % 2):
reportError(token, 'style', "Attempt to cast away const", 'EXP05-C')
elif token.str == '(' and token.astOperand1 and token.astOperand2 and token.astOperand1.function:
function = token.astOperand1.function
arguments = cppcheckdata.getArguments(token.previous)
if not arguments:
continue
for argnr, argvar in function.argument.items():
if argnr < 1 or argnr > len(arguments):
continue
if not argvar.isPointer:
continue
if (argvar.constness % 2) == 1: # data is const
continue
argtok = arguments[argnr - 1]
if not argtok.valueType:
continue
if argtok.valueType.pointer == 0:
continue
const2 = arguments[argnr - 1].valueType.constness
if (const2 % 2) == 1:
reportError(token, 'style', "Attempt to cast away const", 'EXP05-C')
# EXP42-C
# do not compare padding data
def exp42(data):
for token in data.tokenlist:
if token.str != '(' or not token.astOperand1 or token.astOperand1.str != 'memcmp':
continue
arg1 = None
arg2 = None
if token.astOperand2 and token.astOperand2.str == ',':
if token.astOperand2.astOperand1 and token.astOperand2.astOperand1.str == ',':
arg1 = token.astOperand2.astOperand1.astOperand1
arg2 = token.astOperand2.astOperand1.astOperand2
if isLocalUnpackedStruct(arg1) or isLocalUnpackedStruct(arg2):
reportError(
token, 'style', "Comparison of struct padding data " +
"(fix either by packing the struct using '#pragma pack' or by rewriting the comparison)", 'EXP42-C')
# EXP15-C
# Do not place a semicolon on the same line as an if, for or while statement
def exp15(data):
for scope in data.scopes:
if scope.type in ('If', 'For', 'While'):
token = scope.bodyStart.next
if token.str==';' and token.linenr==scope.bodyStart.linenr:
reportError(token, 'style', 'Do not place a semicolon on the same line as an IF, FOR or WHILE', 'EXP15-C')
# EXP46-C
# Do not use a bitwise operator with a Boolean-like operand
# int x = (a == b) & c;
def exp46(data):
for token in data.tokenlist:
if isBitwiseOp(token) and (isComparisonOp(token.astOperand1) or isComparisonOp(token.astOperand2)):
reportError(
token, 'style', 'Bitwise operator is used with a Boolean-like operand', 'EXP46-c')
# INT31-C
# Ensure that integer conversions do not result in lost or misinterpreted data
def int31(data, platform):
if not platform:
return
for token in data.tokenlist:
if not isCast(token):
continue
if not token.valueType or not token.astOperand1.values:
continue
bits = None
if token.valueType.type == 'char':
bits = platform.char_bit
elif token.valueType.type == 'short':
bits = platform.short_bit
elif token.valueType.type == 'int':
bits = platform.int_bit
elif token.valueType.type == 'long':
bits = platform.long_bit
elif token.valueType.type == 'long long':
bits = platform.long_long_bit
else:
continue
if token.valueType.sign == 'unsigned':
found = False
for value in token.astOperand1.values:
if value.intvalue and value.intvalue < 0:
found = True
reportError(
token,
'style',
'Ensure that integer conversions do not result in lost or misinterpreted data (casting ' + str(value.intvalue) + ' to unsigned ' + token.valueType.type + ')',
'INT31-c')
break
if found:
continue
if bits >= 64:
continue
minval = 0
maxval = 1
if token.valueType.sign == 'signed':
minval = -(1 << (bits - 1))
maxval = ((1 << (bits - 1)) - 1)
else:
minval = 0
maxval = ((1 << bits) - 1)
for value in token.astOperand1.values:
if value.intvalue and (value.intvalue < minval or value.intvalue > maxval):
destType = ''
if token.valueType.sign:
destType = token.valueType.sign + ' ' + token.valueType.type
else:
destType = token.valueType.type
reportError(
token,
'style',
'Ensure that integer conversions do not result in lost or misinterpreted data (casting ' + str(value.intvalue) + ' to ' + destType + ')',
'INT31-c')
break
# ENV33-C
# Do not call system()
def env33(data):
for token in data.tokenlist:
if isFunctionCall(token, ('system',), 1):
# Invalid syntax
if not token.next.astOperand2:
continue
# ENV33-C-EX1: It is permissible to call system() with a null
# pointer argument to determine the presence of a command processor
# for the system.
argValue = token.next.astOperand2.getValue(0)
if argValue and argValue.intvalue == 0 and argValue.isKnown():
continue
reportError(token, 'style', 'Do not call system()', 'ENV33-C')
# MSC24-C
# Do not use deprecated or obsolescent functions
def msc24(data):
for token in data.tokenlist:
if isFunctionCall(token, ('asctime',), 1):
reportError(token,'style','Do not use asctime() better use asctime_s()', 'MSC24-C')
elif isFunctionCall(token, ('atof',), 1):
reportError(token,'style','Do not use atof() better use strtod()', 'MSC24-C')
elif isFunctionCall(token, ('atoi',), 1):
reportError(token,'style','Do not use atoi() better use strtol()', 'MSC24-C')
elif isFunctionCall(token, ('atol',), 1):
reportError(token,'style','Do not use atol() better use strtol()', 'MSC24-C')
elif isFunctionCall(token, ('atoll',), 1):
reportError(token,'style','Do not use atoll() better use strtoll()', 'MSC24-C')
elif isFunctionCall(token, ('ctime',), 1):
reportError(token,'style','Do not use ctime() better use ctime_s()', 'MSC24-C')
elif isFunctionCall(token, ('fopen',), 2):
reportError(token,'style','Do not use fopen() better use fopen_s()', 'MSC24-C')
elif isFunctionCall(token, ('freopen',), 3):
reportError(token,'style','Do not use freopen() better use freopen_s()', 'MSC24-C')
elif isFunctionCall(token, ('rewind',), 1):
reportError(token,'style','Do not use rewind() better use fseek()', 'MSC24-C')
elif isFunctionCall(token, ('setbuf',), 2):
reportError(token,'style','Do not use setbuf() better use setvbuf()', 'MSC24-C')
# MSC30-C
# Do not use the rand() function for generating pseudorandom numbers
def msc30(data):
for token in data.tokenlist:
if simpleMatch(token, "rand ( )") and isStandardFunction(token):
reportError(token, 'style', 'Do not use the rand() function for generating pseudorandom numbers', 'MSC30-c')
# STR03-C
# Do not inadvertently truncate a string
def str03(data):
for token in data.tokenlist:
if not isFunctionCall(token, 'strncpy'):
continue
arguments = cppcheckdata.getArguments(token)
if len(arguments)!=3:
continue
if arguments[2].str=='(' and arguments[2].astOperand1.str=='sizeof':
reportError(token, 'style', 'Do not inadvertently truncate a string', 'STR03-C')
# STR05-C
# Use pointers to const when referring to string literals
def str05(data):
for token in data.tokenlist:
if token.isString:
parent = token.astParent
if parent is None:
continue
parentOp1 = parent.astOperand1
if parent.isAssignmentOp and parentOp1.valueType:
if (parentOp1.valueType.type in ('char', 'wchar_t')) and parentOp1.valueType.pointer and not parentOp1.valueType.constness:
reportError(parentOp1, 'style', 'Use pointers to const when referring to string literals', 'STR05-C')
# STR07-C
# Use the bounds-checking interfaces for string manipulation
def str07(data):
if data.standards.c=='c89' or data.standards.c=='c99':
return
for token in data.tokenlist:
if not isFunctionCall(token, ('strcpy', 'strcat')):
continue
args = cppcheckdata.getArguments(token)
if len(args)!=2:
continue
if args[1].isString:
continue
reportError(token, 'style', 'Use the bounds-checking interfaces %s_s()' % token.str, 'STR07-C')
# STR11-C
# Do not specify the bound of a character array initialized with a string literal
def str11(data):
for token in data.tokenlist:
if not token.isString:
continue
strlen = token.strlen
parent = token.astParent
if parent is None:
continue
parentOp1 = parent.astOperand1
if parentOp1 is None or parentOp1.str!='[':
continue
if not parent.isAssignmentOp:
continue
varToken = parentOp1.astOperand1
if varToken is None or not varToken.isName:
continue
if varToken.variable is None:
continue
if varToken != varToken.variable.nameToken:
continue
valueToken = parentOp1.astOperand2
if valueToken is None:
continue
if valueToken.isNumber and int(valueToken.str)==strlen:
reportError(valueToken, 'style', 'Do not specify the bound of a character array initialized with a string literal', 'STR11-C')
# API01-C
# Avoid laying out strings in memory directly before sensitive data
def api01(data):
for scope in data.scopes:
if scope.type!='Struct':
continue
token = scope.bodyStart
arrayFound=False
# loop through the complete struct
while token != scope.bodyEnd:
if token.isName and token.variable:
if token.variable.isArray:
arrayFound=True
elif arrayFound and not token.variable.isArray and not token.variable.isConst:
reportError(token, 'style', 'Avoid laying out strings in memory directly before sensitive data', 'API01-C')
# reset flags to report other positions in the same struct
arrayFound=False
token = token.next
def get_args():
parser = cppcheckdata.ArgumentParser()
parser.add_argument("-verify", help=argparse.SUPPRESS, action="store_true")
return parser.parse_args()
if __name__ == '__main__':
args = get_args()
if args.verify:
VERIFY = True
if not args.dumpfile:
if not args.quiet:
print("no input files.")
sys.exit(0)
for dumpfile in args.dumpfile:
if not args.quiet:
print('Checking %s...' % dumpfile)
data = cppcheckdata.CppcheckData(dumpfile)
if VERIFY:
VERIFY_ACTUAL = []
VERIFY_EXPECTED = []
for tok in data.rawTokens:
if tok.str.startswith('//') and 'TODO' not in tok.str:
for word in tok.str[2:].split(' '):
if re.match(r'cert-[A-Z][A-Z][A-Z][0-9][0-9].*',word):
VERIFY_EXPECTED.append(str(tok.linenr) + ':' + word)
for cfg in data.iterconfigurations():
if not args.quiet:
print('Checking %s, config %s...' % (dumpfile, cfg.name))
exp05(cfg)
exp42(cfg)
exp46(cfg)
exp15(cfg)
int31(cfg, data.platform)
str03(cfg)
str05(cfg)
str07(cfg)
str11(cfg)
env33(cfg)
msc24(cfg)
msc30(cfg)
api01(cfg)
if VERIFY:
for expected in VERIFY_EXPECTED:
if expected not in VERIFY_ACTUAL:
print('Expected but not seen: ' + expected)
sys.exit(1)
for actual in VERIFY_ACTUAL:
if actual not in VERIFY_EXPECTED:
print('Not expected: ' + actual)
sys.exit(1)
sys.exit(cppcheckdata.EXIT_CODE)

View File

@ -1,39 +0,0 @@
import cppcheckdata, sys, os
__checkers__ = []
def checker(f):
__checkers__.append(f)
return f
__errorid__ = ''
__addon_name__ = ''
def reportError(location, severity, message, errorId=None):
cppcheckdata.reportError(location, severity, message, __addon_name__, errorId or __errorid__)
def runcheckers():
# If there are no checkers then don't run
if len(__checkers__) == 0:
return
global __addon_name__
global __errorid__
addon = sys.argv[0]
parser = cppcheckdata.ArgumentParser()
args = parser.parse_args()
__addon_name__ = os.path.splitext(os.path.basename(addon))[0]
for dumpfile in args.dumpfile:
if not args.quiet:
print('Checking %s...' % dumpfile)
data = cppcheckdata.CppcheckData(dumpfile)
for cfg in data.iterconfigurations():
if not args.quiet:
print('Checking %s, config %s...' % (dumpfile, cfg.name))
for c in __checkers__:
__errorid__ = c.__name__
c(cfg, data)

File diff suppressed because it is too large Load Diff

View File

@ -3,30 +3,40 @@
# Locate casts in the code # Locate casts in the code
# #
import cppcheck import cppcheckdata
import sys
@cppcheck.checker for arg in sys.argv[1:]:
def cast(cfg, data): if arg.startswith('-'):
for token in cfg.tokenlist: continue
if token.str != '(' or not token.astOperand1 or token.astOperand2:
continue
# Is it a lambda? print('Checking %s...' % arg)
if token.astOperand1.str == '{': data = cppcheckdata.CppcheckData(arg)
continue
# we probably have a cast.. if there is something inside the parentheses for cfg in data.iterconfigurations():
# there is a cast. Otherwise this is a function call. print('Checking %s, config %s...' % (arg, cfg.name))
typetok = token.next for token in cfg.tokenlist:
if not typetok.isName: if token.str != '(' or not token.astOperand1 or token.astOperand2:
continue continue
# cast number => skip output # Is it a lambda?
if token.astOperand1.isNumber: if token.astOperand1.str == '{':
continue continue
# void cast => often used to suppress compiler warnings # we probably have a cast.. if there is something inside the parentheses
if typetok.str == 'void': # there is a cast. Otherwise this is a function call.
continue typetok = token.next
if not typetok.isName:
continue
cppcheck.reportError(token, 'information', 'found a cast') # cast number => skip output
if token.astOperand1.isNumber:
continue
# void cast => often used to suppress compiler warnings
if typetok.str == 'void':
continue
cppcheckdata.reportError(token, 'information', 'found a cast', 'findcasts', 'cast')
sys.exit(cppcheckdata.EXIT_CODE)

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,3 @@
import cppcheckdata
# Holds information about an array, struct or union's element definition. # Holds information about an array, struct or union's element definition.
class ElementDef: class ElementDef:
def __init__(self, elementType, name, valueType, dimensions = None): def __init__(self, elementType, name, valueType, dimensions = None):
@ -32,7 +30,7 @@ class ElementDef:
attrs = ["childIndex", "elementType", "valueType"] attrs = ["childIndex", "elementType", "valueType"]
return "{}({}, {}, {})".format( return "{}({}, {}, {})".format(
"ElementDef", "ED",
self.getLongName(), self.getLongName(),
inits, inits,
", ".join(("{}={}".format(a, repr(getattr(self, a))) for a in attrs)) ", ".join(("{}={}".format(a, repr(getattr(self, a))) for a in attrs))
@ -88,8 +86,8 @@ class ElementDef:
def getChildByIndex(self, index): def getChildByIndex(self, index):
if self.isFlexible: if self.isFlexible:
while len(self.children) <= index: while len(self.children) <= index:
createChild(self, self.flexibleToken, len(self.children), None) createChild(self, self.flexibleToken, len(self.children))
return self.children[index] if 0 <= index < len(self.children) else None return self.children[index] if index >= 0 and len(self.children) > index else None
def getChildByName(self, name): def getChildByName(self, name):
for c in self.children: for c in self.children:
@ -132,7 +130,7 @@ class ElementDef:
def getChildByValueElement(self, ed): def getChildByValueElement(self, ed):
potentialChild = ed potentialChild = ed
while potentialChild and potentialChild not in self.children: while potentialChild and not potentialChild in self.children:
potentialChild = potentialChild.parent potentialChild = potentialChild.parent
return self.children[self.children.index(potentialChild)] if potentialChild else None return self.children[self.children.index(potentialChild)] if potentialChild else None
@ -184,7 +182,7 @@ class ElementDef:
def isAllChildrenSet(self): def isAllChildrenSet(self):
myself = len(self.children) == 0 and (self.isDesignated or self.isPositional) myself = len(self.children) == 0 and (self.isDesignated or self.isPositional)
mychildren = len(self.children) > 0 and all([child.isAllChildrenSet() for child in self.children]) mychildren = len(self.children) > 0 and all([child.isAllChildrenSet() for child in self.children])
return myself or mychildren return myself or mychildren
def isAllSet(self): def isAllSet(self):
@ -199,9 +197,9 @@ class ElementDef:
def isMisra93Compliant(self): def isMisra93Compliant(self):
if self.elementType == 'array': if self.elementType == 'array':
result = self.isAllChildrenSet() or \ result = self.isAllChildrenSet() or \
((self.isAllSet() or ((self.isAllSet() or \
self.isOnlyDesignated()) and self.isOnlyDesignated()) and \
all([not (child.isDesignated or child.isPositional) or child.isMisra93Compliant() for child in self.children])) all([not (child.isDesignated or child.isPositional) or child.isMisra93Compliant() for child in self.children]))
return result return result
elif self.elementType == 'record': elif self.elementType == 'record':
result = all([child.isMisra93Compliant() for child in self.children]) result = all([child.isMisra93Compliant() for child in self.children])
@ -215,7 +213,7 @@ class ElementDef:
def isMisra95Compliant(self): def isMisra95Compliant(self):
return not self.isFlexible or all([not child.isDesignated for child in self.children]) return not self.isFlexible or all([not child.isDesignated for child in self.children])
# Parses the initializers and update the ElementDefs status accordingly # Parses the initializers and uodate the ElementDefs status accordingly
class InitializerParser: class InitializerParser:
def __init__(self): def __init__(self):
self.token = None self.token = None
@ -255,18 +253,8 @@ class InitializerParser:
isFirstElement = False isFirstElement = False
isDesignated = True isDesignated = True
elif self.token.isString and self.ed and self.ed.isArray:
self.ed.setInitialized(isDesignated)
if self.token == self.token.astParent.astOperand1 and self.token.astParent.astOperand2:
self.token = self.token.astParent.astOperand2
self.ed.markAsCurrent()
self.ed = self.root.getNextChild()
else:
self.unwindAndContinue()
continue
elif self.token.str == '{': elif self.token.str == '{':
nextChild = self.root.getNextChild() if self.root is not None else None nextChild = self.root.getNextChild()
if nextChild: if nextChild:
if nextChild.isArray or nextChild.isRecord: if nextChild.isArray or nextChild.isRecord:
@ -293,17 +281,16 @@ class InitializerParser:
# Fake dummy as nextChild (of current root) # Fake dummy as nextChild (of current root)
nextChild = dummyRoot nextChild = dummyRoot
if nextChild and self.token.astOperand1: if self.token.astOperand1:
self.root = nextChild self.root = nextChild
self.token = self.token.astOperand1 self.token = self.token.astOperand1
isFirstElement = True isFirstElement = True
else: else:
if self.root: # {}
# {} if self.root.name == '<-':
if self.root.name == '<-': self.root.parent.markStuctureViolation(self.token)
self.root.parent.markStuctureViolation(self.token) else:
else: self.root.markStuctureViolation(self.token)
self.root.markStuctureViolation(self.token)
self.ed = None self.ed = None
self.unwindAndContinue() self.unwindAndContinue()
@ -315,7 +302,7 @@ class InitializerParser:
if isFirstElement and self.token.str == '0' and self.token.next.str == '}': if isFirstElement and self.token.str == '0' and self.token.next.str == '}':
# Zero initializer causes recursive initialization # Zero initializer causes recursive initialization
self.root.initializeChildren() self.root.initializeChildren()
elif self.token.isString and self.ed.valueType and self.ed.valueType.pointer > 0: elif self.token.isString and self.ed.valueType.pointer > 0:
if self.ed.valueType.pointer - self.ed.getEffectiveLevel() == 1: if self.ed.valueType.pointer - self.ed.getEffectiveLevel() == 1:
if self.ed.parent != self.root: if self.ed.parent != self.root:
self.root.markStuctureViolation(self.token) self.root.markStuctureViolation(self.token)
@ -326,14 +313,12 @@ class InitializerParser:
else: else:
self.ed.parent.setInitialized(isDesignated) self.ed.parent.setInitialized(isDesignated)
self.ed.parent.initializeChildren() self.ed.parent.initializeChildren()
else: else:
if self.root is not None and self.ed.parent != self.root: if self.ed.parent != self.root:
# Check if token is correct value type for self.root.children[?] # Check if token is correct value type for self.root.children[?]
child = self.root.getChildByValueElement(self.ed) child = self.root.getChildByValueElement(self.ed)
if self.token.valueType: if child.elementType != 'record' or self.token.valueType.type != 'record' or child.valueType.typeScope != self.token.valueType.typeScope:
if child.elementType != 'record' or self.token.valueType.type != 'record' or child.valueType.typeScope != self.token.valueType.typeScope: self.root.markStuctureViolation(self.token)
self.root.markStuctureViolation(self.token)
self.ed.setInitialized(isDesignated) self.ed.setInitialized(isDesignated)
@ -346,8 +331,6 @@ class InitializerParser:
parent = parent.parent parent = parent.parent
isDesignated = False isDesignated = False
if self.token.isString and self.ed.parent.isArray:
self.ed = self.ed.parent
self.unwindAndContinue() self.unwindAndContinue()
def pushToRootStackAndMarkAsDesignated(self): def pushToRootStackAndMarkAsDesignated(self):
@ -396,11 +379,10 @@ class InitializerParser:
break break
def misra_9_x(self, data, rule, rawTokens = None): def misra_9_x(self, data, rule, rawTokens = None):
parser = InitializerParser() parser = InitializerParser()
for variable in data.variables: for variable in data.variables:
if variable.nameToken is None: if not variable.nameToken:
continue continue
nameToken = variable.nameToken nameToken = variable.nameToken
@ -421,23 +403,11 @@ def misra_9_x(self, data, rule, rawTokens = None):
if variable.isArray or variable.isClass: if variable.isArray or variable.isClass:
ed = getElementDef(nameToken, rawTokens) ed = getElementDef(nameToken, rawTokens)
# No need to check non-arrays if valueType is missing,
# since we can't say anything useful about the structure
# without it.
if ed.valueType is None and not variable.isArray:
continue
parser.parseInitializer(ed, eq.astOperand2) parser.parseInitializer(ed, eq.astOperand2)
# print(rule, nameToken.str + '=', ed.getInitDump()) # print(rule, nameToken.str + '=', ed.getInitDump())
if rule == 902 and not ed.isMisra92Compliant(): if rule == 902 and not ed.isMisra92Compliant():
self.reportError(nameToken, 9, 2) self.reportError(nameToken, 9, 2)
if rule == 903 and not ed.isMisra93Compliant(): if rule == 903 and not ed.isMisra93Compliant():
# Do not check when variable is pointer type
type_token = variable.nameToken
while type_token and type_token.isName:
type_token = type_token.previous
if type_token and type_token.str == '*':
continue
self.reportError(nameToken, 9, 3) self.reportError(nameToken, 9, 3)
if rule == 904 and not ed.isMisra94Compliant(): if rule == 904 and not ed.isMisra94Compliant():
self.reportError(nameToken, 9, 4) self.reportError(nameToken, 9, 4)
@ -447,82 +417,50 @@ def misra_9_x(self, data, rule, rawTokens = None):
def getElementDef(nameToken, rawTokens = None): def getElementDef(nameToken, rawTokens = None):
if nameToken.variable.isArray: if nameToken.variable.isArray:
ed = ElementDef("array", nameToken.str, nameToken.valueType) ed = ElementDef("array", nameToken.str, nameToken.valueType)
createArrayChildrenDefs(ed, nameToken.astParent, nameToken.variable, rawTokens) createArrayChildrenDefs(ed, nameToken.astParent, rawTokens)
elif nameToken.variable.isClass: elif nameToken.variable.isClass:
ed = ElementDef("record", nameToken.str, nameToken.valueType) ed = ElementDef("record", nameToken.str, nameToken.valueType)
createRecordChildrenDefs(ed, nameToken.variable) createRecordChildrenDefs(ed)
else: else:
ed = ElementDef("value", nameToken.str, nameToken.valueType) ed = ElementDef("value", nameToken.str, nameToken.valueType)
return ed return ed
def createArrayChildrenDefs(ed, token, var, rawTokens = None): def createArrayChildrenDefs(ed, token, rawTokens = None):
if token and token.str == '[': if token.str == '[':
if rawTokens is not None: if rawTokens is not None:
foundToken = next((rawToken for rawToken in rawTokens foundToken = next(rawToken for rawToken in rawTokens if rawToken.file == token.file and rawToken.linenr == token.linenr and rawToken.column == token.column)
if rawToken.file == token.file
and rawToken.linenr == token.linenr
and rawToken.column == token.column
), None)
if foundToken and foundToken.next and foundToken.next.str == ']': if foundToken and foundToken.next and foundToken.next.str == ']':
ed.markAsFlexibleArray(token) ed.markAsFlexibleArray(token)
if (token.astOperand2 is not None) and (token.astOperand2.getKnownIntValue() is not None): if (token.astOperand2 is not None) and (token.astOperand2.getKnownIntValue() is not None):
for i in range(token.astOperand2.getKnownIntValue()): for i in range(token.astOperand2.getKnownIntValue()):
createChild(ed, token, i, var) createChild(ed, token, i)
else: else:
ed.markAsFlexibleArray(token) ed.markAsFlexibleArray(token)
def createChild(ed, token, name, var): def createChild(ed, token, name):
if token.astParent and token.astParent.str == '[': if token.astParent and token.astParent.str == '[':
child = ElementDef("array", name, ed.valueType) child = ElementDef("array", name, ed.valueType)
createArrayChildrenDefs(child, token.astParent, var) createArrayChildrenDefs(child, token.astParent)
else: else:
if ed.valueType and ed.valueType.type == "record": if ed.valueType and ed.valueType.type == "record":
child = ElementDef("record", name, ed.valueType) child = ElementDef("record", name, ed.valueType)
createRecordChildrenDefs(child, var) createRecordChildrenDefs(child)
else: else:
child = ElementDef("value", name, ed.valueType) child = ElementDef("value", name, ed.valueType)
ed.addChild(child) ed.addChild(child)
def createRecordChildrenDefs(ed, var): def createRecordChildrenDefs(ed):
valueType = ed.valueType valueType = ed.valueType
if not valueType or not valueType.typeScope: if not valueType or not valueType.typeScope:
return return
if var is None:
return
typeToken = var.typeEndToken
while typeToken and typeToken.isName:
typeToken = typeToken.previous
if typeToken and typeToken.str == '*':
child = ElementDef("pointer", var.nameToken, var.nameToken.valueType)
ed.addChild(child)
return
child_dict = {}
for variable in valueType.typeScope.varlist:
if variable is var:
continue
child = getElementDef(variable.nameToken)
child_dict[variable.nameToken] = child
for scopes in valueType.typeScope.nestedList:
varscope = False
if scopes.nestedIn == valueType.typeScope:
for variable in valueType.typeScope.varlist:
if variable.nameToken and variable.nameToken.valueType and variable.nameToken.valueType.typeScope == scopes:
varscope = True
break
if not varscope:
ed1 = ElementDef("record", scopes.Id, valueType)
for variable in scopes.varlist:
child = getElementDef(variable.nameToken)
ed1.addChild(child)
child_dict[scopes.bodyStart] = ed1
sorted_keys = sorted(list(child_dict.keys()), key=lambda k: "%s %s %s" % (k.file, k.linenr, k.column))
for _key in sorted_keys:
ed.addChild(child_dict[_key])
for variable in valueType.typeScope.varlist:
child = getElementDef(variable.nameToken)
ed.addChild(child)
def getElementByDesignator(ed, token): def getElementByDesignator(ed, token):
if not token.str in [ '.', '[' ]: if not token.str in [ '.', '[' ]:

View File

@ -81,7 +81,7 @@ for arg in sys.argv[1:]:
for scope in cfg.scopes: for scope in cfg.scopes:
if scope.type == 'Function': if scope.type == 'Function':
function = scope.function function = scope.function
if function is not None and function.type in ('Constructor', 'Destructor', 'CopyConstructor', 'MoveConstructor'): if function is not None and function.type in ('Constructor', 'Destructor'):
continue continue
res = re.match(RE_FUNCTIONNAME, scope.className) res = re.match(RE_FUNCTIONNAME, scope.className)
if not res: if not res:

View File

@ -182,7 +182,7 @@ def process(dumpfiles, configfile, debugprint=False):
if "RE_FUNCTIONNAME" in conf and conf["RE_FUNCTIONNAME"]: if "RE_FUNCTIONNAME" in conf and conf["RE_FUNCTIONNAME"]:
for token in cfg.tokenlist: for token in cfg.tokenlist:
if token.function: if token.function:
if token.function.type in ('Constructor', 'Destructor', 'CopyConstructor', 'MoveConstructor'): if token.function.type == 'Constructor' or token.function.type == 'Destructor':
continue continue
retval = token.previous.str retval = token.previous.str
prev = token.previous prev = token.previous

View File

@ -1,12 +0,0 @@
import cppcheckdata, cppcheck, runpy, sys, os
if __name__ == '__main__':
addon = sys.argv[1]
__addon_name__ = os.path.splitext(os.path.basename(addon))[0]
sys.argv.pop(0)
runpy.run_path(addon, run_name='__main__')
# Run registered checkers
cppcheck.runcheckers()
sys.exit(cppcheckdata.EXIT_CODE)

194
addons/test/cert-test.c Normal file
View File

@ -0,0 +1,194 @@
// To test:
// ~/cppcheck/cppcheck --dump cert-test.c && python ../cert.py -verify cert-test.c.dump
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
struct S {
short a;
short b;
};
#pragma pack()
struct PackedStruct {
short a;
short b;
};
void api01()
{
const size_t String_Size = 20;
struct bad_node_s
{
char name[String_Size];
struct bad_node_s* next; // cert-API01-C
};
struct good_node_s
{
struct good_node_s* next;
char name[String_Size];
};
struct also_good_node_s
{
struct also_good_node_s* next;
char *name;
};
}
void dostuff(int *data);
void exp05()
{
const int x = 42;
int y = (int)x;
int *p;
p = (int *)&x; // cert-EXP05-C
const int data[] = {1,2,3,4};
dostuff(data); // cert-EXP05-C
}
void print(const char *p);
void exp05_fp() {
print("hello");
}
void exp42()
{
struct S s1 = {1,2};
struct S s2 = {1,2};
memcmp(&s1, &s2, sizeof(struct S)); // cert-EXP42-C
struct PackedStruct s3 = {1,2};
struct PackedStruct s4 = {1,2};
memcmp(&s3, &s4, sizeof(struct S));
}
void exp46(int x, int y, int z)
{
if ((x == y) & z) {} // cert-EXP46-c
}
unsigned char int31(int x)
{
x = (unsigned char)1000; // cert-INT31-c
x = (signed char)0xff; // cert-INT31-c
x = (unsigned char)-1; // cert-INT31-c
x = (unsigned long long)-1; // cert-INT31-c
}
void env33()
{
system("chmod -x $(which chmod)"); // cert-ENV33-C
system(""); // cert-ENV33-C
system(NULL); // no-warning
system(0); // no-warning
const int *np = NULL;
system(np); // no-warning
int system;
}
void msc24()
{
struct S {
int x; int fopen;
};
struct S s;
time_t rawtime;
struct tm *timeinfo;
char buffer[256];
int i;
long int li;
long long int lli;
FILE *f;
s.fopen = 123;
f = fopen ("myfile.txt","w+"); //cert-MSC24-C
setbuf ( f , buffer ); //cert-MSC24-C
for ( i='A' ; i<='Z' ; i++)
fputc ( i, f);
rewind (f); //cert-MSC24-C
fclose (f);
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf ( "The current date/time is: %s", asctime (timeinfo) ); //cert-MSC24-C
float n = atof (buffer); //cert-MSC24-C
float m = sin (n*M_PI/180);
i = atoi (buffer); //cert-MSC24-C
li = atol(buffer); //cert-MSC24-C
lli = atoll(buffer); //cert-MSC24-C
time (&rawtime);
printf ("The current local time is: %s", ctime (&rawtime)); //cert-MSC24-C
freopen ("myfile.txt","w",stdout); //cert-MSC24-C
printf ("This sentence is redirected to a file.");
fclose (stdout);
}
void msc30()
{
unsigned int num = rand(); // cert-MSC30-c
int rand = 5;
int a = rand;
}
void exp15()
{
int x=5, y=7;
if(x==y); //cert-EXP15-C
{
printf("not working\n");
}
if(x)
;
}
void str03()
{
char *string_data=(char*)malloc(16);
char a[16];
int d;
strncpy(a, string_data, sizeof(a)); //cert-STR03-C
strncpy(a, string_data, 5); d=sizeof(int);
}
void str05()
{
int x=5, y=7;
if(x==y); //cert-EXP15-C
{
printf("not working\n");
}
if(x)
;
}
void str07(char *buf, const char *newBuf)
{
const char *str = "test";
strcat(buf,"bla");
strcat(buf, str); //cert-STR07-C
strcat(buf, newBuf); //cert-STR07-C
strcpy(buf, newBuf); //cert-STR07-C
}
void str11()
{
const char str[3]="abc"; //cert-STR11-C
const char *x[10]; x[3]="def";
}

26
addons/test/cert-test.cpp Normal file
View File

@ -0,0 +1,26 @@
// To test:
// ~/cppcheck/cppcheck --dump cert-test.cpp && python ../cert.py -verify cert-test.cpp.dump
#include <cstdlib>
class msc30TestClass {
public:
static int rand();
};
namespace exp05c {
using uint32 = std::uint32_t;
static const uint32 a = static_cast<uint32>(0xFFFFFFFF);
}
void msc30(msc30TestClass & testClass)
{
unsigned int num = rand(); // cert-MSC30-c
num = std::rand(); // cert-MSC30-c
num = msc30TestClass::rand();
num = unknownClass::rand();
num = testClass.rand();
num = unknownClass.rand();
int rand = 5;
int a = rand;
}

View File

@ -1,10 +0,0 @@
struct S {
uint32_t some[100];
};
void foo( void )
{
if (((S *)0x8000)->some[0] != 0U) { }
}

View File

@ -1,8 +0,0 @@
struct expression {
int nargs;
struct expression *args[3];
};
struct expression plvar = {0};

View File

@ -1,12 +0,0 @@
//#12267
extern uint32_t end;
//#define KEEP // if uncomment this then wont crash
KEEP static const int32_t ptr_to_end = &end;
void foo(void)
{
(void)ptr_to_end;
}

View File

@ -1,9 +0,0 @@
// #11793
typedef struct pfmlib_pmu {
int flags ;
int (*get_event_encoding[10])(void* this, pfmlib_event_desc_t* e);
} pfmlib_pmu_t ;
pfmlib_pmu_t sparc_ultra3_support = { .flags = 0 };

View File

@ -1,30 +0,0 @@
/* This is the representation of the expressions to determine the
plural form. */
struct expression
{
int nargs; /* Number of arguments. */
union
{
unsigned long int num; /* Number value for `num'. */
struct expression *args[3]; /* Up to three arguments. */
} val;
};
struct expression GERMANIC_PLURAL =
{
.nargs = 2,
.val =
{
.args =
{
[0] = (struct expression *) &plvar,
[1] = (struct expression *) &plone
}
}
};

View File

@ -1,11 +0,0 @@
struct ConDesDesc {
unsigned Order;
unsigned Import;
};
// cppcheck-suppress misra-config
static ConDesDesc ConDes[CD_TYPE_COUNT] = {
{ 0, 0 },
{ 0, 0 },
};

View File

@ -1,23 +0,0 @@
struct _boardcnf_ch {
// cppcheck-suppress misra-config
uint8_t ddr_density[CS_CNT];
uint64_t ca_swap;
};
struct _boardcnf {
uint16_t dqdm_dly_r;
// cppcheck-suppress misra-config
struct _boardcnf_ch ch[DRAM_CH_CNT];
};
static const struct _boardcnf boardcnfs[1] = {
{
0x0a0,
{
{ {0x02, 0x02}, 0x00345201 },
{ {0x02, 0x02}, 0x00302154 }
}
},
};

View File

@ -1,17 +0,0 @@
typedef struct _tGames
{
char magicdirname[10];
unsigned int expectedmask;
unsigned char pictureorder[3];
} tGames;
static const tGames games[1]={
{"Pawn", 1, {0,1,2}}
};

View File

@ -1,8 +0,0 @@
static const struct id3_frametype wordlist[] =
{
{0, "Encryption method registration"},
{1, "Popularimeter"},
};

View File

@ -1,10 +0,0 @@
struct three_d_filter_t {
char name[16];
double elem[2];
};
static three_d_filter_t base_filters[] = {
{"Identity", { 1.0, 0.0 } },
{"Echo", { 0.4, 0.0 } }
};

View File

@ -1,3 +0,0 @@
#line 3 "<stdout>"
typedef int8_t flex_int8_t;

View File

@ -1,18 +0,0 @@
union {
struct {
uint8_t a;
uint8_t b;
} a;
} bar;
struct foo {
uint8_t a;
union bar w;
uint8_t b;
};
struct foo asdf = {
0,
{{0,0}},
1
};

View File

@ -1,48 +0,0 @@
// Test with command:
// ./cppcheck --enable=information --enable=style --addon=misra --inline-suppr addons/test/misra/misra-ctu-*-test.c
#include "misra-ctu-test.h"
extern MISRA_2_3_A misra_2_3_a;
x = MISRA_2_5_OK_1;
// cppcheck-suppress misra-c2012-2.3
// cppcheck-suppress misra-c2012-5.6
typedef int MISRA_5_6_VIOLATION;
// cppcheck-suppress misra-c2012-5.7
struct misra_5_7_violation_t {
int x; // cppcheck-suppress unusedStructMember
};
static misra_5_7_violation_t misra_5_7_use_type_1;
// #11443 - FP
static struct
{ // no warning
uint16_t x; // cppcheck-suppress unusedStructMember
} misra_5_7_false_positive_1;
// cppcheck-suppress misra-c2012-8.4
// cppcheck-suppress misra-c2012-5.8
int misra_5_8_var1;
// cppcheck-suppress misra-c2012-8.4
// cppcheck-suppress misra-c2012-5.8
int misra_5_8_var2;
// cppcheck-suppress misra-c2012-5.8
static void misra_5_8_f(void) {}
// cppcheck-suppress misra-c2012-5.9
static int misra_5_9_count;
// cppcheck-suppress misra-c2012-5.9
static void misra_5_8_foo(void) {}
// cppcheck-suppress misra-c2012-8.5
extern int misra_8_5;
// cppcheck-suppress misra-c2012-8.4
// cppcheck-suppress misra-c2012-8.6
int32_t misra_8_6 = 1;
void misra_8_7_external(void) {}

View File

@ -1,58 +0,0 @@
// Test with command:
// ./cppcheck --enable=information --enable=style --addon=misra --inline-suppr addons/test/misra/misra-ctu-*-test.c
#include "misra-ctu-test.h"
extern MISRA_2_3_B misra_2_3_b;
x = MISRA_2_5_OK_2;
// cppcheck-suppress misra-c2012-5.6
typedef int MISRA_5_6_VIOLATION;
static MISRA_5_6_VIOLATION misra_5_6_x;
// cppcheck-suppress misra-c2012-5.7
struct misra_5_7_violation_t {
int x; // cppcheck-suppress unusedStructMember
};
static misra_5_7_violation_t misra_5_7_use_type_2;
// #11443 - FP
static struct
{ // no warning
uint16_t x; // cppcheck-suppress unusedStructMember
} misra_5_7_false_positive_2;
// cppcheck-suppress misra-c2012-5.8
static int misra_5_8_var1;
// cppcheck-suppress misra-c2012-8.4
// cppcheck-suppress misra-c2012-5.8
void misra_5_8_f(void) {
// cppcheck-suppress [misra-c2012-5.8, unusedVariable]
char misra_5_8_var2;
}
// cppcheck-suppress misra-c2012-5.9
static int misra_5_9_count;
// cppcheck-suppress misra-c2012-5.9
static void misra_5_8_foo(void) {}
// cppcheck-suppress misra-c2012-8.5
extern int misra_8_5;
// cppcheck-suppress misra-c2012-8.4
// cppcheck-suppress misra-c2012-8.6
int32_t misra_8_6 = 2;
// cppcheck-suppress misra-c2012-8.4
int32_t misra_8_6_1;
// cppcheck-suppress misra-c2012-8.7
// cppcheck-suppress misra-c2012-8.4
int32_t misra_8_6_1 = 2;
// cppcheck-suppress misra-c2012-8.4
// cppcheck-suppress misra-c2012-8.7
void misra_8_7(void) {}
static void misra_8_7_caller(void) {
misra_8_7();
misra_8_7_external();
}

View File

@ -1,21 +0,0 @@
typedef int MISRA_2_3_A;
typedef int MISRA_2_3_B;
typedef int MISRA_2_3_VIOLATION; // cppcheck-suppress misra-c2012-2.3
// cppcheck-suppress misra-c2012-2.4
struct misra_2_4_violation_t {
int x;
};
static inline void misra_5_9_exception(void) {}
void misra_8_7_external(void);
#define MISRA_2_5_OK_1 1
#define MISRA_2_5_OK_2 2
// cppcheck-suppress misra-c2012-2.5
#define MISRA_2_5_VIOLATION 0

View File

@ -6,11 +6,11 @@
// If it is changed update suppressions.txt with the new line number // If it is changed update suppressions.txt with the new line number
#include <stdio.h> //21.6 #include <stdio.h> //21.6
extern int misra_5_2_var_hides_var______31x;//8.4 extern int misra_5_2_var_hides_var______31x;
static int misra_5_2_var_hides_var______31y;//5.2 static int misra_5_2_var_hides_var______31y;//5.2
static int misra_5_2_function_hides_var_31x; static int misra_5_2_function_hides_var_31x;
static void misra_5_2_function_hides_var_31y(void) {}//5.2 void misra_5_2_function_hides_var_31y(void) {}//5.2
static void foo(void) void foo(void)
{ {
int i; int i;
switch(misra_5_2_func1()) //16.4 16.6 switch(misra_5_2_func1()) //16.4 16.6
@ -21,13 +21,13 @@ static void foo(void)
{ {
for(i = 0; i < 10; i++) for(i = 0; i < 10; i++)
{ {
if(misra_5_2_func3()) //17.3 if(misra_5_2_func3()) //14.4
{ {
int misra_5_2_var_hides_var_1____31x; int misra_5_2_var_hides_var_1____31x;
int misra_5_2_var_hides_var_1____31y;//5.2 int misra_5_2_var_hides_var_1____31y;//5.2
} }
} }
} while(misra_5_2_func2()); //17.3 } while(misra_5_2_func2()); //14.4
} }
} }
} }

View File

@ -10,10 +10,5 @@ struct misra_5_2_field_hides_field__63y { //5.2
int misra_5_2_field_hides_field1_31x; int misra_5_2_field_hides_field1_31x;
int misra_5_2_field_hides_field1_31y;//5.2 int misra_5_2_field_hides_field1_31y;//5.2
}; };
const char *s41_1 = "\x41g"; // 4.1 8.4 const char *s41_1 = "\x41g"; // 4.1
const char *s41_2 = "\x41\x42"; // 8.4 const char *s41_2 = "\x41\x42";
// cppcheck-suppress misra-c2012-5.7
struct misra_5_7_violation_t {
int x;
};

View File

@ -1,29 +0,0 @@
// To test:
// ~/cppcheck/cppcheck--dump -DDUMMY --suppress=uninitvar misra/misra-test-avr8.c --std=c89 --platform=avr8 && python3 ../misra.py -verify misra/misra-test-avr8.c.dump
static void misra_10_4(void)
{
// #10480
const char buf1[1] = {a};
const char c = '0';
x = buf1[0] - c;
const char buf2[2] = {x,y};
x = 'a' == buf2[0]; // no-warning
typedef struct {
int t;
char buf[2];
} foo_t;
const foo_t cmd = {0};
x = 'b' == cmd.buf[0]; // no-warning
const foo_t * pcmd = &cmd;
x='c' == pcmd->buf[0]; // no-warning
(void)cmd.t;
}
static void misra_12_2(void) {
a = (((uint64_t)0xFF) << 32);
}

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
class C { class C {
int a; int a;
int b; int b;
C(void) : a(1), b(1) { c; } C() : a(1), b(1) { c; }
}; };
class misra_21_1_C { class misra_21_1_C {
@ -12,13 +12,13 @@ class misra_21_1_C {
class C2 { class C2 {
public: public:
C2(void); C2();
private: private:
void* f; void* f;
}; };
C2::C2(void) : f(NULL) {} C2::C2() : f(NULL) {}
static void test_misra_21_1_crash(void) static bool test_misra_21_1_crash()
{ {
auto misra_21_1_C a, b; // 12.3 auto misra_21_1_C a, b; // 12.3
a = b; a = b;

View File

@ -1,7 +1,4 @@
#ifndef MISRA_TEST_H #ifndef MISRA_TEST_H
#define MISRA_TEST_H #define MISRA_TEST_H
struct misra_h_s { int foo; }; struct misra_h_s { int foo; };
bool test(char *a); // OK
int misra_8_2_no_fp(int a);
void misra_8_4_bar(void);
#endif // MISRA_TEST_H #endif // MISRA_TEST_H

View File

@ -1,9 +1,7 @@
misra-c2012-21.6:*/misra-suppressions1-test.c:7 misra-c2012-21.6:*/misra-suppressions1-test.c:7
misra-c2012-17.3 misra-c2012-14.4
misra-c2012-5.2 misra-c2012-5.2
misra-c2012-8.4:*/misra-suppressions1-test.c
misra-c2012-16.4:*/misra-suppressions1-test.c misra-c2012-16.4:*/misra-suppressions1-test.c
misra-c2012-16.6:*/misra-suppressions1-test.c misra-c2012-16.6:*/misra-suppressions1-test.c
misra-c2012-4.1:*/misra-suppressions2-test.c misra-c2012-4.1:*/misra-suppressions2-test.c
misra-c2012-8.4:*/misra-suppressions2-test.c
misra-c2012-19.2:*/misra-suppressions2-test.c misra-c2012-19.2:*/misra-suppressions2-test.c

View File

@ -1,5 +1,5 @@
// To test: // To test:
// ~/cppcheck/cppcheck --dump naming_test.c && python ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump // ~/cppcheck/cppcheck --dump naming_test.c && python ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump
// Should not crash when there is no name // Should not crash when there is no name
void func(int number, int); void func(int number, int);

View File

@ -1,11 +1,9 @@
// To test: // To test:
// ~/cppcheck/cppcheck --dump naming_test.cpp && python ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump // ~/cppcheck/cppcheck --dump naming_test.cpp && python ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump
// No error for mismatching Constructor/Destructor names should be issued, they can not be changed. // No error for mismatching Constructor/Destructor names should be issued, they can not be changed.
class TestClass1 class TestClass1
{ {
TestClass1() {} TestClass1() {}
~TestClass1() {} ~TestClass1() {}
TestClass1(const TestClass1 &) {} };
TestClass1(TestClass1 &&) {}
};

35
addons/test/test-cert.py Normal file
View File

@ -0,0 +1,35 @@
# Running the test with Python 2:
# Be sure to install pytest version 4.6.4 (newer should also work)
# Command in cppcheck directory:
# python -m pytest addons/test/test-cert.py
#
# Running the test with Python 3:
# Command in cppcheck directory:
# PYTHONPATH=./addons python3 -m pytest addons/test/test-cert.py
import sys
import pytest
def test_arguments_regression():
args_ok = ["-q", "--quiet",
"-verify",
"--cli"]
# Arguments with expected SystemExit
args_exit = ["--non-exists", "--non-exists-param=42", "-h", "--help"]
from addons.cert import get_args
for arg in args_exit:
sys.argv.append(arg)
with pytest.raises(SystemExit):
get_args()
sys.argv.remove(arg)
for arg in args_ok:
sys.argv.append(arg)
try:
get_args()
except SystemExit:
pytest.fail("Unexpected SystemExit with '%s'" % arg)
sys.argv.remove(arg)

View File

@ -7,11 +7,9 @@
# Command in cppcheck directory: # Command in cppcheck directory:
# PYTHONPATH=./addons python3 -m pytest addons/test/test-misra.py # PYTHONPATH=./addons python3 -m pytest addons/test/test-misra.py
import os
import pytest import pytest
import re import re
import sys import sys
import tempfile
from .util import dump_create, dump_remove, convert_json_output from .util import dump_create, dump_remove, convert_json_output
@ -19,32 +17,24 @@ from .util import dump_create, dump_remove, convert_json_output
TEST_SOURCE_FILES = ['./addons/test/misra/misra-test.c'] TEST_SOURCE_FILES = ['./addons/test/misra/misra-test.c']
def remove_misra_config(s:str): def setup_module(module):
ret = '' for f in TEST_SOURCE_FILES:
for line in s.splitlines(): dump_create(f)
if '[misra-config]' not in line:
ret += line + '\n'
return ret def teardown_module(module):
for f in TEST_SOURCE_FILES:
dump_remove(f)
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def checker(): def checker():
from addons.misra import MisraChecker, MisraSettings, get_args_parser from addons.misra import MisraChecker, MisraSettings, get_args
parser = get_args_parser() args = get_args()
args = parser.parse_args([])
settings = MisraSettings(args) settings = MisraSettings(args)
return MisraChecker(settings) return MisraChecker(settings)
@pytest.fixture
def test_files():
for f in TEST_SOURCE_FILES:
dump_create(f)
yield
for f in TEST_SOURCE_FILES:
dump_remove(f)
def test_loadRuleTexts_structure(checker): def test_loadRuleTexts_structure(checker):
checker.loadRuleTexts("./addons/test/misra/misra_rules_structure.txt") checker.loadRuleTexts("./addons/test/misra/misra_rules_structure.txt")
assert(checker.ruleTexts.get(101, None) is None) assert(checker.ruleTexts.get(101, None) is None)
@ -84,7 +74,7 @@ def test_rules_misra_severity(checker):
assert(checker.ruleTexts[2104].misra_severity == '') assert(checker.ruleTexts[2104].misra_severity == '')
def test_json_out(checker, capsys, test_files): def test_json_out(checker, capsys):
sys.argv.append("--cli") sys.argv.append("--cli")
checker.loadRuleTexts("./addons/test/misra/misra_rules_dummy.txt") checker.loadRuleTexts("./addons/test/misra/misra_rules_dummy.txt")
checker.parseDump("./addons/test/misra/misra-test.c.dump") checker.parseDump("./addons/test/misra/misra-test.c.dump")
@ -97,20 +87,20 @@ def test_json_out(checker, capsys, test_files):
assert("Advisory" in json_output['c2012-20.1'][0]['extra']) assert("Advisory" in json_output['c2012-20.1'][0]['extra'])
def test_rules_cppcheck_severity(checker, capsys, test_files): def test_rules_cppcheck_severity(checker, capsys):
checker.loadRuleTexts("./addons/test/misra/misra_rules_dummy.txt") checker.loadRuleTexts("./addons/test/misra/misra_rules_dummy.txt")
checker.parseDump("./addons/test/misra/misra-test.c.dump") checker.parseDump("./addons/test/misra/misra-test.c.dump")
captured = capsys.readouterr().err captured = capsys.readouterr().err
assert("(error)" not in remove_misra_config(captured)) assert("(error)" not in captured)
assert("(warning)" not in captured) assert("(warning)" not in captured)
assert("(style)" in captured) assert("(style)" in captured)
def test_rules_cppcheck_severity_custom(checker, capsys, test_files): def test_rules_cppcheck_severity_custom(checker, capsys):
checker.loadRuleTexts("./addons/test/misra/misra_rules_dummy.txt") checker.loadRuleTexts("./addons/test/misra/misra_rules_dummy.txt")
checker.setSeverity("custom-severity") checker.setSeverity("custom-severity")
checker.parseDump("./addons/test/misra/misra-test.c.dump") checker.parseDump("./addons/test/misra/misra-test.c.dump")
captured = capsys.readouterr().err captured = capsys.readouterr().err
assert("(error)" not in remove_misra_config(captured)) assert("(error)" not in captured)
assert("(warning)" not in captured) assert("(warning)" not in captured)
assert("(style)" not in captured) assert("(style)" not in captured)
assert("(custom-severity)" in captured) assert("(custom-severity)" in captured)
@ -129,6 +119,7 @@ def test_rules_suppression(checker, capsys):
assert found is None, 'Unexptected output:\n' + captured assert found is None, 'Unexptected output:\n' + captured
dump_remove(src) dump_remove(src)
def test_arguments_regression(): def test_arguments_regression():
args_ok = ["-generate-table", args_ok = ["-generate-table",
"--rule-texts=./addons/test/assets/misra_rules_multiple_lines.txt", "--rule-texts=./addons/test/assets/misra_rules_multiple_lines.txt",
@ -144,34 +135,18 @@ def test_arguments_regression():
# Arguments with expected SystemExit # Arguments with expected SystemExit
args_exit = ["--non-exists", "--non-exists-param=42", "-h", "--help"] args_exit = ["--non-exists", "--non-exists-param=42", "-h", "--help"]
from addons.misra import get_args_parser from addons.misra import get_args
# sys.argv contains all pytest arguments - so clear all existing arguments first and restore afterwards for arg in args_exit:
sys_argv_old = sys.argv sys.argv.append(arg)
sys.argv = [sys.argv[0]] with pytest.raises(SystemExit):
get_args()
sys.argv.remove(arg)
try: for arg in args_ok:
for arg in args_exit: sys.argv.append(arg)
sys.argv.append(arg) try:
with pytest.raises(SystemExit): get_args()
parser = get_args_parser() except SystemExit:
parser.parse_args() pytest.fail("Unexpected SystemExit with '%s'" % arg)
sys.argv.remove(arg) sys.argv.remove(arg)
for arg in args_ok:
sys.argv.append(arg)
try:
parser = get_args_parser()
parser.parse_args()
except SystemExit:
pytest.fail("Unexpected SystemExit with '%s'" % arg)
sys.argv.remove(arg)
finally:
sys.argv = sys_argv_old
def test_read_ctu_info_line(checker):
assert checker.read_ctu_info_line('{') is None
assert checker.read_ctu_info_line('{"summary":"123"}') is None
assert checker.read_ctu_info_line('{"data":123}') is None
assert checker.read_ctu_info_line('{"summary":"123","data":123}') is not None

View File

@ -113,27 +113,18 @@ def test_arguments_regression():
# Arguments with expected SystemExit # Arguments with expected SystemExit
args_exit = ["--non-exists", "--non-exists-param=42", "-h", "--help"] args_exit = ["--non-exists", "--non-exists-param=42", "-h", "--help"]
from addons.y2038 import get_args_parser from addons.y2038 import get_args
# sys.argv contains all pytest arguments - so clear all existing arguments first and restore afterwards for arg in args_exit:
sys_argv_old = sys.argv sys.argv.append(arg)
sys.argv = [sys.argv[0]] with pytest.raises(SystemExit):
get_args()
sys.argv.remove(arg)
try: for arg in args_ok:
for arg in args_exit: sys.argv.append(arg)
sys.argv.append(arg) try:
with pytest.raises(SystemExit): get_args()
parser = get_args_parser() except SystemExit:
parser.parse_args() pytest.fail("Unexpected SystemExit with '%s'" % arg)
sys.argv.remove(arg) sys.argv.remove(arg)
for arg in args_ok:
sys.argv.append(arg)
try:
parser = get_args_parser()
parser.parse_args()
except SystemExit:
pytest.fail("Unexpected SystemExit with '%s'" % arg)
sys.argv.remove(arg)
finally:
sys.argv = sys_argv_old

View File

@ -1,67 +0,0 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2023 Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This does not match the standard cppchek test code,
* because I haven't figured that out yet.
* This code does compile and run, and does demonstrate
* the issues that the threadsafety.py addon is supposed to find.
* It does not use threads !
*/
#include <stdio.h>
#include <time.h>
#include <string.h>
void threadsafety_static()
{
// cppcheck-suppress threadsafety-threadsafety
static unsigned int nCount = 0;
nCount++;
printf("%d\n", nCount);
}
void threadsafety_call()
{
time_t now = time(nullptr);
// cppcheck-suppress threadsafety-unsafe-call
printf("%s\n", ctime(&now));
}
// cppcheck --addon=threadsafety
// should *not* find any problems with this function.
void threadsafety_safecall()
{
char haystack[] = "alphabet";
char needle[] = "Alph";
char* found = strcasestr(haystack, needle);
printf("%s %sin %s\n", needle, found ? "" : "not ", haystack);
}
int main() {
threadsafety_static();
threadsafety_call();
threadsafety_safecall();
threadsafety_static();
return 0;
}

View File

@ -2,6 +2,5 @@ struct Dummy {
int x; int x;
}; };
void func() { void func() {
// cppcheck-suppress threadsafety-threadsafety static Dummy dummy;
static Dummy dummy;
} }

View File

@ -2,6 +2,5 @@ struct Dummy {
int x; int x;
}; };
void func() { void func() {
// cppcheck-suppress threadsafety-threadsafety-const
static const Dummy dummy; static const Dummy dummy;
} }

View File

@ -20,18 +20,16 @@ def find_cppcheck_binary():
def dump_create(fpath, *argv): def dump_create(fpath, *argv):
cppcheck_binary = find_cppcheck_binary() cppcheck_binary = find_cppcheck_binary()
cmd = [cppcheck_binary, "--dump", "-DDUMMY", "--quiet", fpath] + list(argv) cmd = [cppcheck_binary, "--dump", "--quiet", fpath] + list(argv)
p = subprocess.Popen(cmd) p = subprocess.Popen(cmd)
p.communicate() p.communicate()
if p.returncode != 0: if p.returncode != 0:
raise OSError("cppcheck returns error code: %d" % p.returncode) raise OSError("cppcheck returns error code: %d" % p.returncode)
p = subprocess.Popen(["sync"]) subprocess.Popen(["sync"])
p.communicate()
def dump_remove(fpath): def dump_remove(fpath):
p = subprocess.Popen(["rm", "-f", fpath + ".dump"]) subprocess.Popen(["rm", "-f", fpath + ".dump"])
p.communicate()
def convert_json_output(raw_json_strings): def convert_json_output(raw_json_strings):

View File

@ -1,350 +1,39 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" #
cppcheck addon for threadsafety detection. # This script analyses Cppcheck dump files to locate threadsafety issues
# - warn about static local objects
This script analyses Cppcheck dump files to locate threadsafety issues. #
It warns about
- static local objects
- MT-Unsafe symbols listed in the "Attributes" sections of man pages.
"""
import re
import sys
import cppcheckdata import cppcheckdata
import sys
# -------------------------------- def reportError(token, severity, msg, id):
# List of MT-Unsafe identifiers cppcheckdata.reportError(token, severity, msg, 'threadsafety', id)
# --------------------------------
# This is Work In Progress.
# Eventually it should contain all identifiers (types
# and functions) which are MT-Unsafe.
# The script tools/MT-Unsafe.py can help to re-generate this list.
# It reads a man-page tree and report identifiers marked as "MT-Unsafe"
# (see man 7 attributes for what this means), eg
# MT-Unsafe.py /usr/share/man/man3
id_MTunsafe_full = {
# MT-Unsafe types by definition
# 'pthread_t',
# Types marked MT-Unsafe
'const:env',
'const:hostid',
'const:mallopt',
'const:sigintr',
'race:LogMask',
'race:asctime',
'race:crypt',
'race:crypt_gensalt',
'race:cuserid/!string',
'race:dirstream',
'race:drand48',
'race:ecvt',
'race:exit',
'race:fcvt',
'race:fgetgrent',
'race:fgetpwent',
'race:fgetspent',
'race:fsent',
'race:getdate',
'race:getlogin',
'race:getopt',
'race:getspent',
'race:getspnam',
'race:grent',
'race:grgid',
'race:grnam',
'race:hostbyaddr',
'race:hostbyname',
'race:hostbyname2',
'race:hostent',
'race:hsearch',
'race:l64a',
'race:localeconv',
'race:mbrlen/!ps',
'race:mbrtowc/!ps',
'race:mbsnrtowcs/!ps',
'race:mbsrtowcs/!ps',
'race:mcheck',
'race:mntentbuf',
'race:netbyaddr',
'race:netbyname',
'race:netent',
'race:netgrent',
'race:protobyname',
'race:protobynumber',
'race:protoent',
'race:ptsname',
'race:pwent',
'race:pwnam',
'race:pwuid',
'race:qecvt',
'race:qfcvt',
'race:servbyname',
'race:servbyport',
'race:servent',
'race:sgetspent',
'race:signgam',
'race:stdin',
'race:stdout',
'race:streams',
'race:strerror',
'race:strsignal',
'race:strtok',
'race:tmbuf',
'race:tmpnam/!s',
'race:ttyent',
'race:ttyname',
'race:utent',
'race:wcrtomb/!ps',
'race:wcsnrtombs/!ps',
'race:wcsrtombs/!ps',
'sig:ALRM',
'sig:SIGCHLD/linux',
# APIs marked MT-Unsafe
'asctime',
'clearenv',
'ctime',
'cuserid',
'drand48',
'ecvt',
'encrypt',
'endfsent',
'endgrent',
'endhostent',
'endnetent',
'endnetgrent',
'endprotoent',
'endpwent',
'endservent',
'endspent',
'endttyent',
'endusershell',
'endutent',
'erand48',
'error_at_line',
'ether_aton',
'ether_ntoa',
'exit',
'fcloseall',
'fcvt',
'fgetgrent',
'fgetpwent',
'fgetspent',
'fts_children',
'fts_read',
'gamma',
'gammaf',
'gammal',
'getaliasbyname',
'getaliasent',
'getchar_unlocked',
'getdate',
'getfsent',
'getfsfile',
'getfsspec',
'getgrent',
'getgrent_r',
'getgrgid',
'getgrnam',
'gethostbyaddr',
'gethostbyname',
'gethostbyname2',
'gethostent',
'gethostent_r',
'getlogin',
'getlogin_r',
'getmntent',
'getnetbyaddr',
'getnetbyname',
'getnetent',
'getnetgrent',
'getnetgrent_r',
'getopt',
'getopt_long',
'getopt_long_only',
'getpass',
'getprotobyname',
'getprotobynumber',
'getprotoent',
'getpwent',
'getpwent_r',
'getpwnam',
'getpwuid',
'getrpcbyname',
'getrpcbynumber',
'getrpcent',
'getservbyname',
'getservbyport',
'getservent',
'getspent',
'getspent_r',
'getspnam',
'getttyent',
'getttynam',
'getusershell',
'getutent',
'getutid',
'getutline',
'getwchar_unlocked',
'glob',
'gmtime',
'hcreate',
'hdestroy',
'hsearch',
'innetgr',
'jrand48',
'l64a',
'lcong48',
'localeconv',
'localtime',
'login',
'login_tty',
'logout',
'logwtmp',
'lrand48',
'mallinfo',
'mallinfo2',
'mblen',
'mbrlen',
'mbrtowc',
'mbsnrtowcs',
'mbsrtowcs',
'mbtowc',
'mcheck',
'mcheck_check_all',
'mcheck_pedantic',
'mprobe',
'mrand48',
'mtrace',
'muntrace',
'nrand48',
'profil',
'ptsname',
'putchar_unlocked',
'putenv',
'pututline',
'putwchar_unlocked',
'pvalloc',
'qecvt',
'qfcvt',
'rcmd',
'rcmd_af',
're_comp',
're_exec',
'readdir',
'rexec',
'rexec_af',
'seed48',
'setenv',
'setfsent',
'setgrent',
'sethostent',
'sethostid',
'setkey',
'setlogmask',
'setnetent',
'setnetgrent',
'setprotoent',
'setpwent',
'setservent',
'setspent',
'setttyent',
'setusershell',
'setutent',
'sgetspent',
'siginterrupt',
'sleep',
'srand48',
'strerror',
'strsignal',
'strtok',
'tmpnam',
'ttyname',
'ttyslot',
'unsetenv',
'updwtmp',
'utmpname',
'valloc',
'wcrtomb',
'wcsnrtombs',
'wcsrtombs',
'wctomb',
'wordexp'
}
# From man 7 attributes
# the full token could be feature:function/condition - we just want function.
id_MTunsafe = [re.sub('^.*:', '', re.sub('/.*$', '', x))
for x in id_MTunsafe_full
]
def reportError(token, severity, msg, errid): # noqa: D103 def checkstatic(data):
cppcheckdata.reportError(token, severity, msg, 'threadsafety', errid)
def checkstatic(data): # noqa: D103
for var in data.variables: for var in data.variables:
if var.isStatic and var.isLocal: if var.isStatic and var.isLocal:
vartype = None type = None
if var.isClass: if var.isClass:
vartype = 'object' type = 'object'
else: else:
vartype = 'variable' type = 'variable'
if var.isConst: if var.isConst:
if data.standards.cpp == 'c++03': if data.standards.cpp == 'c++03':
reportError( reportError(var.typeStartToken, 'warning', 'Local constant static ' + type + ' \'' + var.nameToken.str + '\', dangerous if it is initialized in parallel threads', 'threadsafety-const')
var.typeStartToken,
'warning',
'Local constant static '
+ vartype + "'" + var.nameToken.str
+ "', dangerous if it is initialized"
+ ' in parallel threads',
'threadsafety-const')
else: else:
reportError(var.typeStartToken, 'warning', reportError(var.typeStartToken, 'warning', 'Local static ' + type + ': ' + var.nameToken.str, 'threadsafety')
'Local static ' + vartype + ': '
+ var.nameToken.str,
'threadsafety')
for arg in sys.argv[1:]:
if arg.startswith('-'):
continue
def check_MTunsafe(cfg): print('Checking %s...' % arg)
""" data = cppcheckdata.CppcheckData(arg)
Look for functions marked MT-unsafe in their man pages.
The MT-unsafe functions are listed in id_MTunsafe (and id_MTunsafe_full). for cfg in data.iterconfigurations():
That section of code can be regenerated by the external script MT-Unsafe.py print('Checking %s, config %s...' % (arg, cfg.name))
""" checkstatic(cfg)
for token in cfg.tokenlist:
if token.str in id_MTunsafe:
reportError(token, 'warning', token.str + ' is MT-unsafe',
'unsafe-call')
if __name__ == '__main__':
parser = cppcheckdata.ArgumentParser()
args = parser.parse_args()
quiet = args.quiet or args.cli
if not args.dumpfile:
if not args.quiet:
print('no input files.')
sys.exit(0)
for dumpfile in args.dumpfile:
# load XML from .dump file
data = cppcheckdata.CppcheckData(dumpfile)
for cfg in data.iterconfigurations():
if not args.quiet:
srcfile = data.files[0]
print('Checking %s, config %s...' % (srcfile, cfg.name))
check_MTunsafe(cfg)
checkstatic(cfg)
sys.exit(cppcheckdata.EXIT_CODE) sys.exit(cppcheckdata.EXIT_CODE)

View File

@ -9,13 +9,15 @@
# 3. Any Y2038-unsafe symbol when _USE_TIME_BITS64 is not defined. # 3. Any Y2038-unsafe symbol when _USE_TIME_BITS64 is not defined.
# #
# Example usage: # Example usage:
# $ cppcheck --addon=y2038 path-to-src/test.c # $ cppcheck --dump path-to-src/test.c
# $ y2038.py path-to-src/test.c.dump
# #
# y2038.py will walk the source tree for .dump files.
from __future__ import print_function from __future__ import print_function
import cppcheckdata import cppcheckdata
import sys import sys
import os
import re import re
@ -154,14 +156,22 @@ def check_y2038_safe(dumpfile, quiet=False):
# load XML from .dump file # load XML from .dump file
data = cppcheckdata.CppcheckData(dumpfile) data = cppcheckdata.CppcheckData(dumpfile)
srcfile = data.files[0] # Convert dump file path to source file in format generated by cppcheck.
# For example after the following call:
# cppcheck ./src/my-src.c --dump
# We got 'src/my-src.c' value for 'file' field in cppcheckdata.
srcfile = dumpfile.rstrip('.dump')
srcfile = os.path.expanduser(srcfile)
srcfile = os.path.normpath(srcfile)
# go through each configuration
for cfg in data.iterconfigurations(): for cfg in data.iterconfigurations():
if not quiet: if not quiet:
print('Checking %s, config %s...' % (srcfile, cfg.name)) print('Checking %s, config %s...' % (srcfile, cfg.name))
safe_ranges = [] safe_ranges = []
safe = -1 safe = -1
time_bits_defined = False time_bits_defined = False
srclinenr = 0 srclinenr = '0'
for directive in cfg.directives: for directive in cfg.directives:
# track source line number # track source line number
@ -216,17 +226,16 @@ def check_y2038_safe(dumpfile, quiet=False):
return y2038safe return y2038safe
def get_args_parser(): def get_args():
parser = cppcheckdata.ArgumentParser() parser = cppcheckdata.ArgumentParser()
return parser return parser.parse_args()
if __name__ == '__main__': if __name__ == '__main__':
parser = get_args_parser() args = get_args()
args = parser.parse_args()
exit_code = 0 exit_code = 0
quiet = args.quiet or args.cli quiet = not any((args.quiet, args.cli))
if not args.dumpfile: if not args.dumpfile:
if not args.quiet: if not args.quiet:
@ -234,7 +243,7 @@ if __name__ == '__main__':
sys.exit(0) sys.exit(0)
for dumpfile in args.dumpfile: for dumpfile in args.dumpfile:
if not quiet: if not args.quiet:
print('Checking ' + dumpfile + '...') print('Checking ' + dumpfile + '...')
check_y2038_safe(dumpfile, quiet) check_y2038_safe(dumpfile, quiet)

75
appveyor.yml Normal file
View File

@ -0,0 +1,75 @@
version: '{build}'
clone_depth: 10
matrix:
fast_finish: true
environment:
matrix:
- VisualStudioVersion: 12.0
platform: x64
configuration: Debug
vcvarsall_platform: x64
PlatformToolset: v120
cygwin_build: yes
MYQTDIR: C:\Qt\5.6\msvc2013_64
- VisualStudioVersion: 12.0
platform: x64
configuration: Release
vcvarsall_platform: x64
PlatformToolset: v120
# FIXME: These are disabled for now. They were broken by ae8653612802b41b70424ec9a5eefe8a1178f6d1
# - VisualStudioVersion: 14.0
# platform: x64
# configuration: Debug
# vcvarsall_platform: x64
# PlatformToolset: v140
# MYQTDIR: C:\Qt\5.11\msvc2015_64
# That platform causes frequent errors on appveyor due to an unknown infrastructure failure
# - VisualStudioVersion: 14.0
# platform: x64
# configuration: Release
# vcvarsall_platform: x64
# PlatformToolset: v140
install:
- python -m pip install --user pip --upgrade
- python -m pip install --user pytest
- curl -fsSL https://github.com/Z3Prover/z3/releases/download/z3-4.8.9/z3-4.8.9-%platform%-win.zip -o z3-4.8.9-win.zip
- 7z x z3-4.8.9-win.zip -oexternals -r -y
- move externals\z3-4.8.9-%platform%-win externals\z3
build_script:
- ECHO Building %configuration% %platform% with MSVC %VisualStudioVersion% using %PlatformToolset% PlatformToolset
- 'CALL "C:\Program Files (x86)\Microsoft Visual Studio %VisualStudioVersion%\VC\vcvarsall.bat" %vcvarsall_platform%'
# Visual studio project..
- msbuild "cppcheck.sln" /consoleloggerparameters:Verbosity=minimal /target:Build /property:Configuration="%configuration%";Platform=%platform% /p:PlatformToolset=%PlatformToolset% /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
# the following builds are Debug ones so do not perform them in Release jobs
- 'IF "%configuration%" == "Release" exit /b 0'
# cmake..
- mkdir build
- cd build
- cmake -DBUILD_TESTS=ON -G"NMake Makefiles" ..
- nmake
- copy bin\cppcheck.exe ..
- cd ..
# build gui..
- ECHO MYQTDIR=%MYQTDIR%
- 'IF defined MYQTDIR cd gui'
- 'IF defined MYQTDIR set QTDIR=%MYQTDIR%'
- 'IF defined MYQTDIR set PATH=%PATH%;%QTDIR%\bin'
- 'IF defined MYQTDIR %QTDIR%\bin\qmake'
- 'IF defined MYQTDIR nmake'
- 'IF defined MYQTDIR cd ..'
test_script:
- build\bin\testrunner.exe -q
- IF EXIST bin\debug\testrunner.exe bin\debug\testrunner.exe -q
- IF EXIST bin\testrunner.exe bin\testrunner.exe -q
- cd test\cli
- python -m pytest test-helloworld.py
- python -m pytest test-inline-suppress.py
- python -m pytest test-proj2.py
- python -m pytest test-suppress-syntaxError.py
- 'IF defined cygwin_build C:\cygwin64\bin\bash -e -l -c "cd /cygdrive/c/projects/cppcheck && make clean && make -j 2 test checkcfg"'

22
benchmarks.txt Normal file
View File

@ -0,0 +1,22 @@
==========
Benchmarks
==========
In this file we can document some good code repos / code samples to use when working on optimisations.
Trac tickets
------------
http://trac.cppcheck.net/ticket/2435 -- Tokenizer::simplifyTypedef
http://trac.cppcheck.net/ticket/8355 -- TokenList::createAst
http://trac.cppcheck.net/ticket/9007 -- Unused types
Repos
-----
Small C++ library with lots of templates:
https://framagit.org/dtschump/CImg
Just check the file examples/use_tinymatwriter.cpp

View File

@ -1,76 +1,76 @@
PCRE is a library that is used by the optional "rules" feature for the command PCRE is a library that is used by the optional "rules" feature for the command
line version of cppcheck. It is readily available on Linux and Mac OS X, but line version of cppcheck. It is readily available on Linux and Mac OS X, but
must be obtained separately for Windows. must be obtained separately for Windows.
If you're using qmake to generate makefiles, the following behavior applies: If you're using qmake to generate makefiles, the following behavior applies:
- If you're not on Windows, it assumes by default that you have PCRE and want - If you're not on Windows, it assumes by default that you have PCRE and want
to enable rules support. You can disable rules support (removing the PCRE to enable rules support. You can disable rules support (removing the PCRE
dependency) by passing HAVE_RULES=no to qmake. dependency) by passing HAVE_RULES=no to qmake.
- If you are on Windows, but have PCRE available, you can enable rules support - If you are on Windows, but have PCRE available, you can enable rules support
by passing HAVE_RULES=yes to qmake. by passing HAVE_RULES=yes to qmake.
- Note: This includes using build.bat since it calls qmake - to use PCRE and - Note: This includes using build.bat since it calls qmake - to use PCRE and
build.bat, you need to run set HAVE_RULES=yes before each run of build.bat build.bat, you need to run set HAVE_RULES=yes before each run of build.bat
Build instructions Build instructions
------------------ ------------------
Windows Windows
------- -------
Visual Studio Visual Studio
To build PCRE, download the source code from www.pcre.org and To build PCRE, download the source code from www.pcre.org and
CMake (https://cmake.org/download/). We assume you use Visual Studio 2015 - CMake (https://cmake.org/download/). We assume you use Visual Studio 2015 -
otherwise adapt the commands for your version. otherwise adapt the commands for your version.
VS Solution file VS Solution file
cmake . -G "Visual Studio 14 2015" cmake . -G "Visual Studio 14 2015"
Open PCRE.sln with VS IDE or via cmd: Open PCRE.sln with VS IDE or via cmd:
call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86 call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86
MSBuild PCRE.sln /target:Build /property:Configuration="Release" MSBuild PCRE.sln /target:Build /property:Configuration="Release"
For 64-bit target: cmake . -G "Visual Studio 14 2015 Win64" For 64-bit target: cmake . -G "Visual Studio 14 2015 Win64"
or using NMake or using NMake
call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86 call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x86
cmake . -G "NMake Makefiles" cmake . -G "NMake Makefiles"
nmake nmake
or using MSYS or using MSYS
cmake . -G "MSYS Makefiles" cmake . -G "MSYS Makefiles"
make make
Linux Linux
----- -----
The normal Makefile should work. The normal Makefile should work.
Install PCRE on Ubuntu might be needed: Install PCRE on Ubuntu might be needed:
sudo apt-get install libpcre3 libpcre3-dev sudo apt-get install libpcre3 libpcre3-dev
Mac OSX Mac OSX
------- -------
Install PCRE: Install PCRE:
homebre homebre
brew install pcre brew install pcre
or macport or macport
sudo port install pcre sudo port install pcre
Ensure /path/to/pcre.h is in CXXFLAGS, e.g: Ensure /path/to/pcre.h is in CXXFLAGS, e.g:
for homebrew for homebrew
export CXXFLAGS=${CXXFLAGS}:/usr/local/include export CXXFLAGS=${CXXFLAGS}:/usr/local/include
or macport or macport
export CXXFLAGS=${CXXFLAGS}:/opt/local/include export CXXFLAGS=${CXXFLAGS}:/opt/local/include
Or for MSVC copy pcre.lib and pcre.h in /externals directory. Or for MSVC copy pcre.lib and pcre.h in /externals directory.

View File

@ -3,6 +3,8 @@
<def format="2"> <def format="2">
<!-- stdint.h --> <!-- stdint.h -->
<define name="__USING_MINT8" value="0"/> <define name="__USING_MINT8" value="0"/>
<define name="__CONCATenate(left, right)" value="left ## right"/>
<define name="__CONCAT(left, right)" value="__CONCATenate(left, right)"/>
<!-- Integer types capable of holding object pointers --> <!-- Integer types capable of holding object pointers -->
<podtype name="intptr_t" sign="s" size="2"/> <podtype name="intptr_t" sign="s" size="2"/>
<podtype name="uintptr_t" sign="u" size="2"/> <podtype name="uintptr_t" sign="u" size="2"/>
@ -84,8 +86,32 @@
<define name="SIG_ATOMIC_MAX" value="INT8_MAX"/> <define name="SIG_ATOMIC_MAX" value="INT8_MAX"/>
<define name="SIG_ATOMIC_MIN" value="INT8_MIN"/> <define name="SIG_ATOMIC_MIN" value="INT8_MIN"/>
<define name="SIZE_MAX" value="(__CONCAT(INT16_MAX, U))"/> <define name="SIZE_MAX" value="(__CONCAT(INT16_MAX, U))"/>
<!-- Macros for integer constants -->
<define name="INT8_C(value)" value="((int8_t) value)"/>
<define name="UINT8_C(value)" value="((uint8_t) __CONCAT(value, U))"/>
<define name="INT16_C(value)" value="value"/>
<define name="UINT16_C(value)" value="__CONCAT(value, U)"/>
<define name="INT32_C(value)" value="__CONCAT(value, L)"/>
<define name="UINT32_C(value)" value="__CONCAT(value, UL)"/>
<define name="INT64_C(value)" value="__CONCAT(value, LL)"/>
<define name="UINT64_C(value)" value="__CONCAT(value, ULL)"/>
<define name="INTMAX_C(value)" value="__CONCAT(value, LL)"/>
<define name="UINTMAX_C(value)" value="__CONCAT(value, ULL)"/>
<!-- FIXME: add macros for printf and scanf format specifiers,e.g. PRId8 --> <!-- FIXME: add macros for printf and scanf format specifiers,e.g. PRId8 -->
<!-- math.h --> <!-- math.h -->
<define name="M_E" value="2.7182818284590452354"/>
<define name="M_LOG2E" value="1.4426950408889634074"/>
<define name="M_LOG10E" value="0.43429448190325182765"/>
<define name="M_LN2" value="0.69314718055994530942"/>
<define name="M_LN10" value="2.30258509299404568402"/>
<define name="M_PI" value="3.14159265358979323846"/>
<define name="M_PI_2" value="1.57079632679489661923"/>
<define name="M_PI_4" value="0.78539816339744830962"/>
<define name="M_1_PI" value="0.31830988618379067154"/>
<define name="M_2_PI" value="0.63661977236758134308"/>
<define name="M_2_SQRTPI" value="1.12837916709551257390"/>
<define name="M_SQRT2" value="1.41421356237309504880"/>
<define name="M_SQRT1_2" value="0.70710678118654752440"/>
<define name="powf" value="pow"/> <define name="powf" value="pow"/>
<define name="roundf" value="round"/> <define name="roundf" value="round"/>
<define name="signbitf" value="signbit"/> <define name="signbitf" value="signbit"/>
@ -111,6 +137,9 @@
<define name="putchar(__c)" value="fputc(__c, stdout)"/> <define name="putchar(__c)" value="fputc(__c, stdout)"/>
<define name="getc(__stream)" value="fgetc(__stream)"/> <define name="getc(__stream)" value="fgetc(__stream)"/>
<define name="getchar()" value="fgetc(stdin)"/> <define name="getchar()" value="fgetc(stdin)"/>
<define name="SEEK_SET" value="0"/>
<define name="SEEK_CUR" value="1"/>
<define name="SEEK_END" value="2"/>
<function name="vfprintf_P"> <function name="vfprintf_P">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>

View File

@ -12,11 +12,8 @@
<define name="BOOST_TYPEOF_REGISTER_TYPE(x)" value=""/> <define name="BOOST_TYPEOF_REGISTER_TYPE(x)" value=""/>
<define name="BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)" value=""/> <define name="BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)" value=""/>
<define name="BOOST_PP_LIST_FOR_EACH(macro, data, list)" value=""/> <define name="BOOST_PP_LIST_FOR_EACH(macro, data, list)" value=""/>
<define name="BOOST_PP_SEQ_FOR_EACH(macro, data, list)" value=""/>
<define name="BOOST_PP_SEQ_TRANSFORM(macro, data, list)" value=""/>
<define name="BOOST_PP_CAT(a, b)" value=""/> <define name="BOOST_PP_CAT(a, b)" value=""/>
<define name="BOOST_PP_REPEAT(a,b,c)" value=""/> <define name="BOOST_PP_REPEAT(a,b,c)" value=""/>
<define name="BOOST_PP_STRINGIZE(t)" value=""/>
<!-- https://www.boost.org/doc/libs/master/doc/html/foreach.html --> <!-- https://www.boost.org/doc/libs/master/doc/html/foreach.html -->
<define name="BOOST_FOREACH(A,B)" value="for (A: B)"/> <define name="BOOST_FOREACH(A,B)" value="for (A: B)"/>
<!-- https://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html --> <!-- https://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html -->
@ -26,41 +23,21 @@
<define name="BOOST_THROW_EXCEPTION(X)" value="boost::throw_exception(X)"/> <define name="BOOST_THROW_EXCEPTION(X)" value="boost::throw_exception(X)"/>
<define name="BOOST_LIKELY(X)" value="(X)"/> <define name="BOOST_LIKELY(X)" value="(X)"/>
<define name="BOOST_UNLIKELY(X)" value="(X)"/> <define name="BOOST_UNLIKELY(X)" value="(X)"/>
<define name="BOOST_FIXTURE_TEST_SUITE(name, fixture, ...)" value="struct name : fixture {" /> <define name="BOOST_FIXTURE_TEST_SUITE(...)" value=""/>
<define name="BOOST_FIXTURE_TEST_SUITE_END()" value="};"/> <define name="BOOST_FIXTURE_TEST_SUITE_END()" value=""/>
<define name="BOOST_TEST_GLOBAL_FIXTURE(name)" value=""/> <define name="BOOST_TEST_GLOBAL_FIXTURE(name)" value=""/>
<define name="BOOST_PYTHON_FUNCTION_OVERLOADS(foo_overloads, foo, x, y)" value=""/> <define name="BOOST_PYTHON_FUNCTION_OVERLOADS(foo_overloads, foo, x, y)" value=""/>
<define name="BOOST_AUTO_TEST_SUITE(name, ...)" value="namespace name {" /> <define name="BOOST_AUTO_TEST_SUITE(...)" value=""/>
<define name="BOOST_AUTO_TEST_SUITE_END()" value="}" /> <define name="BOOST_AUTO_TEST_SUITE_END()" value=""/>
<define name="BOOST_ASSERT(condition)" value="assert(condition)"/> <define name="BOOST_ASSERT(condition)" value="assert(condition)"/>
<define name="BOOST_TEST(condition, ...)" value="static_cast&lt;void&gt;(static_cast&lt;bool&gt;(condition))" /> <define name="BOOST_TEST(condition)" value="assert(condition)"/>
<define name="BOOST_TEST_REQUIRE(condition, ...)" value="static_cast&lt;void&gt;(static_cast&lt;bool&gt;(condition))" /> <define name="BOOST_WARN(condition)" value="assert(condition)"/>
<define name="BOOST_WARN(condition)" value="static_cast&lt;void&gt;(static_cast&lt;bool&gt;(condition))" /> <define name="BOOST_CHECK(condition)" value="assert(condition)"/>
<define name="BOOST_WARN_MESSAGE(condition, msg)" value="static_cast&lt;void&gt;(static_cast&lt;bool&gt;(condition)); std::string(msg)" /> <define name="BOOST_REQUIRE(condition)" value="assert(condition)"/>
<define name="BOOST_WARN_EQUAL(a, b)" value="static_cast&lt;void&gt;((a) == (b))" /> <define name="BOOST_CHECK_EQUAL(a,b)" value="assert((a) == (b))"/>
<define name="BOOST_WARN_NE(a, b)" value="static_cast&lt;void&gt;((a) != (b))" /> <define name="BOOST_WARN_EQUAL(a,b)" value="assert((a) == (b))"/>
<define name="BOOST_WARN_GT(a, b)" value="static_cast&lt;void&gt;((a) &gt; (b))" /> <define name="BOOST_REQUIRE_EQUAL(a,b)" value="assert((a) == (b))"/>
<define name="BOOST_WARN_GE(a, b)" value="static_cast&lt;void&gt;((a) &gt;= (b))" />
<define name="BOOST_WARN_LT(a, b)" value="static_cast&lt;void&gt;((a) &lt; (b))" />
<define name="BOOST_WARN_LE(a, b)" value="static_cast&lt;void&gt;((a) &lt;= (b))" />
<define name="BOOST_CHECK(condition)" value="static_cast&lt;void&gt;(static_cast&lt;bool&gt;(condition))" />
<define name="BOOST_CHECK_MESSAGE(condition, msg)" value="static_cast&lt;void&gt;(static_cast&lt;bool&gt;(condition)); std::string(msg)" />
<define name="BOOST_CHECK_EQUAL(a, b)" value="static_cast&lt;void&gt;((a) == (b))" />
<define name="BOOST_CHECK_NE(a, b)" value="static_cast&lt;void&gt;((a) != (b))" />
<define name="BOOST_CHECK_GT(a, b)" value="static_cast&lt;void&gt;((a) &gt; (b))" />
<define name="BOOST_CHECK_GE(a, b)" value="static_cast&lt;void&gt;((a) &gt;= (b))" />
<define name="BOOST_CHECK_LT(a, b)" value="static_cast&lt;void&gt;((a) &lt; (b))" />
<define name="BOOST_CHECK_LE(a, b)" value="static_cast&lt;void&gt;((a) &lt;= (b))" />
<define name="BOOST_REQUIRE(condition)" value="static_cast&lt;void&gt;(static_cast&lt;bool&gt;(condition))" />
<define name="BOOST_REQUIRE_MESSAGE(condition, msg)" value="static_cast&lt;void&gt;(static_cast&lt;bool&gt;(condition)); std::string(msg)" />
<define name="BOOST_REQUIRE_EQUAL(a, b)" value="static_cast&lt;void&gt;(static_cast&lt;bool&gt;((a) == (b)))" />
<define name="BOOST_REQUIRE_NE(a, b)" value="static_cast&lt;void&gt;((a) != (b))" />
<define name="BOOST_REQUIRE_GT(a, b)" value="static_cast&lt;void&gt;((a) &gt; (b))" />
<define name="BOOST_REQUIRE_GE(a, b)" value="static_cast&lt;void&gt;((a) &gt;= (b))" />
<define name="BOOST_REQUIRE_LT(a, b)" value="static_cast&lt;void&gt;((a) &lt; (b))" />
<define name="BOOST_REQUIRE_LE(a, b)" value="static_cast&lt;void&gt;((a) &lt;= (b))" />
<define name="BOOST_LOG_ATTRIBUTE_KEYWORD(keyword, name_, value_type_)" value="value_type_ keyword;"/> <define name="BOOST_LOG_ATTRIBUTE_KEYWORD(keyword, name_, value_type_)" value="value_type_ keyword;"/>
<define name="BOOST_TEST_DONT_PRINT_LOG_VALUE(the_type)" value="" />
<!--Boost.Math Macros --> <!--Boost.Math Macros -->
<define name="BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS" value=""/> <define name="BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS" value=""/>
<define name="BOOST_MATH_USE_FLOAT128" value=""/> <define name="BOOST_MATH_USE_FLOAT128" value=""/>
@ -85,17 +62,10 @@
<define name="BOOST_MATH_INT_VALUE_SUFFIX" value=""/> <define name="BOOST_MATH_INT_VALUE_SUFFIX" value=""/>
<!-- Tell cppcheck to interpret BOOST_AUTO_TEST_CASE as a function definition --> <!-- Tell cppcheck to interpret BOOST_AUTO_TEST_CASE as a function definition -->
<define name="BOOST_AUTO_TEST_CASE(...)" value="void BOOST_AUTO_TEST_CASE_run(__VA_ARGS__)"/> <define name="BOOST_AUTO_TEST_CASE(...)" value="void BOOST_AUTO_TEST_CASE_run(__VA_ARGS__)"/>
<define name="BOOST_FIXTURE_TEST_CASE(name, fixture, ...)" value="struct name : fixture { void test_method(); }; void name::test_method()" /> <define name="BOOST_FIXTURE_TEST_CASE(...)" value="void BOOST_FIXTURE_TEST_CASE_run(__VA_ARGS__)"/>
<define name="BOOST_FIXTURE_TEST_CASE_TEMPLATE(test_name, type_name, TL, F)" value="template&lt;typename type_name&gt; struct test_name : public F { void test_method(); }; template&lt;typename type_name&gt; void test_name&lt;type_name&gt;::test_method()" />
<define name="BOOST_DATA_TEST_CASE(...)" value="void BOOST_DATA_TEST_CASE_run(__VA_ARGS__)"/>
<define name="BOOST_DATA_TEST_CASE_F(...)" value="void BOOST_DATA_TEST_CASE_F_run(__VA_ARGS__)"/>
<define name="BOOST_PYTHON_MODULE(str)" value="void BOOST_PYTHON_MODULE_definition(str)"/> <define name="BOOST_PYTHON_MODULE(str)" value="void BOOST_PYTHON_MODULE_definition(str)"/>
<define name="BOOST_SCOPED_ENUM_DECLARE_BEGIN(x)" value=""/> <define name="BOOST_SCOPED_ENUM_DECLARE_BEGIN(x)" value=""/>
<define name="BOOST_SCOPED_ENUM_DECLARE_END(x)" value=""/> <define name="BOOST_SCOPED_ENUM_DECLARE_END(x)" value=""/>
<define name="BOOST_TTI_HAS_TYPE(x)" value=""/>
<define name="BOOST_TTI_HAS_TYPE(x)" value=""/>
<define name="BOOST_TTI_MEMBER_TYPE(x)" value=""/>
<define name="BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(x)" value=""/>
<!-- ########## Boost containers ########## --> <!-- ########## Boost containers ########## -->
<!-- boost containers that are similar to std containers --> <!-- boost containers that are similar to std containers -->
<container id="boostArray" startPattern="boost :: array|scoped_array &lt;" inherits="stdArray"/> <container id="boostArray" startPattern="boost :: array|scoped_array &lt;" inherits="stdArray"/>
@ -108,24 +78,19 @@
<container id="boostVector" startPattern="boost :: vector|small_vector &lt;" inherits="stdVector"/> <container id="boostVector" startPattern="boost :: vector|small_vector &lt;" inherits="stdVector"/>
<container id="boostStableVector" startPattern="boost :: stable_vector|static_vector &lt;" inherits="stdVectorDeque"/> <container id="boostStableVector" startPattern="boost :: stable_vector|static_vector &lt;" inherits="stdVectorDeque"/>
<container id="boostDeque" startPattern="boost :: deque &lt;" inherits="stdDeque"/> <container id="boostDeque" startPattern="boost :: deque &lt;" inherits="stdDeque"/>
<container id="boostStringView" startPattern="boost :: string_view" inherits="stdStringView"/>
<!-- ########## Boost smart pointers ########## --> <!-- ########## Boost smart pointers ########## -->
<!-- https://www.boost.org/doc/libs/1_70_0/libs/smart_ptr/doc/html/smart_ptr.html --> <!-- https://www.boost.org/doc/libs/1_70_0/libs/smart_ptr/doc/html/smart_ptr.html -->
<smart-pointer class-name="boost::scoped_ptr"> <smart-pointer class-name="boost::scoped_ptr"/>
<unique/>
</smart-pointer>
<!-- <smart-pointer class-name="boost::scoped_array"/> Already configured as container --> <!-- <smart-pointer class-name="boost::scoped_array"/> Already configured as container -->
<smart-pointer class-name="boost::shared_ptr"/> <smart-pointer class-name="boost::shared_ptr"/>
<smart-pointer class-name="boost::weak_ptr"/> <smart-pointer class-name="boost::weak_ptr"/>
<smart-pointer class-name="boost::intrusive_ptr"/> <smart-pointer class-name="boost::intrusive_ptr"/>
<smart-pointer class-name="boost::local_shared_ptr"/> <smart-pointer class-name="boost::local_shared_ptr"/>
<!-- https://www.boost.org/doc/libs/1_70_0/doc/html/boost/movelib/unique_ptr.html --> <!-- https://www.boost.org/doc/libs/1_70_0/doc/html/boost/movelib/unique_ptr.html -->
<smart-pointer class-name="boost::movelib::unique_ptr"> <smart-pointer class-name="boost::movelib::unique_ptr"/>
<unique/>
</smart-pointer>
<!-- ########## Boost functions ########## --> <!-- ########## Boost functions ########## -->
<!-- https://www.boost.org/doc/libs/1_69_0/doc/html/boost/algorithm/join.html --> <!-- https://www.boost.org/doc/libs/1_69_0/doc/html/boost/algorithm/join.html -->
<!-- template<typename SequenceSequenceT, typename Range1T> <!-- template<typename SequenceSequenceT, typename Range1T>
range_value< SequenceSequenceT >::type join(const SequenceSequenceT & Input, const Range1T & Separator); --> range_value< SequenceSequenceT >::type join(const SequenceSequenceT & Input, const Range1T & Separator); -->
<function name="boost::algorithm::join"> <function name="boost::algorithm::join">
<noreturn>false</noreturn> <noreturn>false</noreturn>

View File

@ -181,7 +181,6 @@
<returnValue type="size_t"/> <returnValue type="size_t"/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" size-arg="3"/>
<arg nr="1"> <arg nr="1">
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
@ -204,7 +203,6 @@
<returnValue type="size_t"/> <returnValue type="size_t"/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" size-arg="3"/>
<arg nr="1"> <arg nr="1">
<minsize type="argvalue" arg="3"/> <minsize type="argvalue" arg="3"/>
</arg> </arg>
@ -218,176 +216,6 @@
<valid>0:</valid> <valid>0:</valid>
</arg> </arg>
</function> </function>
<!-- https://linux.die.net/man/3/setbuffer -->
<!-- void setbuffer(FILE *stream, char *buf, size_t size); -->
<function name="setbuffer">
<returnValue type="void"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="inout">
<not-null/>
<not-uninit/>
</arg>
<arg nr="2">
<not-uninit/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
</function>
<!-- https://linux.die.net/man/3/setbuffer -->
<!-- void setlinebuf(FILE *stream); -->
<function name="setlinebuf">
<returnValue type="void"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="inout">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t readv(int fd, const struct iovec *iov, int iovcnt); -->
<function name="readv">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="out">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t writev(int fd, const struct iovec *iov, int iovcnt); -->
<function name="writev">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="in">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset); -->
<function name="preadv">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="out">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags); -->
<function name="preadv2">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="out">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="5" direction="in">
<not-uninit/>
</arg>
</function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset); -->
<function name="pwritev">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="in">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags); -->
<function name="pwritev2">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="in">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="5" direction="in">
<not-uninit/>
</arg>
</function>
<!-- https://www.freebsd.org/cgi/man.cgi?query=arc4random --> <!-- https://www.freebsd.org/cgi/man.cgi?query=arc4random -->
<!-- uint32_t arc4random(void); --> <!-- uint32_t arc4random(void); -->
<function name="arc4random"> <function name="arc4random">
@ -400,7 +228,7 @@
<noreturn>false</noreturn> <noreturn>false</noreturn>
<returnValue type="void"/> <returnValue type="void"/>
<leak-ignore/> <leak-ignore/>
<arg nr="1" direction="out"> <arg nr="1">
<not-null/> <not-null/>
<minsize type="argvalue" arg="2"/> <minsize type="argvalue" arg="2"/>
</arg> </arg>
@ -465,59 +293,6 @@
<not-bool/> <not-bool/>
</arg> </arg>
</function> </function>
<function name="err,errx">
<noreturn>true</noreturn>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<formatstr/>
<arg nr="2" direction="in">
<formatstr/>
<strz/>
<not-uninit/>
</arg>
</function>
<function name="errc">
<noreturn>true</noreturn>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<formatstr/>
<arg nr="3" direction="in">
<formatstr/>
<strz/>
<not-uninit/>
</arg>
</function>
<function name="verr,verrx">
<noreturn>true</noreturn>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<strz/>
<not-uninit/>
</arg>
<arg nr="3"/>
</function>
<function name="verrc">
<noreturn>true</noreturn>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<formatstr/>
<arg nr="3" direction="in">
<strz/>
<not-uninit/>
</arg>
<arg nr="4"/>
</function>
<podtype name="FTS"/> <podtype name="FTS"/>
<podtype name="FTSENT"/> <podtype name="FTSENT"/>
<!-- This type definitions refer to https://mandoc.bsd.lv/includes/sys/types.h.html --> <!-- This type definitions refer to https://mandoc.bsd.lv/includes/sys/types.h.html -->

File diff suppressed because it is too large Load Diff

31
cfg/daca.cfg Normal file
View File

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<def format="2">
<!-- This configuration is used in daca@home and contains some common practice macros and functions which are helpful for daca analysis. -->
<!-- see gnu.cfg -->
<define name="ASSERT(expr)" value="assert (expr)"/>
<define name="BE(expr, val)" value="__builtin_expect (expr, val)"/>
<function name="MIN">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
<returnValue>arg1&lt;arg2?arg1:arg2</returnValue>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
</function>
<function name="MAX">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
<returnValue>arg1&gt;arg2?arg1:arg2</returnValue>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
</function>
</def>

View File

@ -1,11 +0,0 @@
<?xml version="1.0"?>
<def format="2">
<function name="rte_panic">
<noreturn>true</noreturn>
<formatstr/>
<arg nr="1" direction="in">
<not-uninit/>
<formatstr/>
</arg>
</function>
</def>

View File

@ -2,6 +2,4 @@
<def format="2"> <def format="2">
<define name="EM_ASM(...)" value=""/> <define name="EM_ASM(...)" value=""/>
<define name="EM_JS(...)" value=""/> <define name="EM_JS(...)" value=""/>
<define name="MAIN_THREAD_EM_ASM(...)" value=""/>
<define name="EMSCRIPTEN_BINDINGS(...)" value=""/>
</def> </def>

View File

@ -25,45 +25,15 @@
<alloc init="false" buffer-size="malloc">pvalloc</alloc> <alloc init="false" buffer-size="malloc">pvalloc</alloc>
<dealloc>free</dealloc> <dealloc>free</dealloc>
</memory> </memory>
<function name="bswap_16"> <define name="bswap_16(x)" value="((unsigned short int) ((((x) &gt;&gt; 8) &amp; 0xff) | (((x) &amp; 0xff) &lt;&lt; 8)))"/>
<noreturn>false</noreturn>
<use-retval/>
<returnValue type="uint16_t">((arg1 &amp; 0xff00u) &gt;&gt; 8) | ((arg1 &amp; 0x00ffu) &lt;&lt; 8)</returnValue>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<define name="__bswap_constant_16(x)" value="bswap_16(x)"/> <define name="__bswap_constant_16(x)" value="bswap_16(x)"/>
<define name="__builtin_bswap16(x)" value="bswap_16(x)"/> <define name="__builtin_bswap16(x)" value="bswap_16(x)"/>
<define name="__bswap_16(x)" value="bswap_16(x)"/> <define name="__bswap_16(x)" value="bswap_16(x)"/>
<function name="bswap_32"> <define name="bswap_32(x)" value="((((x) &amp; 0xff000000) &gt;&gt; 24) | (((x) &amp; 0x00ff0000) &gt;&gt; 8) | (((x) &amp; 0x0000ff00) &lt;&lt; 8) | (((x) &amp; 0x000000ff) &lt;&lt; 24))"/>
<noreturn>false</noreturn>
<use-retval/>
<returnValue type="uint32_t">((arg1 &amp; 0xff000000ul) &gt;&gt; 24) | ((arg1 &amp; 0x00ff0000ul) &gt;&gt; 8) | ((arg1 &amp; 0x0000ff00ul) &lt;&lt; 8) | ((arg1 &amp; 0x000000fful) &lt;&lt; 24)</returnValue>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<define name="__bswap_constant_32(x)" value="bswap_32(x)"/> <define name="__bswap_constant_32(x)" value="bswap_32(x)"/>
<define name="__builtin_bswap32(x)" value="bswap_32(x)"/> <define name="__builtin_bswap32(x)" value="bswap_32(x)"/>
<define name="__bswap_32(x)" value="bswap_32(x)"/> <define name="__bswap_32(x)" value="bswap_32(x)"/>
<function name="bswap_64"> <define name="bswap_64(x)" value="((((x) &amp; 0xff00000000000000ull) &gt;&gt; 56) | (((x) &amp; 0x00ff000000000000ull) &gt;&gt; 40) | (((x) &amp; 0x0000ff0000000000ull) &gt;&gt; 24) | (((x) &amp; 0x000000ff00000000ull) &gt;&gt; 8) | (((x) &amp; 0x00000000ff000000ull) &lt;&lt; 8) | (((x) &amp; 0x0000000000ff0000ull) &lt;&lt; 24) | (((x) &amp; 0x000000000000ff00ull) &lt;&lt; 40) | (((x) &amp; 0x00000000000000ffull) &lt;&lt; 56))"/>
<noreturn>false</noreturn>
<use-retval/>
<returnValue type="uint64_t">((arg1 &amp; 0xff00000000000000ull) &gt;&gt; 56) | ((arg1 &amp; 0x00ff000000000000ull) &gt;&gt; 40) | ((arg1 &amp; 0x0000ff0000000000ull) &gt;&gt; 24) | ((arg1 &amp; 0x000000ff00000000ull) &gt;&gt; 8) | ((arg1 &amp; 0x00000000ff000000ull) &lt;&lt; 8) | ((arg1 &amp; 0x0000000000ff0000ull) &lt;&lt; 24) | ((arg1 &amp; 0x000000000000ff00ull) &lt;&lt; 40) | ((arg1 &amp; 0x00000000000000ffull) &lt;&lt; 56)</returnValue>
<leak-ignore/>
<const/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<define name="__bswap_constant_64(x)" value="bswap_64(x)"/> <define name="__bswap_constant_64(x)" value="bswap_64(x)"/>
<define name="__builtin_bswap64(x)" value="bswap_64(x)"/> <define name="__builtin_bswap64(x)" value="bswap_64(x)"/>
<define name="__bswap_64(x)" value="bswap_64(x)"/> <define name="__bswap_64(x)" value="bswap_64(x)"/>
@ -92,34 +62,6 @@
<valid>0:</valid> <valid>0:</valid>
</arg> </arg>
</function> </function>
<!-- https://man7.org/linux/man-pages/man2/semop.2.html -->
<!-- int semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout); -->
<function name="semtimedop">
<noreturn>false</noreturn>
<returnValue type="int"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="out">
<not-null/>
<not-uninit/>
<not-bool/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<!-- If the timeout argument is NULL, then semtimedop() behaves exactly like semop() -->
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- void * __builtin_assume_aligned (const void *exp, size_t align, ...) --> <!-- void * __builtin_assume_aligned (const void *exp, size_t align, ...) -->
<!-- This function can have either two or three arguments, if it has three, the third argument should have integer type. --> <!-- This function can have either two or three arguments, if it has three, the third argument should have integer type. -->
<function name="__builtin_assume_aligned"> <function name="__builtin_assume_aligned">
@ -143,7 +85,6 @@
<noreturn>false</noreturn> <noreturn>false</noreturn>
<returnValue type="void *"/> <returnValue type="void *"/>
<leak-ignore/> <leak-ignore/>
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" size-arg="3"/>
<arg nr="1" direction="out"> <arg nr="1" direction="out">
<not-null/> <not-null/>
<minsize type="argvalue" arg="3"/> <minsize type="argvalue" arg="3"/>
@ -168,19 +109,6 @@
<arg nr="variadic" direction="in"> <arg nr="variadic" direction="in">
<not-uninit/> <not-uninit/>
</arg> </arg>
</function>
<!-- https://man7.org/linux/man-pages/man3/getenv.3.html -->
<!-- char * secure_getenv(const char *name); -->
<function name="secure_getenv">
<use-retval/>
<returnValue type="char *"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
<strz/>
</arg>
</function> </function>
<!-- https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Alignment.html --> <!-- https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Alignment.html -->
<!-- __alignof__ is used like sizeof --> <!-- __alignof__ is used like sizeof -->
@ -213,21 +141,6 @@
<not-null/> <not-null/>
</arg> </arg>
</function> </function>
<!-- https://man7.org/linux/man-pages/man3/getpw.3.html -->
<!-- int getpw(uid_t uid, char *buf); -->
<function name="getpw">
<returnValue type="int"/>
<noreturn>false</noreturn>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2" direction="out">
<not-null/>
<not-bool/>
</arg>
<warn severity="style" reason="Obsolescent" alternatives="getpwnam"/>
</function>
<!-- void timeradd(struct timeval *a, struct timeval *b, struct timeval *res);--> <!-- void timeradd(struct timeval *a, struct timeval *b, struct timeval *res);-->
<!-- void timersub(struct timeval *a, struct timeval *b, struct timeval *res);--> <!-- void timersub(struct timeval *a, struct timeval *b, struct timeval *res);-->
<function name="timeradd,timersub"> <function name="timeradd,timersub">
@ -276,50 +189,6 @@
<not-bool/> <not-bool/>
</arg> </arg>
</function> </function>
<!-- https://man7.org/linux/man-pages/man3/mempcpy.3.html-->
<!-- wchar_t *wmempcpy(wchar_t *restrict dest, const wchar_t *restrict src, size_t n);-->
<function name="wmempcpy">
<returnValue type="wchar_t *"/>
<noreturn>false</noreturn>
<leak-ignore/>
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" size-arg="3"/>
<arg nr="1" direction="out">
<not-null/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="2" direction="in">
<not-null/>
<not-uninit/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- https://man7.org/linux/man-pages/man3/mempcpy.3.html-->
<!-- void *mempcpy(void *restrict dest, const void *restrict src, size_t n);-->
<function name="mempcpy">
<returnValue type="void *"/>
<noreturn>false</noreturn>
<leak-ignore/>
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" size-arg="3"/>
<arg nr="1" direction="out">
<not-null/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="2" direction="in">
<not-null/>
<not-uninit/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- void xexit(int status); --> <!-- void xexit(int status); -->
<function name="xexit"> <function name="xexit">
<noreturn>true</noreturn> <noreturn>true</noreturn>
@ -346,7 +215,6 @@
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<not-bool/> <not-bool/>
<strz/>
</arg> </arg>
</function> </function>
<!-- void xfree(void *block); --> <!-- void xfree(void *block); -->
@ -414,7 +282,7 @@
<arg nr="1" direction="out"> <arg nr="1" direction="out">
<not-null/> <not-null/>
<not-bool/> <not-bool/>
<minsize type="value" value="2" baseType="int"/> <minsize type="value" value="2"/>
</arg> </arg>
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-uninit/> <not-uninit/>
@ -471,7 +339,6 @@
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<formatstr/> <formatstr/>
<not-uninit/> <not-uninit/>
<strz/>
</arg> </arg>
</function> </function>
<!-- int isascii_l(int c, locale_t locale); --> <!-- int isascii_l(int c, locale_t locale); -->
@ -501,7 +368,6 @@
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<formatstr/> <formatstr/>
<not-uninit/> <not-uninit/>
<strz/>
</arg> </arg>
<arg nr="3" direction="in"> <arg nr="3" direction="in">
<not-uninit/> <not-uninit/>
@ -530,114 +396,6 @@
</arg> </arg>
<leak-ignore/> <leak-ignore/>
</function> </function>
<!-- https://man7.org/linux/man-pages/man3/gethostbyaddr_r.3.html -->
<!-- int gethostbyaddr_r(const void *addr, socklen_t len, int type, struct hostent *restrict ret, char *restrict buf, size_t buflen, struct hostent **restrict result, int *restrict h_errnop); -->
<function name="gethostbyaddr_r">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
</arg>
<arg nr="4" direction="out">
<not-null/>
</arg>
<arg nr="5" direction="in">
<not-uninit/>
<not-null/>
<minsize type="argvalue" arg="6"/>
</arg>
<arg nr="6" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="7" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="8" direction="in">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- https://man7.org/linux/man-pages/man3/gethostbyname2_r.3.html -->
<!-- int gethostbyname2_r(const char *name, int af, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); -->
<function name="gethostbyname2_r">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
<strz/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<arg nr="3" direction="out">
<not-null/>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
<not-null/>
<minsize type="argvalue" arg="5"/>
</arg>
<arg nr="5" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="6" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="7" direction="in">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- https://man7.org/linux/man-pages/man3/gethostbyname_r.3.html -->
<!-- int gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); -->
<function name="gethostbyname_r">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
<strz/>
</arg>
<arg nr="2" direction="out">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-null/>
<minsize type="argvalue" arg="4"/>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="5" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="6" direction="in">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- https://www.gnu.org/software/libc/manual/html_node/Getopt-Long-Options.html#Getopt-Long-Options --> <!-- https://www.gnu.org/software/libc/manual/html_node/Getopt-Long-Options.html#Getopt-Long-Options -->
<!-- int getopt_long(int argc, char * const argv[], <!-- int getopt_long(int argc, char * const argv[],
const char *optstring, const char *optstring,
@ -678,7 +436,6 @@
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<not-bool/> <not-bool/>
<strz/>
</arg> </arg>
</function> </function>
<!-- char *strndupa(const char *s, size_t n); --> <!-- char *strndupa(const char *s, size_t n); -->
@ -689,7 +446,6 @@
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<strz/>
</arg> </arg>
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-uninit/> <not-uninit/>
@ -729,7 +485,6 @@
<not-uninit/> <not-uninit/>
<not-null/> <not-null/>
<not-bool/> <not-bool/>
<strz/>
</arg> </arg>
</function> </function>
<!-- char *strdupa(const char *s); --> <!-- char *strdupa(const char *s); -->
@ -741,7 +496,6 @@
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<not-bool/> <not-bool/>
<strz/>
</arg> </arg>
</function> </function>
<!-- http://www.gnu.org/software/libc/manual/html_node/Backtraces.html --> <!-- http://www.gnu.org/software/libc/manual/html_node/Backtraces.html -->
@ -842,30 +596,6 @@
<not-bool/> <not-bool/>
</arg> </arg>
</function> </function>
<!-- https://man7.org/linux/man-pages/man3/getservent_r.3.html -->
<!-- int getservent_r(struct servent *restrict result_buf, char *restrict buf, size_t buflen, struct servent **restrict result); -->
<function name="getservent_r">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<arg nr="1" direction="out">
<not-null/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<not-null/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- https://linux.die.net/man/3/ecvt_r --> <!-- https://linux.die.net/man/3/ecvt_r -->
<!-- int ecvt_r (double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); --> <!-- int ecvt_r (double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); -->
<function name="ecvt_r"> <function name="ecvt_r">
@ -980,23 +710,21 @@
<warn severity="style" reason="Obsolescent" alternatives="sprintf"/> <warn severity="style" reason="Obsolescent" alternatives="sprintf"/>
</function> </function>
<!-- https://www.gnu.org/software/gnulib/manual/html_node/c_002dstrcasestr.html --> <!-- https://www.gnu.org/software/gnulib/manual/html_node/c_002dstrcasestr.html -->
<!-- char* strcasestr(const char *s1, const char *s2); --> <!-- size_t strcasestr(const char *s1, const char *s2); -->
<function name="strcasestr"> <function name="strcasestr">
<use-retval/> <use-retval/>
<returnValue type="char *"/> <returnValue type="size_t"/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<pure/> <pure/>
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<strz/>
</arg> </arg>
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<not-bool/> <not-bool/>
<strz/>
</arg> </arg>
</function> </function>
<!-- http://linux.die.net/man/2/getresuid --> <!-- http://linux.die.net/man/2/getresuid -->
@ -1076,7 +804,6 @@
<arg nr="1"> <arg nr="1">
<not-uninit/> <not-uninit/>
<not-null/> <not-null/>
<strz/>
</arg> </arg>
<arg nr="2"> <arg nr="2">
<not-null/> <not-null/>
@ -1091,7 +818,6 @@
<not-uninit/> <not-uninit/>
<not-null/> <not-null/>
<not-bool/> <not-bool/>
<strz/>
</arg> </arg>
<leak-ignore/> <leak-ignore/>
</function> </function>
@ -1143,7 +869,6 @@
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-uninit/> <not-uninit/>
<not-null/> <not-null/>
<strz/>
</arg> </arg>
<arg nr="3" direction="out"> <arg nr="3" direction="out">
<not-null/> <not-null/>
@ -1182,7 +907,6 @@
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-null/> <not-null/>
<not-bool/> <not-bool/>
<strz/>
</arg> </arg>
</function> </function>
<!-- https://linux.die.net/man/3/execvpe --> <!-- https://linux.die.net/man/3/execvpe -->
@ -1194,7 +918,6 @@
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<strz/>
</arg> </arg>
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-uninit/> <not-uninit/>
@ -1273,7 +996,6 @@
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<minsize type="argvalue" arg="3"/>
</arg> </arg>
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-uninit/> <not-uninit/>
@ -1303,37 +1025,12 @@
<valid>0:</valid> <valid>0:</valid>
</arg> </arg>
</function> </function>
<!-- https://man7.org/linux/man-pages/man3/qsort.3.html -->
<!-- void qsort_r(void *base, size_t n, size_t size, int (*cmp)(const void *, const void *, void *), void *arg); -->
<function name="qsort_r">
<noreturn>false</noreturn>
<returnValue type="void"/>
<leak-ignore/>
<arg nr="1" direction="inout">
<not-null/>
<not-uninit/>
<minsize type="argvalue" arg="2"/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="out">
<not-null/>
<not-bool/>
</arg>
</function>
<!-- http://man7.org/linux/man-pages/man3/ffs.3.html --> <!-- http://man7.org/linux/man-pages/man3/ffs.3.html -->
<!-- int ffsl(long int i); <!-- int ffsl(long int i);
int ffsll(long long int i); --> int ffsll(long long int i); -->
<function name="ffsl,ffsll"> <function name="ffsl,ffsll">
<use-retval/> <use-retval/>
<!-- It returns the position of the first bit set, or 0 if no bits are set in i. --> <returnValue type="int"/>
<returnValue type="int">arg1==0 &amp;0</returnValue>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1" direction="in"> <arg nr="1" direction="in">
@ -1488,7 +1185,6 @@
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<minsize type="argvalue" arg="2"/> <minsize type="argvalue" arg="2"/>
<strz/>
</arg> </arg>
<arg nr="2"> <arg nr="2">
<not-uninit/> <not-uninit/>
@ -1553,7 +1249,6 @@
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-uninit/> <not-uninit/>
<not-null/> <not-null/>
<strz/>
</arg> </arg>
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-uninit/> <not-uninit/>
@ -1656,7 +1351,6 @@
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<strz/>
</arg> </arg>
<arg nr="3" direction="out"> <arg nr="3" direction="out">
<not-null/> <not-null/>
@ -1682,7 +1376,6 @@
<arg nr="3" direction="in"> <arg nr="3" direction="in">
<not-null/> <not-null/>
<not-uninit/> <not-uninit/>
<strz/>
</arg> </arg>
<arg nr="4" direction="out"> <arg nr="4" direction="out">
<not-null/> <not-null/>
@ -1693,17 +1386,6 @@
<not-uninit/> <not-uninit/>
</arg> </arg>
</function> </function>
<!-- https://man7.org/linux/man-pages/man3/error.3.html -->
<!-- void error(int status, int errnum, const char *format, ...); -->
<!-- void error_at_line(int status, int errnum, const char *filename, unsigned int linenum, const char *format, ...); -->
<function name="error,error_at_line">
<noreturn>true</noreturn>
<leak-ignore/>
<returnValue type="void"/>
<arg nr="any" direction="in">
<not-uninit/>
</arg>
</function>
<!-- ########## Resource allocation ########## --> <!-- ########## Resource allocation ########## -->
<resource> <resource>
<alloc init="true">mkostemp</alloc> <alloc init="true">mkostemp</alloc>
@ -1731,6 +1413,4 @@
<define name="STDIN_FILENO" value="0"/> <define name="STDIN_FILENO" value="0"/>
<define name="STDOUT_FILENO" value="1"/> <define name="STDOUT_FILENO" value="1"/>
<define name="STDERR_FILENO" value="2"/> <define name="STDERR_FILENO" value="2"/>
<entrypoint name="_init"/>
<entrypoint name="_fini"/>
</def> </def>

View File

@ -1,29 +1,29 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<def format="2"> <def format="2">
<!-- see https://github.com/google/googletest/blob/main/docs/primer.md --> <!-- see https://github.com/google/googletest/blob/master/googletest/docs/primer.md -->
<define name="ASSERT_TRUE(cond)" value="{if (!(cond)) throw false;}"/> <define name="ASSERT_TRUE(cond)" value="assert(cond)"/>
<define name="EXPECT_TRUE(cond)" value="(void)(cond)"/> <define name="EXPECT_TRUE(cond)" value="(void)(cond)"/>
<define name="ASSERT_FALSE(cond)" value="{if (cond) throw false;}"/> <define name="ASSERT_FALSE(cond)" value="assert(!(cond))"/>
<define name="EXPECT_FALSE(cond)" value="(void)(cond)"/> <define name="EXPECT_FALSE(cond)" value="(void)(cond)"/>
<define name="ASSERT_EQ(val1,val2)" value="{if (!((val1) == (val2))) throw false;}"/> <define name="ASSERT_EQ(val1,val2)" value="assert((val1)==(val2))"/>
<define name="EXPECT_EQ(val1,val2)" value="(void)((val1)==(val2))"/> <define name="EXPECT_EQ(val1,val2)" value="(void)((val1)==(val2))"/>
<define name="ASSERT_NE(val1,val2)" value="{if (!((val1) != (val2))) throw false;}"/> <define name="ASSERT_NE(val1,val2)" value="assert((val1)!=(val2))"/>
<define name="EXPECT_NE(val1,val2)" value="(void)((val1)!=(val2))"/> <define name="EXPECT_NE(val1,val2)" value="(void)((val1)!=(val2))"/>
<define name="ASSERT_LT(val1,val2)" value="{if (!((val1) &lt; (val2))) throw false;}"/> <define name="ASSERT_LT(val1,val2)" value="assert((val1)&lt;(val2))"/>
<define name="EXPECT_LT(val1,val2)" value="(void)((val1)&lt;(val2))"/> <define name="EXPECT_LT(val1,val2)" value="(void)((val1)&lt;(val2))"/>
<define name="ASSERT_LE(val1,val2)" value="{if (!((val1) &lt;= (val2))) throw false;}"/> <define name="ASSERT_LE(val1,val2)" value="assert((val1)&lt;=(val2))"/>
<define name="EXPECT_LE(val1,val2)" value="(void)((val1)&lt;=(val2))"/> <define name="EXPECT_LE(val1,val2)" value="(void)((val1)&lt;=(val2))"/>
<define name="ASSERT_GT(val1,val2)" value="{if (!((val1) &gt; (val2))) throw false;}"/> <define name="ASSERT_GT(val1,val2)" value="assert((val1)&gt;(val2))"/>
<define name="EXPECT_GT(val1,val2)" value="(void)((val1)&gt;(val2))"/> <define name="EXPECT_GT(val1,val2)" value="(void)((val1)&gt;(val2))"/>
<define name="ASSERT_GE(val1,val2)" value="{if (!((val1) &gt;= (val2))) throw false;}"/> <define name="ASSERT_GE(val1,val2)" value="assert((val1)&gt;=(val2))"/>
<define name="EXPECT_GE(val1,val2)" value="(void)((val1)&gt;=(val2))"/> <define name="EXPECT_GE(val1,val2)" value="(void)((val1)&gt;=(val2))"/>
<define name="ASSERT_STREQ(str1,str2)" value="{if (!(strcmp(str1, str2) == 0)) throw false;}"/> <define name="ASSERT_STREQ(str1,str2)" value="assert(strcmp(str1, str2) == 0)"/>
<define name="EXPECT_STREQ(str1,str2)" value="(void)(*(str1)==*(str2))"/> <define name="EXPECT_STREQ(str1,str2)" value="(void)(*(str1)==*(str2))"/>
<define name="ASSERT_STRNE(str1,str2)" value="{if (!(strcmp(str1, str2) != 0)) throw false;}"/> <define name="ASSERT_STRNE(str1,str2)" value="assert(strcmp(str1, str2) != 0)"/>
<define name="EXPECT_STRNE(str1,str2)" value="(void)(*(str1)!=*(str2))"/> <define name="EXPECT_STRNE(str1,str2)" value="(void)(*(str1)!=*(str2))"/>
<define name="ASSERT_STRCASEEQ(str1,str2)" value="{if (!(stricmp(str1, str2) == 0)) throw false;}"/> <define name="ASSERT_STRCASEEQ(str1,str2)" value="assert(stricmp(str1, str2) == 0)"/>
<define name="EXPECT_STRCASEEQ(str1,str2)" value="(void)(*(str1)==*(str2))"/> <define name="EXPECT_STRCASEEQ(str1,str2)" value="(void)(*(str1)==*(str2))"/>
<define name="ASSERT_STRCASENE(str1,str2)" value="{if (!(stricmp(str1, str2) != 0)) throw false;}"/> <define name="ASSERT_STRCASENE(str1,str2)" value="assert(stricmp(str1, str2) != 0)"/>
<define name="EXPECT_STRCASENE(str1,str2)" value="(void)(*(str1)!=*(str2))"/> <define name="EXPECT_STRCASENE(str1,str2)" value="(void)(*(str1)!=*(str2))"/>
<define name="ASSERT_THROW(code, e)" value="try{code;}catch(e){}"/> <define name="ASSERT_THROW(code, e)" value="try{code;}catch(e){}"/>
<define name="EXPECT_THROW(code, e)" value="try{code;}catch(e){}"/> <define name="EXPECT_THROW(code, e)" value="try{code;}catch(e){}"/>

View File

@ -36,22 +36,13 @@
<define name="G_STRINGIFY_ARG(contents)" value="#contents"/> <define name="G_STRINGIFY_ARG(contents)" value="#contents"/>
<define name="G_STRLOC" value="__FILE__ &quot;:&quot; G_STRINGIFY (__LINE__)"/> <define name="G_STRLOC" value="__FILE__ &quot;:&quot; G_STRINGIFY (__LINE__)"/>
<define name="G_STRFUNC" value="((const char*) (__FUNCTION__))"/> <define name="G_STRFUNC" value="((const char*) (__FUNCTION__))"/>
<define name="G_DEFINE_TYPE(TN, t_n, T_P)" value=""/>
<define name="G_DEFINE_TYPE_WITH_PRIVATE(TN, t_n, T_P)" value=""/> <define name="G_DEFINE_TYPE_WITH_PRIVATE(TN, t_n, T_P)" value=""/>
<define name="G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_)" value=""/> <define name="G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_)" value=""/>
<define name="G_DEFINE_FINAL_TYPE(TN, t_n, T_P)" value=""/>
<define name="G_DEFINE_FINAL_TYPE_WITH_PRIVATE(TN, t_n, T_P)" value=""/>
<define name="G_DEFINE_FINAL_TYPE_WITH_CODE(TN, t_n, T_P, _C_)" value=""/>
<define name="G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P)" value=""/> <define name="G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P)" value=""/>
<define name="G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(TN, t_n, T_P)" value=""/> <define name="G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(TN, t_n, T_P)" value=""/>
<define name="G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_)" value=""/> <define name="G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_)" value=""/>
<define name="G_DEFINE_DYNAMIC_TYPE(TN, t_n, T_P)" value=""/>
<define name="G_DEFINE_DYNAMIC_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)" value=""/>
<define name="G_DEFINE_BOXED_TYPE(TypeName,type_name,copy_func,free_func)" value=""/> <define name="G_DEFINE_BOXED_TYPE(TypeName,type_name,copy_func,free_func)" value=""/>
<define name="G_DEFINE_BOXED_TYPE_WITH_CODE(TypeName,type_name,copy_func,free_func,_C_)" value=""/> <define name="G_DEFINE_BOXED_TYPE_WITH_CODE(TypeName,type_name,copy_func,free_func,_C_)" value=""/>
<define name="G_DEFINE_QUARK(QN,q_n)" value=""/>
<define name="G_BEGIN_DECLS" value=""/>
<define name="G_END_DECLS" value=""/>
<define name="G_ADD_PRIVATE(TypeName)" value=""/> <define name="G_ADD_PRIVATE(TypeName)" value=""/>
<define name="G_PRIVATE_OFFSET(TypeName, field)" value=""/> <define name="G_PRIVATE_OFFSET(TypeName, field)" value=""/>
<define name="G_PRIVATE_FIELD(TypeName, inst, field_type, field_name)" value=""/> <define name="G_PRIVATE_FIELD(TypeName, inst, field_type, field_name)" value=""/>
@ -60,9 +51,6 @@
<define name="G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_)" value=""/> <define name="G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_)" value=""/>
<define name="G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)" value=""/> <define name="G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)" value=""/>
<define name="G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)" value=""/> <define name="G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)" value=""/>
<define name="G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func)" value=""/>
<define name="G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none)" value=""/>
<define name="G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func)" value=""/>
<define name="MAX(a, b)" value="(((a) &gt; (b)) ? (a) : (b))"/> <define name="MAX(a, b)" value="(((a) &gt; (b)) ? (a) : (b))"/>
<define name="MIN(a, b)" value="(((a) &lt; (b)) ? (a) : (b))"/> <define name="MIN(a, b)" value="(((a) &lt; (b)) ? (a) : (b))"/>
<define name="ABS(a)" value="(((a) &lt; 0) ? -(a) : (a))"/> <define name="ABS(a)" value="(((a) &lt; 0) ? -(a) : (a))"/>
@ -205,7 +193,6 @@
<alloc init="true">g_thread_try_new</alloc> <alloc init="true">g_thread_try_new</alloc>
<use>g_thread_ref</use> <use>g_thread_ref</use>
<dealloc>g_thread_unref</dealloc> <dealloc>g_thread_unref</dealloc>
<dealloc>g_thread_join</dealloc>
</memory> </memory>
<memory> <memory>
<alloc init="true">g_variant_iter_copy</alloc> <alloc init="true">g_variant_iter_copy</alloc>
@ -2889,18 +2876,6 @@
<leak-ignore/> <leak-ignore/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
</function> </function>
<function name="g_file_info_get_attribute_object">
<leak-ignore/>
<noreturn>false</noreturn>
</function>
<function name="g_file_info_get_icon">
<leak-ignore/>
<noreturn>false</noreturn>
</function>
<function name="g_file_info_get_symbolic_icon">
<leak-ignore/>
<noreturn>false</noreturn>
</function>
<!-- gint g_fprintf (FILE *file, gchar const *format, ...); --> <!-- gint g_fprintf (FILE *file, gchar const *format, ...); -->
<function name="g_fprintf"> <function name="g_fprintf">
<leak-ignore/> <leak-ignore/>
@ -4111,10 +4086,12 @@
<returnValue type="int"/> <returnValue type="int"/>
<use-retval/> <use-retval/>
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-null/>
<not-uninit/> <not-uninit/>
<strz/> <strz/>
</arg> </arg>
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-null/>
<not-uninit/> <not-uninit/>
<strz/> <strz/>
<not-bool/> <not-bool/>
@ -20454,6 +20431,7 @@
<returnValue type="gchar *"/> <returnValue type="gchar *"/>
<use-retval/> <use-retval/>
<arg nr="1"> <arg nr="1">
<not-null/>
<not-uninit/> <not-uninit/>
<not-bool/> <not-bool/>
</arg> </arg>

View File

@ -253,19 +253,4 @@
<define name="ON_THREAD_MESSAGE(x,y)" value=""/> <define name="ON_THREAD_MESSAGE(x,y)" value=""/>
<define name="ON_REGISTERED_THREAD_MESSAGE(x,y)" value=""/> <define name="ON_REGISTERED_THREAD_MESSAGE(x,y)" value=""/>
<define name="END_MESSAGE_MAP()" value=""/> <define name="END_MESSAGE_MAP()" value=""/>
<define name="DECLARE_DYNAMIC(x)" value=""/>
<define name="IMPLEMENT_DYNAMIC(x,y)" value=""/>
<define name="DECLARE_DYNCREATE(x)" value=""/>
<define name="IMPLEMENT_DYNCREATE(x,y)" value=""/>
<define name="DECLARE_SERIAL(x)" value=""/>
<define name="IMPLEMENT_SERIAL(x,y,z)" value=""/>
<define name="DECLARE_EVENTSINK_MAP()" value=""/>
<define name="END_EVENTSINK_MAP()" value=""/>
<define name="BEGIN_EVENTSINK_MAP(x,y)" value=""/>
<define name="ON_EVENT(a,b,c,d,e)" value=""/>
<define name="ON_EVENT_RANGE(a,b,c,d,e,f)" value=""/>
<define name="ON_EVENT_REFLECT(a,b,c,d)" value=""/>
<define name="ON_PROPNOTIFY(a,b,c,d,e)" value=""/>
<define name="ON_PROPNOTIFY_RANGE(a,b,c,d,e,f)" value=""/>
<define name="ON_PROPNOTIFY_REFLECT(a,b,c,d)" value=""/>
</def> </def>

View File

@ -3,11 +3,6 @@
<!-- Microsoft Windows ATL (Active Template Library) https://docs.microsoft.com/en-us/cpp/atl/atl-com-desktop-components --> <!-- Microsoft Windows ATL (Active Template Library) https://docs.microsoft.com/en-us/cpp/atl/atl-com-desktop-components -->
<define name="BEGIN_COM_MAP(x)" value=""/> <define name="BEGIN_COM_MAP(x)" value=""/>
<define name="END_COM_MAP()" value=""/> <define name="END_COM_MAP()" value=""/>
<define name="BEGIN_MSG_MAP(x)" value=""/>
<define name="MESSAGE_HANDLER(msg, func)" value=""/>
<define name="COMMAND_HANDLER(id, code, func)" value=""/>
<define name="CHAIN_MSG_MAP(theChainClass)" value=""/>
<define name="END_MSG_MAP()" value=""/>
<define name="COM_INTERFACE_ENTRY(x)" value=""/> <define name="COM_INTERFACE_ENTRY(x)" value=""/>
<define name="COM_INTERFACE_ENTRY2(x, x2)" value=""/> <define name="COM_INTERFACE_ENTRY2(x, x2)" value=""/>
<define name="COM_INTERFACE_ENTRY_IID(iid, x)" value=""/> <define name="COM_INTERFACE_ENTRY_IID(iid, x)" value=""/>
@ -25,16 +20,8 @@
<define name="COM_INTERFACE_ENTRY_NOINTERFACE(x)" value=""/> <define name="COM_INTERFACE_ENTRY_NOINTERFACE(x)" value=""/>
<define name="DECLARE_LIBID(libid)" value=""/> <define name="DECLARE_LIBID(libid)" value=""/>
<define name="DECLARE_NO_REGISTRY()" value=""/> <define name="DECLARE_NO_REGISTRY()" value=""/>
<define name="DECLARE_NOT_AGGREGATABLE(x)" value=""/>
<define name="DECLARE_OBJECT_DESCRIPTION(x)" value=""/>
<define name="DECLARE_PROTECT_FINAL_CONSTRUCT()" value=""/>
<define name="DECLARE_REGISTRY(class,pid,vpid,nid,flags)" value=""/> <define name="DECLARE_REGISTRY(class,pid,vpid,nid,flags)" value=""/>
<define name="DECLARE_REGISTRY_APPID_RESOURCEID(resid,appid)" value=""/> <define name="DECLARE_REGISTRY_APPID_RESOURCEID(resid,appid)" value=""/>
<define name="DECLARE_REGISTRY_RESOURCE(x)" value=""/> <define name="DECLARE_REGISTRY_RESOURCE(x)" value=""/>
<define name="DECLARE_REGISTRY_RESOURCEID(x)" value=""/> <define name="DECLARE_REGISTRY_RESOURCEID(x)" value=""/>
<define name="STDMETHOD(method)" value="HRESULT STDMETHODCALLTYPE method"/>
<define name="STDMETHOD_(type,method)" value="type STDMETHODCALLTYPE method"/>
<define name="IFACEMETHOD(method)" value="STDMETHOD(method)"/>
<define name="IFACEMETHOD_(type,method)" value="STDMETHOD_(type,method)"/>
<define name="OBJECT_ENTRY_AUTO(clsid, class)" value=""/>
</def> </def>

View File

@ -160,7 +160,9 @@
<function name="XtSetArg"> <function name="XtSetArg">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"/> <arg nr="1">
<not-uninit/>
</arg>
<arg nr="2"> <arg nr="2">
<not-uninit/> <not-uninit/>
<strz/> <strz/>

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<def format="2"> <def format="2">
<define name="Py_RETURN_FALSE" value="return Py_INCREF(Py_False), Py_False"/>
<define name="Py_RETURN_NONE" value="return Py_INCREF(Py_None), Py_None"/>
<define name="Py_RETURN_TRUE" value="return Py_INCREF(Py_True), Py_True"/>
<!-- Python C API. see https://docs.python.org/2/c-api/index.html --> <!-- Python C API. see https://docs.python.org/2/c-api/index.html -->
<!-- ########## Python C API Types ########## --> <!-- ########## Python C API Types ########## -->
<define name="PY_LONG_LONG" value="long long"/> <define name="PY_LONG_LONG" value="long long"/>

Some files were not shown because too many files have changed in this diff Show More