From f4ed9e9840c24a9b6bb21c9eb876f75215239f4a Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Thu, 25 Apr 2024 11:46:59 +0200 Subject: [PATCH 1/2] CI: fixed cppcheck for Windows --- cppcheck/includes.txt | 10 ++++++++++ cppcheck/run.cmd | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 cppcheck/includes.txt diff --git a/cppcheck/includes.txt b/cppcheck/includes.txt new file mode 100644 index 0000000..9dca0d5 --- /dev/null +++ b/cppcheck/includes.txt @@ -0,0 +1,10 @@ +../src/ +../external/src/ +../external/src/cryptonote/ +../external/src/libuv/ +../external/src/cppzmq/ +../external/src/libzmq/ +../external/src/miniupnp/miniupnpc/include/ +../external/src/randomx/src/ +../external/src/rapidjson/include/ +../external/src/robin-hood-hashing/src/include/ diff --git a/cppcheck/run.cmd b/cppcheck/run.cmd index 2636b9f..1ad7de1 100644 --- a/cppcheck/run.cmd +++ b/cppcheck/run.cmd @@ -1,5 +1,5 @@ @echo off -"..\cppcheck-main\bin\cppcheck.exe" --project=..\build\p2pool.vcxproj --project-configuration="Release|x64" -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN --platform=win64 --std=c++14 --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 +"..\cppcheck-main\bin\cppcheck.exe" ../src/*.cpp -D_WIN32=1 -D_WIN64=1 -DWIN32=1 -D_WINDOWS=1 -DNDEBUG=1 -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 -DCMAKE_INTDIR="Release" -D__SSE2__=1 -D_MSC_VER=1900 -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -D__COVERITY__ --platform=win64 --std=c++14 --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 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 From bbddf40590da72fbee90b2fa43efeb101f42a954 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:48:34 +0200 Subject: [PATCH 2/2] Fixed cppcheck error --- src/block_cache.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/block_cache.cpp b/src/block_cache.cpp index 6392bee..1005bdf 100644 --- a/src/block_cache.cpp +++ b/src/block_cache.cpp @@ -86,8 +86,9 @@ struct BlockCache::Impl : public nocopy_nomove #elif defined(_WIN32) Impl() + : m_file(CreateFile(cache_name, GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL)) + , m_map(0) { - m_file = CreateFile(cache_name, GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL); if (m_file == INVALID_HANDLE_VALUE) { LOGERR(1, "couldn't open " << cache_name << ", error " << static_cast(GetLastError())); return; @@ -140,8 +141,8 @@ struct BlockCache::Impl : public nocopy_nomove } } - HANDLE m_file = INVALID_HANDLE_VALUE; - HANDLE m_map = 0; + HANDLE m_file; + HANDLE m_map; #else // Not implemented on other platforms