Skip to content

Commit

Permalink
Merge branch 'main' into revert-valueflow-split
Browse files Browse the repository at this point in the history
  • Loading branch information
pfultz2 authored Nov 20, 2024
2 parents 6b3680b + c307483 commit 3ec1753
Show file tree
Hide file tree
Showing 43 changed files with 253 additions and 238 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/CI-unixish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,30 +309,37 @@ jobs:
run: |
tools/generate_and_run_more_tests.sh
# do not use pushd in this step since we go below the working directory
- name: Run test/cli
run: |
cd test/cli
python3 -m pytest -Werror --strict-markers -vv
cd ../../..
python3 -m pytest -Werror --strict-markers -vv test/cli
# TODO: use the step below instead
# do not use pushd in this step since we go below the working directory
- name: Run test/cli (symlink)
run: |
cd ..
ln -s cppcheck 'cpp check'
cd 'cpp check/test/cli'
python3 -m pytest -Werror --strict-markers -vv
# do not use pushd in this step since we go below the working directory
# FIXME: proj2_test.py fails because of the relative path cleanups in ImportProject::setRelativePaths()
# It fails because the application path used as base path has its symlink resolved by getcwd().
- name: Run test/cli (symlink)
if: false
run: |
ln -s . 'cpp check'
python3 -m pytest -Werror --strict-markers -vv 'cpp check/test/cli'
- name: Run test/cli (-j2)
run: |
cd test/cli
python3 -m pytest -Werror --strict-markers -vv
python3 -m pytest -Werror --strict-markers -vv test/cli
env:
TEST_CPPCHECK_INJECT_J: 2

# do not use pushd in this step since we go below the working directory
- name: Run test/cli (--clang)
if: false
run: |
cd test/cli
python3 -m pytest -Werror --strict-markers -vv
python3 -m pytest -Werror --strict-markers -vv test/cli
env:
TEST_CPPCHECK_INJECT_CLANG: clang

Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/CI-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
matrix:
os: [windows-2019, windows-2022]
qt_ver: [5.15.2, 6.7.3]
qt_ver: [5.15.2, 6.8.0]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -172,23 +172,20 @@ jobs:
- name: Run test/cli
if: matrix.config == 'release'
run: |
cd test/cli || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv test/cli || exit /b !errorlevel!
- name: Run test/cli (-j2)
if: matrix.config == 'release'
run: |
cd test/cli || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv test/cli || exit /b !errorlevel!
env:
TEST_CPPCHECK_INJECT_J: 2

# TODO: install clang
- name: Run test/cli (--clang)
if: false # matrix.config == 'release'
run: |
cd test/cli || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv test/cli || exit /b !errorlevel!
env:
TEST_CPPCHECK_INJECT_CLANG: clang

Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-22.04

env:
QT_VERSION: 6.7.3
QT_VERSION: 6.8.0
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
Expand Down Expand Up @@ -100,23 +100,20 @@ jobs:
- 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_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test/cli
- name: Run test/cli (-j2)
run: |
pwd=$(pwd)
cd test/cli
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test/cli
env:
TEST_CPPCHECK_INJECT_J: 2

- name: Run test/cli (--clang)
if: false
run: |
pwd=$(pwd)
cd test/cli
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test/cli
env:
TEST_CPPCHECK_INJECT_CLANG: clang

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-22.04

env:
QT_VERSION: 6.7.3
QT_VERSION: 6.8.0

steps:
- uses: actions/checkout@v4
Expand Down
55 changes: 46 additions & 9 deletions .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ jobs:
strategy:
matrix:
image: ["fedora:latest"] # "opensuse/tumbleweed:latest" / "fedora:latest" / "debian:unstable" / "archlinux:latest"
stdlib: [libstdc++, libc++]
include:
- stdlib: libstdc++
use_libcxx: Off
- stdlib: libc++
use_libcxx: On
fail-fast: false

runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'danmar' }}
Expand All @@ -24,7 +31,7 @@ jobs:
image: ${{ matrix.image }}

env:
QT_VERSION: 6.7.3
QT_VERSION: 6.8.0

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -65,6 +72,11 @@ jobs:
dnf install -y iwyu
ln -s iwyu_tool.py /usr/bin/iwyu_tool
- name: Install missing software on Fedora (libc++)
if: contains(matrix.image, 'fedora') && matrix.stdlib == 'libc++'
run: |
dnf install -y libcxx-devel
- name: Install missing software on OpenSUSE
if: contains(matrix.image, 'opensuse')
run: |
Expand All @@ -86,7 +98,8 @@ jobs:

- 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 -DUSE_QT6=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 -DEXTERNALS_AS_SYSTEM=On
# TODO: why does it build dmake in the next step?
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=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 -DEXTERNALS_AS_SYSTEM=On -DUSE_LIBCXX=${{ matrix.use_libcxx }}
env:
CC: clang
CXX: clang++
Expand All @@ -110,27 +123,38 @@ jobs:
run: |
PWD=$(pwd)
# -isystem/usr/lib/clang/17/include
iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments > iwyu.log
# TODO: remove -stdlib= - it should have been taken from the compilation database
iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments -stdlib=${{ matrix.stdlib }} > iwyu.log
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Compilation Database
name: Compilation Database (include-what-you-use - ${{ matrix.stdlib }})
path: ./cmake.output/compile_commands.json

- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Logs (include-what-you-use)
name: Logs (include-what-you-use - ${{ matrix.stdlib }})
path: ./*.log

clang-include-cleaner:

strategy:
matrix:
stdlib: [libstdc++, libc++]
include:
- stdlib: libstdc++
use_libcxx: Off
- stdlib: libc++
use_libcxx: On
fail-fast: false

runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'danmar' }}

env:
QT_VERSION: 6.7.3
QT_VERSION: 6.8.0

steps:
- uses: actions/checkout@v4
Expand All @@ -150,6 +174,11 @@ jobs:
sudo ./llvm.sh 19
sudo apt-get install -y clang-tools-19
- name: Install libc++
if: matrix.stdlib == 'libc++'
run: |
sudo apt-get install -y libc++-19-dev
- name: Install Qt ${{ env.QT_VERSION }}
uses: jurplel/install-qt-action@v4
with:
Expand All @@ -160,7 +189,8 @@ jobs:

- 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 -DUSE_QT6=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 -DEXTERNALS_AS_SYSTEM=On
# TODO: why does it build dmake in the next step?
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=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 -DEXTERNALS_AS_SYSTEM=On -DUSE_LIBCXX=${{ matrix.use_libcxx }}
env:
CC: clang-19
CXX: clang++-19
Expand All @@ -180,9 +210,16 @@ jobs:
- name: clang-include-cleaner
run: |
# TODO: run multi-threaded
find $PWD/cli $PWD/lib $PWD/test $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-19 --print=changes --extra-arg=-w -p cmake.output > clang-include-cleaner.log 2>&1
find $PWD/cli $PWD/lib $PWD/test $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-19 --print=changes --extra-arg=-w --extra-arg=-stdlib=${{ matrix.stdlib }} -p cmake.output > clang-include-cleaner.log 2>&1
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Compilation Database (clang-include-cleaner - ${{ matrix.stdlib }})
path: ./cmake.output/compile_commands.json

- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Logs (clang-include-cleaner)
name: Logs (clang-include-cleaner - ${{ matrix.stdlib }})
path: ./*.log
7 changes: 4 additions & 3 deletions .github/workflows/scriptcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permissions:
jobs:
build:

# 'ubuntu-22.04' removes Python 3.5 and 3.6 so keep the previous LTS version
# 'ubuntu-22.04' removes Python 3.6 so keep the previous LTS version
runs-on: ubuntu-20.04

steps:
Expand All @@ -44,7 +44,7 @@ jobs:
scriptcheck:

needs: build
# 'ubuntu-22.04' removes Python 3.5 and 3.6 so keep the previous LTS version
# 'ubuntu-22.04' removes Python 3.6 so keep the previous LTS version
runs-on: ubuntu-20.04
strategy:
matrix:
Expand All @@ -58,6 +58,7 @@ jobs:
steps:
- uses: actions/checkout@v4

# TODO: bailout on error
- name: Restore Cppcheck
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -101,7 +102,7 @@ jobs:
if: matrix.python-latest
run: |
shopt -s globstar
pylint --jobs $(nproc) addons/**/*.py htmlreport/cppcheck-htmlreport htmlreport/**/*.py test/**/*.py tools/**/*.py
pylint --jobs $(nproc) --py-version 3.6 addons/**/*.py htmlreport/cppcheck-htmlreport htmlreport/**/*.py test/**/*.py tools/**/*.py
- name: check .json files
if: matrix.python-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/selfcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-22.04

env:
QT_VERSION: 6.7.3
QT_VERSION: 6.8.0

steps:
- uses: actions/checkout@v4
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/tsan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-22.04

env:
QT_VERSION: 6.7.3
QT_VERSION: 6.8.0
TSAN_OPTIONS: halt_on_error=1
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
Expand Down Expand Up @@ -99,25 +99,22 @@ jobs:
- 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_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test/cli
env:
TEST_CPPCHECK_INJECT_EXECUTOR: thread

- name: Run test/cli (-j2)
run: |
pwd=$(pwd)
cd test/cli
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test/cli
env:
TEST_CPPCHECK_INJECT_J: 2

- name: Run test/cli (--clang)
if: false
run: |
pwd=$(pwd)
cd test/cli
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test/cli
env:
TEST_CPPCHECK_INJECT_CLANG: clang

Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/ubsan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-22.04

env:
QT_VERSION: 6.7.3
QT_VERSION: 6.8.0
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
Expand Down Expand Up @@ -99,23 +99,20 @@ jobs:
- 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_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test/cli
- name: Run test/cli (-j2)
run: |
pwd=$(pwd)
cd test/cli
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test/cli
env:
TEST_CPPCHECK_INJECT_J: 2

- name: Run test/cli (--clang)
if: false
run: |
pwd=$(pwd)
cd test/cli
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test/cli
env:
TEST_CPPCHECK_INJECT_CLANG: clang

Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ if(LIBXML2_XMLLINT_EXECUTABLE)
add_custom_target(validateRules ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/rules/*.xml)
endif()

# TODO: add the following Makefile features:
# - "man/cppcheck.1" target
# - "tags" target
# - Cygwin handling
# - MinGW handling

if(BUILD_TESTS)
enable_testing()
endif()
Expand Down
1 change: 1 addition & 0 deletions addons/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def validate_regex(expr):
elif arg[:11] == '--function=':
RE_FUNCTIONNAME = arg[11:]
validate_regex(RE_FUNCTIONNAME)
# TODO: bail out on unknown parameter


def reportError(token, severity, msg, errorId):
Expand Down
Loading

0 comments on commit 3ec1753

Please sign in to comment.