Compare commits

...

49 Commits

Author SHA1 Message Date
Ed Hennis
922885a4f8 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-22 23:53:24 -04:00
Alex Kremer
b41cbb08c6 chore: Add pre-commit hook to fix include style (#6995)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-04-22 22:20:14 +00:00
pdp2121
bd1b126230 feat: Add --definitions flag and artifact (#6858)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-04-22 20:10:52 +00:00
Ed Hennis
012926ead9 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-22 14:49:42 -04:00
Mayukha Vadari
1c6cdc653c fix: More clang-tidy issues (#6992) 2026-04-22 17:42:15 +00:00
Ed Hennis
9a0b70b45d Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-22 13:11:15 -04:00
Alex Kremer
4ab20770f7 chore: Optionally run clang-tidy via pre-commit (#6680)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-04-22 15:06:36 +00:00
Vito Tumas
2e307329f0 refactor: Add transaction-specific invariant checking (#6551) 2026-04-22 14:41:19 +00:00
Ayaz Salikhov
3429845c40 style: Add bashate pre-commit hook to unify bash style (#6994) 2026-04-22 14:26:02 +00:00
Ed Hennis
6311292c2b Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-21 19:35:16 -04:00
Alex Kremer
7c7c1894b9 chore: Add -fix to clang-tidy invocation (#6990) 2026-04-21 19:00:00 +00:00
Jingchen
45d4aacb53 chore: Remove empty Taker.h (#6984) 2026-04-21 18:15:58 +00:00
Alex Kremer
ce3951bbb3 chore: Enable clang-tidy modernize checks (#6975)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-04-21 15:32:51 +00:00
Ayaz Salikhov
ab887f5049 ci: Upload clang-tidy git diff (#6983) 2026-04-21 14:22:33 +00:00
Alex Kremer
ea023121f5 fix: Add rounding to Vault invariants (#6217) (#6955)
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Ed Hennis <ed@ripple.com>
2026-04-21 12:14:07 +00:00
Ed Hennis
4f98a09b65 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-20 17:50:16 -04:00
yinyiqian1
4b198cd5bb fix: Disallow MPTClearRequireAuth if is set (#6712)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2026-04-20 21:25:52 +00:00
Ed Hennis
eabfa77c77 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-20 15:45:33 -04:00
Alex Kremer
726f20c8f6 feat: Add GRPC TLS support (#6374)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-20 17:12:14 +00:00
Zhiyuan Wang
96643bb0fa fix: Check for empty sfAdditionalBooks array in hybrid offer invariant (#6716) 2026-04-20 17:10:28 +00:00
chuanshanjida
e83818241a chore: Remove repetitive word in multiple files (#6978)
Signed-off-by: chuanshanjida <chuanshanjida@outlook.com>
2026-04-20 16:56:03 +00:00
Ed Hennis
d689047950 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-20 11:39:41 -04:00
Ed Hennis
4d4ac414ae Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-17 18:21:13 -04:00
Ed Hennis
6e751091b1 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-16 13:45:04 -04:00
Ed Hennis
d6459c8ac7 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-15 19:09:48 -04:00
Ed Hennis
40cb63f423 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-15 14:29:25 -04:00
Ed Hennis
98206e6514 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-13 20:45:27 -04:00
Ed Hennis
a047d1bc9b Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-10 12:13:23 -04:00
Ed Hennis
2ca91e701e Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-10 09:14:24 -04:00
Ed Hennis
3db7e84e06 Merge branch 'develop' into ximinez/lending-sendmulti 2026-04-09 17:00:43 -04:00
Ed Hennis
75d0960e1d Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-sendmulti
* XRPLF/develop: (105 commits)
  fix: Handle WSClient write failure when server closes WebSocket (6671)
  ci: Change conditions for uploading artifacts in public/private/org repos (6734)
  refactor: Rename non-functional uses of `ripple(d)` to `xrpl(d)` (6676)
  refactor: Move more helper files into `libxrpl/ledger/helpers` (6731)
  fix: Minor RPC fixes (6730)
  fix: Prevent deletion of MPTokens with active escrow (6635)
  fix: Clamp VaultClawback to assetsAvailable for zero-amount clawback (6646)
  fix: Add assorted Lending Protocol fixes (6678)
  fix: Change variable signedness and correctly handle `std::optional` (6657)
  refactor: Reorganize RPC handler files (6628)
  chore: Update XRPLF/actions (6713)
  docs: Add explanatory comment to checkFee (6631)
  fix: Decouple reserve from fee in delegate payment (6568)
  fix: Check trustline limits for share-denominated vault withdrawals (6645)
  fix: Remove fatal assertion on Linux thread name truncation  (6690)
  chore: Enable clang-tidy `coreguidelines` checks (6698)
  ci: Allow uploading artifacts for XRPLF org (6702)
  fix: Enforce aggregate MaximumAmount in multi-send MPT (6644)
  chore: Use nudb recipe from the upstream (6701)
  fix: Fix previous ledger size typo in RCLConsensus (6696)
  ...
2026-04-07 18:11:51 -04:00
Ed Hennis
091709e7d7 Merge branch 'develop' into ximinez/lending-sendmulti 2026-03-12 15:04:57 -04:00
Ed Hennis
b5756c44bc Merge branch 'develop' into ximinez/lending-sendmulti 2026-03-10 13:39:33 -04:00
Ed Hennis
613a94645d Merge branch 'develop' into ximinez/lending-sendmulti 2026-03-06 13:55:14 -04:00
Ed Hennis
c0323540f9 Merge branch 'develop' into ximinez/lending-sendmulti 2026-03-04 17:12:17 -04:00
Ed Hennis
e0fd480ae7 Merge branch 'develop' into ximinez/lending-sendmulti 2026-03-03 18:38:33 -04:00
Ed Hennis
fe80f0e895 Merge branch 'develop' into ximinez/lending-sendmulti 2026-02-24 17:43:52 -04:00
Ed Hennis
9988e596e9 Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-sendmulti
* XRPLF/develop:
  ci: [DEPENDABOT] bump actions/upload-artifact from 4.6.2 to 6.0.0 (6396)
  ci: [DEPENDABOT] bump actions/checkout from 4.3.0 to 6.0.2 (6397)
  ci: [DEPENDABOT] bump actions/setup-python from 5.6.0 to 6.2.0 (6395)
  ci: [DEPENDABOT] bump tj-actions/changed-files from 46.0.5 to 47.0.4 (6394)
  ci: [DEPENDABOT] bump codecov/codecov-action from 5.4.3 to 5.5.2 (6398)
  ci: Build docs in PRs and in private repos (6400)
  ci: Add dependabot config (6379)
  Fix tautological assertion (6393)
2026-02-20 17:56:41 -05:00
Ed Hennis
3523c437a8 Merge commit '2c1fad1023' into ximinez/lending-sendmulti
* commit '2c1fad1023':
  chore: Apply clang-format width 100 (6387)
2026-02-20 17:56:19 -05:00
Ed Hennis
0f38b4b541 Update formatting 2026-02-20 17:52:11 -05:00
Ed Hennis
f84350c61c Merge commit '25cca465538a56cce501477f9e5e2c1c7ea2d84c' into ximinez/lending-sendmulti
* commit '25cca465538a56cce501477f9e5e2c1c7ea2d84c':
  chore: Set clang-format width to 100 in config file (6387)
2026-02-20 17:51:51 -05:00
Ed Hennis
7a118245f7 Merge branch 'develop' into ximinez/lending-sendmulti 2026-02-19 16:25:29 -05:00
Ed Hennis
47ddc34fda Merge branch 'develop' into ximinez/lending-sendmulti 2026-02-18 21:15:30 -04:00
Ed Hennis
1f579efc2f Merge branch 'develop' into ximinez/lending-sendmulti 2026-02-04 17:18:43 -04:00
Ed Hennis
e464e101be Fix formatting 2026-01-28 19:23:26 -05:00
Ed Hennis
4dfa6db32a Merge branch 'develop' into ximinez/lending-sendmulti 2026-01-28 19:33:14 -04:00
Ed Hennis
766124ed6d Merge commit '5f638f55536def0d88b970d1018a465a238e55f4' into ximinez/lending-sendmulti
* commit '5f638f55536def0d88b970d1018a465a238e55f4':
  chore: Set ColumnLimit to 120 in clang-format (6288)
2026-01-28 18:32:07 -05:00
Ed Hennis
5c34a7b8fb Merge commit '92046785d1fea5f9efe5a770d636792ea6cab78b' into ximinez/lending-sendmulti
* commit '92046785d1fea5f9efe5a770d636792ea6cab78b':
  test: Fix the `xrpl.net` unit test using async read (6241)
  ci: Upload Conan recipes for develop, release candidates, and releases (6286)
  fix: Stop embedded tests from hanging on ARM by using `atomic_flag` (6248)
  fix:  Remove DEFAULT fields that change to the default in associateAsset (6259) (6273)
  refactor: Update Boost to 1.90 (6280)
  refactor: clean up uses of `std::source_location` (6272)
  ci: Pass missing sanitizers input to actions (6266)
  ci: Properly propagate Conan credentials (6265)
  ci: Explicitly set version when exporting the Conan recipe (6264)
  ci: Use plus instead of hyphen for Conan recipe version suffix (6261)
  chore: Detect uninitialized variables in CMake files (6247)
  ci: Run on-trigger and on-pr when generate-version is modified (6257)
  refactor: Enforce 15-char limit and simplify labels for thread naming (6212)
  docs: Update Ripple Bug Bounty public key (6258)
  ci: Add missing commit hash to Conan recipe version (6256)
  fix: Include `<functional>` header in `Number.h` (6254)
  ci: Upload Conan recipe for merges into develop and commits to release (6235)
  Limit reply size on `TMGetObjectByHash` queries (6110)
  ci: remove 'master' branch as a trigger (6234)
  Improve ledger_entry lookups for fee, amendments, NUNL, and hashes (5644)
2026-01-28 18:31:27 -05:00
Ed Hennis
f6f3542b7e Refactor the sendMulti functions into a common method with callbacks 2026-01-15 12:01:23 -05:00
867 changed files with 10340 additions and 5638 deletions

View File

@@ -97,9 +97,21 @@ Checks: "-*,
misc-throw-by-value-catch-by-reference,
misc-unused-alias-decls,
misc-unused-using-decls,
modernize-deprecated-headers,
modernize-concat-nested-namespaces,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-type-traits,
modernize-use-designated-initializers,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-override,
modernize-use-ranges,
modernize-use-starts-ends-with,
modernize-use-std-numbers,
modernize-use-using,
modernize-deprecated-headers,
llvm-namespace-comment,
performance-faster-string-find,
performance-for-range-copy,
@@ -141,19 +153,6 @@ Checks: "-*,
# readability-inconsistent-declaration-parameter-name, # in this codebase this check will break a lot of arg names
# readability-static-accessed-through-instance, # this check is probably unnecessary. it makes the code less readable
# readability-identifier-naming, # https://github.com/XRPLF/rippled/pull/6571
#
# modernize-concat-nested-namespaces,
# modernize-pass-by-value,
# modernize-type-traits,
# modernize-use-designated-initializers,
# modernize-use-emplace,
# modernize-use-equals-default,
# modernize-use-equals-delete,
# modernize-use-override,
# modernize-use-ranges,
# modernize-use-starts-ends-with,
# modernize-use-std-numbers,
# modernize-use-using,
# ---
#
CheckOptions:

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script changes the binary name from `rippled` to `xrpld`, and reverses

View File

@@ -8,16 +8,16 @@ set -e
SED_COMMAND=sed
HEAD_COMMAND=head
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v ghead &> /dev/null; then
echo "Error: ghead is not installed. Please install it using 'brew install coreutils'."
exit 1
fi
HEAD_COMMAND=ghead
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v ghead &> /dev/null; then
echo "Error: ghead is not installed. Please install it using 'brew install coreutils'."
exit 1
fi
HEAD_COMMAND=ghead
fi
# This script renames CMake files from `RippleXXX.cmake` or `RippledXXX.cmake`
@@ -44,10 +44,10 @@ pushd "${DIRECTORY}"
find cmake -type f -name 'Rippled*.cmake' -exec bash -c 'mv "${1}" "${1/Rippled/Xrpl}"' - {} \;
find cmake -type f -name 'Ripple*.cmake' -exec bash -c 'mv "${1}" "${1/Ripple/Xrpl}"' - {} \;
if [ -e cmake/xrpl_add_test.cmake ]; then
mv cmake/xrpl_add_test.cmake cmake/XrplAddTest.cmake
mv cmake/xrpl_add_test.cmake cmake/XrplAddTest.cmake
fi
if [ -e include/xrpl/proto/ripple.proto ]; then
mv include/xrpl/proto/ripple.proto include/xrpl/proto/xrpl.proto
mv include/xrpl/proto/ripple.proto include/xrpl/proto/xrpl.proto
fi
# Rename inside the files.
@@ -71,14 +71,14 @@ ${SED_COMMAND} -i 's@xrpl/validator-keys-tool@ripple/validator-keys-tool@' cmake
# Ensure the name of the binary and config remain 'rippled' for now.
${SED_COMMAND} -i -E 's/xrpld(-example)?\.cfg/rippled\1.cfg/g' cmake/XrplInstall.cmake
if grep -q '"xrpld"' cmake/XrplCore.cmake; then
# The script has been rerun, so just restore the name of the binary.
${SED_COMMAND} -i 's/"xrpld"/"rippled"/' cmake/XrplCore.cmake
# The script has been rerun, so just restore the name of the binary.
${SED_COMMAND} -i 's/"xrpld"/"rippled"/' cmake/XrplCore.cmake
elif ! grep -q '"rippled"' cmake/XrplCore.cmake; then
${HEAD_COMMAND} -n -1 cmake/XrplCore.cmake > cmake.tmp
echo ' # For the time being, we will keep the name of the binary as it was.' >> cmake.tmp
echo ' set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled")' >> cmake.tmp
tail -1 cmake/XrplCore.cmake >> cmake.tmp
mv cmake.tmp cmake/XrplCore.cmake
${HEAD_COMMAND} -n -1 cmake/XrplCore.cmake > cmake.tmp
echo ' # For the time being, we will keep the name of the binary as it was.' >> cmake.tmp
echo ' set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled")' >> cmake.tmp
tail -1 cmake/XrplCore.cmake >> cmake.tmp
mv cmake.tmp cmake/XrplCore.cmake
fi
# Restore the symlink from 'xrpld' to 'rippled'.

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames the config from `rippled.cfg` to `xrpld.cfg`, and updates
@@ -32,28 +32,28 @@ pushd "${DIRECTORY}"
# Add the xrpld.cfg to the .gitignore.
if ! grep -q 'xrpld.cfg' .gitignore; then
${SED_COMMAND} -i '/rippled.cfg/a\
${SED_COMMAND} -i '/rippled.cfg/a\
/xrpld.cfg' .gitignore
fi
# Rename the files.
if [ -e rippled.cfg ]; then
mv rippled.cfg xrpld.cfg
mv rippled.cfg xrpld.cfg
fi
if [ -e cfg/rippled-example.cfg ]; then
mv cfg/rippled-example.cfg cfg/xrpld-example.cfg
mv cfg/rippled-example.cfg cfg/xrpld-example.cfg
fi
# Rename inside the files.
DIRECTORIES=("cfg" "cmake" "include" "src")
for DIRECTORY in "${DIRECTORIES[@]}"; do
echo "Processing directory: ${DIRECTORY}"
echo "Processing directory: ${DIRECTORY}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.cmake" -o -name "*.txt" -o -name "*.cfg" -o -name "*.md" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i -E 's/rippled(-example)?[ .]cfg/xrpld\1.cfg/g' "${FILE}"
${SED_COMMAND} -i 's/rippleConfig/xrpldConfig/g' "${FILE}"
done
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.cmake" -o -name "*.txt" -o -name "*.cfg" -o -name "*.md" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i -E 's/rippled(-example)?[ .]cfg/xrpld\1.cfg/g' "${FILE}"
${SED_COMMAND} -i 's/rippleConfig/xrpldConfig/g' "${FILE}"
done
done
${SED_COMMAND} -i 's/rippled/xrpld/g' cfg/xrpld-example.cfg
${SED_COMMAND} -i 's/rippled/xrpld/g' src/test/core/Config_test.cpp

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script removes superfluous copyright notices in source and header files
@@ -43,56 +43,56 @@ ${SED_COMMAND} -i -E "s@\\\t@${PLACEHOLDER_TAB}@g" src/test/rpc/ValidatorInfo_te
# Process the include/ and src/ directories.
DIRECTORIES=("include" "src")
for DIRECTORY in "${DIRECTORIES[@]}"; do
echo "Processing directory: ${DIRECTORY}"
echo "Processing directory: ${DIRECTORY}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.macro" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
# Handle the cases where the copyright notice is enclosed in /* ... */
# and usually surrounded by //---- and //======.
${SED_COMMAND} -z -i -E 's@^//-------+\n+@@' "${FILE}"
${SED_COMMAND} -z -i -E 's@^.*Copyright.+(Ripple|Bougalis|Falco|Hinnant|Null|Ritchford|XRPLF).+PERFORMANCE OF THIS SOFTWARE\.\n\*/\n+@@' "${FILE}" # cspell: ignore Bougalis Falco Hinnant Ritchford
${SED_COMMAND} -z -i -E 's@^//=======+\n+@@' "${FILE}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.macro" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
# Handle the cases where the copyright notice is enclosed in /* ... */
# and usually surrounded by //---- and //======.
${SED_COMMAND} -z -i -E 's@^//-------+\n+@@' "${FILE}"
${SED_COMMAND} -z -i -E 's@^.*Copyright.+(Ripple|Bougalis|Falco|Hinnant|Null|Ritchford|XRPLF).+PERFORMANCE OF THIS SOFTWARE\.\n\*/\n+@@' "${FILE}" # cspell: ignore Bougalis Falco Hinnant Ritchford
${SED_COMMAND} -z -i -E 's@^//=======+\n+@@' "${FILE}"
# Handle the cases where the copyright notice is commented out with //.
${SED_COMMAND} -z -i -E 's@^//\n// Copyright.+Falco \(vinnie dot falco at gmail dot com\)\n//\n+@@' "${FILE}" # cspell: ignore Vinnie Falco
done
# Handle the cases where the copyright notice is commented out with //.
${SED_COMMAND} -z -i -E 's@^//\n// Copyright.+Falco \(vinnie dot falco at gmail dot com\)\n//\n+@@' "${FILE}" # cspell: ignore Vinnie Falco
done
done
# Restore copyright notices that were removed from specific files, without
# restoring the verbiage that is already present in LICENSE.md. Ensure that if
# the script is run multiple times, duplicate notices are not added.
if ! grep -q 'Raw Material Software' include/xrpl/beast/core/CurrentThreadName.h; then
echo -e "// Portions of this file are from JUCE (http://www.juce.com).\n// Copyright (c) 2013 - Raw Material Software Ltd.\n// Please visit http://www.juce.com\n\n$(cat include/xrpl/beast/core/CurrentThreadName.h)" > include/xrpl/beast/core/CurrentThreadName.h
echo -e "// Portions of this file are from JUCE (http://www.juce.com).\n// Copyright (c) 2013 - Raw Material Software Ltd.\n// Please visit http://www.juce.com\n\n$(cat include/xrpl/beast/core/CurrentThreadName.h)" > include/xrpl/beast/core/CurrentThreadName.h
fi
if ! grep -q 'Dev Null' src/test/app/NetworkID_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/NetworkID_test.cpp)" > src/test/app/NetworkID_test.cpp
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/NetworkID_test.cpp)" > src/test/app/NetworkID_test.cpp
fi
if ! grep -q 'Dev Null' src/test/app/tx/apply_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/tx/apply_test.cpp)" > src/test/app/tx/apply_test.cpp
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/tx/apply_test.cpp)" > src/test/app/tx/apply_test.cpp
fi
if ! grep -q 'Dev Null' src/test/rpc/ManifestRPC_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ManifestRPC_test.cpp)" > src/test/rpc/ManifestRPC_test.cpp
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ManifestRPC_test.cpp)" > src/test/rpc/ManifestRPC_test.cpp
fi
if ! grep -q 'Dev Null' src/test/rpc/ValidatorInfo_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ValidatorInfo_test.cpp)" > src/test/rpc/ValidatorInfo_test.cpp
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ValidatorInfo_test.cpp)" > src/test/rpc/ValidatorInfo_test.cpp
fi
if ! grep -q 'Dev Null' src/xrpld/rpc/handlers/server_info/Manifest.cpp; then
echo -e "// Copyright (c) 2019 Dev Null Productions\n\n$(cat src/xrpld/rpc/handlers/server_info/Manifest.cpp)" > src/xrpld/rpc/handlers/server_info/Manifest.cpp
echo -e "// Copyright (c) 2019 Dev Null Productions\n\n$(cat src/xrpld/rpc/handlers/server_info/Manifest.cpp)" > src/xrpld/rpc/handlers/server_info/Manifest.cpp
fi
if ! grep -q 'Dev Null' src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp; then
echo -e "// Copyright (c) 2019 Dev Null Productions\n\n$(cat src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp)" > src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp
echo -e "// Copyright (c) 2019 Dev Null Productions\n\n$(cat src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp)" > src/xrpld/rpc/handlers/admin/status/ValidatorInfo.cpp
fi
if ! grep -q 'Bougalis' include/xrpl/basics/SlabAllocator.h; then
echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/SlabAllocator.h)" > include/xrpl/basics/SlabAllocator.h # cspell: ignore Nikolaos Bougalis nikb
echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/SlabAllocator.h)" > include/xrpl/basics/SlabAllocator.h # cspell: ignore Nikolaos Bougalis nikb
fi
if ! grep -q 'Bougalis' include/xrpl/basics/spinlock.h; then
echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/spinlock.h)" > include/xrpl/basics/spinlock.h # cspell: ignore Nikolaos Bougalis nikb
echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/spinlock.h)" > include/xrpl/basics/spinlock.h # cspell: ignore Nikolaos Bougalis nikb
fi
if ! grep -q 'Bougalis' include/xrpl/basics/tagged_integer.h; then
echo -e "// Copyright (c) 2014, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/tagged_integer.h)" > include/xrpl/basics/tagged_integer.h # cspell: ignore Nikolaos Bougalis nikb
echo -e "// Copyright (c) 2014, Nikolaos D. Bougalis <nikb@bougalis.net>\n\n$(cat include/xrpl/basics/tagged_integer.h)" > include/xrpl/basics/tagged_integer.h # cspell: ignore Nikolaos Bougalis nikb
fi
if ! grep -q 'Ritchford' include/xrpl/beast/utility/Zero.h; then
echo -e "// Copyright (c) 2014, Tom Ritchford <tom@swirly.com>\n\n$(cat include/xrpl/beast/utility/Zero.h)" > include/xrpl/beast/utility/Zero.h # cspell: ignore Ritchford
echo -e "// Copyright (c) 2014, Tom Ritchford <tom@swirly.com>\n\n$(cat include/xrpl/beast/utility/Zero.h)" > include/xrpl/beast/utility/Zero.h # cspell: ignore Ritchford
fi
# Restore newlines and tabs in string literals in the affected file.

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames definitions, such as include guards, in this project.

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames all remaining references to `ripple` and `rippled` to

View File

@@ -23,8 +23,8 @@ fi
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
if grep -q "#ifndef XRPL_" "${FILE}"; then
echo "Please replace all include guards by #pragma once."
exit 1
echo "Please replace all include guards by #pragma once."
exit 1
fi
done
echo "Checking complete."

View File

@@ -6,11 +6,11 @@ set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames the `ripple` namespace to `xrpl` in this project.
@@ -35,15 +35,15 @@ pushd "${DIRECTORY}"
DIRECTORIES=("include" "src" "tests")
for DIRECTORY in "${DIRECTORIES[@]}"; do
echo "Processing directory: ${DIRECTORY}"
echo "Processing directory: ${DIRECTORY}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.macro" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i 's/namespace ripple/namespace xrpl/g' "${FILE}"
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
${SED_COMMAND} -i 's/"ripple:/"xrpl::/g' "${FILE}"
${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' "${FILE}"
done
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.macro" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i 's/namespace ripple/namespace xrpl/g' "${FILE}"
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
${SED_COMMAND} -i 's/"ripple:/"xrpl::/g' "${FILE}"
${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' "${FILE}"
done
done
# Special case for NuDBFactory that has ripple twice in the test suite name.

View File

@@ -210,6 +210,22 @@ jobs:
retention-days: 3
if-no-files-found: error
- name: Export server definitions
if: ${{ runner.os != 'Windows' && !inputs.build_only && env.VOIDSTAR_ENABLED != 'true' }}
working-directory: ${{ env.BUILD_DIR }}
run: |
set -o pipefail
./xrpld --definitions | python3 -m json.tool > server_definitions.json
- name: Upload server definitions
if: ${{ github.event.repository.visibility == 'public' && inputs.config_name == 'debian-bookworm-gcc-13-amd64-release' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: server-definitions
path: ${{ env.BUILD_DIR }}/server_definitions.json
retention-days: 3
if-no-files-found: error
- name: Check linking (Linux)
if: ${{ runner.os == 'Linux' && env.SANITIZERS_ENABLED == 'false' }}
working-directory: ${{ env.BUILD_DIR }}

View File

@@ -80,7 +80,7 @@ jobs:
env:
TARGETS: ${{ inputs.files != '' && inputs.files || 'src tests' }}
run: |
run-clang-tidy -j ${{ steps.nproc.outputs.nproc }} -p "${BUILD_DIR}" -quiet -allow-no-checks ${TARGETS} 2>&1 | tee clang-tidy-output.txt
run-clang-tidy -j ${{ steps.nproc.outputs.nproc }} -p "${BUILD_DIR}" -quiet -fix -allow-no-checks ${TARGETS} 2>&1 | tee clang-tidy-output.txt
- name: Upload clang-tidy output
if: ${{ github.event.repository.visibility == 'public' && steps.run_clang_tidy.outcome != 'success' }}
@@ -90,8 +90,21 @@ jobs:
path: clang-tidy-output.txt
retention-days: 30
- name: Generate git diff
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
run: |
git diff | tee clang-tidy-git-diff.txt
- name: Upload clang-tidy diff output
if: ${{ github.event.repository.visibility == 'public' && steps.run_clang_tidy.outcome != 'success' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: clang-tidy-git-diff
path: clang-tidy-git-diff.txt
retention-days: 30
- name: Create an issue
if: steps.run_clang_tidy.outcome != 'success' && inputs.create_issue_on_failure
if: ${{ steps.run_clang_tidy.outcome != 'success' && inputs.create_issue_on_failure }}
id: create_issue
shell: bash
env:
@@ -156,7 +169,7 @@ jobs:
rm -f create_issue.log issue.md clang-tidy-output.txt
- name: Fail the workflow if clang-tidy failed
if: steps.run_clang_tidy.outcome != 'success'
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
run: |
echo "Clang-tidy check failed!"
exit 1

View File

@@ -20,6 +20,22 @@ repos:
- id: check-merge-conflict
args: [--assume-in-merge]
- repo: local
hooks:
- id: clang-tidy
name: "clang-tidy (enable with: TIDY=1)"
entry: ./bin/pre-commit/clang_tidy_check.py
language: python
types_or: [c++, c]
exclude: ^include/xrpl/protocol_autogen
pass_filenames: false # script determines the staged files itself
- id: fix-include-style
name: fix include style
entry: ./bin/pre-commit/fix_include_style.py
language: python
types_or: [c++, c]
exclude: ^include/xrpl/protocol_autogen/(transactions|ledger_entries)/
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: cd481d7b0bfb5c7b3090c21846317f9a8262e891 # frozen: v22.1.0
hooks:
@@ -44,6 +60,12 @@ repos:
hooks:
- id: black
- repo: https://github.com/openstack/bashate
rev: 5798d24d571676fc407e81df574c1ef57b520f23 # frozen: 2.1.1
hooks:
- id: bashate
args: ["--ignore=E006"]
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: a42085ade523f591dca134379a595e7859986445 # frozen: v9.7.0
hooks:

View File

@@ -267,6 +267,26 @@ See the [environment setup guide](./docs/build/environment.md#clang-tidy) for pl
Before running clang-tidy, you must build the project to generate required files (particularly protobuf headers). Refer to [`BUILD.md`](./BUILD.md) for build instructions.
#### Via pre-commit (recommended)
If you have already installed the pre-commit hooks (see above), you can run clang-tidy on your staged files using:
```
TIDY=1 pre-commit run clang-tidy
```
This runs clang-tidy locally with the same configuration/flags as CI, scoped to your staged C++ files. The `TIDY=1` environment variable is required to opt in — without it the hook is skipped.
You can also have clang-tidy run automatically on every `git commit` by setting `TIDY=1` in your shell environment:
```
export TIDY=1
```
With this set, the hook will run as part of `git commit` alongside the other pre-commit checks.
#### Manually
Then run clang-tidy on your local changes:
```

View File

@@ -1,14 +1,13 @@
#!/bin/bash
if [[ $# -ne 1 || "$1" == "--help" || "$1" == "-h" ]]
then
name=$( basename $0 )
cat <<- USAGE
Usage: $name <username>
if [[ $# -ne 1 || "$1" == "--help" || "$1" == "-h" ]]; then
name=$( basename $0 )
cat <<- USAGE
Usage: $name <username>
Where <username> is the Github username of the upstream repo. e.g. XRPLF
Where <username> is the Github username of the upstream repo. e.g. XRPLF
USAGE
exit 0
exit 0
fi
# Create upstream remotes based on origin
@@ -16,10 +15,9 @@ shift
user="$1"
# Get the origin URL. Expect it be an SSH-style URL
origin=$( git remote get-url origin )
if [[ "${origin}" == "" ]]
then
echo Invalid origin remote >&2
exit 1
if [[ "${origin}" == "" ]]; then
echo Invalid origin remote >&2
exit 1
fi
# echo "Origin: ${origin}"
# Parse the origin
@@ -30,11 +28,9 @@ IFS='@' read sshuser server <<< "${remote}"
# echo "SSHUser: ${sshuser}, Server: ${server}"
IFS='/' read originuser repo <<< "${originpath}"
# echo "Originuser: ${originuser}, Repo: ${repo}"
if [[ "${sshuser}" == "" || "${server}" == "" || "${originuser}" == ""
|| "${repo}" == "" ]]
then
echo "Can't parse origin URL: ${origin}" >&2
exit 1
if [[ "${sshuser}" == "" || "${server}" == "" || "${originuser}" == "" || "${repo}" == "" ]]; then
echo "Can't parse origin URL: ${origin}" >&2
exit 1
fi
upstream="https://${server}/${user}/${repo}"
upstreampush="${remote}:${user}/${repo}"
@@ -42,42 +38,34 @@ upstreamgroup="upstream upstream-push"
current=$( git remote get-url upstream 2>/dev/null )
currentpush=$( git remote get-url upstream-push 2>/dev/null )
currentgroup=$( git config remotes.upstreams )
if [[ "${current}" == "${upstream}" ]]
then
echo "Upstream already set up correctly. Skip"
elif [[ -n "${current}" && "${current}" != "${upstream}" &&
"${current}" != "${upstreampush}" ]]
then
echo "Upstream already set up as: ${current}. Skip"
if [[ "${current}" == "${upstream}" ]]; then
echo "Upstream already set up correctly. Skip"
elif [[ -n "${current}" && "${current}" != "${upstream}" && "${current}" != "${upstreampush}" ]]; then
echo "Upstream already set up as: ${current}. Skip"
else
if [[ "${current}" == "${upstreampush}" ]]
then
echo "Upstream set to dangerous push URL. Update."
_run git remote rename upstream upstream-push || \
_run git remote remove upstream
currentpush=$( git remote get-url upstream-push 2>/dev/null )
fi
_run git remote add upstream "${upstream}"
if [[ "${current}" == "${upstreampush}" ]]; then
echo "Upstream set to dangerous push URL. Update."
_run git remote rename upstream upstream-push || \
_run git remote remove upstream
currentpush=$( git remote get-url upstream-push 2>/dev/null )
fi
_run git remote add upstream "${upstream}"
fi
if [[ "${currentpush}" == "${upstreampush}" ]]
then
echo "upstream-push already set up correctly. Skip"
elif [[ -n "${currentpush}" && "${currentpush}" != "${upstreampush}" ]]
then
echo "upstream-push already set up as: ${currentpush}. Skip"
if [[ "${currentpush}" == "${upstreampush}" ]]; then
echo "upstream-push already set up correctly. Skip"
elif [[ -n "${currentpush}" && "${currentpush}" != "${upstreampush}" ]]; then
echo "upstream-push already set up as: ${currentpush}. Skip"
else
_run git remote add upstream-push "${upstreampush}"
_run git remote add upstream-push "${upstreampush}"
fi
if [[ "${currentgroup}" == "${upstreamgroup}" ]]
then
echo "Upstreams group already set up correctly. Skip"
elif [[ -n "${currentgroup}" && "${currentgroup}" != "${upstreamgroup}" ]]
then
echo "Upstreams group already set up as: ${currentgroup}. Skip"
if [[ "${currentgroup}" == "${upstreamgroup}" ]]; then
echo "Upstreams group already set up correctly. Skip"
elif [[ -n "${currentgroup}" && "${currentgroup}" != "${upstreamgroup}" ]]; then
echo "Upstreams group already set up as: ${currentgroup}. Skip"
else
_run git config --add remotes.upstreams "${upstreamgroup}"
_run git config --add remotes.upstreams "${upstreamgroup}"
fi
_run git fetch --jobs=$(nproc) upstreams

View File

@@ -1,17 +1,16 @@
#!/bin/bash
if [[ $# -lt 3 || "$1" == "--help" || "$1" = "-h" ]]
then
name=$( basename $0 )
cat <<- USAGE
Usage: $name workbranch base/branch user/branch [user/branch [...]]
if [[ $# -lt 3 || "$1" == "--help" || "$1" = "-h" ]]; then
name=$( basename $0 )
cat <<- USAGE
Usage: $name workbranch base/branch user/branch [user/branch [...]]
* workbranch will be created locally from base/branch
* base/branch and user/branch may be specified as user:branch to allow
easy copying from Github PRs
* Remotes for each user must already be set up
* workbranch will be created locally from base/branch
* base/branch and user/branch may be specified as user:branch to allow
easy copying from Github PRs
* Remotes for each user must already be set up
USAGE
exit 0
exit 0
fi
work="$1"
@@ -24,9 +23,8 @@ unset branches[0]
set -e
users=()
for b in "${branches[@]}"
do
users+=( $( echo $b | cut -d/ -f1 ) )
for b in "${branches[@]}"; do
users+=( $( echo $b | cut -d/ -f1 ) )
done
users=( $( printf '%s\n' "${users[@]}" | sort -u ) )
@@ -34,10 +32,9 @@ users=( $( printf '%s\n' "${users[@]}" | sort -u ) )
git fetch --multiple upstreams "${users[@]}"
git checkout -B "$work" --no-track "$base"
for b in "${branches[@]}"
do
git merge --squash "${b}"
git commit -S # Use the commit message provided on the PR
for b in "${branches[@]}"; do
git merge --squash "${b}"
git commit -S # Use the commit message provided on the PR
done
# Make sure the commits look right
@@ -47,13 +44,11 @@ parts=( $( echo $base | sed "s/\// /" ) )
repo="${parts[0]}"
b="${parts[1]}"
push=$repo
if [[ "$push" == "upstream" ]]
then
push="upstream-push"
if [[ "$push" == "upstream" ]]; then
push="upstream-push"
fi
if [[ "$repo" == "upstream" ]]
then
repo="upstreams"
if [[ "$repo" == "upstream" ]]; then
repo="upstreams"
fi
cat << PUSH

View File

@@ -1,17 +1,16 @@
#!/bin/bash
if [[ $# -ne 3 || "$1" == "--help" || "$1" = "-h" ]]
then
name=$( basename $0 )
cat <<- USAGE
Usage: $name workbranch base/branch version
if [[ $# -ne 3 || "$1" == "--help" || "$1" = "-h" ]]; then
name=$( basename $0 )
cat <<- USAGE
Usage: $name workbranch base/branch version
* workbranch will be created locally from base/branch. If it exists,
it will be reused, so make sure you don't overwrite any work.
* base/branch may be specified as user:branch to allow easy copying
from Github PRs.
* workbranch will be created locally from base/branch. If it exists,
it will be reused, so make sure you don't overwrite any work.
* base/branch may be specified as user:branch to allow easy copying
from Github PRs.
USAGE
exit 0
exit 0
fi
work="$1"
@@ -30,10 +29,9 @@ git fetch upstreams
git checkout -B "${work}" --no-track "${base}"
push=$( git rev-parse --abbrev-ref --symbolic-full-name '@{push}' \
2>/dev/null ) || true
if [[ "${push}" != "" ]]
then
echo "Warning: ${push} may already exist."
2>/dev/null ) || true
if [[ "${push}" != "" ]]; then
echo "Warning: ${push} may already exist."
fi
build=$( find -name BuildInfo.cpp )

View File

@@ -0,0 +1,206 @@
#!/usr/bin/env python3
"""Pre-commit hook that runs clang-tidy on changed files using run-clang-tidy."""
from __future__ import annotations
import json
import os
import re
import shutil
import subprocess
import sys
from collections import defaultdict
from pathlib import Path
HEADER_EXTENSIONS = {".h", ".hpp", ".ipp"}
SOURCE_EXTENSIONS = {".cpp"}
INCLUDE_RE = re.compile(r"^\s*#\s*include\s*[<\"]([^>\"]+)[>\"]")
def find_run_clang_tidy() -> str | None:
for candidate in ("run-clang-tidy-21", "run-clang-tidy"):
if path := shutil.which(candidate):
return path
return None
def find_build_dir(repo_root: Path) -> Path | None:
for name in (".build", "build"):
candidate = repo_root / name
if (candidate / "compile_commands.json").exists():
return candidate
return None
def build_include_graph(build_dir: Path, repo_root: Path) -> tuple[dict, set]:
"""
Scan all files reachable from compile_commands.json and build an inverted include graph.
Returns:
inverted: header_path -> set of files that include it
source_files: set of all TU paths from compile_commands.json
"""
with open(build_dir / "compile_commands.json") as f:
db = json.load(f)
source_files = {Path(e["file"]).resolve() for e in db}
include_roots = [repo_root / "include", repo_root / "src"]
inverted: dict[Path, set[Path]] = defaultdict(set)
to_scan: set[Path] = set(source_files)
scanned: set[Path] = set()
while to_scan:
file = to_scan.pop()
if file in scanned or not file.exists():
continue
scanned.add(file)
content = file.read_text()
for line in content.splitlines():
m = INCLUDE_RE.match(line)
if not m:
continue
for root in include_roots:
candidate = (root / m.group(1)).resolve()
if candidate.exists():
inverted[candidate].add(file)
if candidate not in scanned:
to_scan.add(candidate)
break
return inverted, source_files
def find_tus_for_headers(
headers: list[Path],
inverted: dict[Path, set[Path]],
source_files: set[Path],
) -> set[Path]:
"""
For each header, pick one TU that transitively includes it.
Prefers a TU whose stem matches the header's stem, otherwise picks the first found.
"""
result: set[Path] = set()
for header in headers:
preferred: Path | None = None
visited: set[Path] = {header}
stack: list[Path] = [header]
while stack:
h = stack.pop()
for inc in inverted.get(h, ()):
if inc in source_files:
if inc.stem == header.stem:
preferred = inc
break
if preferred is None:
preferred = inc
if inc not in visited:
visited.add(inc)
stack.append(inc)
if preferred is not None and preferred.stem == header.stem:
break
if preferred is not None:
result.add(preferred)
return result
def resolve_files(
input_files: list[str], build_dir: Path, repo_root: Path
) -> list[str]:
"""
Split input into source files and headers. Source files are passed through;
headers are resolved to the TUs that transitively include them.
"""
sources: list[Path] = []
headers: list[Path] = []
for f in input_files:
p = Path(f).resolve()
if p.suffix in SOURCE_EXTENSIONS:
sources.append(p)
elif p.suffix in HEADER_EXTENSIONS:
headers.append(p)
if not headers:
return [str(p) for p in sources]
print(
f"Resolving {len(headers)} header(s) to compilation units...", file=sys.stderr
)
inverted, source_files = build_include_graph(build_dir, repo_root)
tus = find_tus_for_headers(headers, inverted, source_files)
if not tus:
print(
"Warning: no compilation units found that include the modified headers; "
"skipping clang-tidy for headers.",
file=sys.stderr,
)
return sorted({str(p) for p in (*sources, *tus)})
def staged_files(repo_root: Path) -> list[str]:
result = subprocess.run(
["git", "diff", "--staged", "--name-only", "--diff-filter=d"],
capture_output=True,
text=True,
cwd=repo_root,
)
if result.returncode != 0:
print(
"clang-tidy check failed: 'git diff --staged' command failed.",
file=sys.stderr,
)
if result.stderr:
print(result.stderr, file=sys.stderr)
sys.exit(result.returncode or 1)
return [str(repo_root / p) for p in result.stdout.splitlines() if p]
def main():
if not os.environ.get("TIDY"):
return 0
repo_root = Path(__file__).parent.parent
files = staged_files(repo_root)
if not files:
return 0
run_clang_tidy = find_run_clang_tidy()
if not run_clang_tidy:
print(
"clang-tidy check failed: TIDY is enabled but neither "
"'run-clang-tidy-21' nor 'run-clang-tidy' was found in PATH.",
file=sys.stderr,
)
return 1
build_dir = find_build_dir(repo_root)
if not build_dir:
print(
"clang-tidy check failed: no build directory with compile_commands.json found "
"(looked for .build/ and build/)",
file=sys.stderr,
)
return 1
tidy_files = resolve_files(files, build_dir, repo_root)
if not tidy_files:
return 0
result = subprocess.run(
[run_clang_tidy, "-quiet", "-p", str(build_dir), "-fix", "-allow-no-checks"]
+ tidy_files
)
return result.returncode
if __name__ == "__main__":
sys.exit(main())

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env python3
"""
Converts quoted includes (#include "...") to angle-bracket includes
(#include <...>), which is the required style in this project.
Usage: ./bin/pre-commit/fix_include_style.py <file1> <file2> ...
"""
import re
import sys
from pathlib import Path
PATTERN = re.compile(r'^(\s*#include\s*)"([^"]+)"', re.MULTILINE)
def fix_includes(path: Path) -> bool:
original = path.read_text(encoding="utf-8")
fixed = PATTERN.sub(r"\1<\2>", original)
if fixed != original:
path.write_text(fixed, encoding="utf-8")
return False
return True
def main() -> int:
files = [Path(f) for f in sys.argv[1:]]
success = True
for path in files:
success &= fix_includes(path)
return 0 if success else 1
if __name__ == "__main__":
sys.exit(main())

View File

@@ -1416,6 +1416,12 @@
# in this section to a comma-separated list of the addresses
# of your Clio servers, in order to bypass xrpld's rate limiting.
#
# TLS/SSL can be enabled for gRPC by specifying ssl_cert and ssl_key.
# Both parameters must be provided together. The ssl_cert_chain parameter
# is optional and provides intermediate CA certificates for the certificate
# chain. The ssl_client_ca parameter is optional and enables mutual TLS
# (client certificate verification).
#
# This port is commented out but can be enabled by removing
# the '#' from each corresponding line including the entry under [server]
#
@@ -1465,11 +1471,74 @@ admin = 127.0.0.1
protocol = ws
send_queue_limit = 500
# gRPC TLS/SSL Configuration
#
# The gRPC port supports optional TLS/SSL encryption. When TLS is not
# configured, the gRPC server will accept unencrypted connections.
#
# ssl_cert = <filename>
# ssl_key = <filename>
#
# To enable TLS for gRPC, both ssl_cert and ssl_key must be specified.
# If only one is provided, xrpld will fail to start.
#
# ssl_cert: Path to the server's SSL certificate file in PEM format.
# ssl_key: Path to the server's SSL private key file in PEM format.
#
# When configured, the gRPC server will only accept TLS-encrypted
# connections. Clients must use TLS (secure) channel credentials rather
# than plaintext / insecure connections.
#
# ssl_cert_chain = <filename>
#
# Optional. Path to intermediate CA certificate(s) in PEM format that
# complete the server's certificate chain.
#
# This file should contain the intermediate CA certificate(s) needed
# to build a trust chain from the server certificate (ssl_cert) to a
# root CA that clients trust. Multiple certificates should be
# concatenated in PEM format.
#
# This is needed when your server certificate was signed by an
# intermediate CA rather than directly by a root CA. Without this,
# clients may fail to verify your server certificate.
#
# If not specified, only the server certificate from ssl_cert will be
# presented to clients.
#
# ssl_client_ca = <filename>
#
# Optional. Path to a CA certificate file in PEM format for verifying
# client certificates (mutual TLS / mTLS).
#
# When specified, the gRPC server will verify client certificates
# against this CA. This enables mutual authentication where both the
# server and client verify each other's identity.
#
# This is typically NOT needed for public-facing gRPC servers. Only
# use this if you want to restrict access to clients with valid
# certificates signed by the specified CA.
#
# If not specified, the server will use one-way TLS (server
# authentication only) and will accept connections from any client.
#
[port_grpc]
port = 50051
ip = 127.0.0.1
secure_gateway = 127.0.0.1
# Optional TLS/SSL configuration for gRPC
# To enable TLS, uncomment and configure both ssl_cert and ssl_key:
#ssl_cert = /etc/ssl/certs/grpc-server.crt
#ssl_key = /etc/ssl/private/grpc-server.key
# Optional: Include intermediate CA certificates for complete certificate chain
#ssl_cert_chain = /etc/ssl/certs/grpc-intermediate-ca.crt
# Optional: Enable mutual TLS (client certificate verification)
# Uncomment to require and verify client certificates:
#ssl_client_ca = /etc/ssl/certs/grpc-client-ca.crt
#[port_ws_public]
#port = 6005
#ip = 127.0.0.1

View File

@@ -23,14 +23,14 @@ rm -f conan.lock
# first create command will create a new lockfile, while the subsequent create
# commands will merge any additional dependencies into the created lockfile.
conan lock create . \
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/linux.profile
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/linux.profile
conan lock create . \
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/macos.profile
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/macos.profile
conan lock create . \
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/windows.profile
--options '&:jemalloc=True' \
--options '&:rocksdb=True' \
--profile:all=conan/lockfile/windows.profile

View File

@@ -33,7 +33,7 @@ private:
public:
/** Create an empty section. */
explicit Section(std::string const& name = "");
explicit Section(std::string name = "");
/** Returns the name of this section. */
std::string const&
@@ -275,8 +275,7 @@ public:
bool
had_trailing_comments() const
{
return std::any_of(
map_.cbegin(), map_.cend(), [](auto s) { return s.second.had_trailing_comments(); });
return std::ranges::any_of(map_, [](auto s) { return s.second.had_trailing_comments(); });
}
protected:

View File

@@ -92,7 +92,7 @@ public:
{
// Ensure the slice isn't a subset of the buffer.
XRPL_ASSERT(
s.size() == 0 || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_,
s.empty() || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_,
"xrpl::Buffer::operator=(Slice) : input not a subset");
if (auto p = alloc(s.size()))

View File

@@ -9,9 +9,7 @@
#include <stdexcept>
#include <vector>
namespace xrpl {
namespace compression_algorithms {
namespace xrpl::compression_algorithms {
/** LZ4 block compression.
* @tparam BufferFactory Callable object or lambda.
@@ -141,6 +139,4 @@ lz4Decompress(
return lz4Decompress(chunk, inSize, decompressed, decompressedSize);
}
} // namespace compression_algorithms
} // namespace xrpl
} // namespace xrpl::compression_algorithms

View File

@@ -61,7 +61,7 @@ template <class E>
class Unexpected
{
public:
static_assert(!std::is_same<E, void>::value, "E must not be void");
static_assert(!std::is_same_v<E, void>, "E must not be void");
Unexpected() = delete;

View File

@@ -4,6 +4,7 @@
#include <memory>
#include <unordered_map>
#include <utility>
namespace xrpl {
@@ -28,7 +29,7 @@ struct LocalValues
T t_;
Value() = default;
explicit Value(T const& t) : t_(t)
explicit Value(T t) : t_(std::move(t))
{
}

View File

@@ -38,7 +38,7 @@ private:
std::string partition_;
public:
Sink(std::string const& partition, beast::severities::Severity thresh, Logs& logs);
Sink(std::string partition, beast::severities::Severity thresh, Logs& logs);
Sink(Sink const&) = delete;
Sink&

View File

@@ -66,12 +66,10 @@ class SlabAllocator
}
}
~SlabBlock()
{
// Calling this destructor will release the allocated memory but
// will not properly destroy any objects that are constructed in
// the block itself.
}
// Calling this destructor will release the allocated memory but
// will not properly destroy any objects that are constructed in
// the block itself.
~SlabBlock() = default;
SlabBlock(SlabBlock const& other) = delete;
SlabBlock&
@@ -176,12 +174,10 @@ public:
SlabAllocator&
operator=(SlabAllocator&& other) = delete;
~SlabAllocator()
{
// FIXME: We can't destroy the memory blocks we've allocated, because
// we can't be sure that they are not being used. Cleaning the
// shutdown process up could make this possible.
}
// FIXME: We can't destroy the memory blocks we've allocated, because
// we can't be sure that they are not being used. Cleaning the
// shutdown process up could make this possible.
~SlabAllocator() = default;
/** Returns the size of the memory block this allocator returns. */
constexpr std::size_t
@@ -288,7 +284,7 @@ class SlabAllocatorSet
{
private:
// The list of allocators that belong to this set
boost::container::static_vector<SlabAllocator<Type>, 64> allocators_;
boost::container::static_vector<SlabAllocator<Type>, 64> allocators_{};
std::size_t maxSize_ = 0;
@@ -347,9 +343,7 @@ public:
SlabAllocatorSet&
operator=(SlabAllocatorSet&& other) = delete;
~SlabAllocatorSet()
{
}
~SlabAllocatorSet() = default;
/** Returns a suitably aligned pointer, if one is available.

View File

@@ -211,14 +211,14 @@ operator<<(Stream& s, Slice const& v)
}
template <class T, std::size_t N>
std::enable_if_t<std::is_same<T, char>::value || std::is_same<T, unsigned char>::value, Slice>
std::enable_if_t<std::is_same_v<T, char> || std::is_same_v<T, unsigned char>, Slice>
makeSlice(std::array<T, N> const& a)
{
return Slice(a.data(), a.size());
}
template <class T, class Alloc>
std::enable_if_t<std::is_same<T, char>::value || std::is_same<T, unsigned char>::value, Slice>
std::enable_if_t<std::is_same_v<T, char> || std::is_same_v<T, unsigned char>, Slice>
makeSlice(std::vector<T, Alloc> const& v)
{
return Slice(v.data(), v.size());

View File

@@ -251,7 +251,7 @@ private:
}
};
typedef typename std::conditional<IsKeyCache, KeyOnlyEntry, ValueEntry>::type Entry;
using Entry = std::conditional_t<IsKeyCache, KeyOnlyEntry, ValueEntry>;
using KeyOnlyCacheType = hardened_partitioned_hash_map<key_type, KeyOnlyEntry, Hash, KeyEqual>;

View File

@@ -12,7 +12,7 @@ namespace xrpl {
*/
template <class T>
typename std::enable_if<std::is_arithmetic<T>::value, std::string>::type
std::enable_if_t<std::is_arithmetic_v<T>, std::string>
to_string(T t)
{
return std::to_string(t);

View File

@@ -269,7 +269,7 @@ public:
class Container,
class = std::enable_if_t<
detail::is_contiguous_container<Container>::value &&
std::is_trivially_copyable<typename Container::value_type>::value>>
std::is_trivially_copyable_v<typename Container::value_type>>>
explicit base_uint(Container const& c)
{
XRPL_ASSERT(
@@ -281,7 +281,7 @@ public:
template <class Container>
std::enable_if_t<
detail::is_contiguous_container<Container>::value &&
std::is_trivially_copyable<typename Container::value_type>::value,
std::is_trivially_copyable_v<typename Container::value_type>,
base_uint&>
operator=(Container const& c)
{

View File

@@ -49,8 +49,7 @@ template <class E, class... Args>
Throw(Args&&... args)
{
static_assert(
std::is_convertible<E*, std::exception*>::value,
"Exception must derive from std::exception.");
std::is_convertible_v<E*, std::exception*>, "Exception must derive from std::exception.");
E e(std::forward<Args>(args)...);
LogThrow(std::string("Throwing exception of type " + beast::type_name<E>() + ": ") + e.what());

View File

@@ -72,14 +72,12 @@ template <class HashAlgorithm = beast::xxhasher>
class hardened_hash
{
private:
detail::seed_pair m_seeds;
detail::seed_pair m_seeds{detail::make_seed_pair<>()};
public:
using result_type = typename HashAlgorithm::result_type;
hardened_hash() : m_seeds(detail::make_seed_pair<>())
{
}
hardened_hash() = default;
template <class T>
result_type

View File

@@ -57,7 +57,7 @@ public:
{
using iterator_category = std::forward_iterator_tag;
partition_map_type* map_{nullptr};
typename partition_map_type::iterator ait_;
typename partition_map_type::iterator ait_{};
typename map_type::iterator mit_;
iterator() = default;
@@ -126,7 +126,7 @@ public:
using iterator_category = std::forward_iterator_tag;
partition_map_type* map_{nullptr};
typename partition_map_type::iterator ait_;
typename partition_map_type::iterator ait_{};
typename map_type::iterator mit_;
const_iterator() = default;

View File

@@ -15,8 +15,8 @@ namespace xrpl {
#ifndef __INTELLISENSE__
static_assert(
// NOLINTNEXTLINE(misc-redundant-expression)
std::is_integral<beast::xor_shift_engine::result_type>::value &&
std::is_unsigned<beast::xor_shift_engine::result_type>::value,
std::is_integral_v<beast::xor_shift_engine::result_type> &&
std::is_unsigned_v<beast::xor_shift_engine::result_type>,
"The XRPL default PRNG engine must return an unsigned integral type.");
static_assert(
@@ -91,7 +91,7 @@ default_prng()
*/
/** @{ */
template <class Engine, class Integral>
std::enable_if_t<std::is_integral<Integral>::value && detail::is_engine<Engine>::value, Integral>
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
rand_int(Engine& engine, Integral min, Integral max)
{
XRPL_ASSERT(max > min, "xrpl::rand_int : max over min inputs");
@@ -103,35 +103,35 @@ rand_int(Engine& engine, Integral min, Integral max)
}
template <class Integral>
std::enable_if_t<std::is_integral<Integral>::value, Integral>
std::enable_if_t<std::is_integral_v<Integral>, Integral>
rand_int(Integral min, Integral max)
{
return rand_int(default_prng(), min, max);
}
template <class Engine, class Integral>
std::enable_if_t<std::is_integral<Integral>::value && detail::is_engine<Engine>::value, Integral>
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
rand_int(Engine& engine, Integral max)
{
return rand_int(engine, Integral(0), max);
}
template <class Integral>
std::enable_if_t<std::is_integral<Integral>::value, Integral>
std::enable_if_t<std::is_integral_v<Integral>, Integral>
rand_int(Integral max)
{
return rand_int(default_prng(), max);
}
template <class Integral, class Engine>
std::enable_if_t<std::is_integral<Integral>::value && detail::is_engine<Engine>::value, Integral>
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
rand_int(Engine& engine)
{
return rand_int(engine, std::numeric_limits<Integral>::max());
}
template <class Integral = int>
std::enable_if_t<std::is_integral<Integral>::value, Integral>
std::enable_if_t<std::is_integral_v<Integral>, Integral>
rand_int()
{
return rand_int(default_prng(), std::numeric_limits<Integral>::max());
@@ -142,7 +142,7 @@ rand_int()
/** @{ */
template <class Byte, class Engine>
std::enable_if_t<
(std::is_same<Byte, unsigned char>::value || std::is_same<Byte, std::uint8_t>::value) &&
(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>) &&
detail::is_engine<Engine>::value,
Byte>
rand_byte(Engine& engine)
@@ -152,9 +152,7 @@ rand_byte(Engine& engine)
}
template <class Byte = std::uint8_t>
std::enable_if_t<
(std::is_same<Byte, unsigned char>::value || std::is_same<Byte, std::uint8_t>::value),
Byte>
std::enable_if_t<(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>), Byte>
rand_byte()
{
return rand_byte<Byte>(default_prng());

View File

@@ -12,9 +12,9 @@ namespace xrpl {
template <class Src, class Dest>
concept SafeToCast = (std::is_integral_v<Src> && std::is_integral_v<Dest>) &&
(std::is_signed<Src>::value || std::is_unsigned<Dest>::value) &&
(std::is_signed<Src>::value != std::is_signed<Dest>::value ? sizeof(Dest) > sizeof(Src)
: sizeof(Dest) >= sizeof(Src));
(std::is_signed_v<Src> || std::is_unsigned_v<Dest>) &&
(std::is_signed_v<Src> != std::is_signed_v<Dest> ? sizeof(Dest) > sizeof(Src)
: sizeof(Dest) >= sizeof(Src));
template <class Dest, class Src>
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>

View File

@@ -10,9 +10,9 @@ std::string
strHex(FwdIt begin, FwdIt end)
{
static_assert(
std::is_convertible<
std::is_convertible_v<
typename std::iterator_traits<FwdIt>::iterator_category,
std::forward_iterator_tag>::value,
std::forward_iterator_tag>,
"FwdIt must be a forward iterator");
std::string result;
result.reserve(2 * std::distance(begin, end));

View File

@@ -44,8 +44,7 @@ public:
template <
class OtherInt,
class = typename std::enable_if<
std::is_integral<OtherInt>::value && sizeof(OtherInt) <= sizeof(Int)>::type>
class = std::enable_if_t<std::is_integral_v<OtherInt> && sizeof(OtherInt) <= sizeof(Int)>>
explicit constexpr tagged_integer(OtherInt value) noexcept : m_value(value)
{
static_assert(sizeof(tagged_integer) == sizeof(Int), "tagged_integer is adding padding");

View File

@@ -9,7 +9,7 @@ namespace beast {
/** Expire aged container items past the specified age. */
template <class AgedContainer, class Rep, class Period>
typename std::enable_if<is_aged_container<AgedContainer>::value, std::size_t>::type
std::enable_if_t<is_aged_container<AgedContainer>::value, std::size_t>
expire(AgedContainer& c, std::chrono::duration<Rep, Period> const& age)
{
std::size_t n(0);

View File

@@ -1,7 +1,6 @@
#pragma once
namespace beast {
namespace detail {
namespace beast::detail {
// Extracts the key portion of value
template <bool maybe_map>
@@ -30,5 +29,4 @@ struct aged_associative_container_extract_t<false>
}
};
} // namespace detail
} // namespace beast
} // namespace beast::detail

View File

@@ -2,6 +2,7 @@
#include <iterator>
#include <type_traits>
#include <utility>
namespace beast {
@@ -131,7 +132,7 @@ private:
friend class aged_container_iterator;
template <class OtherIterator>
aged_container_iterator(OtherIterator const& iter) : m_iter(iter)
aged_container_iterator(OtherIterator iter) : m_iter(std::move(iter))
{
}

View File

@@ -57,8 +57,7 @@ template <
class T,
class Clock = std::chrono::steady_clock,
class Compare = std::less<Key>,
class Allocator =
std::allocator<typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type>>
class Allocator = std::allocator<std::conditional_t<IsMap, std::pair<Key const, T>, Key>>>
class aged_ordered_container
{
public:
@@ -67,7 +66,7 @@ public:
using duration = typename clock_type::duration;
using key_type = Key;
using mapped_type = T;
using value_type = typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type;
using value_type = std::conditional_t<IsMap, std::pair<Key const, T>, Key>;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
@@ -110,8 +109,7 @@ private:
template <
class... Args,
class =
typename std::enable_if<std::is_constructible<value_type, Args...>::value>::type>
class = std::enable_if_t<std::is_constructible_v<value_type, Args...>>>
element(time_point const& when_, Args&&... args)
: value(std::forward<Args>(args)...), when(when_)
{
@@ -135,9 +133,7 @@ private:
return Compare::operator()(lhs.first, rhs.first);
}
pair_value_compare()
{
}
pair_value_compare() = default;
pair_value_compare(pair_value_compare const& other) : Compare(other)
{
@@ -200,7 +196,7 @@ private:
using list_type = typename boost::intrusive::
make_list<element, boost::intrusive::constant_time_size<false>>::type;
using cont_type = typename std::conditional<
using cont_type = std::conditional_t<
IsMulti,
typename boost::intrusive::make_multiset<
element,
@@ -209,7 +205,7 @@ private:
typename boost::intrusive::make_set<
element,
boost::intrusive::constant_time_size<true>,
boost::intrusive::compare<KeyValueCompare>>::type>::type;
boost::intrusive::compare<KeyValueCompare>>::type>;
using ElementAllocator =
typename std::allocator_traits<Allocator>::template rebind_alloc<element>;
@@ -374,7 +370,7 @@ private:
public:
using key_compare = Compare;
using value_compare = typename std::conditional<IsMap, pair_value_compare, Compare>::type;
using value_compare = std::conditional_t<IsMap, pair_value_compare, Compare>;
using allocator_type = Allocator;
using reference = value_type&;
using const_reference = value_type const&;
@@ -402,6 +398,8 @@ public:
class chronological_t
{
chronological_t() = default;
public:
// A set iterator (IsMap==false) is always const
// because the elements of a set are immutable.
@@ -489,7 +487,7 @@ public:
iterator
iterator_to(value_type& value)
{
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
return list.iterator_to(*reinterpret_cast<element*>(
reinterpret_cast<uint8_t*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -498,20 +496,16 @@ public:
const_iterator
iterator_to(value_type const& value) const
{
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
return list.iterator_to(*reinterpret_cast<element const*>(
reinterpret_cast<uint8_t const*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
}
private:
chronological_t()
{
}
chronological_t(chronological_t const&) = delete;
chronological_t(chronological_t&&) = delete;
private:
friend class aged_ordered_container;
list_type mutable list;
} chronological;
@@ -617,30 +611,30 @@ public:
class K,
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
at(K const& k);
template <
class K,
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
class = std::enable_if_t<maybe_map && !maybe_multi>>
typename std::conditional<IsMap, T, void*>::type const&
at(K const& k) const;
template <
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
operator[](Key const& key);
template <
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
operator[](Key&& key);
//--------------------------------------------------------------------------
@@ -724,7 +718,7 @@ public:
iterator
iterator_to(value_type& value)
{
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
return m_cont.iterator_to(*reinterpret_cast<element*>(
reinterpret_cast<uint8_t*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -733,7 +727,7 @@ public:
const_iterator
iterator_to(value_type const& value) const
{
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
return m_cont.iterator_to(*reinterpret_cast<element const*>(
reinterpret_cast<uint8_t const*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -775,37 +769,35 @@ public:
// map, set
template <bool maybe_multi = IsMulti>
auto
insert(value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
insert(value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
// multimap, multiset
template <bool maybe_multi = IsMulti>
auto
insert(value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type;
insert(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>;
// set
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
auto
insert(value_type&& value) ->
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type;
insert(value_type&& value)
-> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>;
// multiset
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
auto
insert(value_type&& value) ->
typename std::enable_if<maybe_multi && !maybe_map, iterator>::type;
insert(value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>;
//---
// map, set
template <bool maybe_multi = IsMulti>
auto
insert(const_iterator hint, value_type const& value) ->
typename std::enable_if<!maybe_multi, iterator>::type;
insert(const_iterator hint, value_type const& value)
-> std::enable_if_t<!maybe_multi, iterator>;
// multimap, multiset
template <bool maybe_multi = IsMulti>
typename std::enable_if<maybe_multi, iterator>::type
std::enable_if_t<maybe_multi, iterator>
insert(const_iterator /*hint*/, value_type const& value)
{
// VFALCO TODO Figure out how to utilize 'hint'
@@ -815,12 +807,11 @@ public:
// map, set
template <bool maybe_multi = IsMulti>
auto
insert(const_iterator hint, value_type&& value) ->
typename std::enable_if<!maybe_multi, iterator>::type;
insert(const_iterator hint, value_type&& value) -> std::enable_if_t<!maybe_multi, iterator>;
// multimap, multiset
template <bool maybe_multi = IsMulti>
typename std::enable_if<maybe_multi, iterator>::type
std::enable_if_t<maybe_multi, iterator>
insert(const_iterator /*hint*/, value_type&& value)
{
// VFALCO TODO Figure out how to utilize 'hint'
@@ -829,9 +820,9 @@ public:
// map, multimap
template <class P, bool maybe_map = IsMap>
typename std::enable_if<
maybe_map && std::is_constructible<value_type, P&&>::value,
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
std::enable_if_t<
maybe_map && std::is_constructible_v<value_type, P&&>,
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
insert(P&& value)
{
return emplace(std::forward<P>(value));
@@ -839,9 +830,9 @@ public:
// map, multimap
template <class P, bool maybe_map = IsMap>
typename std::enable_if<
maybe_map && std::is_constructible<value_type, P&&>::value,
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
std::enable_if_t<
maybe_map && std::is_constructible_v<value_type, P&&>,
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
insert(const_iterator hint, P&& value)
{
return emplace_hint(hint, std::forward<P>(value));
@@ -864,23 +855,22 @@ public:
// map, set
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace(Args&&... args) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
emplace(Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
// multiset, multimap
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace(Args&&... args) -> typename std::enable_if<maybe_multi, iterator>::type;
emplace(Args&&... args) -> std::enable_if_t<maybe_multi, iterator>;
// map, set
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace_hint(const_iterator hint, Args&&... args) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
emplace_hint(const_iterator hint, Args&&... args)
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
// multiset, multimap
template <bool maybe_multi = IsMulti, class... Args>
typename std::enable_if<maybe_multi, iterator>::type
std::enable_if_t<maybe_multi, iterator>
emplace_hint(const_iterator /*hint*/, Args&&... args)
{
// VFALCO TODO Figure out how to utilize 'hint'
@@ -1164,12 +1154,12 @@ private:
template <
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
typename std::enable_if<maybe_propagate>::type
std::enable_if_t<maybe_propagate>
swap_data(aged_ordered_container& other) noexcept;
template <
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
typename std::enable_if<!maybe_propagate>::type
std::enable_if_t<!maybe_propagate>
swap_data(aged_ordered_container& other) noexcept;
private:
@@ -1396,7 +1386,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::opera
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <class K, bool maybe_multi, bool maybe_map, class>
typename std::conditional<IsMap, T, void*>::type&
std::conditional_t<IsMap, T, void*>&
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K const& k)
{
auto const iter(m_cont.find(k, std::cref(m_config.key_compare())));
@@ -1418,7 +1408,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <bool maybe_multi, bool maybe_map, class>
typename std::conditional<IsMap, T, void*>::type&
std::conditional_t<IsMap, T, void*>&
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](
Key const& key)
{
@@ -1437,7 +1427,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::opera
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <bool maybe_multi, bool maybe_map, class>
typename std::conditional<IsMap, T, void*>::type&
std::conditional_t<IsMap, T, void*>&
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](Key&& key)
{
typename cont_type::insert_commit_data d;
@@ -1472,8 +1462,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
{
typename cont_type::insert_commit_data d;
auto const result(m_cont.insert_check(extract(value), std::cref(m_config.key_compare()), d));
@@ -1492,7 +1481,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type
value_type const& value) -> std::enable_if_t<maybe_multi, iterator>
{
auto const before(m_cont.upper_bound(extract(value), std::cref(m_config.key_compare())));
element* const p(new_element(value));
@@ -1506,8 +1495,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi, bool maybe_map>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type&& value) ->
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type
value_type&& value) -> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>
{
typename cont_type::insert_commit_data d;
auto const result(m_cont.insert_check(extract(value), std::cref(m_config.key_compare()), d));
@@ -1526,7 +1514,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi, bool maybe_map>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type&& value) -> typename std::enable_if<maybe_multi && !maybe_map, iterator>::type
value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>
{
auto const before(m_cont.upper_bound(extract(value), std::cref(m_config.key_compare())));
element* const p(new_element(std::move(value)));
@@ -1543,7 +1531,7 @@ template <bool maybe_multi>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
const_iterator hint,
value_type const& value) -> typename std::enable_if<!maybe_multi, iterator>::type
value_type const& value) -> std::enable_if_t<!maybe_multi, iterator>
{
typename cont_type::insert_commit_data d;
auto const result(
@@ -1564,7 +1552,7 @@ template <bool maybe_multi>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
const_iterator hint,
value_type&& value) -> typename std::enable_if<!maybe_multi, iterator>::type
value_type&& value) -> std::enable_if_t<!maybe_multi, iterator>
{
typename cont_type::insert_commit_data d;
auto const result(
@@ -1584,7 +1572,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi, class... Args>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace(Args&&... args)
-> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
{
// VFALCO NOTE Its unfortunate that we need to
// construct element here
@@ -1606,7 +1594,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
template <bool maybe_multi, class... Args>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace(Args&&... args)
-> typename std::enable_if<maybe_multi, iterator>::type
-> std::enable_if_t<maybe_multi, iterator>
{
element* const p(new_element(std::forward<Args>(args)...));
auto const before(m_cont.upper_bound(extract(p->value), std::cref(m_config.key_compare())));
@@ -1621,7 +1609,7 @@ template <bool maybe_multi, class... Args>
auto
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace_hint(
const_iterator hint,
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
{
// VFALCO NOTE Its unfortunate that we need to
// construct element here
@@ -1771,7 +1759,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::touch
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <bool maybe_propagate>
typename std::enable_if<maybe_propagate>::type
std::enable_if_t<maybe_propagate>
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swap_data(
aged_ordered_container& other) noexcept
{
@@ -1782,7 +1770,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swap_
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
template <bool maybe_propagate>
typename std::enable_if<!maybe_propagate>::type
std::enable_if_t<!maybe_propagate>
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swap_data(
aged_ordered_container& other) noexcept
{

View File

@@ -62,8 +62,7 @@ template <
class Clock = std::chrono::steady_clock,
class Hash = std::hash<Key>,
class KeyEqual = std::equal_to<Key>,
class Allocator =
std::allocator<typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type>>
class Allocator = std::allocator<std::conditional_t<IsMap, std::pair<Key const, T>, Key>>>
class aged_unordered_container
{
public:
@@ -72,7 +71,7 @@ public:
using duration = typename clock_type::duration;
using key_type = Key;
using mapped_type = T;
using value_type = typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type;
using value_type = std::conditional_t<IsMap, std::pair<Key const, T>, Key>;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
@@ -115,8 +114,7 @@ private:
template <
class... Args,
class =
typename std::enable_if<std::is_constructible<value_type, Args...>::value>::type>
class = std::enable_if_t<std::is_constructible_v<value_type, Args...>>>
element(time_point const& when_, Args&&... args)
: value(std::forward<Args>(args)...), when(when_)
{
@@ -133,9 +131,7 @@ private:
using argument_type = element;
using result_type = size_t;
ValueHash()
{
}
ValueHash() = default;
ValueHash(Hash const& h) : Hash(h)
{
@@ -169,9 +165,7 @@ private:
using second_argument_type = element;
using result_type = bool;
KeyValueEqual()
{
}
KeyValueEqual() = default;
KeyValueEqual(KeyEqual const& keyEqual) : KeyEqual(keyEqual)
{
@@ -211,7 +205,7 @@ private:
using list_type = typename boost::intrusive::
make_list<element, boost::intrusive::constant_time_size<false>>::type;
using cont_type = typename std::conditional<
using cont_type = std::conditional_t<
IsMulti,
typename boost::intrusive::make_unordered_multiset<
element,
@@ -224,7 +218,7 @@ private:
boost::intrusive::constant_time_size<true>,
boost::intrusive::hash<ValueHash>,
boost::intrusive::equal<KeyValueEqual>,
boost::intrusive::cache_begin<true>>::type>::type;
boost::intrusive::cache_begin<true>>::type>;
using bucket_type = typename cont_type::bucket_type;
using bucket_traits = typename cont_type::bucket_traits;
@@ -662,7 +656,7 @@ public:
iterator
iterator_to(value_type& value)
{
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
return list.iterator_to(*reinterpret_cast<element*>(
reinterpret_cast<uint8_t*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -671,20 +665,17 @@ public:
const_iterator
iterator_to(value_type const& value) const
{
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
return list.iterator_to(*reinterpret_cast<element const*>(
reinterpret_cast<uint8_t const*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
}
private:
chronological_t()
{
}
chronological_t(chronological_t const&) = delete;
chronological_t(chronological_t&&) = delete;
chronological_t() = default;
private:
friend class aged_unordered_container;
list_type mutable list;
} chronological;
@@ -862,30 +853,30 @@ public:
class K,
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
at(K const& k);
template <
class K,
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
class = std::enable_if_t<maybe_map && !maybe_multi>>
typename std::conditional<IsMap, T, void*>::type const&
at(K const& k) const;
template <
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
operator[](Key const& key);
template <
bool maybe_multi = IsMulti,
bool maybe_map = IsMap,
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
typename std::conditional<IsMap, T, void*>::type&
class = std::enable_if_t<maybe_map && !maybe_multi>>
std::conditional_t<IsMap, T, void*>&
operator[](Key&& key);
//--------------------------------------------------------------------------
@@ -933,7 +924,7 @@ public:
iterator
iterator_to(value_type& value)
{
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
return m_cont.iterator_to(*reinterpret_cast<element*>(
reinterpret_cast<uint8_t*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -942,7 +933,7 @@ public:
const_iterator
iterator_to(value_type const& value) const
{
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
return m_cont.iterator_to(*reinterpret_cast<element const*>(
reinterpret_cast<uint8_t const*>(&value) -
((std::size_t)std::addressof(((element*)0)->member))));
@@ -984,29 +975,27 @@ public:
// map, set
template <bool maybe_multi = IsMulti>
auto
insert(value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
insert(value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
// multimap, multiset
template <bool maybe_multi = IsMulti>
auto
insert(value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type;
insert(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>;
// map, set
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
auto
insert(value_type&& value) ->
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type;
insert(value_type&& value)
-> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>;
// multimap, multiset
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
auto
insert(value_type&& value) ->
typename std::enable_if<maybe_multi && !maybe_map, iterator>::type;
insert(value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>;
// map, set
template <bool maybe_multi = IsMulti>
typename std::enable_if<!maybe_multi, iterator>::type
std::enable_if_t<!maybe_multi, iterator>
insert(const_iterator /*hint*/, value_type const& value)
{
// Hint is ignored but we provide the interface so
@@ -1016,7 +1005,7 @@ public:
// multimap, multiset
template <bool maybe_multi = IsMulti>
typename std::enable_if<maybe_multi, iterator>::type
std::enable_if_t<maybe_multi, iterator>
insert(const_iterator /*hint*/, value_type const& value)
{
// VFALCO TODO The hint could be used to let
@@ -1026,7 +1015,7 @@ public:
// map, set
template <bool maybe_multi = IsMulti>
typename std::enable_if<!maybe_multi, iterator>::type
std::enable_if_t<!maybe_multi, iterator>
insert(const_iterator /*hint*/, value_type&& value)
{
// Hint is ignored but we provide the interface so
@@ -1036,7 +1025,7 @@ public:
// multimap, multiset
template <bool maybe_multi = IsMulti>
typename std::enable_if<maybe_multi, iterator>::type
std::enable_if_t<maybe_multi, iterator>
insert(const_iterator /*hint*/, value_type&& value)
{
// VFALCO TODO The hint could be used to let
@@ -1046,9 +1035,9 @@ public:
// map, multimap
template <class P, bool maybe_map = IsMap>
typename std::enable_if<
maybe_map && std::is_constructible<value_type, P&&>::value,
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
std::enable_if_t<
maybe_map && std::is_constructible_v<value_type, P&&>,
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
insert(P&& value)
{
return emplace(std::forward<P>(value));
@@ -1056,9 +1045,9 @@ public:
// map, multimap
template <class P, bool maybe_map = IsMap>
typename std::enable_if<
maybe_map && std::is_constructible<value_type, P&&>::value,
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
std::enable_if_t<
maybe_map && std::is_constructible_v<value_type, P&&>,
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
insert(const_iterator hint, P&& value)
{
return emplace_hint(hint, std::forward<P>(value));
@@ -1080,23 +1069,22 @@ public:
// set, map
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace(Args&&... args) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
emplace(Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
// multiset, multimap
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace(Args&&... args) -> typename std::enable_if<maybe_multi, iterator>::type;
emplace(Args&&... args) -> std::enable_if_t<maybe_multi, iterator>;
// set, map
template <bool maybe_multi = IsMulti, class... Args>
auto
emplace_hint(const_iterator /*hint*/, Args&&... args) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
emplace_hint(const_iterator /*hint*/, Args&&... args)
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
// multiset, multimap
template <bool maybe_multi = IsMulti, class... Args>
typename std::enable_if<maybe_multi, iterator>::type
std::enable_if_t<maybe_multi, iterator>
emplace_hint(const_iterator /*hint*/, Args&&... args)
{
// VFALCO TODO The hint could be used for multi, to let
@@ -1328,7 +1316,7 @@ public:
class OtherHash,
class OtherAllocator,
bool maybe_multi = IsMulti>
typename std::enable_if<!maybe_multi, bool>::type
std::enable_if_t<!maybe_multi, bool>
operator==(aged_unordered_container<
false,
OtherIsMap,
@@ -1347,7 +1335,7 @@ public:
class OtherHash,
class OtherAllocator,
bool maybe_multi = IsMulti>
typename std::enable_if<maybe_multi, bool>::type
std::enable_if_t<maybe_multi, bool>
operator==(aged_unordered_container<
true,
OtherIsMap,
@@ -1401,14 +1389,13 @@ private:
// map, set
template <bool maybe_multi = IsMulti>
auto
insert_unchecked(value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
insert_unchecked(value_type const& value)
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
// multimap, multiset
template <bool maybe_multi = IsMulti>
auto
insert_unchecked(value_type const& value) ->
typename std::enable_if<maybe_multi, iterator>::type;
insert_unchecked(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>;
template <class InputIt>
void
@@ -1449,7 +1436,7 @@ private:
template <
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
typename std::enable_if<maybe_propagate>::type
std::enable_if_t<maybe_propagate>
swap_data(aged_unordered_container& other) noexcept
{
std::swap(m_config.key_compare(), other.m_config.key_compare());
@@ -1459,7 +1446,7 @@ private:
template <
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
typename std::enable_if<!maybe_propagate>::type
std::enable_if_t<!maybe_propagate>
swap_data(aged_unordered_container& other) noexcept
{
std::swap(m_config.key_compare(), other.m_config.key_compare());
@@ -2114,7 +2101,7 @@ template <
class KeyEqual,
class Allocator>
template <class K, bool maybe_multi, bool maybe_map, class>
typename std::conditional<IsMap, T, void*>::type&
std::conditional_t<IsMap, T, void*>&
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::at(K const& k)
{
auto const iter(
@@ -2155,7 +2142,7 @@ template <
class KeyEqual,
class Allocator>
template <bool maybe_multi, bool maybe_map, class>
typename std::conditional<IsMap, T, void*>::type&
std::conditional_t<IsMap, T, void*>&
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator[](
Key const& key)
{
@@ -2184,7 +2171,7 @@ template <
class KeyEqual,
class Allocator>
template <bool maybe_multi, bool maybe_map, class>
typename std::conditional<IsMap, T, void*>::type&
std::conditional_t<IsMap, T, void*>&
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator[](
Key&& key)
{
@@ -2239,8 +2226,7 @@ template <
template <bool maybe_multi>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
{
maybe_rehash(1);
typename cont_type::insert_commit_data d;
@@ -2272,7 +2258,7 @@ template <
template <bool maybe_multi>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type
value_type const& value) -> std::enable_if_t<maybe_multi, iterator>
{
maybe_rehash(1);
element* const p(new_element(value));
@@ -2294,8 +2280,7 @@ template <
template <bool maybe_multi, bool maybe_map>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
value_type&& value) ->
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type
value_type&& value) -> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>
{
maybe_rehash(1);
typename cont_type::insert_commit_data d;
@@ -2327,7 +2312,7 @@ template <
template <bool maybe_multi, bool maybe_map>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
value_type&& value) -> typename std::enable_if<maybe_multi && !maybe_map, iterator>::type
value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>
{
maybe_rehash(1);
element* const p(new_element(std::move(value)));
@@ -2350,7 +2335,7 @@ template <
template <bool maybe_multi, class... Args>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace(
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
{
maybe_rehash(1);
// VFALCO NOTE Its unfortunate that we need to
@@ -2415,7 +2400,7 @@ template <
template <bool maybe_multi, class... Args>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace(
Args&&... args) -> typename std::enable_if<maybe_multi, iterator>::type
Args&&... args) -> std::enable_if_t<maybe_multi, iterator>
{
maybe_rehash(1);
element* const p(new_element(std::forward<Args>(args)...));
@@ -2438,7 +2423,7 @@ template <bool maybe_multi, class... Args>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace_hint(
const_iterator /*hint*/,
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
{
maybe_rehash(1);
// VFALCO NOTE Its unfortunate that we need to
@@ -2590,7 +2575,7 @@ template <
class OtherHash,
class OtherAllocator,
bool maybe_multi>
typename std::enable_if<!maybe_multi, bool>::type
std::enable_if_t<!maybe_multi, bool>
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator==(
aged_unordered_container<
false,
@@ -2630,7 +2615,7 @@ template <
class OtherHash,
class OtherAllocator,
bool maybe_multi>
typename std::enable_if<maybe_multi, bool>::type
std::enable_if_t<maybe_multi, bool>
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator==(
aged_unordered_container<
true,
@@ -2677,8 +2662,8 @@ template <
template <bool maybe_multi>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
insert_unchecked(value_type const& value) ->
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
insert_unchecked(value_type const& value)
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
{
typename cont_type::insert_commit_data d;
auto const result(m_cont.insert_check(
@@ -2709,8 +2694,7 @@ template <
template <bool maybe_multi>
auto
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
insert_unchecked(value_type const& value) ->
typename std::enable_if<maybe_multi, iterator>::type
insert_unchecked(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>
{
element* const p(new_element(value));
chronological.list.push_back(*p);

View File

@@ -11,12 +11,11 @@
#include <type_traits>
#include <utility>
namespace beast {
namespace detail {
namespace beast::detail {
template <class T>
struct is_empty_base_optimization_derived
: std::integral_constant<bool, std::is_empty<T>::value && !boost::is_final<T>::value>
: std::integral_constant<bool, std::is_empty_v<T> && !boost::is_final<T>::value>
{
};
@@ -86,5 +85,4 @@ public:
}
};
} // namespace detail
} // namespace beast
} // namespace beast::detail

View File

@@ -16,7 +16,7 @@ struct CopyConst
{
explicit CopyConst() = default;
using type = typename std::remove_const<U>::type;
using type = std::remove_const_t<U>;
};
template <typename T, typename U>

View File

@@ -13,22 +13,18 @@ class LockFreeStackIterator
{
protected:
using Node = typename Container::Node;
using NodePtr = typename std::conditional<IsConst, Node const*, Node*>::type;
using NodePtr = std::conditional_t<IsConst, Node const*, Node*>;
public:
using iterator_category = std::forward_iterator_tag;
using value_type = typename Container::value_type;
using difference_type = typename Container::difference_type;
using pointer = typename std::
conditional<IsConst, typename Container::const_pointer, typename Container::pointer>::type;
using reference = typename std::conditional<
IsConst,
typename Container::const_reference,
typename Container::reference>::type;
using pointer =
std::conditional_t<IsConst, typename Container::const_pointer, typename Container::pointer>;
using reference = std::
conditional_t<IsConst, typename Container::const_reference, typename Container::reference>;
LockFreeStackIterator() : m_node()
{
}
LockFreeStackIterator() = default;
LockFreeStackIterator(NodePtr node) : m_node(node)
{
@@ -81,7 +77,7 @@ public:
}
private:
NodePtr m_node;
NodePtr m_node{};
};
//------------------------------------------------------------------------------

View File

@@ -69,7 +69,7 @@ template <class T>
struct is_uniquely_represented
: public std::integral_constant<
bool,
std::is_integral<T>::value || std::is_enum<T>::value || std::is_pointer<T>::value>
std::is_integral_v<T> || std::is_enum_v<T> || std::is_pointer_v<T>>
{
explicit is_uniquely_represented() = default;
};
@@ -210,7 +210,7 @@ hash_append(Hasher& h, T const& t) noexcept
template <class Hasher, class T>
inline std::enable_if_t<
!is_contiguously_hashable<T, Hasher>::value &&
(std::is_integral<T>::value || std::is_pointer<T>::value || std::is_enum<T>::value)>
(std::is_integral_v<T> || std::is_pointer_v<T> || std::is_enum_v<T>)>
hash_append(Hasher& h, T t) noexcept
{
detail::reverse_bytes(t);
@@ -218,7 +218,7 @@ hash_append(Hasher& h, T t) noexcept
}
template <class Hasher, class T>
inline std::enable_if_t<std::is_floating_point<T>::value>
inline std::enable_if_t<std::is_floating_point_v<T>>
hash_append(Hasher& h, T t) noexcept
{
if (t == 0)

View File

@@ -121,13 +121,13 @@ public:
}
}
template <class Seed, std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
template <class Seed, std::enable_if_t<std::is_unsigned_v<Seed>>* = nullptr>
explicit xxhasher(Seed seed) : seed_(seed)
{
resetBuffers();
}
template <class Seed, std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
template <class Seed, std::enable_if_t<std::is_unsigned_v<Seed>>* = nullptr>
xxhasher(Seed seed, Seed) : seed_(seed)
{
resetBuffers();

View File

@@ -8,8 +8,7 @@
#include <string>
namespace beast {
namespace insight {
namespace beast::insight {
/** Interface for a manager that allows collection of metrics.
@@ -117,5 +116,4 @@ public:
/** @} */
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -4,8 +4,7 @@
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
/** A metric for measuring an integral value.
@@ -23,9 +22,7 @@ public:
/** Create a null metric.
A null metric reports no information.
*/
Counter()
{
}
Counter() = default;
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -91,5 +88,4 @@ private:
std::shared_ptr<CounterImpl> m_impl;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -3,8 +3,7 @@
#include <cstdint>
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
class Counter;
@@ -18,5 +17,4 @@ public:
increment(value_type amount) = 0;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -5,8 +5,7 @@
#include <chrono>
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
/** A metric for reporting event timing.
@@ -25,9 +24,7 @@ public:
/** Create a null metric.
A null metric reports no information.
*/
Event()
{
}
Event() = default;
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -58,5 +55,4 @@ private:
std::shared_ptr<EventImpl> m_impl;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -3,8 +3,7 @@
#include <chrono>
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
class Event;
@@ -18,5 +17,4 @@ public:
notify(value_type const& value) = 0;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -4,8 +4,7 @@
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
/** A metric for measuring an integral value.
@@ -25,9 +24,7 @@ public:
/** Create a null metric.
A null metric reports no information.
*/
Gauge()
{
}
Gauge() = default;
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -121,5 +118,4 @@ private:
std::shared_ptr<GaugeImpl> m_impl;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -3,8 +3,7 @@
#include <cstdint>
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
class Gauge;
@@ -21,5 +20,4 @@ public:
increment(difference_type amount) = 0;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -5,8 +5,7 @@
#include <memory>
#include <string>
namespace beast {
namespace insight {
namespace beast::insight {
/** A collector front-end that manages a group of metrics. */
class Group : public Collector
@@ -19,5 +18,4 @@ public:
name() const = 0;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -6,8 +6,7 @@
#include <memory>
#include <string>
namespace beast {
namespace insight {
namespace beast::insight {
/** A container for managing a set of metric groups. */
class Groups
@@ -32,5 +31,4 @@ public:
std::unique_ptr<Groups>
make_Groups(Collector::ptr const& collector);
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -4,8 +4,7 @@
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
/** A reference to a handler for performing polled collection. */
class Hook final
@@ -14,9 +13,7 @@ public:
/** Create a null hook.
A null hook has no associated handler.
*/
Hook()
{
}
Hook() = default;
/** Create a hook referencing the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -37,5 +34,4 @@ private:
std::shared_ptr<HookImpl> m_impl;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -3,8 +3,7 @@
#include <functional>
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
class HookImpl : public std::enable_shared_from_this<HookImpl>
{
@@ -14,5 +13,4 @@ public:
virtual ~HookImpl() = 0;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -4,8 +4,7 @@
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
/** A metric for measuring an integral value.
@@ -22,9 +21,7 @@ public:
/** Create a null metric.
A null metric reports no information.
*/
Meter()
{
}
Meter() = default;
/** Create the metric reference the specified implementation.
Normally this won't be called directly. Instead, call the appropriate
@@ -76,5 +73,4 @@ private:
std::shared_ptr<MeterImpl> m_impl;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -3,8 +3,7 @@
#include <cstdint>
#include <memory>
namespace beast {
namespace insight {
namespace beast::insight {
class Meter;
@@ -18,5 +17,4 @@ public:
increment(value_type amount) = 0;
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -2,8 +2,7 @@
#include <xrpl/beast/insight/Collector.h>
namespace beast {
namespace insight {
namespace beast::insight {
/** A Collector which does not collect metrics. */
class NullCollector : public Collector
@@ -15,5 +14,4 @@ public:
New();
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -4,8 +4,7 @@
#include <xrpl/beast/net/IPEndpoint.h>
#include <xrpl/beast/utility/Journal.h>
namespace beast {
namespace insight {
namespace beast::insight {
/** A Collector that reports metrics to a StatsD server.
Reference:
@@ -25,5 +24,4 @@ public:
New(IP::Endpoint const& address, std::string const& prefix, Journal journal);
};
} // namespace insight
} // namespace beast
} // namespace beast::insight

View File

@@ -4,8 +4,7 @@
#include <boost/asio.hpp>
namespace beast {
namespace IP {
namespace beast::IP {
/** Convert to Endpoint.
The port is set to zero.
@@ -27,8 +26,7 @@ to_asio_address(Endpoint const& endpoint);
boost::asio::ip::tcp::endpoint
to_asio_endpoint(Endpoint const& endpoint);
} // namespace IP
} // namespace beast
} // namespace beast::IP
namespace beast {

View File

@@ -4,8 +4,7 @@
#include <boost/asio/ip/address_v4.hpp>
namespace beast {
namespace IP {
namespace beast::IP {
using AddressV4 = boost::asio::ip::address_v4;
@@ -23,5 +22,4 @@ is_public(AddressV4 const& addr);
char
get_class(AddressV4 const& address);
} // namespace IP
} // namespace beast
} // namespace beast::IP

View File

@@ -4,8 +4,7 @@
#include <boost/asio/ip/address_v6.hpp>
namespace beast {
namespace IP {
namespace beast::IP {
using AddressV6 = boost::asio::ip::address_v6;
@@ -17,5 +16,4 @@ is_private(AddressV6 const& addr);
bool
is_public(AddressV6 const& addr);
} // namespace IP
} // namespace beast
} // namespace beast::IP

View File

@@ -8,8 +8,7 @@
#include <optional>
#include <string>
namespace beast {
namespace IP {
namespace beast::IP {
using Port = std::uint16_t;
@@ -21,7 +20,7 @@ public:
Endpoint();
/** Create an endpoint from the address and optional port. */
explicit Endpoint(Address const& addr, Port port = 0);
explicit Endpoint(Address addr, Port port = 0);
/** Create an Endpoint from a string.
If the port is omitted, the endpoint will have a zero port.
@@ -184,8 +183,7 @@ operator<<(OutputStream& os, Endpoint const& endpoint)
std::istream&
operator>>(std::istream& is, Endpoint& endpoint);
} // namespace IP
} // namespace beast
} // namespace beast::IP
//------------------------------------------------------------------------------

View File

@@ -12,8 +12,7 @@
#include <string>
#include <vector>
namespace beast {
namespace rfc2616 {
namespace beast::rfc2616 {
namespace detail {
@@ -370,5 +369,4 @@ is_keep_alive(boost::beast::http::message<isRequest, Body, Fields> const& m)
"close");
}
} // namespace rfc2616
} // namespace beast
} // namespace beast::rfc2616

View File

@@ -15,8 +15,7 @@
#include <thread>
#include <vector>
namespace beast {
namespace test {
namespace beast::test {
/** Mix-in to support tests using asio coroutines.
@@ -125,5 +124,4 @@ enable_yield_to::spawn(F0&& f, FN&&... fn)
spawn(fn...);
}
} // namespace test
} // namespace beast
} // namespace beast::test

View File

@@ -15,7 +15,7 @@ template <typename T>
std::string
type_name()
{
using TR = typename std::remove_reference<T>::type;
using TR = std::remove_reference_t<T>;
std::string name = typeid(TR).name();
@@ -27,15 +27,15 @@ type_name()
}
#endif
if (std::is_const<TR>::value)
if (std::is_const_v<TR>)
name += " const";
if (std::is_volatile<TR>::value)
if (std::is_volatile_v<TR>)
name += " volatile";
if (std::is_lvalue_reference<T>::value)
if (std::is_lvalue_reference_v<T>)
{
name += "&";
}
else if (std::is_rvalue_reference<T>::value)
else if (std::is_rvalue_reference_v<T>)
{
name += "&&";
}

View File

@@ -8,8 +8,7 @@
#include <ostream>
#include <string>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
/** Utility for producing nicely composed output of amounts with units. */
class amount
@@ -42,5 +41,4 @@ operator<<(std::ostream& s, amount const& t)
return s;
}
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -4,9 +4,7 @@
#pragma once
namespace beast {
namespace unit_test {
namespace detail {
namespace beast::unit_test::detail {
/** Adapter to constrain a container interface.
The interface allows for limited read only operations. Derived classes
@@ -82,6 +80,4 @@ public:
/** @} */
};
} // namespace detail
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test::detail

View File

@@ -6,8 +6,7 @@
#include <xrpl/beast/unit_test/suite_list.h>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
namespace detail {
@@ -42,5 +41,4 @@ global_suites()
return detail::global_suites();
}
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -8,8 +8,7 @@
#include <string>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
// Predicate for implementing matches
class selector
@@ -163,5 +162,4 @@ match_library(std::string const& name)
return selector(selector::library, name);
}
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -7,8 +7,7 @@
#include <xrpl/beast/unit_test/results.h>
#include <xrpl/beast/unit_test/runner.h>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
/** A test runner that stores the results. */
class recorder : public runner
@@ -29,49 +28,48 @@ public:
}
private:
virtual void
void
on_suite_begin(suite_info const& info) override
{
m_suite = suite_results(info.full_name());
}
virtual void
void
on_suite_end() override
{
m_results.insert(std::move(m_suite));
}
virtual void
void
on_case_begin(std::string const& name) override
{
m_case = case_results(name);
}
virtual void
void
on_case_end() override
{
if (!m_case.tests.empty())
m_suite.insert(std::move(m_case));
}
virtual void
void
on_pass() override
{
m_case.tests.pass();
}
virtual void
void
on_fail(std::string const& reason) override
{
m_case.tests.fail(reason);
}
virtual void
void
on_log(std::string const& s) override
{
m_case.log.insert(s);
}
};
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -18,8 +18,7 @@
#include <string>
#include <utility>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
namespace detail {
@@ -86,7 +85,7 @@ public:
reporter&
operator=(reporter const&) = delete;
~reporter();
~reporter() override;
explicit reporter(std::ostream& os = std::cout);
@@ -94,25 +93,25 @@ private:
static std::string
fmtdur(typename clock_type::duration const& d);
virtual void
void
on_suite_begin(suite_info const& info) override;
virtual void
void
on_suite_end() override;
virtual void
void
on_case_begin(std::string const& name) override;
virtual void
void
on_case_end() override;
virtual void
void
on_pass() override;
virtual void
void
on_fail(std::string const& reason) override;
virtual void
void
on_log(std::string const& s) override;
};
@@ -251,5 +250,4 @@ reporter<Unused>::on_log(std::string const& s)
using reporter = detail::reporter<>;
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -7,10 +7,10 @@
#include <xrpl/beast/unit_test/detail/const_container.h>
#include <string>
#include <utility>
#include <vector>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
/** Holds a set of test condition outcomes in a testcase. */
class case_results
@@ -23,7 +23,7 @@ public:
{
}
test(bool pass_, std::string const& reason_) : pass(pass_), reason(reason_)
test(bool pass_, std::string reason_) : pass(pass_), reason(std::move(reason_))
{
}
@@ -38,9 +38,7 @@ private:
std::size_t failed_{0};
public:
tests_t()
{
}
tests_t() = default;
/** Returns the total number of test conditions. */
std::size_t
@@ -86,7 +84,7 @@ private:
std::string name_;
public:
explicit case_results(std::string const& name = "") : name_(name)
explicit case_results(std::string name = "") : name_(std::move(name))
{
}
@@ -115,7 +113,7 @@ private:
std::size_t failed_ = 0;
public:
explicit suite_results(std::string const& name = "") : name_(name)
explicit suite_results(std::string name = "") : name_(std::move(name))
{
}
@@ -172,9 +170,7 @@ private:
std::size_t failed_{0};
public:
results()
{
}
results() = default;
/** Returns the total number of test cases. */
std::size_t
@@ -219,5 +215,4 @@ public:
/** @} */
};
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -11,8 +11,7 @@
#include <mutex>
#include <string>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
/** Unit test runner interface.
@@ -277,5 +276,4 @@ runner::log(std::string const& s)
on_log(s);
}
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -14,8 +14,7 @@
#include <sstream>
#include <string>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
namespace detail {
@@ -75,7 +74,7 @@ private:
{
}
~log_buf()
~log_buf() override
{
sync();
}
@@ -573,8 +572,7 @@ suite::run(runner& r)
((cond) ? (pass(), true) : (fail((reason), __FILE__, __LINE__), false))
#endif
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test
//------------------------------------------------------------------------------

View File

@@ -9,8 +9,7 @@
#include <string>
#include <utility>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
class runner;
@@ -110,5 +109,4 @@ make_suite_info(
});
}
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -13,8 +13,7 @@
#include <typeindex>
#include <unordered_set>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
/// A container of test suites.
class suite_list : public detail::const_container<std::set<suite_info>>
@@ -62,5 +61,4 @@ suite_list::insert(
cont().emplace(make_suite_info<Suite>(name, module, library, manual, priority));
}
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -10,8 +10,7 @@
#include <thread>
#include <utility>
namespace beast {
namespace unit_test {
namespace beast::unit_test {
/** Replacement for std::thread that handles exceptions in unit tests. */
class Thread
@@ -108,5 +107,4 @@ private:
}
};
} // namespace unit_test
} // namespace beast
} // namespace beast::unit_test

View File

@@ -55,15 +55,16 @@ public:
class Sink
{
protected:
Sink() = delete;
explicit Sink(Sink const& sink) = default;
Sink(Severity thresh, bool console);
Sink&
operator=(Sink const& lhs) = delete;
public:
virtual ~Sink() = 0;
Sink() = delete;
Sink&
operator=(Sink const& lhs) = delete;
/** Returns `true` if text at the passed severity produces output. */
virtual bool
active(Severity level) const;
@@ -371,10 +372,6 @@ class logstream_buf : public std::basic_stringbuf<CharT, Traits>
{
beast::Journal::Stream strm_;
template <class T>
void
write(T const*) = delete;
void
write(char const* s)
{
@@ -394,7 +391,7 @@ public:
{
}
~logstream_buf()
~logstream_buf() override
{
sync();
}
@@ -406,6 +403,10 @@ public:
this->str("");
return 0;
}
template <class T>
void
write(T const*) = delete;
};
} // namespace detail
@@ -413,11 +414,11 @@ public:
template <class CharT, class Traits = std::char_traits<CharT>>
class basic_logstream : public std::basic_ostream<CharT, Traits>
{
typedef CharT char_type;
typedef Traits traits_type;
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
using char_type = CharT;
using traits_type = Traits;
using int_type = typename traits_type::int_type;
using pos_type = typename traits_type::pos_type;
using off_type = typename traits_type::off_type;
detail::logstream_buf<CharT, Traits> buf_;

View File

@@ -174,7 +174,7 @@ private:
std::ostringstream mutable m_ostream;
public:
Proxy(Map const& map, std::string const& key);
Proxy(Map const& map, std::string key);
Proxy(Proxy const& other);
~Proxy();
@@ -315,7 +315,7 @@ private:
List<Item> children_;
public:
explicit Source(std::string const& name);
explicit Source(std::string name);
virtual ~Source();
Source(Source const&) = delete;

View File

@@ -2,6 +2,8 @@
#include <xrpl/beast/utility/Journal.h>
#include <utility>
namespace beast {
/** Wraps a Journal::Sink to prefix its output with a string. */
@@ -17,8 +19,8 @@ private:
std::string prefix_;
public:
explicit WrappedSink(beast::Journal::Sink& sink, std::string const& prefix = "")
: Sink(sink), sink_(sink), prefix_(prefix)
explicit WrappedSink(beast::Journal::Sink& sink, std::string prefix = "")
: Sink(sink), sink_(sink), prefix_(std::move(prefix))
{
}

View File

@@ -38,8 +38,7 @@ signum(T const& t)
return t.signum();
}
namespace detail {
namespace zero_helper {
namespace detail::zero_helper {
// For argument dependent lookup to function properly, calls to signum must
// be made from a namespace that does not include overloads of the function..
@@ -50,8 +49,7 @@ call_signum(T const& t)
return signum(t);
}
} // namespace zero_helper
} // namespace detail
} // namespace detail::zero_helper
// Handle operators where T is on the left side using signum.

View File

@@ -9,10 +9,8 @@ template <bool IsConst, class T>
struct maybe_const
{
explicit maybe_const() = default;
using type = typename std::conditional<
IsConst,
typename std::remove_const<T>::type const,
typename std::remove_const<T>::type>::type;
using type = std::
conditional_t<IsConst, typename std::remove_const<T>::type const, std::remove_const_t<T>>;
};
/** Alias for omitting `typename`. */

View File

@@ -7,8 +7,7 @@
#include <cstdint>
#include <set>
namespace xrpl {
namespace cryptoconditions {
namespace xrpl::cryptoconditions {
enum class Type : std::uint8_t {
preimageSha256 = 0,
@@ -88,6 +87,4 @@ operator!=(Condition const& lhs, Condition const& rhs)
return !(lhs == rhs);
}
} // namespace cryptoconditions
} // namespace xrpl
} // namespace xrpl::cryptoconditions

View File

@@ -4,8 +4,7 @@
#include <xrpl/basics/Slice.h>
#include <xrpl/conditions/Condition.h>
namespace xrpl {
namespace cryptoconditions {
namespace xrpl::cryptoconditions {
struct Fulfillment
{
@@ -119,5 +118,4 @@ validate(Fulfillment const& f, Condition const& c, Slice m);
bool
validate(Fulfillment const& f, Condition const& c);
} // namespace cryptoconditions
} // namespace xrpl
} // namespace xrpl::cryptoconditions

View File

@@ -9,8 +9,7 @@
#include <memory>
namespace xrpl {
namespace cryptoconditions {
namespace xrpl::cryptoconditions {
class PreimageSha256 final : public Fulfillment
{
@@ -127,5 +126,4 @@ public:
}
};
} // namespace cryptoconditions
} // namespace xrpl
} // namespace xrpl::cryptoconditions

View File

@@ -2,8 +2,7 @@
#include <system_error>
namespace xrpl {
namespace cryptoconditions {
namespace xrpl::cryptoconditions {
enum class error {
generic = 1,
@@ -28,8 +27,7 @@ enum class error {
std::error_code
make_error_code(error ev);
} // namespace cryptoconditions
} // namespace xrpl
} // namespace xrpl::cryptoconditions
namespace std {

View File

@@ -8,15 +8,12 @@
#include <limits>
namespace xrpl {
namespace cryptoconditions {
// A collection of functions to decode binary blobs
// encoded with X.690 Distinguished Encoding Rules.
//
// This is a very trivial decoder and only implements
// the bare minimum needed to support PreimageSha256.
namespace der {
namespace xrpl::cryptoconditions::der {
// The preamble encapsulates the DER identifier and
// length octets:
@@ -204,6 +201,4 @@ parseInteger(Slice& s, std::size_t count, std::error_code& ec)
return v;
}
} // namespace der
} // namespace cryptoconditions
} // namespace xrpl
} // namespace xrpl::cryptoconditions::der

View File

@@ -72,10 +72,10 @@ private:
{
private:
ClosureCounter& counter_;
std::remove_reference_t<Closure> closure_;
std::remove_reference_t<Closure> closure_{};
static_assert(
std::is_same<decltype(closure_(std::declval<Args_t>()...)), Ret_t>::value,
std::is_same_v<decltype(closure_(std::declval<Args_t>()...)), Ret_t>,
"Closure arguments don't match ClosureCounter Ret_t or Args_t");
public:
@@ -86,7 +86,7 @@ private:
++counter_;
}
Substitute(Substitute&& rhs) noexcept(std::is_nothrow_move_constructible<Closure>::value)
Substitute(Substitute&& rhs) noexcept(std::is_nothrow_move_constructible_v<Closure>)
: counter_(rhs.counter_), closure_(std::move(rhs.closure_))
{
++counter_;

View File

@@ -109,9 +109,7 @@ private:
class Entry : public CountedObject<Entry>
{
public:
Entry()
{
}
Entry() = default;
void
addPeer(PeerShortID peer)

View File

@@ -128,7 +128,7 @@ public:
beast::Journal journal,
Logs& logs,
perf::PerfLog& perfLog);
~JobQueue();
~JobQueue() override;
/** Adds a job to the JobQueue.
@@ -141,8 +141,7 @@ public:
*/
template <
typename JobHandler,
typename =
std::enable_if_t<std::is_same<decltype(std::declval<JobHandler&&>()()), void>::value>>
typename = std::enable_if_t<std::is_same_v<decltype(std::declval<JobHandler&&>()()), void>>>
bool
addJob(JobType type, std::string const& name, JobHandler&& jobHandler)
{

View File

@@ -4,6 +4,8 @@
#include <xrpl/beast/insight/Collector.h>
#include <xrpl/core/JobTypeInfo.h>
#include <utility>
namespace xrpl {
struct JobTypeData
@@ -33,9 +35,9 @@ public:
JobTypeData(
JobTypeInfo const& info_,
beast::insight::Collector::ptr const& collector,
beast::insight::Collector::ptr collector,
Logs& logs) noexcept
: m_load(logs.journal("LoadMonitor")), m_collector(collector), info(info_)
: m_load(logs.journal("LoadMonitor")), m_collector(std::move(collector)), info(info_)
{
m_load.setTargetLatency(info.getAverageLatency(), info.getPeakLatency());

View File

@@ -33,8 +33,7 @@ private:
std::chrono::milliseconds avgLatency,
std::chrono::milliseconds peakLatency) {
XRPL_ASSERT(
m_map.find(jt) == m_map.end(),
"xrpl::JobTypes::JobTypes::add : unique job type input");
!m_map.contains(jt), "xrpl::JobTypes::JobTypes::add : unique job type input");
[[maybe_unused]] auto const inserted =
m_map

View File

@@ -16,7 +16,7 @@ class LoadEvent
{
public:
// VFALCO TODO remove the dependency on LoadMonitor. Is that possible?
LoadEvent(LoadMonitor& monitor, std::string const& name, bool shouldStart);
LoadEvent(LoadMonitor& monitor, std::string name, bool shouldStart);
LoadEvent(LoadEvent const&) = delete;
~LoadEvent();

View File

@@ -93,7 +93,7 @@ public:
explicit Workers(
Callback& callback,
perf::PerfLog* perfLog,
std::string const& threadNames = "Worker",
std::string threadNames = "Worker",
int numberOfThreads = static_cast<int>(std::thread::hardware_concurrency()));
~Workers();
@@ -164,7 +164,7 @@ private:
public beast::LockFreeStack<Worker, PausedTag>::Node
{
public:
Worker(Workers& workers, std::string const& threadName, int const instance);
Worker(Workers& workers, std::string threadName, int const instance);
~Worker();

View File

@@ -15,9 +15,7 @@ class Value;
class WriterBase
{
public:
virtual ~WriterBase()
{
}
virtual ~WriterBase() = default;
virtual std::string
write(Value const& root) = 0;
};
@@ -34,9 +32,7 @@ class FastWriter : public WriterBase
{
public:
FastWriter() = default;
virtual ~FastWriter()
{
}
~FastWriter() override = default;
public: // overridden from Writer
std::string
@@ -71,9 +67,7 @@ class StyledWriter : public WriterBase
{
public:
StyledWriter();
virtual ~StyledWriter()
{
}
~StyledWriter() override = default;
public: // overridden from Writer
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a>
@@ -136,9 +130,7 @@ class StyledStreamWriter
{
public:
StyledStreamWriter(std::string indentation = "\t");
~StyledStreamWriter()
{
}
~StyledStreamWriter() = default;
public:
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a>

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