Updated rapidjson
Some checks are pending
C/C++ CI / build-ubuntu (map[c:gcc-8 cpp:g++-8 flags: os:ubuntu-20.04]) (push) Waiting to run
C/C++ CI / build-alpine-static (map[arch:aarch64 branch:latest-stable flags:-ffunction-sections -Wno-error=inline -mfix-cortex-a53-835769 -mfix-cortex-a53-843419]) (push) Waiting to run
C/C++ CI / build-alpine-static (map[arch:riscv64 branch:edge flags:-ffunction-sections -Wno-error=inline]) (push) Waiting to run
C/C++ CI / build-alpine-static (map[arch:x86_64 branch:latest-stable flags:-ffunction-sections -Wno-error=inline]) (push) Waiting to run
C/C++ CI / build-ubuntu (map[c:gcc-11 cpp:g++-11 flags: os:ubuntu-20.04]) (push) Waiting to run
C/C++ CI / build-ubuntu (map[c:gcc-12 cpp:g++-12 flags: os:ubuntu-22.04]) (push) Waiting to run
C/C++ CI / build-ubuntu-static-libs (map[flags:-fuse-linker-plugin -ffunction-sections -Wno-error=inline]) (push) Waiting to run
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-20.04]) (push) Waiting to run
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-22.04]) (push) Waiting to run
C/C++ CI / build-windows-msys2 (map[c:clang cxx:clang++ flags:-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled]) (push) Waiting to run
C/C++ CI / build-windows-msys2 (map[c:gcc cxx:g++ flags:-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:OFF upnp:OFF vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:ON upnp:OFF vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:ON tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2019 rx:ON tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2022 rx:ON tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Waiting to run
C/C++ CI / build-macos (push) Waiting to run
C/C++ CI / build-macos-aarch64 (push) Waiting to run
C/C++ CI / build-freebsd (map[architecture:x86-64 host:ubuntu-latest name:freebsd version:13.3]) (push) Waiting to run
C/C++ CI / build-openbsd (map[architecture:x86-64 host:ubuntu-latest name:openbsd version:7.4]) (push) Waiting to run
clang-tidy / clang-tidy (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
cppcheck / cppcheck-ubuntu (push) Waiting to run
cppcheck / cppcheck-windows (push) Waiting to run
Microsoft C++ Code Analysis / Analyze (push) Waiting to run
source-snapshot / source-snapshot (push) Waiting to run
Sync test / sync-test-ubuntu-tsan (push) Waiting to run
Sync test / sync-test-ubuntu-msan (push) Waiting to run
Sync test / sync-test-ubuntu-ubsan (push) Waiting to run
Sync test / sync-test-ubuntu-asan (push) Waiting to run
Sync test / sync-test-macos (map[flags: os:macos-13]) (push) Waiting to run
Sync test / sync-test-macos (map[flags:-target arm64-apple-macos-11 os:macos-14]) (push) Waiting to run
Sync test / sync-test-windows-debug-asan (push) Waiting to run
Sync test / sync-test-windows-leaks (push) Waiting to run

This commit is contained in:
SChernykh 2024-12-02 17:44:08 +01:00
parent 94da2e8dff
commit cf325e0e76
12 changed files with 43 additions and 12 deletions

View file

@ -1,9 +1,19 @@
@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=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
"..\cppcheck-main\bin\cppcheck.exe" ../src/*.cpp -D__cppcheck__ -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
findstr /C:"There were critical errors" checkers_report.txt > checkers_report_filtered.txt
for /f %%i in ("errors_filtered.txt") do set size=%%~zi
if %size% gtr 0 (
type errors_filtered.txt
exit 1
)
for /f %%i in ("checkers_report_filtered.txt") do set size2=%%~zi
if %size2% gtr 0 (
type checkers_report_filtered.txt
exit 1
)

View file

@ -1,8 +1,17 @@
#!/bin/bash
../cppcheck-main/cppcheck --project=../build/compile_commands.json -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -DRAPIDJSON_64BIT=1 -D__SSE2__=1 -D__BYTE_ORDER__=1 -D__ORDER_LITTLE_ENDIAN__=1 -D__linux__=1 -D__x86_64 -D_M_AMD64 -D_M_X64 --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
grep 'There were critical errors' checkers_report.txt > checkers_report_filtered.txt
if [ -s errors_filtered.txt ]; then
cat errors_filtered.txt
exit 1
fi
if [ -s checkers_report_filtered.txt ]; then
cat checkers_report_filtered.txt
exit 1
fi

@ -1 +1 @@
Subproject commit 5eb4b2335a3f849c8b421b75354f98a1169fed95
Subproject commit a6f118884172d86c2bfb6f5adae70bdebc88c059

View file

@ -22,7 +22,7 @@
#include "params.h"
#include "json_rpc_request.h"
#include "json_parsers.h"
#include <rapidjson/document.h>
#include "rapidjson_wrapper.h"
LOG_CATEGORY(MergeMiningClientJSON_RPC)

View file

@ -28,7 +28,7 @@
#include "block_template.h"
#include "p2pool_api.h"
#include "stratum_server.h"
#include <rapidjson/document.h>
#include "rapidjson_wrapper.h"
#include <fstream>
#include <numeric>

View file

@ -20,7 +20,7 @@
#include "zmq_reader.h"
#include "mempool.h"
#include "json_rpc_request.h"
#include "rapidjson/document.h"
#include "rapidjson_wrapper.h"
#include "json_parsers.h"
#include "pow_hash.h"
#include "block_template.h"

View file

@ -26,7 +26,7 @@
#endif
#include "json_rpc_request.h"
#include "json_parsers.h"
#include <rapidjson/document.h>
#include "rapidjson_wrapper.h"
#include <thread>
LOG_CATEGORY(RandomX_Hasher)

5
src/rapidjson_wrapper.h Normal file
View file

@ -0,0 +1,5 @@
#if defined(_MSC_VER) && defined(__cppcheck__)
// cppcheck chokes on rapidjson headers in Windows
#else
#include <rapidjson/document.h>
#endif

View file

@ -34,8 +34,12 @@
#include "json_parsers.h"
#include "crypto.h"
#include "hardforks/hardforks.h"
#if !defined(_MSC_VER) || !defined(__cppcheck__)
#include <rapidjson/document.h>
#include <rapidjson/istreamwrapper.h>
#endif
#include <fstream>
#include <iterator>
#include <numeric>

View file

@ -24,6 +24,8 @@
#include "p2pool_api.h"
#include "p2p_server.h"
#include "rapidjson_wrapper.h"
LOG_CATEGORY(StratumServer)
static constexpr int DEFAULT_BACKLOG = 128;
@ -1311,7 +1313,8 @@ bool StratumServer::StratumClient::process_request(char* data, uint32_t size)
return false;
}
bool StratumServer::StratumClient::process_login(rapidjson::Document& doc, uint32_t id)
template<typename T>
bool StratumServer::StratumClient::process_login(T& doc, uint32_t id)
{
const auto params_it = doc.FindMember("params");
if (params_it == doc.MemberEnd()) {
@ -1340,7 +1343,8 @@ bool StratumServer::StratumClient::process_login(rapidjson::Document& doc, uint3
return static_cast<StratumServer*>(m_owner)->on_login(this, id, login.GetString());
}
bool StratumServer::StratumClient::process_submit(rapidjson::Document& doc, uint32_t id)
template<typename T>
bool StratumServer::StratumClient::process_submit(T& doc, uint32_t id)
{
const auto params_it = doc.FindMember("params");
if (params_it == doc.MemberEnd()) {

View file

@ -18,7 +18,6 @@
#pragma once
#include "tcp_server.h"
#include <rapidjson/document.h>
namespace p2pool {
@ -50,8 +49,8 @@ public:
[[nodiscard]] bool on_read(const char* data, uint32_t size) override;
[[nodiscard]] bool process_request(char* data, uint32_t size);
[[nodiscard]] bool process_login(rapidjson::Document& doc, uint32_t id);
[[nodiscard]] bool process_submit(rapidjson::Document& doc, uint32_t id);
template<typename T> [[nodiscard]] bool process_login(T& doc, uint32_t id);
template<typename T> [[nodiscard]] bool process_submit(T& doc, uint32_t id);
bool send_http_response(bool send_content);

View file

@ -18,7 +18,7 @@
#include "common.h"
#include "zmq_reader.h"
#include "json_parsers.h"
#include <rapidjson/document.h>
#include "rapidjson_wrapper.h"
LOG_CATEGORY(ZMQReader)