From 5f6206959017426545a22d6de86db5e87e1e3e06 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:13:50 +0200 Subject: [PATCH] CI: cppcheck script fixes --- .github/workflows/cppcheck.yml | 2 +- cppcheck/includes.txt | 4 ++++ cppcheck/run.cmd | 2 +- cppcheck/run.sh | 2 +- src/merge_mining_client_tari.cpp | 2 +- src/merge_mining_client_tari.h | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index ff7132b..2c94229 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -15,7 +15,7 @@ on: jobs: cppcheck-ubuntu: - timeout-minutes: 60 + timeout-minutes: 120 runs-on: ubuntu-latest steps: diff --git a/cppcheck/includes.txt b/cppcheck/includes.txt index 9dca0d5..bbd8ce3 100644 --- a/cppcheck/includes.txt +++ b/cppcheck/includes.txt @@ -1,5 +1,6 @@ ../src/ ../external/src/ +../external/src/crypto/ ../external/src/cryptonote/ ../external/src/libuv/ ../external/src/cppzmq/ @@ -8,3 +9,6 @@ ../external/src/randomx/src/ ../external/src/rapidjson/include/ ../external/src/robin-hood-hashing/src/include/ +../external/src/grpc/include/ +../external/src/grpc/third_party/abseil-cpp/ +../external/src/grpc/third_party/protobuf/src/ diff --git a/cppcheck/run.cmd b/cppcheck/run.cmd index c8393c2..1c792c0 100644 --- a/cppcheck/run.cmd +++ b/cppcheck/run.cmd @@ -1,5 +1,5 @@ @echo off -"..\cppcheck-main\bin\cppcheck.exe" ../src/*.cpp -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D_WIN32=1 -D_WIN64=1 -DWIN32=1 -D_WINDOWS=1 -DNDEBUG=1 -DWITH_GRPC=1 -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 -DWITH_RANDOMX=1 -DWITH_UPNP=1 -DCURL_STATICLIB=1 -DWIN32_LEAN_AND_MEAN=1 -D_WIN32_WINNT=0x0600 -D_DISABLE_VECTOR_ANNOTATION=1 -D_DISABLE_STRING_ANNOTATION=1 -DZMQ_STATIC=1 -DHAVE_BITSCANREVERSE64=1 -DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag -DMINIUPNP_STATICLIB=1 -DCARES_STATICLIB=1 -DCMAKE_INTDIR="Release" -D__SSE2__=1 -D_MSC_VER=1900 -D__COVERITY__ --platform=win64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --includes-file=includes.txt --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive +"..\cppcheck-main\bin\cppcheck.exe" ../src/*.cpp -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D_WIN32=1 -D_WIN64=1 -DWIN32=1 -D_WINDOWS=1 -DNDEBUG=1 -DWITH_GRPC=1 -DPROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0 -DWITH_RANDOMX=1 -DWITH_UPNP=1 -DCURL_STATICLIB=1 -DWIN32_LEAN_AND_MEAN=1 -D_WIN32_WINNT=0x0600 -D_DISABLE_VECTOR_ANNOTATION=1 -D_DISABLE_STRING_ANNOTATION=1 -DZMQ_STATIC=1 -DHAVE_BITSCANREVERSE64=1 -DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag -DMINIUPNP_STATICLIB=1 -DCARES_STATICLIB=1 -DCMAKE_INTDIR="Release" -D__SSE2__=1 -D_MSC_VER=1929 -D__COVERITY__ --platform=win64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --includes-file=includes.txt --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive --checkers-report=checkers_report.txt findstr /V /C:"external\src" errors_full.txt > errors_filtered0.txt findstr /V /C:":checkersReport" errors_filtered0.txt > errors_filtered.txt for /f %%i in ("errors_filtered.txt") do set size=%%~zi diff --git a/cppcheck/run.sh b/cppcheck/run.sh index 1bd54a7..f2cf6aa 100755 --- a/cppcheck/run.sh +++ b/cppcheck/run.sh @@ -1,5 +1,5 @@ #!/bin/bash -../cppcheck-main/cppcheck --project=../build/compile_commands.json -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D__SSE2__=1 --platform=unix64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive --checkers-report=checkers_report.txt +../cppcheck-main/cppcheck --project=../build/compile_commands.json -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D__SSE2__=1 -D__BYTE_ORDER__=1 -D__ORDER_LITTLE_ENDIAN__=1 -D__linux__=1 --platform=unix64 --std=c++17 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive --checkers-report=checkers_report.txt grep -v 'external' errors_full.txt > errors_filtered0.txt grep -v ':checkersReport' errors_filtered0.txt > errors_filtered.txt if [ -s errors_filtered.txt ]; then diff --git a/src/merge_mining_client_tari.cpp b/src/merge_mining_client_tari.cpp index ff75d86..a6185f5 100644 --- a/src/merge_mining_client_tari.cpp +++ b/src/merge_mining_client_tari.cpp @@ -42,7 +42,7 @@ MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, con host.erase(0, sizeof(TARI_PREFIX) - 1); - while (host.back() == '/') { + while (!host.empty() && (host.back() == '/')) { host.pop_back(); } diff --git a/src/merge_mining_client_tari.h b/src/merge_mining_client_tari.h index 4dd6e63..5c07e9e 100644 --- a/src/merge_mining_client_tari.h +++ b/src/merge_mining_client_tari.h @@ -73,7 +73,7 @@ private: struct TariClient : public TCPServer::Client { TariClient(); - ~TariClient() {} + ~TariClient() override {} static Client* allocate() { return new TariClient(); } virtual size_t size() const override { return sizeof(TariClient); }