mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-03 20:42:12 +00:00
Compare commits
38 Commits
mvadari/te
...
bthomee/go
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4ceb23d40 | ||
|
|
c92285f10d | ||
|
|
53649cc298 | ||
|
|
f151293e8a | ||
|
|
7ba1d76d05 | ||
|
|
3d847f2a60 | ||
|
|
6003fd03fc | ||
|
|
41622b87ae | ||
|
|
6f0f5b8bb3 | ||
|
|
3b9e24e0e0 | ||
|
|
4c619e8a85 | ||
|
|
8e378c4f47 | ||
|
|
c53aafa6bf | ||
|
|
0d149ba5b6 | ||
|
|
d1ff948244 | ||
|
|
ba739c94ce | ||
|
|
6d0b758a12 | ||
|
|
6aed3bb71d | ||
|
|
ea13be81b7 | ||
|
|
86d8b244d6 | ||
|
|
ecf7f805c9 | ||
|
|
8abbd1ba3a | ||
|
|
95d53b4d43 | ||
|
|
62bfc4ca5b | ||
|
|
809a629075 | ||
|
|
74b55a59b2 | ||
|
|
768d7603b1 | ||
|
|
fd8a915243 | ||
|
|
3e9f1d0ab8 | ||
|
|
652b5f9af1 | ||
|
|
50fdb38ace | ||
|
|
bb2ab4243b | ||
|
|
2ab43b6fda | ||
|
|
12a5d9014e | ||
|
|
b9eee1d245 | ||
|
|
0711a7b493 | ||
|
|
07c64f07f0 | ||
|
|
3097c157b6 |
287
.clang-tidy
287
.clang-tidy
@@ -1,161 +1,136 @@
|
||||
---
|
||||
Checks: "-*,
|
||||
bugprone-argument-comment,
|
||||
bugprone-assert-side-effect,
|
||||
bugprone-bad-signal-to-kill-thread,
|
||||
bugprone-bool-pointer-implicit-conversion,
|
||||
bugprone-capturing-this-in-member-variable,
|
||||
bugprone-casting-through-void,
|
||||
bugprone-chained-comparison,
|
||||
bugprone-compare-pointer-to-member-virtual-function,
|
||||
bugprone-copy-constructor-init,
|
||||
bugprone-crtp-constructor-accessibility,
|
||||
bugprone-dangling-handle,
|
||||
bugprone-derived-method-shadowing-base-method,
|
||||
bugprone-dynamic-static-initializers,
|
||||
bugprone-empty-catch,
|
||||
bugprone-fold-init-type,
|
||||
bugprone-forward-declaration-namespace,
|
||||
bugprone-inaccurate-erase,
|
||||
bugprone-inc-dec-in-conditions,
|
||||
bugprone-incorrect-enable-if,
|
||||
bugprone-incorrect-roundings,
|
||||
bugprone-infinite-loop,
|
||||
bugprone-integer-division,
|
||||
bugprone-invalid-enum-default-initialization,
|
||||
bugprone-lambda-function-name,
|
||||
bugprone-macro-parentheses,
|
||||
bugprone-macro-repeated-side-effects,
|
||||
bugprone-misleading-setter-of-reference,
|
||||
bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||
bugprone-misplaced-pointer-arithmetic-in-alloc,
|
||||
bugprone-misplaced-widening-cast,
|
||||
bugprone-move-forwarding-reference,
|
||||
bugprone-multi-level-implicit-pointer-conversion,
|
||||
bugprone-multiple-new-in-one-expression,
|
||||
bugprone-multiple-statement-macro,
|
||||
bugprone-no-escape,
|
||||
bugprone-non-zero-enum-to-bool-conversion,
|
||||
bugprone-optional-value-conversion,
|
||||
bugprone-parent-virtual-call,
|
||||
bugprone-pointer-arithmetic-on-polymorphic-object,
|
||||
bugprone-posix-return,
|
||||
bugprone-redundant-branch-condition,
|
||||
bugprone-reserved-identifier,
|
||||
bugprone-return-const-ref-from-parameter,
|
||||
bugprone-shared-ptr-array-mismatch,
|
||||
bugprone-signal-handler,
|
||||
bugprone-signed-char-misuse,
|
||||
bugprone-sizeof-container,
|
||||
bugprone-sizeof-expression,
|
||||
bugprone-spuriously-wake-up-functions,
|
||||
bugprone-standalone-empty,
|
||||
bugprone-string-constructor,
|
||||
bugprone-string-integer-assignment,
|
||||
bugprone-string-literal-with-embedded-nul,
|
||||
bugprone-stringview-nullptr,
|
||||
bugprone-suspicious-enum-usage,
|
||||
bugprone-suspicious-include,
|
||||
bugprone-suspicious-memory-comparison,
|
||||
bugprone-suspicious-memset-usage,
|
||||
bugprone-suspicious-missing-comma,
|
||||
bugprone-suspicious-realloc-usage,
|
||||
bugprone-suspicious-semicolon,
|
||||
bugprone-suspicious-string-compare,
|
||||
bugprone-suspicious-stringview-data-usage,
|
||||
bugprone-swapped-arguments,
|
||||
bugprone-switch-missing-default-case,
|
||||
bugprone-terminating-continue,
|
||||
bugprone-throw-keyword-missing,
|
||||
bugprone-too-small-loop-variable,
|
||||
bugprone-unchecked-optional-access,
|
||||
bugprone-undefined-memory-manipulation,
|
||||
bugprone-undelegated-constructor,
|
||||
bugprone-unhandled-exception-at-new,
|
||||
bugprone-unhandled-self-assignment,
|
||||
bugprone-unique-ptr-array-mismatch,
|
||||
bugprone-unsafe-functions,
|
||||
bugprone-unused-local-non-trivial-variable,
|
||||
bugprone-unused-raii,
|
||||
bugprone-unused-return-value,
|
||||
bugprone-use-after-move,
|
||||
bugprone-virtual-near-miss,
|
||||
cppcoreguidelines-init-variables,
|
||||
cppcoreguidelines-misleading-capture-default-by-value,
|
||||
cppcoreguidelines-no-suspend-with-lock,
|
||||
cppcoreguidelines-pro-type-member-init,
|
||||
cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
cppcoreguidelines-rvalue-reference-param-not-moved,
|
||||
cppcoreguidelines-use-default-member-init,
|
||||
cppcoreguidelines-use-enum-class,
|
||||
cppcoreguidelines-virtual-class-destructor,
|
||||
hicpp-ignored-remove-result,
|
||||
bugprone-*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-exception-escape,
|
||||
-bugprone-implicit-widening-of-multiplication-result,
|
||||
-bugprone-narrowing-conversions,
|
||||
-bugprone-throwing-static-initialization,
|
||||
|
||||
cppcoreguidelines-*,
|
||||
-cppcoreguidelines-avoid-c-arrays,
|
||||
-cppcoreguidelines-avoid-capturing-lambda-coroutines,
|
||||
-cppcoreguidelines-avoid-const-or-ref-data-members,
|
||||
-cppcoreguidelines-avoid-do-while,
|
||||
-cppcoreguidelines-avoid-goto,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-avoid-non-const-global-variables,
|
||||
-cppcoreguidelines-avoid-reference-coroutine-parameters,
|
||||
-cppcoreguidelines-c-copy-assignment-signature,
|
||||
-cppcoreguidelines-explicit-virtual-functions,
|
||||
-cppcoreguidelines-interfaces-global-init,
|
||||
-cppcoreguidelines-macro-to-enum,
|
||||
-cppcoreguidelines-macro-usage,
|
||||
-cppcoreguidelines-missing-std-forward,
|
||||
-cppcoreguidelines-narrowing-conversions,
|
||||
-cppcoreguidelines-no-malloc,
|
||||
-cppcoreguidelines-noexcept-destructor,
|
||||
-cppcoreguidelines-noexcept-move-operations,
|
||||
-cppcoreguidelines-noexcept-swap,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
-cppcoreguidelines-owning-memory,
|
||||
-cppcoreguidelines-prefer-member-initializer,
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-bounds-avoid-unchecked-container-access,
|
||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cppcoreguidelines-pro-type-const-cast,
|
||||
-cppcoreguidelines-pro-type-cstyle-cast,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
-cppcoreguidelines-pro-type-union-access,
|
||||
-cppcoreguidelines-pro-type-vararg,
|
||||
-cppcoreguidelines-slicing,
|
||||
-cppcoreguidelines-special-member-functions,
|
||||
|
||||
llvm-namespace-comment,
|
||||
misc-const-correctness,
|
||||
misc-definitions-in-headers,
|
||||
misc-header-include-cycle,
|
||||
misc-include-cleaner,
|
||||
misc-misplaced-const,
|
||||
misc-redundant-expression,
|
||||
misc-static-assert,
|
||||
misc-throw-by-value-catch-by-reference,
|
||||
misc-unused-alias-decls,
|
||||
misc-unused-using-decls,
|
||||
modernize-concat-nested-namespaces,
|
||||
modernize-deprecated-headers,
|
||||
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-nodiscard,
|
||||
modernize-use-override,
|
||||
modernize-use-ranges,
|
||||
modernize-use-scoped-lock,
|
||||
modernize-use-starts-ends-with,
|
||||
modernize-use-std-numbers,
|
||||
modernize-use-using,
|
||||
performance-faster-string-find,
|
||||
performance-for-range-copy,
|
||||
performance-implicit-conversion-in-loop,
|
||||
performance-inefficient-vector-operation,
|
||||
performance-move-const-arg,
|
||||
performance-move-constructor-init,
|
||||
performance-no-automatic-move,
|
||||
performance-trivially-destructible,
|
||||
readability-ambiguous-smartptr-reset-call,
|
||||
readability-avoid-nested-conditional-operator,
|
||||
readability-avoid-return-with-void-value,
|
||||
readability-braces-around-statements,
|
||||
readability-const-return-type,
|
||||
readability-container-contains,
|
||||
readability-container-size-empty,
|
||||
readability-convert-member-functions-to-static,
|
||||
readability-duplicate-include,
|
||||
readability-else-after-return,
|
||||
readability-enum-initial-value,
|
||||
readability-identifier-naming,
|
||||
readability-implicit-bool-conversion,
|
||||
readability-inconsistent-ifelse-braces,
|
||||
readability-make-member-function-const,
|
||||
readability-math-missing-parentheses,
|
||||
readability-misleading-indentation,
|
||||
readability-non-const-parameter,
|
||||
readability-redundant-casting,
|
||||
readability-redundant-declaration,
|
||||
readability-redundant-inline-specifier,
|
||||
readability-redundant-member-init,
|
||||
readability-redundant-parentheses,
|
||||
readability-redundant-string-init,
|
||||
readability-redundant-typename,
|
||||
readability-reference-to-constructed-temporary,
|
||||
readability-simplify-boolean-expr,
|
||||
readability-static-definition-in-anonymous-namespace,
|
||||
readability-suspicious-call-argument,
|
||||
readability-use-std-min-max
|
||||
|
||||
misc-*,
|
||||
-misc-anonymous-namespace-in-header,
|
||||
-misc-confusable-identifiers,
|
||||
-misc-coroutine-hostile-raii,
|
||||
-misc-misleading-bidirectional,
|
||||
-misc-misleading-identifier,
|
||||
-misc-multiple-inheritance,
|
||||
-misc-new-delete-overloads,
|
||||
-misc-no-recursion,
|
||||
-misc-non-copyable-objects,
|
||||
-misc-non-private-member-variables-in-classes,
|
||||
-misc-override-with-different-visibility,
|
||||
-misc-predictable-rand,
|
||||
-misc-unconventional-assign-operator,
|
||||
-misc-uniqueptr-reset-release,
|
||||
-misc-unused-parameters,
|
||||
-misc-use-anonymous-namespace,
|
||||
-misc-use-internal-linkage,
|
||||
|
||||
modernize-*,
|
||||
-modernize-avoid-c-arrays,
|
||||
-modernize-avoid-c-style-cast,
|
||||
-modernize-avoid-setjmp-longjmp,
|
||||
-modernize-avoid-variadic-functions,
|
||||
-modernize-deprecated-ios-base-aliases,
|
||||
-modernize-loop-convert,
|
||||
-modernize-macro-to-enum,
|
||||
-modernize-min-max-use-initializer-list,
|
||||
-modernize-raw-string-literal,
|
||||
-modernize-redundant-void-arg,
|
||||
-modernize-replace-auto-ptr,
|
||||
-modernize-replace-disallow-copy-and-assign-macro,
|
||||
-modernize-replace-random-shuffle,
|
||||
-modernize-return-braced-init-list,
|
||||
-modernize-shrink-to-fit,
|
||||
-modernize-use-bool-literals,
|
||||
-modernize-use-default-member-init,
|
||||
-modernize-use-integer-sign-comparison,
|
||||
-modernize-use-noexcept,
|
||||
-modernize-use-nullptr,
|
||||
-modernize-use-std-format,
|
||||
-modernize-use-std-print,
|
||||
-modernize-use-trailing-return-type,
|
||||
-modernize-use-transparent-functors,
|
||||
-modernize-use-uncaught-exceptions,
|
||||
|
||||
performance-*,
|
||||
-performance-avoid-endl,
|
||||
-performance-enum-size,
|
||||
-performance-inefficient-algorithm,
|
||||
-performance-inefficient-string-concatenation,
|
||||
-performance-no-int-to-ptr,
|
||||
-performance-noexcept-destructor,
|
||||
-performance-noexcept-move-constructor,
|
||||
-performance-noexcept-swap,
|
||||
-performance-type-promotion-in-math-fn,
|
||||
-performance-unnecessary-copy-initialization,
|
||||
-performance-unnecessary-value-param,
|
||||
|
||||
readability-*,
|
||||
-readability-avoid-const-params-in-decls,
|
||||
-readability-avoid-unconditional-preprocessor-if,
|
||||
-readability-container-data-pointer,
|
||||
-readability-delete-null-pointer,
|
||||
-readability-function-cognitive-complexity,
|
||||
-readability-function-size,
|
||||
-readability-identifier-length,
|
||||
-readability-inconsistent-declaration-parameter-name,
|
||||
-readability-isolate-declaration,
|
||||
-readability-magic-numbers,
|
||||
-readability-misplaced-array-index,
|
||||
-readability-named-parameter,
|
||||
-readability-operators-representation,
|
||||
-readability-qualified-auto,
|
||||
-readability-redundant-access-specifiers,
|
||||
-readability-redundant-control-flow,
|
||||
-readability-redundant-function-ptr-dereference,
|
||||
-readability-redundant-preprocessor,
|
||||
-readability-redundant-smartptr-get,
|
||||
-readability-redundant-string-cstr,
|
||||
-readability-simplify-subscript-expr,
|
||||
-readability-static-accessed-through-instance,
|
||||
-readability-string-compare,
|
||||
-readability-uniqueptr-delete-release,
|
||||
-readability-uppercase-literal-suffix,
|
||||
-readability-use-anyofallof,
|
||||
-readability-use-concise-preprocessor-directives
|
||||
"
|
||||
# ---
|
||||
# bugprone-narrowing-conversions, # This will break a lot of code but we should enable it in the future because it can eliminate a lot of bugs
|
||||
@@ -168,7 +143,7 @@ CheckOptions:
|
||||
bugprone-unsafe-functions.ReportMoreUnsafeFunctions: true
|
||||
bugprone-unused-return-value.CheckedReturnTypes: ::std::error_code;::std::error_condition;::std::errc
|
||||
|
||||
misc-include-cleaner.IgnoreHeaders: ".*/(detail|impl)/.*;.*fwd\\.h(pp)?;time.h;stdlib.h;sqlite3.h;netinet/in\\.h;sys/resource\\.h;sys/sysinfo\\.h;linux/sysinfo\\.h;__chrono/.*;bits/.*;_abort\\.h;boost/uuid/uuid_hash.hpp;boost/beast/core/flat_buffer\\.hpp;boost/beast/http/field\\.hpp;boost/beast/http/dynamic_body\\.hpp;boost/beast/http/message\\.hpp;boost/beast/http/read\\.hpp;boost/beast/http/write\\.hpp;openssl/obj_mac\\.h"
|
||||
misc-include-cleaner.IgnoreHeaders: ".*/(detail|impl)/.*;.*fwd\\.h(pp)?;time.h;stdlib.h;sqlite3.h;netinet/in\\.h;sys/resource\\.h;sys/sysinfo\\.h;linux/sysinfo\\.h;__chrono/.*;bits/.*;_abort\\.h;boost/.*;openssl/obj_mac\\.h"
|
||||
|
||||
readability-braces-around-statements.ShortStatementLines: 2
|
||||
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE
|
||||
|
||||
@@ -36,9 +36,7 @@ overrides:
|
||||
- /'[^']*'/g # single-quoted strings
|
||||
- /`[^`]*`/g # backtick strings
|
||||
suggestWords:
|
||||
- xprl->xrpl
|
||||
- xprld->xrpld # cspell: disable-line not sure what this problem is....
|
||||
- unsynched->unsynced # cspell: disable-line not sure what this problem is....
|
||||
- unsynched->unsynced
|
||||
- synched->synced
|
||||
- synch->sync
|
||||
words:
|
||||
@@ -60,6 +58,7 @@ words:
|
||||
- autobridging
|
||||
- bimap
|
||||
- bindir
|
||||
- blindings
|
||||
- bookdir
|
||||
- Bougalis
|
||||
- Britto
|
||||
@@ -95,6 +94,7 @@ words:
|
||||
- daria
|
||||
- dcmake
|
||||
- dearmor
|
||||
- decryptor
|
||||
- dedented
|
||||
- deleteme
|
||||
- demultiplexer
|
||||
@@ -106,6 +106,7 @@ words:
|
||||
- distro
|
||||
- doxyfile
|
||||
- dxrpl
|
||||
- elgamal
|
||||
- enabled
|
||||
- enablerepo
|
||||
- endmacro
|
||||
@@ -119,6 +120,7 @@ words:
|
||||
- fmtdur
|
||||
- fsanitize
|
||||
- funclets
|
||||
- Gamal
|
||||
- gcov
|
||||
- gcovr
|
||||
- ghead
|
||||
@@ -216,6 +218,7 @@ words:
|
||||
- partitioner
|
||||
- paychan
|
||||
- paychans
|
||||
- Pedersen
|
||||
- permdex
|
||||
- perminute
|
||||
- permissioned
|
||||
@@ -239,6 +242,10 @@ words:
|
||||
- Raphson
|
||||
- rcflags
|
||||
- replayer
|
||||
- rerandomize
|
||||
- rerandomization
|
||||
- rerandomized
|
||||
- rerandomizes
|
||||
- rerere
|
||||
- retriable
|
||||
- RIPD
|
||||
@@ -255,6 +262,7 @@ words:
|
||||
- sahyadri
|
||||
- Satoshi
|
||||
- scons
|
||||
- Schnorr
|
||||
- secp
|
||||
- sendq
|
||||
- seqit
|
||||
@@ -285,6 +293,7 @@ words:
|
||||
- stvar
|
||||
- stvector
|
||||
- stxchainattestations
|
||||
- summands
|
||||
- superpeer
|
||||
- superpeers
|
||||
- takergets
|
||||
@@ -48,6 +48,12 @@ endfunction()
|
||||
function(add_module parent name)
|
||||
endfunction()
|
||||
|
||||
function(verify_target_headers target headers_dir)
|
||||
endfunction()
|
||||
|
||||
function(_verify_add_headers target dir)
|
||||
endfunction()
|
||||
|
||||
function(setup_protocol_autogen)
|
||||
endfunction()
|
||||
|
||||
|
||||
2
.github/actions/setup-conan/action.yml
vendored
2
.github/actions/setup-conan/action.yml
vendored
@@ -9,7 +9,7 @@ inputs:
|
||||
remote_url:
|
||||
description: "The URL of the Conan endpoint to use."
|
||||
required: false
|
||||
default: https://conan.ripplex.io
|
||||
default: https://conan.xrplf.org/repository/conan/
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
Loop: test.jtx test.toplevel
|
||||
test.toplevel > test.jtx
|
||||
|
||||
Loop: test.jtx test.unit_test
|
||||
test.unit_test ~= test.jtx
|
||||
|
||||
Loop: xrpld.app xrpld.overlay
|
||||
xrpld.app > xrpld.overlay
|
||||
|
||||
|
||||
@@ -105,9 +105,9 @@ test.csf > xrpl.basics
|
||||
test.csf > xrpld.consensus
|
||||
test.csf > xrpl.json
|
||||
test.csf > xrpl.ledger
|
||||
test.csf > xrpl.protocol
|
||||
test.json > test.jtx
|
||||
test.json > xrpl.json
|
||||
test.jtx > test.unit_test
|
||||
test.jtx > xrpl.basics
|
||||
test.jtx > xrpl.config
|
||||
test.jtx > xrpl.core
|
||||
@@ -194,8 +194,6 @@ test.shamap > xrpl.config
|
||||
test.shamap > xrpl.nodestore
|
||||
test.shamap > xrpl.protocol
|
||||
test.shamap > xrpl.shamap
|
||||
test.toplevel > test.csf
|
||||
test.toplevel > xrpl.json
|
||||
test.unit_test > xrpl.basics
|
||||
test.unit_test > xrpl.protocol
|
||||
tests.libxrpl > xrpl.basics
|
||||
@@ -218,11 +216,14 @@ xrpl.core > xrpl.json
|
||||
xrpl.core > xrpl.protocol
|
||||
xrpl.json > xrpl.basics
|
||||
xrpl.ledger > xrpl.basics
|
||||
xrpl.ledger > xrpl.json
|
||||
xrpl.ledger > xrpl.nodestore
|
||||
xrpl.ledger > xrpl.protocol
|
||||
xrpl.ledger > xrpl.shamap
|
||||
xrpl.net > xrpl.basics
|
||||
xrpl.nodestore > xrpl.basics
|
||||
xrpl.nodestore > xrpl.config
|
||||
xrpl.nodestore > xrpl.json
|
||||
xrpl.nodestore > xrpl.protocol
|
||||
xrpl.protocol > xrpl.basics
|
||||
xrpl.protocol > xrpl.json
|
||||
@@ -240,7 +241,6 @@ xrpl.server > xrpl.json
|
||||
xrpl.server > xrpl.protocol
|
||||
xrpl.server > xrpl.rdb
|
||||
xrpl.server > xrpl.resource
|
||||
xrpl.server > xrpl.shamap
|
||||
xrpl.shamap > xrpl.basics
|
||||
xrpl.shamap > xrpl.nodestore
|
||||
xrpl.shamap > xrpl.protocol
|
||||
@@ -295,8 +295,10 @@ xrpld.peerfinder > xrpl.rdb
|
||||
xrpld.perflog > xrpl.basics
|
||||
xrpld.perflog > xrpl.config
|
||||
xrpld.perflog > xrpl.core
|
||||
xrpld.perflog > xrpld.app
|
||||
xrpld.perflog > xrpld.rpc
|
||||
xrpld.perflog > xrpl.json
|
||||
xrpld.perflog > xrpl.nodestore
|
||||
xrpld.perflog > xrpl.protocol
|
||||
xrpld.rpc > xrpl.basics
|
||||
xrpld.rpc > xrpl.config
|
||||
@@ -314,5 +316,6 @@ xrpld.rpc > xrpl.shamap
|
||||
xrpld.rpc > xrpl.tx
|
||||
xrpld.shamap > xrpl.basics
|
||||
xrpld.shamap > xrpld.core
|
||||
xrpld.shamap > xrpl.nodestore
|
||||
xrpld.shamap > xrpl.protocol
|
||||
xrpld.shamap > xrpl.shamap
|
||||
|
||||
2
.github/scripts/strategy-matrix/macos.json
vendored
2
.github/scripts/strategy-matrix/macos.json
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"platform": "macos/arm64",
|
||||
"runner": ["self-hosted", "macOS", "ARM64", "mac-runner-m1"],
|
||||
"runner": ["self-hosted", "macOS", "ARM64", "macos-26-apple-clang-21"],
|
||||
"configs": [
|
||||
{
|
||||
"build_type": "Release",
|
||||
|
||||
5
.github/workflows/on-pr.yml
vendored
5
.github/workflows/on-pr.yml
vendored
@@ -122,7 +122,6 @@ jobs:
|
||||
issues: write
|
||||
contents: read
|
||||
with:
|
||||
check_only_changed: true
|
||||
create_issue_on_failure: false
|
||||
|
||||
build-test:
|
||||
@@ -154,8 +153,8 @@ jobs:
|
||||
if: ${{ github.repository == 'XRPLF/rippled' && needs.should-run.outputs.go == 'true' && github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release') }}
|
||||
uses: ./.github/workflows/reusable-upload-recipe.yml
|
||||
secrets:
|
||||
remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
||||
remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
|
||||
remote_username: ${{ secrets.NEXUS_REMOTE_USERNAME }}
|
||||
remote_password: ${{ secrets.NEXUS_REMOTE_PASSWORD }}
|
||||
|
||||
notify-clio:
|
||||
needs: upload-recipe
|
||||
|
||||
4
.github/workflows/on-tag.yml
vendored
4
.github/workflows/on-tag.yml
vendored
@@ -20,8 +20,8 @@ jobs:
|
||||
if: ${{ github.repository == 'XRPLF/rippled' }}
|
||||
uses: ./.github/workflows/reusable-upload-recipe.yml
|
||||
secrets:
|
||||
remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
||||
remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
|
||||
remote_username: ${{ secrets.NEXUS_REMOTE_USERNAME }}
|
||||
remote_password: ${{ secrets.NEXUS_REMOTE_PASSWORD }}
|
||||
|
||||
build-test:
|
||||
if: ${{ github.repository == 'XRPLF/rippled' }}
|
||||
|
||||
5
.github/workflows/on-trigger.yml
vendored
5
.github/workflows/on-trigger.yml
vendored
@@ -72,7 +72,6 @@ jobs:
|
||||
issues: write
|
||||
contents: read
|
||||
with:
|
||||
check_only_changed: false
|
||||
create_issue_on_failure: ${{ github.event_name == 'schedule' }}
|
||||
|
||||
build-test:
|
||||
@@ -98,8 +97,8 @@ jobs:
|
||||
if: ${{ github.repository == 'XRPLF/rippled' && github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
|
||||
uses: ./.github/workflows/reusable-upload-recipe.yml
|
||||
secrets:
|
||||
remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
||||
remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
|
||||
remote_username: ${{ secrets.NEXUS_REMOTE_USERNAME }}
|
||||
remote_password: ${{ secrets.NEXUS_REMOTE_PASSWORD }}
|
||||
|
||||
package:
|
||||
needs: build-test
|
||||
|
||||
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
@@ -14,7 +14,7 @@ on:
|
||||
jobs:
|
||||
# Call the workflow in the XRPLF/actions repo that runs the pre-commit hooks.
|
||||
run-hooks:
|
||||
uses: XRPLF/actions/.github/workflows/pre-commit.yml@e06d4138c9ec8dceeb7c818645faa38087ea9e3d
|
||||
uses: XRPLF/actions/.github/workflows/pre-commit.yml@1bde119a1ab71305ba5d3716e7a82cea1c7bdede
|
||||
with:
|
||||
runs_on: ubuntu-latest
|
||||
container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit:sha-41ec7c1" }'
|
||||
|
||||
2
.github/workflows/publish-docs.yml
vendored
2
.github/workflows/publish-docs.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@c47daebb2f9db64ffbac71b47d68a661498d5ce8
|
||||
uses: XRPLF/actions/prepare-runner@64ec3cf3b152b4444638f470bbd6df7a7a30c81c
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
|
||||
33
.github/workflows/reusable-build-test-config.yml
vendored
33
.github/workflows/reusable-build-test-config.yml
vendored
@@ -113,7 +113,7 @@ jobs:
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@c47daebb2f9db64ffbac71b47d68a661498d5ce8
|
||||
uses: XRPLF/actions/prepare-runner@64ec3cf3b152b4444638f470bbd6df7a7a30c81c
|
||||
with:
|
||||
enable_ccache: ${{ inputs.ccache_enabled }}
|
||||
|
||||
@@ -203,7 +203,7 @@ jobs:
|
||||
To fix this:
|
||||
1. Run: cmake --build . --target setup_code_gen
|
||||
2. Run: cmake --build . --target code_gen
|
||||
3. Commit and push the regenerated files
|
||||
3. Commit and push the regenerated files.
|
||||
run: |
|
||||
set -e
|
||||
cmake --build . --target setup_code_gen
|
||||
@@ -216,6 +216,35 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Check Go protobuf bindings are up-to-date
|
||||
working-directory: ${{ env.BUILD_DIR }}
|
||||
env:
|
||||
GO_PROTO_DIR: proto/org/xrpl/rpc/v1
|
||||
MESSAGE: |
|
||||
|
||||
The generated Go protobuf bindings are out of date.
|
||||
|
||||
This happens when the .proto files under proto/org/xrpl/rpc/v1
|
||||
changed but the committed .pb.go files were not regenerated, or when
|
||||
they were generated with a different protoc / plugin version than
|
||||
the one pinned in the Nix environment.
|
||||
|
||||
To fix this:
|
||||
1. Enter the Nix environment (nix develop) so protoc and the
|
||||
protoc-gen-go* plugins match the pinned versions.
|
||||
2. Run: cmake --build . --target go_protobuf
|
||||
3. Commit and push the regenerated files.
|
||||
run: |
|
||||
set -e
|
||||
cmake --build . --target go_protobuf
|
||||
DIFF=$(git -C .. status --porcelain -- "${GO_PROTO_DIR}")
|
||||
if [ -n "${DIFF}" ]; then
|
||||
echo "::error::Generated Go protobuf bindings are out of date"
|
||||
git -C .. diff -- "${GO_PROTO_DIR}"
|
||||
echo "${MESSAGE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build the binary
|
||||
working-directory: ${{ env.BUILD_DIR }}
|
||||
env:
|
||||
|
||||
24
.github/workflows/reusable-clang-tidy.yml
vendored
24
.github/workflows/reusable-clang-tidy.yml
vendored
@@ -3,10 +3,6 @@ name: Run clang-tidy on files
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
check_only_changed:
|
||||
description: "Check only changed files in PR. If false, checks all files in the repository."
|
||||
type: boolean
|
||||
default: false
|
||||
create_issue_on_failure:
|
||||
description: "Whether to create an issue if the check failed"
|
||||
type: boolean
|
||||
@@ -29,15 +25,14 @@ env:
|
||||
|
||||
jobs:
|
||||
determine-files:
|
||||
if: ${{ inputs.check_only_changed }}
|
||||
permissions:
|
||||
contents: read
|
||||
uses: XRPLF/actions/.github/workflows/determine-tidy-files.yml@c7045074aafe9fb92fa537aa4446f81fbfc17e8b
|
||||
uses: XRPLF/actions/.github/workflows/determine-tidy-files.yml@d041ac9f1fa9f07a4ba335eb4c1c82233fb3fef6
|
||||
|
||||
run-clang-tidy:
|
||||
name: Run clang tidy
|
||||
needs: [determine-files]
|
||||
if: ${{ always() && !cancelled() && (!inputs.check_only_changed || needs.determine-files.outputs.cpp_changed_files != '' || needs.determine-files.outputs.clang_tidy_config_changed == 'true') }}
|
||||
if: ${{ needs.determine-files.outputs.cpp_changed_files != '' || needs.determine-files.outputs.need_full_run == 'true' }}
|
||||
runs-on: ["self-hosted", "Linux", "X64", "heavy"]
|
||||
container: "ghcr.io/xrplf/xrpld/nix-debian:sha-e29b523"
|
||||
permissions:
|
||||
@@ -48,7 +43,7 @@ jobs:
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@c47daebb2f9db64ffbac71b47d68a661498d5ce8
|
||||
uses: XRPLF/actions/prepare-runner@64ec3cf3b152b4444638f470bbd6df7a7a30c81c
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
@@ -84,6 +79,7 @@ jobs:
|
||||
-Dtests=ON \
|
||||
-Dwerr=ON \
|
||||
-Dxrpld=ON \
|
||||
-Dverify_headers=ON \
|
||||
..
|
||||
|
||||
# clang-tidy needs headers generated from proto files
|
||||
@@ -96,15 +92,15 @@ jobs:
|
||||
id: run_clang_tidy
|
||||
continue-on-error: true
|
||||
env:
|
||||
TARGETS: ${{ (needs.determine-files.outputs.clang_tidy_config_changed != 'true' && inputs.check_only_changed) && needs.determine-files.outputs.cpp_changed_files || 'src tests' }}
|
||||
TARGETS: ${{ needs.determine-files.outputs.need_full_run != 'true' && needs.determine-files.outputs.cpp_changed_files || 'include src tests' }}
|
||||
run: |
|
||||
set -o pipefail
|
||||
run-clang-tidy -j ${{ steps.nproc.outputs.nproc }} -p "${BUILD_DIR}" -quiet -fix -allow-no-checks ${TARGETS} 2>&1 | tee "${OUTPUT_FILE}"
|
||||
|
||||
- name: Print errors
|
||||
- name: Print filtered clang-tidy errors
|
||||
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
|
||||
run: |
|
||||
sed '/error\||/!d' "${OUTPUT_FILE}"
|
||||
bin/filter-clang-tidy.py "${OUTPUT_FILE}"
|
||||
|
||||
- name: Upload clang-tidy output
|
||||
if: ${{ github.event.repository.visibility == 'public' && steps.run_clang_tidy.outcome != 'success' }}
|
||||
@@ -148,12 +144,12 @@ jobs:
|
||||
\`\`\`
|
||||
EOF
|
||||
|
||||
- name: Append clang-tidy output to issue body (filter for errors and warnings)
|
||||
- name: Append filtered clang-tidy output to issue body
|
||||
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
|
||||
run: |
|
||||
if [ -f "${OUTPUT_FILE}" ]; then
|
||||
# Extract lines containing 'error:', 'warning:', or 'note:'
|
||||
grep -E '(error:|warning:|note:)' "${OUTPUT_FILE}" >"${FILTERED_OUTPUT_FILE}" || true
|
||||
# Filter to the unique errors with their source context.
|
||||
bin/filter-clang-tidy.py "${OUTPUT_FILE}" >"${FILTERED_OUTPUT_FILE}" || true
|
||||
|
||||
# If filtered output is empty, use original (might be a different error format)
|
||||
if [ ! -s "${FILTERED_OUTPUT_FILE}" ]; then
|
||||
|
||||
2
.github/workflows/reusable-package.yml
vendored
2
.github/workflows/reusable-package.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
|
||||
20
.github/workflows/reusable-upload-recipe.yml
vendored
20
.github/workflows/reusable-upload-recipe.yml
vendored
@@ -14,7 +14,7 @@ on:
|
||||
description: "The URL of the Conan endpoint to use."
|
||||
required: false
|
||||
type: string
|
||||
default: https://conan.ripplex.io
|
||||
default: https://conan.xrplf.org/repository/conan/
|
||||
|
||||
secrets:
|
||||
remote_username:
|
||||
@@ -41,6 +41,10 @@ jobs:
|
||||
upload:
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-e29b523
|
||||
env:
|
||||
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||
CONAN_LOGIN_USERNAME_XRPLF: ${{ secrets.remote_username }}
|
||||
CONAN_PASSWORD_XRPLF: ${{ secrets.remote_password }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
@@ -56,15 +60,9 @@ jobs:
|
||||
remote_url: ${{ inputs.remote_url }}
|
||||
|
||||
- name: Log into Conan remote
|
||||
env:
|
||||
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||
REMOTE_USERNAME: ${{ secrets.remote_username }}
|
||||
REMOTE_PASSWORD: ${{ secrets.remote_password }}
|
||||
run: conan remote login "${REMOTE_NAME}" "${REMOTE_USERNAME}" --password "${REMOTE_PASSWORD}"
|
||||
run: conan remote login "${REMOTE_NAME}" "${CONAN_LOGIN_USERNAME_XRPLF}" --password "${CONAN_PASSWORD_XRPLF}"
|
||||
|
||||
- name: Upload Conan recipe (version)
|
||||
env:
|
||||
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||
run: |
|
||||
conan export . --version=${{ steps.version.outputs.version }}
|
||||
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/${{ steps.version.outputs.version }}
|
||||
@@ -73,8 +71,6 @@ jobs:
|
||||
# 'develop' branch, see on-trigger.yml.
|
||||
- name: Upload Conan recipe (develop)
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
env:
|
||||
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||
run: |
|
||||
conan export . --version=develop
|
||||
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/develop
|
||||
@@ -83,8 +79,6 @@ jobs:
|
||||
# one of the 'release' branches, see on-pr.yml.
|
||||
- name: Upload Conan recipe (rc)
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
env:
|
||||
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||
run: |
|
||||
conan export . --version=rc
|
||||
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/rc
|
||||
@@ -93,8 +87,6 @@ jobs:
|
||||
# release, see on-tag.yml.
|
||||
- name: Upload Conan recipe (release)
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
env:
|
||||
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||
run: |
|
||||
conan export . --version=release
|
||||
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/release
|
||||
|
||||
8
.github/workflows/upload-conan-deps.yml
vendored
8
.github/workflows/upload-conan-deps.yml
vendored
@@ -34,7 +34,7 @@ on:
|
||||
|
||||
env:
|
||||
CONAN_REMOTE_NAME: xrplf
|
||||
CONAN_REMOTE_URL: https://conan.ripplex.io
|
||||
CONAN_REMOTE_URL: https://conan.xrplf.org/repository/conan/
|
||||
NPROC_SUBTRACT: 2
|
||||
|
||||
concurrency:
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@c47daebb2f9db64ffbac71b47d68a661498d5ce8
|
||||
uses: XRPLF/actions/prepare-runner@64ec3cf3b152b4444638f470bbd6df7a7a30c81c
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
@@ -108,10 +108,12 @@ jobs:
|
||||
|
||||
- name: Log into Conan remote
|
||||
if: ${{ github.repository == 'XRPLF/rippled' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
|
||||
run: conan remote login "${CONAN_REMOTE_NAME}" "${{ secrets.CONAN_REMOTE_USERNAME }}" --password "${{ secrets.CONAN_REMOTE_PASSWORD }}"
|
||||
run: conan remote login "${CONAN_REMOTE_NAME}" "${{ secrets.NEXUS_REMOTE_USERNAME }}" --password "${{ secrets.NEXUS_REMOTE_PASSWORD }}"
|
||||
|
||||
- name: Upload Conan packages
|
||||
if: ${{ github.repository == 'XRPLF/rippled' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
|
||||
env:
|
||||
FORCE_OPTION: ${{ github.event.inputs.force_upload == 'true' && '--force' || '' }}
|
||||
CONAN_LOGIN_USERNAME_XRPLF: ${{ secrets.NEXUS_REMOTE_USERNAME }}
|
||||
CONAN_PASSWORD_XRPLF: ${{ secrets.NEXUS_REMOTE_PASSWORD }}
|
||||
run: conan upload "*" --remote="${CONAN_REMOTE_NAME}" --confirm ${FORCE_OPTION}
|
||||
|
||||
@@ -28,8 +28,10 @@ repos:
|
||||
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
|
||||
# .ipp fragments are included by their owning header rather than compiled
|
||||
# as standalone translation units, so they have no compile_commands.json
|
||||
# entry to lint (verify_headers checks them transitively).
|
||||
exclude: '^include/xrpl/protocol_autogen|\.ipp$'
|
||||
- id: fix-include-style
|
||||
name: fix include style
|
||||
entry: ./bin/pre-commit/fix_include_style.py
|
||||
@@ -51,12 +53,12 @@ repos:
|
||||
exclude: ^include/xrpl/protocol_autogen/(transactions|ledger_entries)/
|
||||
|
||||
- repo: https://github.com/BlankSpruce/gersemi-pre-commit
|
||||
rev: faadd6a9d852369ca94f4d15b2404c967ba8cb01 # frozen: 0.27.6
|
||||
rev: e98930bdc210d3387007f9252d8c1694ea7e410f # frozen: 0.27.7
|
||||
hooks:
|
||||
- id: gersemi
|
||||
|
||||
- repo: https://github.com/rbubley/mirrors-prettier
|
||||
rev: 515f543f5718ebfd6ce22e16708bb32c68ff96e1 # frozen: v3.8.3
|
||||
rev: 39e2973981e6d2f9b6c543b0086a2d2393abdc89 # frozen: v3.9.4
|
||||
hooks:
|
||||
- id: prettier
|
||||
args: [--end-of-line=auto]
|
||||
@@ -86,22 +88,23 @@ repos:
|
||||
files: \.md$
|
||||
|
||||
- repo: https://github.com/streetsidesoftware/cspell-cli
|
||||
rev: 4643f154907327ee0a2c7038f0296e0dd77d9776 # frozen: v10.0.0
|
||||
rev: ea11f9efc0bec520073405bc30552da887ba71bc # frozen: v10.0.1
|
||||
hooks:
|
||||
- id: cspell # Spell check changed files
|
||||
- id: cspell
|
||||
name: check changed files spelling
|
||||
exclude: |
|
||||
(?x)^(
|
||||
.config/cspell.config.yaml|
|
||||
include/xrpl/protocol_autogen/(transactions|ledger_entries)/.*
|
||||
\.cspell\.config\.yaml|
|
||||
include/xrpl/protocol_autogen/(transactions|ledger_entries)/.*|
|
||||
proto/org/xrpl/rpc/v1/go\.sum|
|
||||
proto/org/xrpl/rpc/v1/.*\.pb\.go
|
||||
)$
|
||||
- id: cspell # Spell check the commit message
|
||||
- id: cspell
|
||||
name: check commit message spelling
|
||||
args:
|
||||
- --no-must-find-files
|
||||
- --no-progress
|
||||
- --no-summary
|
||||
- --files
|
||||
- .git/COMMIT_EDITMSG
|
||||
stages: [commit-msg]
|
||||
|
||||
- repo: local
|
||||
|
||||
42
BUILD.md
42
BUILD.md
@@ -25,7 +25,7 @@ You can verify that the required tools are installed and runnable with:
|
||||
| ----------- | --------------- |
|
||||
| GCC | 15.2 |
|
||||
| Clang | 22 |
|
||||
| Apple Clang | 17 |
|
||||
| Apple Clang | 21 |
|
||||
| MSVC | 19.44[^windows] |
|
||||
|
||||
## Operating Systems
|
||||
@@ -101,7 +101,7 @@ More information on customizing Conan can be found in the [Advanced Conan config
|
||||
Run the following command to add the `xrplf` remote, which hosts some of our dependencies:
|
||||
|
||||
```bash
|
||||
conan remote add --index 0 --force xrplf https://conan.ripplex.io
|
||||
conan remote add --index 0 --force xrplf https://conan.xrplf.org/repository/conan/
|
||||
```
|
||||
|
||||
### Set Up Ccache
|
||||
@@ -317,21 +317,41 @@ See [Sanitizers docs](./docs/build/sanitizers.md) for more details.
|
||||
|
||||
## Options
|
||||
|
||||
| Option | Default Value | Description |
|
||||
| ---------- | ------------- | -------------------------------------------------------------- |
|
||||
| `assert` | OFF | Force enabling assertions. |
|
||||
| `coverage` | OFF | Prepare the coverage report. |
|
||||
| `tests` | OFF | Build tests. |
|
||||
| `unity` | OFF | Configure a unity build. |
|
||||
| `xrpld` | OFF | Build the xrpld application, and not just the libxrpl library. |
|
||||
| `werr` | OFF | Treat compilation warnings as errors |
|
||||
| `wextra` | OFF | Enable additional compilation warnings |
|
||||
| Option | Default Value | Description |
|
||||
| ---------------- | ------------- | ----------------------------------------------------------------------------- |
|
||||
| `assert` | OFF | Force enabling assertions. |
|
||||
| `coverage` | OFF | Prepare the coverage report. |
|
||||
| `tests` | OFF | Build tests. |
|
||||
| `unity` | OFF | Configure a unity build. |
|
||||
| `verify_headers` | ON | Make the `verify-headers` target available to compile each header on its own. |
|
||||
| `xrpld` | OFF | Build the xrpld application, and not just the libxrpl library. |
|
||||
| `werr` | OFF | Treat compilation warnings as errors |
|
||||
| `wextra` | OFF | Enable additional compilation warnings |
|
||||
|
||||
[Unity builds][unity-build] may be faster for the first build (at the cost of much more
|
||||
memory) since they concatenate sources into fewer translation units. Non-unity
|
||||
builds may be faster for incremental builds, and can be helpful for detecting
|
||||
`#include` omissions.
|
||||
|
||||
### Verifying headers
|
||||
|
||||
The regular build only compiles `.cpp` files, so a header is only ever checked
|
||||
through whatever translation unit happens to include it. A header that forgets
|
||||
an `#include` is not caught as long as every `.cpp` that uses it includes its
|
||||
missing dependency first. The `verify_headers` option (ON by default) adds a
|
||||
`verify-headers` target that compiles every header on its own, which fails if a
|
||||
header is not self-contained:
|
||||
|
||||
```bash
|
||||
cmake --build . --target verify-headers
|
||||
```
|
||||
|
||||
The per-header objects are excluded from the `all` target, so a normal build
|
||||
never compiles them; they are built only through `verify-headers`. The generated
|
||||
translation units do appear in `compile_commands.json`, so clang-tidy (and
|
||||
clangd and IDEs) can lint each header on its own. Pass `-Dverify_headers=OFF` to
|
||||
omit them entirely.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Conan
|
||||
|
||||
@@ -90,6 +90,7 @@ find_package(ed25519 REQUIRED)
|
||||
find_package(gRPC REQUIRED)
|
||||
find_package(LibArchive REQUIRED)
|
||||
find_package(lz4 REQUIRED)
|
||||
find_package(mpt-crypto REQUIRED)
|
||||
find_package(nudb REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
find_package(secp256k1 REQUIRED)
|
||||
@@ -102,6 +103,7 @@ target_link_libraries(
|
||||
INTERFACE
|
||||
ed25519::ed25519
|
||||
lz4::lz4
|
||||
mpt-crypto::mpt-crypto
|
||||
OpenSSL::Crypto
|
||||
OpenSSL::SSL
|
||||
secp256k1::secp256k1
|
||||
@@ -135,6 +137,7 @@ endif()
|
||||
|
||||
include(XrplCore)
|
||||
include(XrplProtocolAutogen)
|
||||
include(XrplProtobufGo)
|
||||
include(XrplInstall)
|
||||
include(XrplPackaging)
|
||||
include(XrplValidatorKeys)
|
||||
|
||||
@@ -106,6 +106,9 @@ if [ "${os}" = "linux" ] || [ "${os}" = "macos" ]; then
|
||||
check gpg
|
||||
# pre-commit, or its alternative implementation prek
|
||||
check pre-commit sh -c 'pre-commit --version || prek --version'
|
||||
check protoc
|
||||
check protoc-gen-go
|
||||
check protoc-gen-go-grpc
|
||||
check run-clang-tidy run-clang-tidy --help
|
||||
fi
|
||||
fi
|
||||
|
||||
102
bin/filter-clang-tidy.py
Executable file
102
bin/filter-clang-tidy.py
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Reduce run-clang-tidy output to its unique errors.
|
||||
|
||||
It does two things:
|
||||
|
||||
1. Filters the raw output down to diagnostics and their source-context lines
|
||||
(the indented " 103 | ..." / " | ^" lines clang-tidy prints),
|
||||
matching the "path:line:col: error:" diagnostic shape.
|
||||
|
||||
2. Deduplicates. The same diagnostic in a header is reported once per
|
||||
translation unit that includes it, so identical error blocks are collapsed
|
||||
to their first occurrence.
|
||||
|
||||
An "error block" is an "error:" line together with the indented context lines
|
||||
and any "note:" lines that follow it (up to the next "error:" line). Blocks are
|
||||
compared as a whole, so an error stays attached to its own context, and
|
||||
first-occurrence order is preserved.
|
||||
|
||||
The deduplicated output goes to stdout; a summary of unique error counts per
|
||||
check is printed to stderr.
|
||||
|
||||
Usage:
|
||||
bin/filter-clang-tidy.py [INPUT_FILE] # read from file, or
|
||||
run-clang-tidy ... | bin/filter-clang-tidy.py # read from stdin
|
||||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
from collections import Counter
|
||||
|
||||
# A clang-tidy diagnostic line looks like "path:line:col: error: msg [check]".
|
||||
# Matching on that shape (rather than a loose "error" substring) avoids treating
|
||||
# progress lines whose paths contain "error" as diagnostics, e.g.
|
||||
# [284/850][0.7s] /nix/.../clang-tidy ... src/.../error.cpp
|
||||
DIAG_RE = re.compile(r":\d+:\d+: (?:error|warning|note):")
|
||||
ERROR_RE = re.compile(r":\d+:\d+: error:")
|
||||
CHECK_RE = re.compile(r" error: .*\[([^\],]+)")
|
||||
|
||||
|
||||
def filter_and_dedup(lines: list[str]) -> list[str]:
|
||||
"""Keep diagnostics with their context, then drop duplicate error blocks."""
|
||||
blocks: list[str] = []
|
||||
seen: set[str] = set()
|
||||
current: list[str] = []
|
||||
|
||||
def flush() -> None:
|
||||
if not current:
|
||||
return
|
||||
block = "".join(current)
|
||||
if block not in seen:
|
||||
seen.add(block)
|
||||
blocks.append(block)
|
||||
|
||||
for line in lines:
|
||||
# Keep only diagnostics and their indented source-context lines; drop
|
||||
# progress/status output and blank lines.
|
||||
if not (DIAG_RE.search(line) or line[:1] in (" ", "\t")):
|
||||
continue
|
||||
# An "error:" line starts a new block; its context and any following
|
||||
# "note:" lines (and their context) belong to it.
|
||||
if ERROR_RE.search(line):
|
||||
flush()
|
||||
current = []
|
||||
current.append(line)
|
||||
flush()
|
||||
|
||||
return blocks
|
||||
|
||||
|
||||
def summarize(blocks: list[str]) -> Counter[str]:
|
||||
"""Count unique errors per check name (e.g. "bugprone-branch-clone")."""
|
||||
counts: Counter[str] = Counter()
|
||||
for block in blocks:
|
||||
# The error line is the first line of the block.
|
||||
match = CHECK_RE.search(block.splitlines()[0])
|
||||
if match:
|
||||
counts[match.group(1)] += 1
|
||||
return counts
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if len(sys.argv) > 1 and sys.argv[1] != "-":
|
||||
with open(sys.argv[1], encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
else:
|
||||
lines = sys.stdin.readlines()
|
||||
|
||||
blocks = filter_and_dedup(lines)
|
||||
# Blank line between blocks so distinct errors are easy to tell apart.
|
||||
sys.stdout.write("\n".join(blocks))
|
||||
|
||||
print("\nUnique errors per check:", file=sys.stderr)
|
||||
for check, count in summarize(blocks).most_common():
|
||||
print(f"{count:>4} {check}", file=sys.stderr)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -1,24 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Pre-commit hook that runs clang-tidy on changed files using run-clang-tidy."""
|
||||
"""Pre-commit hook that runs clang-tidy on changed files using run-clang-tidy.
|
||||
|
||||
The set of files is chosen by pre-commit (see .pre-commit-config.yaml), which
|
||||
filters to C/C++ sources and excludes `.ipp` fragments. Headers are linted
|
||||
directly: the `verify_headers` build option (ON by default) compiles every
|
||||
`.h`/`.hpp` on its own, so each header is the main file of its own
|
||||
compile_commands.json entry and run-clang-tidy can analyse it just like a
|
||||
`.cpp`.
|
||||
"""
|
||||
|
||||
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*[<\"]([^>\"]+)[>\"]")
|
||||
CLANG_TIDY_VERSION = 22
|
||||
|
||||
|
||||
def find_run_clang_tidy() -> str | None:
|
||||
for candidate in ("run-clang-tidy-21", "run-clang-tidy"):
|
||||
for candidate in (f"run-clang-tidy-{CLANG_TIDY_VERSION}", "run-clang-tidy"):
|
||||
if path := shutil.which(candidate):
|
||||
return path
|
||||
return None
|
||||
@@ -32,142 +35,23 @@ def find_build_dir(repo_root: Path) -> Path | None:
|
||||
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
|
||||
|
||||
files = sys.argv[1:]
|
||||
if not files:
|
||||
return 0
|
||||
|
||||
run_clang_tidy = find_run_clang_tidy()
|
||||
if not run_clang_tidy:
|
||||
print(
|
||||
f"clang-tidy check failed: TIDY is enabled but neither "
|
||||
f"'run-clang-tidy-{CLANG_TIDY_VERSION}' nor 'run-clang-tidy' was found in PATH.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return 1
|
||||
|
||||
repo_root = Path(
|
||||
subprocess.check_output(
|
||||
["git", "rev-parse", "--show-toplevel"],
|
||||
@@ -175,19 +59,6 @@ def main():
|
||||
text=True,
|
||||
).strip()
|
||||
)
|
||||
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(
|
||||
@@ -197,13 +68,9 @@ def main():
|
||||
)
|
||||
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
|
||||
+ files
|
||||
)
|
||||
return result.returncode
|
||||
|
||||
|
||||
@@ -14,23 +14,23 @@ target_protobuf_sources(
|
||||
xrpl.libpb
|
||||
xrpl/proto
|
||||
LANGUAGE cpp
|
||||
IMPORT_DIRS include/xrpl/proto
|
||||
PROTOS include/xrpl/proto/xrpl.proto
|
||||
IMPORT_DIRS proto
|
||||
PROTOS proto/xrpl.proto
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE protos "include/xrpl/proto/org/*.proto")
|
||||
file(GLOB_RECURSE protos "proto/org/*.proto")
|
||||
target_protobuf_sources(
|
||||
xrpl.libpb
|
||||
xrpl/proto
|
||||
LANGUAGE cpp
|
||||
IMPORT_DIRS include/xrpl/proto
|
||||
IMPORT_DIRS proto
|
||||
PROTOS "${protos}"
|
||||
)
|
||||
target_protobuf_sources(
|
||||
xrpl.libpb
|
||||
xrpl/proto
|
||||
LANGUAGE grpc
|
||||
IMPORT_DIRS include/xrpl/proto
|
||||
IMPORT_DIRS proto
|
||||
PROTOS "${protos}"
|
||||
PLUGIN protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
|
||||
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
|
||||
@@ -293,4 +293,13 @@ if(xrpld)
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/external/antithesis-sdk
|
||||
)
|
||||
endif()
|
||||
|
||||
# The xrpld headers are not built with add_module, so verify them against
|
||||
# the executable's own compile environment.
|
||||
if(verify_headers)
|
||||
verify_target_headers(xrpld "${CMAKE_CURRENT_SOURCE_DIR}/src/xrpld")
|
||||
if(tests)
|
||||
verify_target_headers(xrpld "${CMAKE_CURRENT_SOURCE_DIR}/src/test")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
97
cmake/XrplProtobufGo.cmake
Normal file
97
cmake/XrplProtobufGo.cmake
Normal file
@@ -0,0 +1,97 @@
|
||||
#[===================================================================[
|
||||
Go Protobuf Bindings - Generate the Go gRPC client bindings
|
||||
|
||||
The generated `.pb.go` files are committed to the source tree and consumed as
|
||||
a standalone Go module (`github.com/XRPLF/rippled/proto/org/xrpl/rpc/v1`);
|
||||
they are not compiled into xrpld. Regenerate them whenever the `.proto`
|
||||
definitions change by running:
|
||||
|
||||
cmake --build . --target go_protobuf
|
||||
|
||||
This target is excluded from ALL and is only available when `protoc` and the
|
||||
two Go plugins (`protoc-gen-go`, `protoc-gen-go-grpc`) are found on PATH.
|
||||
|
||||
IMPORTANT: protoc embeds its own version string into every generated file,
|
||||
and CI verifies the committed files are up-to-date with a plain `git diff`.
|
||||
The toolchain must therefore be the version pinned in the Nix environment
|
||||
(protobuf_34 in nix/packages.nix), which provides all three tools:
|
||||
|
||||
nix develop
|
||||
|
||||
This deliberately does NOT use the Conan-provided `protobuf::protoc` used by
|
||||
the C++/gRPC build: that is a different protoc version, and the Go plugins
|
||||
are not part of the Conan toolchain. Keeping the whole Go toolchain pinned in
|
||||
one place (Nix) is what makes the output reproducible across developers and
|
||||
CI. Developers without Nix can install the tools manually, but must match the
|
||||
pinned versions or the CI check will flag the diff.
|
||||
#]===================================================================]
|
||||
|
||||
# Directory holding the .proto files and the generated module.
|
||||
set(GO_PROTO_IMPORT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/proto")
|
||||
set(GO_PROTO_OUT_DIR "${GO_PROTO_IMPORT_DIR}/org/xrpl/rpc/v1")
|
||||
|
||||
# Module path declared by `option go_package` in every .proto file. The
|
||||
# --go_opt=module=<path> flag strips this prefix when computing output paths;
|
||||
# since it equals the full go_package, the remaining relative path is empty and
|
||||
# all generated files land directly in GO_PROTO_OUT_DIR.
|
||||
set(GO_PROTO_MODULE "github.com/XRPLF/rippled/proto/org/xrpl/rpc/v1")
|
||||
|
||||
# The .proto files to generate Go bindings for, relative to the import dir.
|
||||
file(
|
||||
GLOB_RECURSE GO_PROTO_FILES
|
||||
RELATIVE "${GO_PROTO_IMPORT_DIR}"
|
||||
"${GO_PROTO_IMPORT_DIR}/org/xrpl/rpc/v1/*.proto"
|
||||
)
|
||||
|
||||
# Locate the toolchain on PATH. The GOPATH/bin hint helps non-Nix developers who
|
||||
# installed the plugins with `go install`, which places them there (often off
|
||||
# PATH). However, when not using the Nix-provided toolchain, there is a risk
|
||||
# that the versions don't match and the generated files are different from CI.
|
||||
find_program(GO_EXECUTABLE NAMES go)
|
||||
set(GO_BIN_HINT "")
|
||||
if(GO_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND ${GO_EXECUTABLE} env GOPATH
|
||||
OUTPUT_VARIABLE GO_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(GO_PATH)
|
||||
set(GO_BIN_HINT "${GO_PATH}/bin")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(GO_PROTOC NAMES protoc)
|
||||
find_program(PROTOC_GEN_GO NAMES protoc-gen-go HINTS ${GO_BIN_HINT})
|
||||
find_program(PROTOC_GEN_GO_GRPC NAMES protoc-gen-go-grpc HINTS ${GO_BIN_HINT})
|
||||
|
||||
if(NOT GO_PROTOC OR NOT PROTOC_GEN_GO OR NOT PROTOC_GEN_GO_GRPC)
|
||||
message(
|
||||
STATUS
|
||||
"Go protobuf tooling not found; the 'go_protobuf' target will not be available.\n"
|
||||
" protoc: ${GO_PROTOC}\n"
|
||||
" protoc-gen-go: ${PROTOC_GEN_GO}\n"
|
||||
" protoc-gen-go-grpc: ${PROTOC_GEN_GO_GRPC}\n"
|
||||
"Enter the Nix environment (nix develop) to get the pinned toolchain, "
|
||||
"or install the plugins manually with:\n"
|
||||
" go install google.golang.org/protobuf/cmd/protoc-gen-go@latest\n"
|
||||
" go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Custom target to regenerate the committed Go bindings, excluded from ALL.
|
||||
# Run manually with: cmake --build . --target go_protobuf
|
||||
add_custom_target(
|
||||
go_protobuf
|
||||
COMMAND
|
||||
${GO_PROTOC} --proto_path=${GO_PROTO_IMPORT_DIR}
|
||||
--plugin=protoc-gen-go=${PROTOC_GEN_GO}
|
||||
--plugin=protoc-gen-go-grpc=${PROTOC_GEN_GO_GRPC}
|
||||
--go_out=${GO_PROTO_OUT_DIR} --go_opt=module=${GO_PROTO_MODULE}
|
||||
--go-grpc_out=${GO_PROTO_OUT_DIR}
|
||||
--go-grpc_opt=module=${GO_PROTO_MODULE} ${GO_PROTO_FILES}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMMENT
|
||||
"Generating Go protobuf bindings (github.com/XRPLF/rippled/.../rpc/v1)..."
|
||||
)
|
||||
@@ -30,6 +30,23 @@ if(tests)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Enabled by default so every header is compiled on its own as the main file of
|
||||
# its own compile_commands.json entry - this is what lets clang-tidy (and clangd
|
||||
# and IDEs) analyse a header's own includes directly. The per-header objects are
|
||||
# EXCLUDE_FROM_ALL (see cmake/verify_headers.cmake) and the aggregate target
|
||||
# below is not part of `all`, so a normal `cmake --build` never compiles them.
|
||||
option(
|
||||
verify_headers
|
||||
"Compile every header on its own to verify it is self-contained."
|
||||
ON
|
||||
)
|
||||
if(verify_headers)
|
||||
# Aggregate target that builds every per-module header-verification library
|
||||
# created by add_module (see cmake/verify_headers.cmake). Build it with:
|
||||
# cmake --build . --target verify-headers
|
||||
add_custom_target(verify-headers)
|
||||
endif()
|
||||
|
||||
option(unity "Creates a build using UNITY support in cmake." OFF)
|
||||
if(unity)
|
||||
if(NOT is_ci)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
include(isolate_headers)
|
||||
include(verify_headers)
|
||||
|
||||
# Create an OBJECT library target named
|
||||
#
|
||||
@@ -37,4 +38,20 @@ function(add_module parent name)
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}"
|
||||
PRIVATE
|
||||
)
|
||||
# protocol_autogen contains generated headers that are deliberately exempt
|
||||
# from clang-tidy (see ExcludeHeaderFilterRegex in .clang-tidy), so we do not
|
||||
# verify them either.
|
||||
if(
|
||||
verify_headers
|
||||
AND NOT "${parent}/${name}" STREQUAL "xrpl/protocol_autogen"
|
||||
)
|
||||
verify_target_headers(
|
||||
${target}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/${parent}/${name}"
|
||||
)
|
||||
verify_target_headers(
|
||||
${target}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
84
cmake/verify_headers.cmake
Normal file
84
cmake/verify_headers.cmake
Normal file
@@ -0,0 +1,84 @@
|
||||
# Our normal build only ever compiles `.cpp` files, so a header is only ever
|
||||
# checked through whatever translation unit happens to include it. A header that
|
||||
# is missing an `#include` is never caught as long as every `.cpp` that uses it
|
||||
# includes its missing dependency first. To check a header on its own we compile
|
||||
# it directly as a translation unit.
|
||||
#
|
||||
# Compiling the header itself - rather than a `.cpp` wrapper that includes it -
|
||||
# gives two checks at once:
|
||||
# * the compiler fails if the header is not self-contained, i.e. it uses a
|
||||
# declaration that is not available (directly or transitively); and
|
||||
# * the header is the *main file* of its `compile_commands.json` entry, so
|
||||
# clang-tidy's misc-include-cleaner analyses (and can --fix) the header's own
|
||||
# includes - flagging a dependency that is only available transitively, which
|
||||
# a plain compile cannot catch. A wrapper would be the main file instead, and
|
||||
# include-cleaner never looks inside the headers a main file includes.
|
||||
#
|
||||
# The objects are never linked anywhere; we build them only for these checks.
|
||||
|
||||
# Verify that the headers under headers_dir compile on their own, using the
|
||||
# compile environment of an existing target so each header is compiled exactly as
|
||||
# that target compiles it. This works for both add_module libraries and the xrpld
|
||||
# and test binaries: a library's isolated public and private include directories
|
||||
# and a binary's `-I src` both live in its INCLUDE_DIRECTORIES, and the modules or
|
||||
# libraries it links live in its LINK_LIBRARIES. We copy those usage requirements
|
||||
# through generator expressions (rather than linking ${target}, which is
|
||||
# impossible for an executable), evaluated at generation time so they capture
|
||||
# requirements the caller adds after this runs. The verify library is created
|
||||
# once; call this repeatedly to add more header directories.
|
||||
#
|
||||
# verify_target_headers(target headers_dir)
|
||||
function(verify_target_headers target headers_dir)
|
||||
set(verify ${target}.verify)
|
||||
if(NOT TARGET ${verify})
|
||||
add_library(${verify} OBJECT EXCLUDE_FROM_ALL)
|
||||
# A unity build would concatenate the headers into a single translation
|
||||
# unit, where a header missing an include could be satisfied by one that
|
||||
# precedes it in the blob - exactly the bug we want to catch.
|
||||
set_target_properties(${verify} PROPERTIES UNITY_BUILD OFF)
|
||||
target_include_directories(
|
||||
${verify}
|
||||
PRIVATE $<TARGET_PROPERTY:${target},INCLUDE_DIRECTORIES>
|
||||
)
|
||||
target_compile_definitions(
|
||||
${verify}
|
||||
PRIVATE $<TARGET_PROPERTY:${target},COMPILE_DEFINITIONS>
|
||||
)
|
||||
target_compile_options(
|
||||
${verify}
|
||||
PRIVATE $<TARGET_PROPERTY:${target},COMPILE_OPTIONS>
|
||||
)
|
||||
target_link_libraries(
|
||||
${verify}
|
||||
PRIVATE $<TARGET_PROPERTY:${target},LINK_LIBRARIES>
|
||||
)
|
||||
add_dependencies(verify-headers ${verify})
|
||||
endif()
|
||||
_verify_add_headers(${verify} "${headers_dir}")
|
||||
endfunction()
|
||||
|
||||
# Add every .h/.hpp under dir to target as a directly-compiled C++ translation
|
||||
# unit. .ipp files are inline-implementation fragments included by their owning
|
||||
# header (often after a class declaration), so they are not self-contained on
|
||||
# their own and are verified transitively when that header is verified.
|
||||
function(_verify_add_headers target dir)
|
||||
file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${dir}/*.h" "${dir}/*.hpp")
|
||||
if(NOT headers)
|
||||
return()
|
||||
endif()
|
||||
# `-xc++` forces the header to be compiled as a C++ translation unit; a lone
|
||||
# `.h` is otherwise treated as a header to precompile. `#pragma once` is
|
||||
# harmless (and warns) when the header is the main file, so silence it.
|
||||
# Compiled on its own, a header legitimately defines constants and static or
|
||||
# template functions that nothing in this single translation unit uses (they
|
||||
# exist for the files that include it), so the resulting unused-entity
|
||||
# warnings are expected and must not fail the build under -Werror.
|
||||
set_source_files_properties(
|
||||
${headers}
|
||||
PROPERTIES
|
||||
LANGUAGE CXX
|
||||
COMPILE_OPTIONS
|
||||
"-xc++;-Wno-pragma-once-outside-header;-Wno-unused-const-variable;-Wno-unused-function"
|
||||
)
|
||||
target_sources(${target} PRIVATE ${headers})
|
||||
endfunction()
|
||||
65
conan.lock
65
conan.lock
@@ -1,43 +1,44 @@
|
||||
{
|
||||
"version": "0.5",
|
||||
"requires": [
|
||||
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1778091116.056",
|
||||
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1765850149.987",
|
||||
"sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1778091117.311",
|
||||
"soci/4.0.3#fe32b9ad5eb47e79ab9e45a68f363945%1774450067.231",
|
||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878",
|
||||
"secp256k1/0.7.1#481881709eb0bdd0185a12b912bbe8ad%1770910500.329",
|
||||
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86",
|
||||
"re2/20251105#8579cfd0bda4daf0683f9e3898f964b4%1774398111.888",
|
||||
"protobuf/6.33.5#d96d52ba5baaaa532f47bda866ad87a5%1774467363.12",
|
||||
"openssl/3.6.2#4789bbf131b77d0515d15e094c8f697f%1778071755.506",
|
||||
"nudb/2.0.9#11149c73f8f2baff9a0198fe25971fc7%1775040983.408",
|
||||
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914",
|
||||
"libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492",
|
||||
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1765842973.03",
|
||||
"libarchive/3.8.7#c446109bd1f1d8ba7936c94189bc50e6%1778091117.848",
|
||||
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1782392402.122708",
|
||||
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1782392402.420688",
|
||||
"sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1782392403.185447",
|
||||
"soci/4.0.3#e726491a03468795453f7c83fc924a96%1782392402.679521",
|
||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1782307151.633168",
|
||||
"secp256k1/0.7.1#b1f450b7f78a36fff75bb6934a356f3a%1782338841.3729",
|
||||
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1782392413.075713",
|
||||
"re2/20251105#8579cfd0bda4daf0683f9e3898f964b4%1782392402.431897",
|
||||
"protobuf/6.33.5#ff253ead763bd8d9904a52979cd21e81%1782392410.233933",
|
||||
"openssl/3.6.3#1163d4ddc603907084d08a6a0c6e580f%1782307150.583886",
|
||||
"nudb/2.0.9#11149c73f8f2baff9a0198fe25971fc7%1782392402.297166",
|
||||
"mpt-crypto/0.4.0-rc2#a580f2f9ad0e795de696aa62d54fb9af%1782425834.488828",
|
||||
"lz4/1.10.0#982d9b673900f665a1da109e09c17cab%1782392402.164188",
|
||||
"libiconv/1.17#9923bc6dc6f106646d6967e0039a5ada%1782392792.775744",
|
||||
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1782392402.420732",
|
||||
"libarchive/3.8.7#c446109bd1f1d8ba7936c94189bc50e6%1782392403.066892",
|
||||
"jemalloc/5.3.1#1fc58d55316041f10fbc1e8a2eae632a%1776700028.228",
|
||||
"gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1768312129.152",
|
||||
"grpc/1.81.0#2fb144aeb47e7f35c6ebb0e5f35bed31%1781620605.685",
|
||||
"ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1765850143.772",
|
||||
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772",
|
||||
"c-ares/1.34.6#545240bb1c40e2cacd4362d6b8967650%1774439234.681",
|
||||
"bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837",
|
||||
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c%1778091165.282",
|
||||
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1774365460.196"
|
||||
"gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1782392402.791979",
|
||||
"grpc/1.81.1#5217e6ef0544c42b46f4af35d5e7f649%1782307148.845616",
|
||||
"ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1782307148.15562",
|
||||
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1782392402.538492",
|
||||
"c-ares/1.34.6#545240bb1c40e2cacd4362d6b8967650%1782392402.681654",
|
||||
"bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1782392402.296732",
|
||||
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c%1782392419.475605",
|
||||
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1782307147.395833"
|
||||
],
|
||||
"build_requires": [
|
||||
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1778091116.056",
|
||||
"strawberryperl/5.32.1.1#8d114504d172cfea8ea1662d09b6333e%1774447376.964",
|
||||
"protobuf/6.33.5#d96d52ba5baaaa532f47bda866ad87a5%1774467363.12",
|
||||
"nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1765850144.707",
|
||||
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1782392402.122708",
|
||||
"strawberryperl/5.32.1.1#8d114504d172cfea8ea1662d09b6333e%1782395692.540639",
|
||||
"protobuf/6.33.5#ff253ead763bd8d9904a52979cd21e81%1782392410.233933",
|
||||
"nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1782395690.33162",
|
||||
"msys2/cci.latest#d22fe7b2808f5fd34d0a7923ace9c54f%1770657326.649",
|
||||
"m4/1.4.19#4523e4347b55cd26ae918bd5770cab9a%1778062762.471",
|
||||
"cmake/4.3.0#b939a42e98f593fb34d3a8c5cc860359%1774439249.183",
|
||||
"b2/5.4.2#ffd6084a119587e70f11cd45d1a386e2%1774439233.447",
|
||||
"m4/1.4.19#34c4bbc3eeebe98ca6edf2f52d602e7d%1777282960.259",
|
||||
"cmake/4.3.3#840cf00ea09777e05c2050a50a82c722%1782392418.696091",
|
||||
"b2/5.4.2#ffd6084a119587e70f11cd45d1a386e2%1782392402.624226",
|
||||
"automake/1.16.5#b91b7c384c3deaa9d535be02da14d04f%1755524470.56",
|
||||
"autoconf/2.71#51077f068e61700d65bb05541ea1e4b0%1731054366.86",
|
||||
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1774365460.196"
|
||||
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1782307147.395833"
|
||||
],
|
||||
"python_requires": [],
|
||||
"overrides": {
|
||||
@@ -57,7 +58,7 @@
|
||||
"boost/1.91.0"
|
||||
],
|
||||
"lz4/[>=1.9.4 <2]": [
|
||||
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504"
|
||||
"lz4/1.10.0#982d9b673900f665a1da109e09c17cab"
|
||||
]
|
||||
},
|
||||
"config_requires": []
|
||||
|
||||
@@ -14,7 +14,7 @@ export CONAN_HOME="$TEMP_DIR"
|
||||
# Ensure that the xrplf remote is the first to be consulted, so any recipes we
|
||||
# patched are used. We also add it there to not created huge diff when the
|
||||
# official Conan Center Index is updated.
|
||||
conan remote add --force --index 0 xrplf https://conan.ripplex.io
|
||||
conan remote add --force --index 0 xrplf https://conan.xrplf.org/repository/conan/
|
||||
|
||||
# Delete any existing lockfile.
|
||||
rm -f conan.lock
|
||||
|
||||
@@ -10,16 +10,18 @@
|
||||
os={{ os }}
|
||||
arch={{ arch }}
|
||||
build_type=Debug
|
||||
compiler={{compiler}}
|
||||
compiler={{ compiler }}
|
||||
compiler.version={{ compiler_version }}
|
||||
compiler.cppstd=23
|
||||
{% if os == "Windows" %}
|
||||
compiler.runtime=static
|
||||
{% else %}
|
||||
compiler.libcxx={{detect_api.detect_libcxx(compiler, version, compiler_exe)}}
|
||||
compiler.libcxx={{ detect_api.detect_libcxx(compiler, version, compiler_exe) }}
|
||||
{% endif %}
|
||||
|
||||
[conf]
|
||||
{% if compiler == "gcc" and compiler_version < 13 %}
|
||||
tools.build:cxxflags+=['-Wno-restrict']
|
||||
{% endif %}
|
||||
{# By default, Conan tries to reuse binaries built with different cppstd versions. #}
|
||||
{# We want to avoid that to improve reproduceability, so we add the cppstd version to the package ID. #}
|
||||
{# More info: https://docs.conan.io/2/reference/extensions/binary_compatibility.html #}
|
||||
user.package:cppstd_version=23
|
||||
tools.info.package_id:confs+=["user.package:cppstd_version"]
|
||||
|
||||
@@ -87,15 +87,15 @@ include(default)
|
||||
{% endif %}
|
||||
|
||||
[conf]
|
||||
tools.build:defines+={{defines}}
|
||||
tools.build:cxxflags+={{sanitizer_compiler_flags}}
|
||||
tools.build:sharedlinkflags+={{sanitizer_linker_flags}}
|
||||
tools.build:exelinkflags+={{sanitizer_linker_flags}}
|
||||
tools.build:defines+={{ defines }}
|
||||
tools.build:cxxflags+={{ sanitizer_compiler_flags }}
|
||||
tools.build:sharedlinkflags+={{ sanitizer_linker_flags }}
|
||||
tools.build:exelinkflags+={{ sanitizer_linker_flags }}
|
||||
|
||||
tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags", "tools.build:defines"]
|
||||
|
||||
# &: means "apply only to the consumer/root package"
|
||||
&:tools.cmake.cmaketoolchain:extra_variables={"SANITIZERS": "{{sanitizers}}", "SANITIZERS_COMPILER_FLAGS": "{{sanitizer_compiler_flags | join(' ')}}", "SANITIZERS_LINKER_FLAGS": "{{sanitizer_linker_flags | join(' ')}}"}
|
||||
&:tools.cmake.cmaketoolchain:extra_variables={"SANITIZERS": "{{ sanitizers }}", "SANITIZERS_COMPILER_FLAGS": "{{ sanitizer_compiler_flags | join(' ') }}", "SANITIZERS_LINKER_FLAGS": "{{ sanitizer_linker_flags | join(' ') }}"}
|
||||
|
||||
[options]
|
||||
{% if enable_asan %}
|
||||
|
||||
14
conanfile.py
14
conanfile.py
@@ -28,11 +28,10 @@ class Xrpl(ConanFile):
|
||||
|
||||
requires = [
|
||||
"ed25519/2015.03",
|
||||
"grpc/1.81.0",
|
||||
"grpc/1.81.1",
|
||||
"libarchive/3.8.7",
|
||||
"nudb/2.0.9",
|
||||
"openssl/3.6.2",
|
||||
"secp256k1/0.7.1",
|
||||
"openssl/3.6.3",
|
||||
"soci/4.0.3",
|
||||
"zlib/1.3.2",
|
||||
]
|
||||
@@ -132,13 +131,15 @@ class Xrpl(ConanFile):
|
||||
def requirements(self):
|
||||
self.requires("boost/1.91.0", force=True, transitive_headers=True)
|
||||
self.requires("date/3.0.4", transitive_headers=True)
|
||||
self.requires("lz4/1.10.0", force=True)
|
||||
self.requires("protobuf/6.33.5", force=True)
|
||||
self.requires("sqlite3/3.53.0", force=True)
|
||||
if self.options.jemalloc:
|
||||
self.requires("jemalloc/5.3.1")
|
||||
self.requires("lz4/1.10.0", force=True)
|
||||
self.requires("mpt-crypto/0.4.0-rc2", transitive_headers=True)
|
||||
self.requires("protobuf/6.33.5", force=True)
|
||||
if self.options.rocksdb:
|
||||
self.requires("rocksdb/10.5.1")
|
||||
self.requires("secp256k1/0.7.1", transitive_headers=True)
|
||||
self.requires("sqlite3/3.53.0", force=True)
|
||||
self.requires("xxhash/0.8.3", transitive_headers=True)
|
||||
|
||||
exports_sources = (
|
||||
@@ -208,6 +209,7 @@ class Xrpl(ConanFile):
|
||||
"grpc::grpc++",
|
||||
"libarchive::libarchive",
|
||||
"lz4::lz4",
|
||||
"mpt-crypto::mpt-crypto",
|
||||
"nudb::nudb",
|
||||
"openssl::crypto",
|
||||
"protobuf::libprotobuf",
|
||||
|
||||
@@ -288,7 +288,7 @@ components with non-trivial changes are colored green.
|
||||
validated.
|
||||
|
||||

|
||||
Changes")
|
||||
|
||||
## Roads Not Taken
|
||||
|
||||
|
||||
2
docs/build/advanced_conan.md
vendored
2
docs/build/advanced_conan.md
vendored
@@ -34,7 +34,7 @@ higher index than the default Conan Center remote, so it is consulted first. You
|
||||
can do this by running:
|
||||
|
||||
```bash
|
||||
conan remote add --index 0 --force xrplf https://conan.ripplex.io
|
||||
conan remote add --index 0 --force xrplf https://conan.xrplf.org/repository/conan/
|
||||
```
|
||||
|
||||
Alternatively, you can pull our recipes from the repository and export them locally:
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <lz4.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <concepts>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/basics/UnorderedContainers.h>
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
|
||||
#include <boost/beast/core/string.hpp>
|
||||
@@ -11,7 +10,9 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
@@ -11,7 +13,9 @@
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <boost/icl/closed_interval.hpp>
|
||||
#include <boost/icl/interval_set.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <xrpl/beast/net/IPEndpoint.h>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include <boost/asio/io_context.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
class ResolverAsio : public Resolver
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
#include <xrpl/basics/partitioned_unordered_map.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <concepts>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <mutex>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
|
||||
@@ -211,15 +211,17 @@ operator<<(Stream& s, Slice const& v)
|
||||
}
|
||||
|
||||
template <class T, std::size_t N>
|
||||
std::enable_if_t<std::is_same_v<T, char> || std::is_same_v<T, unsigned char>, Slice>
|
||||
Slice
|
||||
makeSlice(std::array<T, N> const& a)
|
||||
requires(std::is_same_v<T, char> || std::is_same_v<T, unsigned char>)
|
||||
{
|
||||
return Slice(a.data(), a.size());
|
||||
}
|
||||
|
||||
template <class T, class Alloc>
|
||||
std::enable_if_t<std::is_same_v<T, char> || std::is_same_v<T, unsigned char>, Slice>
|
||||
Slice
|
||||
makeSlice(std::vector<T, Alloc> const& v)
|
||||
requires(std::is_same_v<T, char> || std::is_same_v<T, unsigned char>)
|
||||
{
|
||||
return Slice(v.data(), v.size());
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/basics/Blob.h>
|
||||
#include <xrpl/basics/strHex.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <concepts>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/basics/IntrusivePointer.h>
|
||||
#include <xrpl/basics/Log.h>
|
||||
#include <xrpl/basics/SharedWeakCachePointer.ipp>
|
||||
#include <xrpl/basics/SharedWeakCachePointer.h>
|
||||
#include <xrpl/basics/SharedWeakCachePointer.ipp> // IWYU pragma: keep
|
||||
#include <xrpl/basics/UnorderedContainers.h>
|
||||
#include <xrpl/basics/hardened_hash.h>
|
||||
#include <xrpl/beast/clock/abstract_clock.h>
|
||||
#include <xrpl/beast/insight/Insight.h>
|
||||
#include <xrpl/beast/insight/Collector.h>
|
||||
#include <xrpl/beast/insight/Gauge.h>
|
||||
#include <xrpl/beast/insight/Hook.h>
|
||||
#include <xrpl/beast/insight/NullCollector.h>
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
@@ -205,11 +212,13 @@ public:
|
||||
*/
|
||||
template <class ReturnType = bool>
|
||||
auto
|
||||
insert(key_type const& key, T const& value) -> std::enable_if_t<!IsKeyCache, ReturnType>;
|
||||
insert(key_type const& key, T const& value) -> ReturnType
|
||||
requires(!IsKeyCache);
|
||||
|
||||
template <class ReturnType = bool>
|
||||
auto
|
||||
insert(key_type const& key) -> std::enable_if_t<IsKeyCache, ReturnType>;
|
||||
insert(key_type const& key) -> ReturnType
|
||||
requires IsKeyCache;
|
||||
|
||||
// VFALCO NOTE It looks like this returns a copy of the data in
|
||||
// the output parameter 'data'. This could be expensive.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/basics/IntrusivePointer.ipp>
|
||||
#include <xrpl/basics/Log.h> // IWYU pragma: keep
|
||||
#include <xrpl/basics/TaggedCache.h>
|
||||
|
||||
namespace xrpl {
|
||||
@@ -56,7 +57,10 @@ inline TaggedCache<
|
||||
beast::insight::Collector::ptr const& collector)
|
||||
: journal_(journal)
|
||||
, clock_(clock)
|
||||
, stats_(name, std::bind(&TaggedCache::collectMetrics, this), collector)
|
||||
, stats_(
|
||||
name,
|
||||
[this] { collectMetrics(); },
|
||||
collector)
|
||||
, name_(name)
|
||||
, targetSize_(size)
|
||||
, targetAge_(expiration)
|
||||
@@ -499,7 +503,8 @@ template <
|
||||
template <class ReturnType>
|
||||
inline auto
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
insert(key_type const& key, T const& value) -> std::enable_if_t<!IsKeyCache, ReturnType>
|
||||
insert(key_type const& key, T const& value) -> ReturnType
|
||||
requires(!IsKeyCache)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same_v<std::shared_ptr<T>, SharedPointerType> ||
|
||||
@@ -529,7 +534,8 @@ template <
|
||||
template <class ReturnType>
|
||||
inline auto
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
insert(key_type const& key) -> std::enable_if_t<IsKeyCache, ReturnType>
|
||||
insert(key_type const& key) -> ReturnType
|
||||
requires IsKeyCache
|
||||
{
|
||||
std::scoped_lock const lock(mutex_);
|
||||
clock_type::time_point const now(clock_.now());
|
||||
|
||||
@@ -12,8 +12,9 @@ namespace xrpl {
|
||||
*/
|
||||
|
||||
template <class T>
|
||||
std::enable_if_t<std::is_arithmetic_v<T>, std::string>
|
||||
std::string
|
||||
to_string(T t) // NOLINT(readability-identifier-naming)
|
||||
requires(std::is_arithmetic_v<T>)
|
||||
{
|
||||
return std::to_string(t);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
#include <xrpl/basics/hardened_hash.h>
|
||||
#include <xrpl/basics/partitioned_unordered_map.h>
|
||||
#include <xrpl/beast/hash/hash_append.h>
|
||||
#include <xrpl/beast/hash/uhash.h>
|
||||
#include <xrpl/beast/hash/xxhasher.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
* Use hash_* containers for keys that do not need a cryptographically secure
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <xrpl/basics/hardened_hash.h>
|
||||
#include <xrpl/basics/partitioned_unordered_map.h>
|
||||
#include <xrpl/basics/strHex.h>
|
||||
#include <xrpl/beast/hash/hash_append.h>
|
||||
#include <xrpl/beast/utility/Zero.h>
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
|
||||
@@ -18,8 +19,17 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <compare>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <expected>
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
@@ -87,7 +97,7 @@ public:
|
||||
//
|
||||
|
||||
static constexpr std::size_t kBytes = Bits / 8;
|
||||
static_assert(sizeof(data_) == kBytes, "");
|
||||
static_assert(sizeof(data_) == kBytes);
|
||||
|
||||
using size_type = std::size_t;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
@@ -270,12 +280,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
class Container,
|
||||
class = std::enable_if_t<
|
||||
detail::IsContiguousContainer<Container>::value &&
|
||||
std::is_trivially_copyable_v<typename Container::value_type>>>
|
||||
template <class Container>
|
||||
explicit BaseUInt(Container const& c)
|
||||
requires(
|
||||
detail::IsContiguousContainer<Container>::value &&
|
||||
std::is_trivially_copyable_v<typename Container::value_type>)
|
||||
{
|
||||
// Use AlwaysFalseT so the static_assert condition is dependent
|
||||
// and only triggers when this constructor template is instantiated.
|
||||
@@ -285,13 +294,12 @@ public:
|
||||
"Use base_uint::fromRaw instead.");
|
||||
}
|
||||
|
||||
template <
|
||||
class Container,
|
||||
class = std::enable_if_t<
|
||||
detail::IsContiguousContainer<Container>::value &&
|
||||
std::is_trivially_copyable_v<typename Container::value_type>>>
|
||||
template <class Container>
|
||||
static BaseUInt
|
||||
fromRaw(Container const& c)
|
||||
requires(
|
||||
detail::IsContiguousContainer<Container>::value &&
|
||||
std::is_trivially_copyable_v<typename Container::value_type>)
|
||||
{
|
||||
BaseUInt result;
|
||||
XRPL_ASSERT(
|
||||
@@ -302,11 +310,11 @@ public:
|
||||
}
|
||||
|
||||
template <class Container>
|
||||
std::enable_if_t<
|
||||
detail::IsContiguousContainer<Container>::value &&
|
||||
std::is_trivially_copyable_v<typename Container::value_type>,
|
||||
BaseUInt&>
|
||||
BaseUInt&
|
||||
operator=(Container const& c)
|
||||
requires(
|
||||
detail::IsContiguousContainer<Container>::value &&
|
||||
std::is_trivially_copyable_v<typename Container::value_type>)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
c.size() * sizeof(typename Container::value_type) == size(),
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <cstdint>
|
||||
#include <ratio>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/hash/hash_append.h>
|
||||
#include <xrpl/beast/hash/xxhasher.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
#include <xrpl/beast/hash/uhash.h>
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
#include <xrpl/beast/xor_shift_engine.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <mutex>
|
||||
@@ -92,8 +91,9 @@ defaultPrng()
|
||||
*/
|
||||
/** @{ */
|
||||
template <class Engine, class Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
|
||||
Integral
|
||||
randInt(Engine& engine, Integral min, Integral max)
|
||||
requires(std::is_integral_v<Integral> && detail::is_engine<Engine>::value)
|
||||
{
|
||||
XRPL_ASSERT(max > min, "xrpl::randInt : max over min inputs");
|
||||
|
||||
@@ -104,36 +104,41 @@ randInt(Engine& engine, Integral min, Integral max)
|
||||
}
|
||||
|
||||
template <class Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral>, Integral>
|
||||
Integral
|
||||
randInt(Integral min, Integral max)
|
||||
requires(std::is_integral_v<Integral>)
|
||||
{
|
||||
return randInt(defaultPrng(), min, max);
|
||||
}
|
||||
|
||||
template <class Engine, class Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
|
||||
Integral
|
||||
randInt(Engine& engine, Integral max)
|
||||
requires(std::is_integral_v<Integral> && detail::is_engine<Engine>::value)
|
||||
{
|
||||
return randInt(engine, Integral(0), max);
|
||||
}
|
||||
|
||||
template <class Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral>, Integral>
|
||||
Integral
|
||||
randInt(Integral max)
|
||||
requires(std::is_integral_v<Integral>)
|
||||
{
|
||||
return randInt(defaultPrng(), max);
|
||||
}
|
||||
|
||||
template <class Integral, class Engine>
|
||||
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
|
||||
Integral
|
||||
randInt(Engine& engine)
|
||||
requires(std::is_integral_v<Integral> && detail::is_engine<Engine>::value)
|
||||
{
|
||||
return randInt(engine, std::numeric_limits<Integral>::max());
|
||||
}
|
||||
|
||||
template <class Integral = int>
|
||||
std::enable_if_t<std::is_integral_v<Integral>, Integral>
|
||||
Integral
|
||||
randInt()
|
||||
requires(std::is_integral_v<Integral>)
|
||||
{
|
||||
return randInt(defaultPrng(), std::numeric_limits<Integral>::max());
|
||||
}
|
||||
@@ -142,19 +147,20 @@ randInt()
|
||||
/** Return a random byte */
|
||||
/** @{ */
|
||||
template <class Byte, class Engine>
|
||||
std::enable_if_t<
|
||||
(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>) &&
|
||||
detail::is_engine<Engine>::value,
|
||||
Byte>
|
||||
Byte
|
||||
randByte(Engine& engine)
|
||||
requires(
|
||||
(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>) &&
|
||||
detail::is_engine<Engine>::value)
|
||||
{
|
||||
return static_cast<Byte>(randInt<Engine, std::uint32_t>(
|
||||
engine, std::numeric_limits<Byte>::min(), std::numeric_limits<Byte>::max()));
|
||||
}
|
||||
|
||||
template <class Byte = std::uint8_t>
|
||||
std::enable_if_t<(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>), Byte>
|
||||
Byte
|
||||
randByte()
|
||||
requires(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>)
|
||||
{
|
||||
return randByte<Byte>(defaultPrng());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
@@ -17,8 +15,9 @@ concept SafeToCast = (std::is_integral_v<Src> && std::is_integral_v<Dest>) &&
|
||||
: 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>
|
||||
constexpr Dest
|
||||
safeCast(Src s) noexcept
|
||||
requires(std::is_integral_v<Dest> && std::is_integral_v<Src>)
|
||||
{
|
||||
static_assert(
|
||||
std::is_signed_v<Dest> || std::is_unsigned_v<Src>, "Cannot cast signed to unsigned");
|
||||
@@ -30,15 +29,17 @@ safeCast(Src s) noexcept
|
||||
}
|
||||
|
||||
template <class Dest, class Src>
|
||||
constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
constexpr Dest
|
||||
safeCast(Src s) noexcept
|
||||
requires(std::is_enum_v<Dest> && std::is_integral_v<Src>)
|
||||
{
|
||||
return static_cast<Dest>(safeCast<std::underlying_type_t<Dest>>(s));
|
||||
}
|
||||
|
||||
template <class Dest, class Src>
|
||||
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
|
||||
constexpr Dest
|
||||
safeCast(Src s) noexcept
|
||||
requires(std::is_integral_v<Dest> && std::is_enum_v<Src>)
|
||||
{
|
||||
return safeCast<Dest>(static_cast<std::underlying_type_t<Src>>(s));
|
||||
}
|
||||
@@ -48,8 +49,9 @@ safeCast(Src s) noexcept
|
||||
// underlying types become safe, it can be converted to a safe_cast.
|
||||
|
||||
template <class Dest, class Src>
|
||||
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
constexpr Dest
|
||||
unsafeCast(Src s) noexcept
|
||||
requires(std::is_integral_v<Dest> && std::is_integral_v<Src>)
|
||||
{
|
||||
static_assert(
|
||||
!SafeToCast<Src, Dest>,
|
||||
@@ -59,15 +61,17 @@ unsafeCast(Src s) noexcept
|
||||
}
|
||||
|
||||
template <class Dest, class Src>
|
||||
constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
constexpr Dest
|
||||
unsafeCast(Src s) noexcept
|
||||
requires(std::is_enum_v<Dest> && std::is_integral_v<Src>)
|
||||
{
|
||||
return static_cast<Dest>(unsafeCast<std::underlying_type_t<Dest>>(s));
|
||||
}
|
||||
|
||||
template <class Dest, class Src>
|
||||
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
|
||||
constexpr Dest
|
||||
unsafeCast(Src s) noexcept
|
||||
requires(std::is_integral_v<Dest> && std::is_enum_v<Src>)
|
||||
{
|
||||
return unsafeCast<Dest>(static_cast<std::underlying_type_t<Src>>(s));
|
||||
}
|
||||
|
||||
@@ -46,11 +46,9 @@ public:
|
||||
operator=(ScopeExit&&) = delete;
|
||||
|
||||
template <class EFP>
|
||||
explicit ScopeExit(
|
||||
EFP&& f,
|
||||
std::enable_if_t<
|
||||
!std::is_same_v<std::remove_cv_t<EFP>, ScopeExit> &&
|
||||
std::is_constructible_v<EF, EFP>>* = 0) noexcept
|
||||
explicit ScopeExit(EFP&& f) noexcept
|
||||
requires(
|
||||
!std::is_same_v<std::remove_cv_t<EFP>, ScopeExit> && std::is_constructible_v<EF, EFP>)
|
||||
: exitFunction_{std::forward<EFP>(f)}
|
||||
{
|
||||
static_assert(std::is_nothrow_constructible_v<EF, decltype(std::forward<EFP>(f))>);
|
||||
@@ -93,11 +91,9 @@ public:
|
||||
operator=(ScopeFail&&) = delete;
|
||||
|
||||
template <class EFP>
|
||||
explicit ScopeFail(
|
||||
EFP&& f,
|
||||
std::enable_if_t<
|
||||
!std::is_same_v<std::remove_cv_t<EFP>, ScopeFail> &&
|
||||
std::is_constructible_v<EF, EFP>>* = 0) noexcept
|
||||
explicit ScopeFail(EFP&& f) noexcept
|
||||
requires(
|
||||
!std::is_same_v<std::remove_cv_t<EFP>, ScopeFail> && std::is_constructible_v<EF, EFP>)
|
||||
: exitFunction_{std::forward<EFP>(f)}
|
||||
{
|
||||
static_assert(std::is_nothrow_constructible_v<EF, decltype(std::forward<EFP>(f))>);
|
||||
@@ -140,12 +136,11 @@ public:
|
||||
operator=(ScopeSuccess&&) = delete;
|
||||
|
||||
template <class EFP>
|
||||
explicit ScopeSuccess(
|
||||
EFP&& f,
|
||||
std::enable_if_t<
|
||||
explicit ScopeSuccess(EFP&& f) noexcept(
|
||||
std::is_nothrow_constructible_v<EF, EFP> || std::is_nothrow_constructible_v<EF, EFP&>)
|
||||
requires(
|
||||
!std::is_same_v<std::remove_cv_t<EFP>, ScopeSuccess> &&
|
||||
std::is_constructible_v<EF, EFP>>* =
|
||||
0) noexcept(std::is_nothrow_constructible_v<EF, EFP> || std::is_nothrow_constructible_v<EF, EFP&>)
|
||||
std::is_constructible_v<EF, EFP>)
|
||||
: exitFunction_{std::forward<EFP>(f)}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
#include <boost/algorithm/hex.hpp>
|
||||
#include <boost/endian/conversion.hpp>
|
||||
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
template <class FwdIt>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl {
|
||||
@@ -42,10 +43,10 @@ public:
|
||||
|
||||
TaggedInteger() = default;
|
||||
|
||||
template <
|
||||
class OtherInt,
|
||||
class = std::enable_if_t<std::is_integral_v<OtherInt> && sizeof(OtherInt) <= sizeof(Int)>>
|
||||
explicit constexpr TaggedInteger(OtherInt value) noexcept : value_(value)
|
||||
template <class OtherInt>
|
||||
explicit constexpr TaggedInteger(OtherInt value) noexcept
|
||||
requires(std::is_integral_v<OtherInt> && sizeof(OtherInt) <= sizeof(Int))
|
||||
: value_(value)
|
||||
{
|
||||
static_assert(sizeof(TaggedInteger) == sizeof(Int), "tagged_integer is adding padding");
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <cstddef>
|
||||
#include <mutex>
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
#include <xrpl/beast/container/aged_container.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace beast {
|
||||
|
||||
/** Expire aged container items past the specified age. */
|
||||
template <class AgedContainer, class Rep, class Period>
|
||||
std::enable_if_t<IsAgedContainer<AgedContainer>::value, std::size_t>
|
||||
std::size_t
|
||||
expire(AgedContainer& c, std::chrono::duration<Rep, Period> const& age)
|
||||
requires(IsAgedContainer<AgedContainer>::value)
|
||||
{
|
||||
std::size_t n(0);
|
||||
auto const expired(c.clock().now() - age);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -30,20 +30,19 @@ public:
|
||||
|
||||
// Disable constructing a const_iterator from a non-const_iterator.
|
||||
// Converting between reverse and non-reverse iterators should be explicit.
|
||||
template <
|
||||
bool OtherIsConst,
|
||||
class OtherIterator,
|
||||
class = std::enable_if_t<
|
||||
(!OtherIsConst || IsConst) &&
|
||||
!static_cast<bool>(std::is_same_v<Iterator, OtherIterator>)>>
|
||||
template <bool OtherIsConst, class OtherIterator>
|
||||
explicit AgedContainerIterator(AgedContainerIterator<OtherIsConst, OtherIterator> const& other)
|
||||
requires(
|
||||
(!OtherIsConst || IsConst) &&
|
||||
!static_cast<bool>(std::is_same_v<Iterator, OtherIterator>))
|
||||
: iter_(other.iter_)
|
||||
{
|
||||
}
|
||||
|
||||
// Disable constructing a const_iterator from a non-const_iterator.
|
||||
template <bool OtherIsConst, class = std::enable_if_t<!OtherIsConst || IsConst>>
|
||||
template <bool OtherIsConst>
|
||||
AgedContainerIterator(AgedContainerIterator<OtherIsConst, Iterator> const& other)
|
||||
requires(!OtherIsConst || IsConst)
|
||||
: iter_(other.iter_)
|
||||
{
|
||||
}
|
||||
@@ -52,7 +51,8 @@ public:
|
||||
template <bool OtherIsConst, class OtherIterator>
|
||||
auto
|
||||
operator=(AgedContainerIterator<OtherIsConst, OtherIterator> const& other)
|
||||
-> std::enable_if_t<!OtherIsConst || IsConst, AgedContainerIterator&>
|
||||
-> AgedContainerIterator&
|
||||
requires(!OtherIsConst || IsConst)
|
||||
{
|
||||
iter_ = other.iter_;
|
||||
return *this;
|
||||
|
||||
@@ -11,9 +11,14 @@
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
@@ -106,10 +111,9 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
class... Args,
|
||||
class = std::enable_if_t<std::is_constructible_v<value_type, Args...>>>
|
||||
template <class... Args>
|
||||
Element(time_point const& when, Args&&... args)
|
||||
requires(std::is_constructible_v<value_type, Args...>)
|
||||
: value(std::forward<Args>(args)...), when(when)
|
||||
{
|
||||
}
|
||||
@@ -603,35 +607,25 @@ public:
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template <
|
||||
class K,
|
||||
bool MaybeMulti = IsMulti,
|
||||
bool MaybeMap = IsMap,
|
||||
class = std::enable_if_t<MaybeMap && !MaybeMulti>>
|
||||
template <class K, bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
at(K const& k);
|
||||
at(K const& k)
|
||||
requires(MaybeMap && !MaybeMulti);
|
||||
|
||||
template <
|
||||
class K,
|
||||
bool MaybeMulti = IsMulti,
|
||||
bool MaybeMap = IsMap,
|
||||
class = std::enable_if_t<MaybeMap && !MaybeMulti>>
|
||||
template <class K, bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
std::conditional<IsMap, T, void*>::type const&
|
||||
at(K const& k) const;
|
||||
at(K const& k) const
|
||||
requires(MaybeMap && !MaybeMulti);
|
||||
|
||||
template <
|
||||
bool MaybeMulti = IsMulti,
|
||||
bool MaybeMap = IsMap,
|
||||
class = std::enable_if_t<MaybeMap && !MaybeMulti>>
|
||||
template <bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
operator[](Key const& key);
|
||||
operator[](Key const& key)
|
||||
requires(MaybeMap && !MaybeMulti);
|
||||
|
||||
template <
|
||||
bool MaybeMulti = IsMulti,
|
||||
bool MaybeMap = IsMap,
|
||||
class = std::enable_if_t<MaybeMap && !MaybeMulti>>
|
||||
template <bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
operator[](Key&& key);
|
||||
operator[](Key&& key)
|
||||
requires(MaybeMap && !MaybeMulti);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
@@ -765,35 +759,40 @@ public:
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
auto
|
||||
insert(value_type const& value) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>;
|
||||
insert(value_type const& value) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti);
|
||||
|
||||
// multimap, multiset
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
auto
|
||||
insert(value_type const& value) -> std::enable_if_t<MaybeMulti, iterator>;
|
||||
insert(value_type const& value) -> iterator
|
||||
requires MaybeMulti;
|
||||
|
||||
// set
|
||||
template <bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
auto
|
||||
insert(value_type&& value)
|
||||
-> std::enable_if_t<!MaybeMulti && !MaybeMap, std::pair<iterator, bool>>;
|
||||
insert(value_type&& value) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti && !MaybeMap);
|
||||
|
||||
// multiset
|
||||
template <bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
auto
|
||||
insert(value_type&& value) -> std::enable_if_t<MaybeMulti && !MaybeMap, iterator>;
|
||||
insert(value_type&& value) -> iterator
|
||||
requires(MaybeMulti && !MaybeMap);
|
||||
|
||||
//---
|
||||
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
auto
|
||||
insert(const_iterator hint, value_type const& value) -> std::enable_if_t<!MaybeMulti, iterator>;
|
||||
insert(const_iterator hint, value_type const& value) -> iterator
|
||||
requires(!MaybeMulti);
|
||||
|
||||
// multimap, multiset
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
std::enable_if_t<MaybeMulti, iterator>
|
||||
iterator
|
||||
insert(const_iterator /*hint*/, value_type const& value)
|
||||
requires MaybeMulti
|
||||
{
|
||||
// VFALCO TODO Figure out how to utilize 'hint'
|
||||
return insert(value);
|
||||
@@ -802,12 +801,14 @@ public:
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
auto
|
||||
insert(const_iterator hint, value_type&& value) -> std::enable_if_t<!MaybeMulti, iterator>;
|
||||
insert(const_iterator hint, value_type&& value) -> iterator
|
||||
requires(!MaybeMulti);
|
||||
|
||||
// multimap, multiset
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
std::enable_if_t<MaybeMulti, iterator>
|
||||
iterator
|
||||
insert(const_iterator /*hint*/, value_type&& value)
|
||||
requires MaybeMulti
|
||||
{
|
||||
// VFALCO TODO Figure out how to utilize 'hint'
|
||||
return insert(std::move(value));
|
||||
@@ -815,20 +816,18 @@ public:
|
||||
|
||||
// map, multimap
|
||||
template <class P, bool MaybeMap = IsMap>
|
||||
std::enable_if_t<
|
||||
MaybeMap && std::is_constructible_v<value_type, P&&>,
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>
|
||||
insert(P&& value)
|
||||
requires(MaybeMap && std::is_constructible_v<value_type, P &&>)
|
||||
{
|
||||
return emplace(std::forward<P>(value));
|
||||
}
|
||||
|
||||
// map, multimap
|
||||
template <class P, bool MaybeMap = IsMap>
|
||||
std::enable_if_t<
|
||||
MaybeMap && std::is_constructible_v<value_type, P&&>,
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>
|
||||
insert(const_iterator hint, P&& value)
|
||||
requires(MaybeMap && std::is_constructible_v<value_type, P &&>)
|
||||
{
|
||||
return emplaceHint(hint, std::forward<P>(value));
|
||||
}
|
||||
@@ -850,46 +849,45 @@ public:
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti, class... Args>
|
||||
auto
|
||||
emplace(Args&&... args) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>;
|
||||
emplace(Args&&... args) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti);
|
||||
|
||||
// multiset, multimap
|
||||
template <bool MaybeMulti = IsMulti, class... Args>
|
||||
auto
|
||||
emplace(Args&&... args) -> std::enable_if_t<MaybeMulti, iterator>;
|
||||
emplace(Args&&... args) -> iterator
|
||||
requires MaybeMulti;
|
||||
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti, class... Args>
|
||||
auto
|
||||
emplaceHint(const_iterator hint, Args&&... args)
|
||||
-> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>;
|
||||
emplaceHint(const_iterator hint, Args&&... args) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti);
|
||||
|
||||
// multiset, multimap
|
||||
template <bool MaybeMulti = IsMulti, class... Args>
|
||||
std::enable_if_t<MaybeMulti, iterator>
|
||||
iterator
|
||||
emplaceHint(const_iterator /*hint*/, Args&&... args)
|
||||
requires MaybeMulti
|
||||
{
|
||||
// VFALCO TODO Figure out how to utilize 'hint'
|
||||
return emplace<MaybeMulti>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// enable_if prevents erase (reverse_iterator pos) from compiling
|
||||
template <
|
||||
bool IsConst,
|
||||
class Iterator,
|
||||
class = std::enable_if_t<!IsBoostReverseIterator<Iterator>::value>>
|
||||
// The constraint prevents erase (reverse_iterator pos) from compiling
|
||||
template <bool IsConst, class Iterator>
|
||||
beast::detail::AgedContainerIterator<false, Iterator>
|
||||
erase(beast::detail::AgedContainerIterator<IsConst, Iterator> pos);
|
||||
erase(beast::detail::AgedContainerIterator<IsConst, Iterator> pos)
|
||||
requires(!IsBoostReverseIterator<Iterator>::value);
|
||||
|
||||
// enable_if prevents erase (reverse_iterator first, reverse_iterator last)
|
||||
// The constraint prevents erase (reverse_iterator first, reverse_iterator last)
|
||||
// from compiling
|
||||
template <
|
||||
bool IsConst,
|
||||
class Iterator,
|
||||
class = std::enable_if_t<!IsBoostReverseIterator<Iterator>::value>>
|
||||
template <bool IsConst, class Iterator>
|
||||
beast::detail::AgedContainerIterator<false, Iterator>
|
||||
erase(
|
||||
beast::detail::AgedContainerIterator<IsConst, Iterator> first,
|
||||
beast::detail::AgedContainerIterator<IsConst, Iterator> last);
|
||||
beast::detail::AgedContainerIterator<IsConst, Iterator> last)
|
||||
requires(!IsBoostReverseIterator<Iterator>::value);
|
||||
|
||||
template <class K>
|
||||
auto
|
||||
@@ -900,13 +898,11 @@ public:
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// enable_if prevents touch (reverse_iterator pos) from compiling
|
||||
template <
|
||||
bool IsConst,
|
||||
class Iterator,
|
||||
class = std::enable_if_t<!IsBoostReverseIterator<Iterator>::value>>
|
||||
// The constraint prevents touch (reverse_iterator pos) from compiling
|
||||
template <bool IsConst, class Iterator>
|
||||
void
|
||||
touch(beast::detail::AgedContainerIterator<IsConst, Iterator> pos)
|
||||
requires(!IsBoostReverseIterator<Iterator>::value)
|
||||
{
|
||||
touch(pos, clock().now());
|
||||
}
|
||||
@@ -1137,25 +1133,25 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
// enable_if prevents erase (reverse_iterator pos, now) from compiling
|
||||
template <
|
||||
bool IsConst,
|
||||
class Iterator,
|
||||
class = std::enable_if_t<!IsBoostReverseIterator<Iterator>::value>>
|
||||
// The constraint prevents erase (reverse_iterator pos, now) from compiling
|
||||
template <bool IsConst, class Iterator>
|
||||
void
|
||||
touch(
|
||||
beast::detail::AgedContainerIterator<IsConst, Iterator> pos,
|
||||
clock_type::time_point const& now);
|
||||
clock_type::time_point const& now)
|
||||
requires(!IsBoostReverseIterator<Iterator>::value);
|
||||
|
||||
template <
|
||||
bool MaybePropagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
|
||||
std::enable_if_t<MaybePropagate>
|
||||
swapData(AgedOrderedContainer& other) noexcept;
|
||||
void
|
||||
swapData(AgedOrderedContainer& other) noexcept
|
||||
requires MaybePropagate;
|
||||
|
||||
template <
|
||||
bool MaybePropagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
|
||||
std::enable_if_t<!MaybePropagate>
|
||||
swapData(AgedOrderedContainer& other) noexcept;
|
||||
void
|
||||
swapData(AgedOrderedContainer& other) noexcept
|
||||
requires(!MaybePropagate);
|
||||
|
||||
private:
|
||||
ConfigT config_;
|
||||
@@ -1247,12 +1243,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrd
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
|
||||
AgedOrderedContainer const& other)
|
||||
: config_(other.config_)
|
||||
#if BOOST_VERSION >= 108000
|
||||
, cont_(other.cont_.get_comp())
|
||||
#else
|
||||
, cont_(other.cont_.comp())
|
||||
#endif
|
||||
: config_(other.config_), cont_(other.cont_.get_comp())
|
||||
{
|
||||
insert(other.cbegin(), other.cend());
|
||||
}
|
||||
@@ -1261,12 +1252,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
|
||||
AgedOrderedContainer const& other,
|
||||
Allocator const& alloc)
|
||||
: config_(other.config_, alloc)
|
||||
#if BOOST_VERSION >= 108000
|
||||
, cont_(other.cont_.get_comp())
|
||||
#else
|
||||
, cont_(other.cont_.comp())
|
||||
#endif
|
||||
: config_(other.config_, alloc), cont_(other.cont_.get_comp())
|
||||
{
|
||||
insert(other.cbegin(), other.cend());
|
||||
}
|
||||
@@ -1283,13 +1269,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
|
||||
AgedOrderedContainer&& other, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
Allocator const& alloc)
|
||||
: config_(std::move(other.config_), alloc)
|
||||
#if BOOST_VERSION >= 108000
|
||||
, cont_(std::move(other.cont_.get_comp()))
|
||||
#else
|
||||
, cont_(std::move(other.cont_.comp()))
|
||||
#endif
|
||||
|
||||
: config_(std::move(other.config_), alloc), cont_(std::move(other.cont_.get_comp()))
|
||||
{
|
||||
insert(other.cbegin(), other.cend());
|
||||
other.clear();
|
||||
@@ -1380,9 +1360,10 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operato
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <class K, bool MaybeMulti, bool MaybeMap, class>
|
||||
template <class K, bool MaybeMulti, bool MaybeMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K const& k)
|
||||
requires(MaybeMap && !MaybeMulti)
|
||||
{
|
||||
auto const iter(cont_.find(k, std::cref(config_.keyCompare())));
|
||||
if (iter == cont_.end())
|
||||
@@ -1391,9 +1372,10 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K co
|
||||
}
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <class K, bool MaybeMulti, bool MaybeMap, class>
|
||||
template <class K, bool MaybeMulti, bool MaybeMap>
|
||||
std::conditional<IsMap, T, void*>::type const&
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K const& k) const
|
||||
requires(MaybeMap && !MaybeMulti)
|
||||
{
|
||||
auto const iter(cont_.find(k, std::cref(config_.keyCompare())));
|
||||
if (iter == cont_.end())
|
||||
@@ -1402,9 +1384,10 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K co
|
||||
}
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool MaybeMulti, bool MaybeMap, class>
|
||||
template <bool MaybeMulti, bool MaybeMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](Key const& key)
|
||||
requires(MaybeMap && !MaybeMulti)
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(cont_.insert_check(key, std::cref(config_.keyCompare()), d));
|
||||
@@ -1420,9 +1403,10 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operato
|
||||
}
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool MaybeMulti, bool MaybeMap, class>
|
||||
template <bool MaybeMulti, bool MaybeMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](Key&& key)
|
||||
requires(MaybeMap && !MaybeMulti)
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(cont_.insert_check(key, std::cref(config_.keyCompare()), d));
|
||||
@@ -1456,7 +1440,8 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool MaybeMulti>
|
||||
auto
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
value_type const& value) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>
|
||||
value_type const& value) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(cont_.insert_check(extract(value), std::cref(config_.keyCompare()), d));
|
||||
@@ -1475,7 +1460,8 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool MaybeMulti>
|
||||
auto
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
value_type const& value) -> std::enable_if_t<MaybeMulti, iterator>
|
||||
value_type const& value) -> iterator
|
||||
requires MaybeMulti
|
||||
{
|
||||
auto const before(cont_.upper_bound(extract(value), std::cref(config_.keyCompare())));
|
||||
Element* const p(newElement(value));
|
||||
@@ -1489,7 +1475,8 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool MaybeMulti, bool MaybeMap>
|
||||
auto
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(value_type&& value)
|
||||
-> std::enable_if_t<!MaybeMulti && !MaybeMap, std::pair<iterator, bool>>
|
||||
-> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti && !MaybeMap)
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(cont_.insert_check(extract(value), std::cref(config_.keyCompare()), d));
|
||||
@@ -1508,7 +1495,8 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool MaybeMulti, bool MaybeMap>
|
||||
auto
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(value_type&& value)
|
||||
-> std::enable_if_t<MaybeMulti && !MaybeMap, iterator>
|
||||
-> iterator
|
||||
requires(MaybeMulti && !MaybeMap)
|
||||
{
|
||||
auto const before(cont_.upper_bound(extract(value), std::cref(config_.keyCompare())));
|
||||
Element* const p(newElement(std::move(value)));
|
||||
@@ -1525,7 +1513,8 @@ template <bool MaybeMulti>
|
||||
auto
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
const_iterator hint,
|
||||
value_type const& value) -> std::enable_if_t<!MaybeMulti, iterator>
|
||||
value_type const& value) -> iterator
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(
|
||||
@@ -1546,7 +1535,8 @@ template <bool MaybeMulti>
|
||||
auto
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
const_iterator hint,
|
||||
value_type&& value) -> std::enable_if_t<!MaybeMulti, iterator>
|
||||
value_type&& value) -> iterator
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(
|
||||
@@ -1566,7 +1556,8 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool MaybeMulti, class... Args>
|
||||
auto
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace(Args&&... args)
|
||||
-> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>
|
||||
-> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
// VFALCO NOTE Its unfortunate that we need to
|
||||
// construct element here
|
||||
@@ -1588,7 +1579,8 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool MaybeMulti, class... Args>
|
||||
auto
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace(Args&&... args)
|
||||
-> std::enable_if_t<MaybeMulti, iterator>
|
||||
-> iterator
|
||||
requires MaybeMulti
|
||||
{
|
||||
Element* const p(newElement(std::forward<Args>(args)...));
|
||||
auto const before(cont_.upper_bound(extract(p->value), std::cref(config_.keyCompare())));
|
||||
@@ -1603,7 +1595,8 @@ template <bool MaybeMulti, class... Args>
|
||||
auto
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplaceHint(
|
||||
const_iterator hint,
|
||||
Args&&... args) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>
|
||||
Args&&... args) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
// VFALCO NOTE Its unfortunate that we need to
|
||||
// construct element here
|
||||
@@ -1622,21 +1615,23 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace
|
||||
}
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool IsConst, class Iterator, class>
|
||||
template <bool IsConst, class Iterator>
|
||||
beast::detail::AgedContainerIterator<false, Iterator>
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::erase(
|
||||
beast::detail::AgedContainerIterator<IsConst, Iterator> pos)
|
||||
requires(!IsBoostReverseIterator<Iterator>::value)
|
||||
{
|
||||
unlinkAndDeleteElement(&*((pos++).iterator()));
|
||||
return beast::detail::AgedContainerIterator<false, Iterator>(pos.iterator());
|
||||
}
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool IsConst, class Iterator, class>
|
||||
template <bool IsConst, class Iterator>
|
||||
beast::detail::AgedContainerIterator<false, Iterator>
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::erase(
|
||||
beast::detail::AgedContainerIterator<IsConst, Iterator> first,
|
||||
beast::detail::AgedContainerIterator<IsConst, Iterator> last)
|
||||
requires(!IsBoostReverseIterator<Iterator>::value)
|
||||
{
|
||||
for (; first != last;)
|
||||
unlinkAndDeleteElement(&*((first++).iterator()));
|
||||
@@ -1739,11 +1734,12 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operato
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool IsConst, class Iterator, class>
|
||||
template <bool IsConst, class Iterator>
|
||||
void
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::touch(
|
||||
beast::detail::AgedContainerIterator<IsConst, Iterator> pos,
|
||||
clock_type::time_point const& now)
|
||||
requires(!IsBoostReverseIterator<Iterator>::value)
|
||||
{
|
||||
auto& e(*pos.iterator());
|
||||
e.when = now;
|
||||
@@ -1753,9 +1749,10 @@ AgedOrderedContainer<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 MaybePropagate>
|
||||
std::enable_if_t<MaybePropagate>
|
||||
void
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swapData(
|
||||
AgedOrderedContainer& other) noexcept
|
||||
requires MaybePropagate
|
||||
{
|
||||
std::swap(config_.keyCompare(), other.config_.keyCompare());
|
||||
std::swap(config_.alloc(), other.config_.alloc());
|
||||
@@ -1764,9 +1761,10 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swapDat
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool MaybePropagate>
|
||||
std::enable_if_t<!MaybePropagate>
|
||||
void
|
||||
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swapData(
|
||||
AgedOrderedContainer& other) noexcept
|
||||
requires(!MaybePropagate)
|
||||
{
|
||||
std::swap(config_.keyCompare(), other.config_.keyCompare());
|
||||
std::swap(config_.clock, other.config_.clock);
|
||||
|
||||
@@ -10,13 +10,19 @@
|
||||
#include <boost/intrusive/unordered_set.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
|
||||
@@ -111,10 +117,9 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
class... Args,
|
||||
class = std::enable_if_t<std::is_constructible_v<value_type, Args...>>>
|
||||
template <class... Args>
|
||||
Element(time_point const& when, Args&&... args)
|
||||
requires(std::is_constructible_v<value_type, Args...>)
|
||||
: value(std::forward<Args>(args)...), when(when)
|
||||
{
|
||||
}
|
||||
@@ -835,35 +840,25 @@ public:
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template <
|
||||
class K,
|
||||
bool MaybeMulti = IsMulti,
|
||||
bool MaybeMap = IsMap,
|
||||
class = std::enable_if_t<MaybeMap && !MaybeMulti>>
|
||||
template <class K, bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
at(K const& k);
|
||||
at(K const& k)
|
||||
requires(MaybeMap && !MaybeMulti);
|
||||
|
||||
template <
|
||||
class K,
|
||||
bool MaybeMulti = IsMulti,
|
||||
bool MaybeMap = IsMap,
|
||||
class = std::enable_if_t<MaybeMap && !MaybeMulti>>
|
||||
template <class K, bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
std::conditional<IsMap, T, void*>::type const&
|
||||
at(K const& k) const;
|
||||
at(K const& k) const
|
||||
requires(MaybeMap && !MaybeMulti);
|
||||
|
||||
template <
|
||||
bool MaybeMulti = IsMulti,
|
||||
bool MaybeMap = IsMap,
|
||||
class = std::enable_if_t<MaybeMap && !MaybeMulti>>
|
||||
template <bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
operator[](Key const& key);
|
||||
operator[](Key const& key)
|
||||
requires(MaybeMap && !MaybeMulti);
|
||||
|
||||
template <
|
||||
bool MaybeMulti = IsMulti,
|
||||
bool MaybeMap = IsMap,
|
||||
class = std::enable_if_t<MaybeMap && !MaybeMulti>>
|
||||
template <bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
operator[](Key&& key);
|
||||
operator[](Key&& key)
|
||||
requires(MaybeMap && !MaybeMulti);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
@@ -961,28 +956,32 @@ public:
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
auto
|
||||
insert(value_type const& value) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>;
|
||||
insert(value_type const& value) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti);
|
||||
|
||||
// multimap, multiset
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
auto
|
||||
insert(value_type const& value) -> std::enable_if_t<MaybeMulti, iterator>;
|
||||
insert(value_type const& value) -> iterator
|
||||
requires MaybeMulti;
|
||||
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
auto
|
||||
insert(value_type&& value)
|
||||
-> std::enable_if_t<!MaybeMulti && !MaybeMap, std::pair<iterator, bool>>;
|
||||
insert(value_type&& value) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti && !MaybeMap);
|
||||
|
||||
// multimap, multiset
|
||||
template <bool MaybeMulti = IsMulti, bool MaybeMap = IsMap>
|
||||
auto
|
||||
insert(value_type&& value) -> std::enable_if_t<MaybeMulti && !MaybeMap, iterator>;
|
||||
insert(value_type&& value) -> iterator
|
||||
requires(MaybeMulti && !MaybeMap);
|
||||
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
std::enable_if_t<!MaybeMulti, iterator>
|
||||
iterator
|
||||
insert(const_iterator /*hint*/, value_type const& value)
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
// Hint is ignored but we provide the interface so
|
||||
// callers may use ordered and unordered interchangeably.
|
||||
@@ -991,8 +990,9 @@ public:
|
||||
|
||||
// multimap, multiset
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
std::enable_if_t<MaybeMulti, iterator>
|
||||
iterator
|
||||
insert(const_iterator /*hint*/, value_type const& value)
|
||||
requires MaybeMulti
|
||||
{
|
||||
// VFALCO TODO The hint could be used to let
|
||||
// the client order equal ranges
|
||||
@@ -1001,8 +1001,9 @@ public:
|
||||
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
std::enable_if_t<!MaybeMulti, iterator>
|
||||
iterator
|
||||
insert(const_iterator /*hint*/, value_type&& value)
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
// Hint is ignored but we provide the interface so
|
||||
// callers may use ordered and unordered interchangeably.
|
||||
@@ -1011,8 +1012,9 @@ public:
|
||||
|
||||
// multimap, multiset
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
std::enable_if_t<MaybeMulti, iterator>
|
||||
iterator
|
||||
insert(const_iterator /*hint*/, value_type&& value)
|
||||
requires MaybeMulti
|
||||
{
|
||||
// VFALCO TODO The hint could be used to let
|
||||
// the client order equal ranges
|
||||
@@ -1021,20 +1023,18 @@ public:
|
||||
|
||||
// map, multimap
|
||||
template <class P, bool MaybeMap = IsMap>
|
||||
std::enable_if_t<
|
||||
MaybeMap && std::is_constructible_v<value_type, P&&>,
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>
|
||||
insert(P&& value)
|
||||
requires(MaybeMap && std::is_constructible_v<value_type, P &&>)
|
||||
{
|
||||
return emplace(std::forward<P>(value));
|
||||
}
|
||||
|
||||
// map, multimap
|
||||
template <class P, bool MaybeMap = IsMap>
|
||||
std::enable_if_t<
|
||||
MaybeMap && std::is_constructible_v<value_type, P&&>,
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>
|
||||
insert(const_iterator hint, P&& value)
|
||||
requires(MaybeMap && std::is_constructible_v<value_type, P &&>)
|
||||
{
|
||||
return emplaceHint(hint, std::forward<P>(value));
|
||||
}
|
||||
@@ -1055,23 +1055,26 @@ public:
|
||||
// set, map
|
||||
template <bool MaybeMulti = IsMulti, class... Args>
|
||||
auto
|
||||
emplace(Args&&... args) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>;
|
||||
emplace(Args&&... args) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti);
|
||||
|
||||
// multiset, multimap
|
||||
template <bool MaybeMulti = IsMulti, class... Args>
|
||||
auto
|
||||
emplace(Args&&... args) -> std::enable_if_t<MaybeMulti, iterator>;
|
||||
emplace(Args&&... args) -> iterator
|
||||
requires MaybeMulti;
|
||||
|
||||
// set, map
|
||||
template <bool MaybeMulti = IsMulti, class... Args>
|
||||
auto
|
||||
emplaceHint(const_iterator /*hint*/, Args&&... args)
|
||||
-> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>;
|
||||
emplaceHint(const_iterator /*hint*/, Args&&... args) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti);
|
||||
|
||||
// multiset, multimap
|
||||
template <bool MaybeMulti = IsMulti, class... Args>
|
||||
std::enable_if_t<MaybeMulti, iterator>
|
||||
iterator
|
||||
emplaceHint(const_iterator /*hint*/, Args&&... args)
|
||||
requires MaybeMulti
|
||||
{
|
||||
// VFALCO TODO The hint could be used for multi, to let
|
||||
// the client order equal ranges
|
||||
@@ -1302,7 +1305,7 @@ public:
|
||||
class OtherHash,
|
||||
class OtherAllocator,
|
||||
bool MaybeMulti = IsMulti>
|
||||
std::enable_if_t<!MaybeMulti, bool>
|
||||
bool
|
||||
operator==(AgedUnorderedContainer<
|
||||
false,
|
||||
OtherIsMap,
|
||||
@@ -1311,7 +1314,8 @@ public:
|
||||
OtherDuration,
|
||||
OtherHash,
|
||||
KeyEqual,
|
||||
OtherAllocator> const& other) const;
|
||||
OtherAllocator> const& other) const
|
||||
requires(!MaybeMulti);
|
||||
|
||||
template <
|
||||
bool OtherIsMap,
|
||||
@@ -1321,7 +1325,7 @@ public:
|
||||
class OtherHash,
|
||||
class OtherAllocator,
|
||||
bool MaybeMulti = IsMulti>
|
||||
std::enable_if_t<MaybeMulti, bool>
|
||||
bool
|
||||
operator==(AgedUnorderedContainer<
|
||||
true,
|
||||
OtherIsMap,
|
||||
@@ -1330,7 +1334,8 @@ public:
|
||||
OtherDuration,
|
||||
OtherHash,
|
||||
KeyEqual,
|
||||
OtherAllocator> const& other) const;
|
||||
OtherAllocator> const& other) const
|
||||
requires MaybeMulti;
|
||||
|
||||
template <
|
||||
bool OtherIsMulti,
|
||||
@@ -1375,13 +1380,14 @@ private:
|
||||
// map, set
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
auto
|
||||
insertUnchecked(value_type const& value)
|
||||
-> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>;
|
||||
insertUnchecked(value_type const& value) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti);
|
||||
|
||||
// multimap, multiset
|
||||
template <bool MaybeMulti = IsMulti>
|
||||
auto
|
||||
insertUnchecked(value_type const& value) -> std::enable_if_t<MaybeMulti, iterator>;
|
||||
insertUnchecked(value_type const& value) -> iterator
|
||||
requires MaybeMulti;
|
||||
|
||||
template <class InputIt>
|
||||
void
|
||||
@@ -1422,8 +1428,9 @@ private:
|
||||
|
||||
template <
|
||||
bool MaybePropagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
|
||||
std::enable_if_t<MaybePropagate>
|
||||
void
|
||||
swapData(AgedUnorderedContainer& other) noexcept
|
||||
requires MaybePropagate
|
||||
{
|
||||
std::swap(config_.hashFunction(), other.config_.hashFunction());
|
||||
std::swap(config_.keyEq(), other.config_.keyEq());
|
||||
@@ -1433,8 +1440,9 @@ private:
|
||||
|
||||
template <
|
||||
bool MaybePropagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
|
||||
std::enable_if_t<!MaybePropagate>
|
||||
void
|
||||
swapData(AgedUnorderedContainer& other) noexcept
|
||||
requires(!MaybePropagate)
|
||||
{
|
||||
std::swap(config_.hashFunction(), other.config_.hashFunction());
|
||||
std::swap(config_.keyEq(), other.config_.keyEq());
|
||||
@@ -2088,9 +2096,10 @@ template <
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Allocator>
|
||||
template <class K, bool MaybeMulti, bool MaybeMap, class>
|
||||
template <class K, bool MaybeMulti, bool MaybeMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::at(K const& k)
|
||||
requires(MaybeMap && !MaybeMulti)
|
||||
{
|
||||
auto const iter(
|
||||
cont_.find(k, std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual())));
|
||||
@@ -2108,10 +2117,11 @@ template <
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Allocator>
|
||||
template <class K, bool MaybeMulti, bool MaybeMap, class>
|
||||
template <class K, bool MaybeMulti, bool MaybeMap>
|
||||
std::conditional<IsMap, T, void*>::type const&
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::at(
|
||||
K const& k) const
|
||||
requires(MaybeMap && !MaybeMulti)
|
||||
{
|
||||
auto const iter(
|
||||
cont_.find(k, std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual())));
|
||||
@@ -2129,10 +2139,11 @@ template <
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Allocator>
|
||||
template <bool MaybeMulti, bool MaybeMap, class>
|
||||
template <bool MaybeMulti, bool MaybeMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator[](
|
||||
Key const& key)
|
||||
requires(MaybeMap && !MaybeMulti)
|
||||
{
|
||||
maybeRehash(1);
|
||||
typename cont_type::insert_commit_data d;
|
||||
@@ -2158,10 +2169,11 @@ template <
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Allocator>
|
||||
template <bool MaybeMulti, bool MaybeMap, class>
|
||||
template <bool MaybeMulti, bool MaybeMap>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator[](
|
||||
Key&& key)
|
||||
requires(MaybeMap && !MaybeMulti)
|
||||
{
|
||||
maybeRehash(1);
|
||||
typename cont_type::insert_commit_data d;
|
||||
@@ -2214,7 +2226,8 @@ template <
|
||||
template <bool MaybeMulti>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
|
||||
value_type const& value) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>
|
||||
value_type const& value) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
maybeRehash(1);
|
||||
typename cont_type::insert_commit_data d;
|
||||
@@ -2243,7 +2256,8 @@ template <
|
||||
template <bool MaybeMulti>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
|
||||
value_type const& value) -> std::enable_if_t<MaybeMulti, iterator>
|
||||
value_type const& value) -> iterator
|
||||
requires MaybeMulti
|
||||
{
|
||||
maybeRehash(1);
|
||||
Element* const p(newElement(value));
|
||||
@@ -2265,7 +2279,8 @@ template <
|
||||
template <bool MaybeMulti, bool MaybeMap>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
|
||||
value_type&& value) -> std::enable_if_t<!MaybeMulti && !MaybeMap, std::pair<iterator, bool>>
|
||||
value_type&& value) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti && !MaybeMap)
|
||||
{
|
||||
maybeRehash(1);
|
||||
typename cont_type::insert_commit_data d;
|
||||
@@ -2294,7 +2309,8 @@ template <
|
||||
template <bool MaybeMulti, bool MaybeMap>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
|
||||
value_type&& value) -> std::enable_if_t<MaybeMulti && !MaybeMap, iterator>
|
||||
value_type&& value) -> iterator
|
||||
requires(MaybeMulti && !MaybeMap)
|
||||
{
|
||||
maybeRehash(1);
|
||||
Element* const p(newElement(std::move(value)));
|
||||
@@ -2303,7 +2319,6 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
|
||||
return iterator(iter);
|
||||
}
|
||||
|
||||
#if 1 // Use insert() instead of insert_check() insert_commit()
|
||||
// set, map
|
||||
template <
|
||||
bool IsMulti,
|
||||
@@ -2317,7 +2332,8 @@ template <
|
||||
template <bool MaybeMulti, class... Args>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace(
|
||||
Args&&... args) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>
|
||||
Args&&... args) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
maybeRehash(1);
|
||||
// VFALCO NOTE Its unfortunate that we need to
|
||||
@@ -2332,42 +2348,6 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
|
||||
deleteElement(p);
|
||||
return std::make_pair(iterator(result.first), false);
|
||||
}
|
||||
#else // As original, use insert_check() / insert_commit () pair.
|
||||
// set, map
|
||||
template <
|
||||
bool IsMulti,
|
||||
bool IsMap,
|
||||
class Key,
|
||||
class T,
|
||||
class Clock,
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Allocator>
|
||||
template <bool maybe_multi, class... Args>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace(
|
||||
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
|
||||
{
|
||||
maybe_rehash(1);
|
||||
// VFALCO NOTE Its unfortunate that we need to
|
||||
// construct element here
|
||||
element* const p(new_element(std::forward<Args>(args)...));
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(m_cont.insert_check(
|
||||
extract(p->value),
|
||||
std::cref(m_config.hashFunction()),
|
||||
std::cref(m_config.keyValueEqual()),
|
||||
d));
|
||||
if (result.second)
|
||||
{
|
||||
auto const iter(m_cont.insert_commit(*p, d));
|
||||
chronological.list.push_back(*p);
|
||||
return std::make_pair(iterator(iter), true);
|
||||
}
|
||||
delete_element(p);
|
||||
return std::make_pair(iterator(result.first), false);
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
// multiset, multimap
|
||||
template <
|
||||
@@ -2382,7 +2362,8 @@ template <
|
||||
template <bool MaybeMulti, class... Args>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace(
|
||||
Args&&... args) -> std::enable_if_t<MaybeMulti, iterator>
|
||||
Args&&... args) -> iterator
|
||||
requires MaybeMulti
|
||||
{
|
||||
maybeRehash(1);
|
||||
Element* const p(newElement(std::forward<Args>(args)...));
|
||||
@@ -2405,7 +2386,8 @@ template <bool MaybeMulti, class... Args>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplaceHint(
|
||||
const_iterator /*hint*/,
|
||||
Args&&... args) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>
|
||||
Args&&... args) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
maybeRehash(1);
|
||||
// VFALCO NOTE Its unfortunate that we need to
|
||||
@@ -2556,7 +2538,7 @@ template <
|
||||
class OtherHash,
|
||||
class OtherAllocator,
|
||||
bool MaybeMulti>
|
||||
std::enable_if_t<!MaybeMulti, bool>
|
||||
bool
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator==(
|
||||
AgedUnorderedContainer<
|
||||
false,
|
||||
@@ -2567,6 +2549,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
|
||||
OtherHash,
|
||||
KeyEqual,
|
||||
OtherAllocator> const& other) const
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
if (size() != other.size())
|
||||
return false;
|
||||
@@ -2596,7 +2579,7 @@ template <
|
||||
class OtherHash,
|
||||
class OtherAllocator,
|
||||
bool MaybeMulti>
|
||||
std::enable_if_t<MaybeMulti, bool>
|
||||
bool
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator==(
|
||||
AgedUnorderedContainer<
|
||||
true,
|
||||
@@ -2607,6 +2590,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
|
||||
OtherHash,
|
||||
KeyEqual,
|
||||
OtherAllocator> const& other) const
|
||||
requires MaybeMulti
|
||||
{
|
||||
if (size() != other.size())
|
||||
return false;
|
||||
@@ -2643,7 +2627,8 @@ template <
|
||||
template <bool MaybeMulti>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insertUnchecked(
|
||||
value_type const& value) -> std::enable_if_t<!MaybeMulti, std::pair<iterator, bool>>
|
||||
value_type const& value) -> std::pair<iterator, bool>
|
||||
requires(!MaybeMulti)
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(cont_.insert_check(
|
||||
@@ -2671,7 +2656,8 @@ template <
|
||||
template <bool MaybeMulti>
|
||||
auto
|
||||
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insertUnchecked(
|
||||
value_type const& value) -> std::enable_if_t<MaybeMulti, iterator>
|
||||
value_type const& value) -> iterator
|
||||
requires MaybeMulti
|
||||
{
|
||||
Element* const p(newElement(value));
|
||||
chronological.list_.push_back(*p);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <boost/predef.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cerrno>
|
||||
#include <cctype>
|
||||
#include <charconv>
|
||||
#include <cstdlib>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
#include <type_traits>
|
||||
#include <typeinfo>
|
||||
|
||||
@@ -28,16 +29,18 @@ struct LexicalCast<std::string, In>
|
||||
explicit LexicalCast() = default;
|
||||
|
||||
template <class Arithmetic = In>
|
||||
std::enable_if_t<std::is_arithmetic_v<Arithmetic>, bool>
|
||||
bool
|
||||
operator()(std::string& out, Arithmetic in)
|
||||
requires(std::is_arithmetic_v<Arithmetic>)
|
||||
{
|
||||
out = std::to_string(in);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class Enumeration = In>
|
||||
std::enable_if_t<std::is_enum_v<Enumeration>, bool>
|
||||
bool
|
||||
operator()(std::string& out, Enumeration in)
|
||||
requires(std::is_enum_v<Enumeration>)
|
||||
{
|
||||
out = std::to_string(static_cast<std::underlying_type_t<Enumeration>>(in));
|
||||
return true;
|
||||
@@ -55,8 +58,9 @@ struct LexicalCast<Out, std::string_view>
|
||||
"beast::LexicalCast can only be used with integral types");
|
||||
|
||||
template <class Integral = Out>
|
||||
std::enable_if_t<std::is_integral_v<Integral> && !std::is_same_v<Integral, bool>, bool>
|
||||
bool
|
||||
operator()(Integral& out, std::string_view in) const
|
||||
requires(std::is_integral_v<Integral> && !std::is_same_v<Integral, bool>)
|
||||
{
|
||||
auto first = in.data();
|
||||
auto last = in.data() + in.size();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -58,7 +59,7 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
NodePtr
|
||||
[[nodiscard]] NodePtr
|
||||
node() const
|
||||
{
|
||||
return node_;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
@@ -26,7 +26,7 @@ template <class T>
|
||||
inline void
|
||||
reverseBytes(T& t)
|
||||
{
|
||||
unsigned char* bytes =
|
||||
auto* bytes =
|
||||
static_cast<unsigned char*>(std::memmove(std::addressof(t), std::addressof(t), sizeof(T)));
|
||||
for (unsigned i = 0; i < sizeof(T) / 2; ++i)
|
||||
std::swap(bytes[i], bytes[sizeof(T) - 1 - i]);
|
||||
@@ -200,26 +200,29 @@ struct IsContiguouslyHashable<T[N], HashAlgorithm>
|
||||
// scalars
|
||||
|
||||
template <class Hasher, class T>
|
||||
inline std::enable_if_t<IsContiguouslyHashable<T, Hasher>::value>
|
||||
inline void
|
||||
hash_append(Hasher& h, T const& t) noexcept
|
||||
requires(IsContiguouslyHashable<T, Hasher>::value)
|
||||
{
|
||||
// NOLINTNEXTLINE(bugprone-sizeof-expression)
|
||||
h(static_cast<void const*>(std::addressof(t)), sizeof(t));
|
||||
}
|
||||
|
||||
template <class Hasher, class T>
|
||||
inline std::enable_if_t<
|
||||
!IsContiguouslyHashable<T, Hasher>::value &&
|
||||
(std::is_integral_v<T> || std::is_pointer_v<T> || std::is_enum_v<T>)>
|
||||
inline void
|
||||
hash_append(Hasher& h, T t) noexcept
|
||||
requires(
|
||||
!IsContiguouslyHashable<T, Hasher>::value &&
|
||||
(std::is_integral_v<T> || std::is_pointer_v<T> || std::is_enum_v<T>))
|
||||
{
|
||||
detail::reverseBytes(t);
|
||||
h(std::addressof(t), sizeof(t));
|
||||
}
|
||||
|
||||
template <class Hasher, class T>
|
||||
inline std::enable_if_t<std::is_floating_point_v<T>>
|
||||
inline void
|
||||
hash_append(Hasher& h, T t) noexcept
|
||||
requires(std::is_floating_point_v<T>)
|
||||
{
|
||||
if (t == 0)
|
||||
t = 0;
|
||||
@@ -239,36 +242,44 @@ hash_append(Hasher& h, std::nullptr_t) noexcept
|
||||
// Forward declarations for ADL purposes
|
||||
|
||||
template <class Hasher, class T, std::size_t N>
|
||||
std::enable_if_t<!IsContiguouslyHashable<T, Hasher>::value>
|
||||
hash_append(Hasher& h, T (&a)[N]) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, T (&a)[N]) noexcept
|
||||
requires(!IsContiguouslyHashable<T, Hasher>::value);
|
||||
|
||||
template <class Hasher, class CharT, class Traits, class Alloc>
|
||||
std::enable_if_t<!IsContiguouslyHashable<CharT, Hasher>::value>
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept
|
||||
requires(!IsContiguouslyHashable<CharT, Hasher>::value);
|
||||
|
||||
template <class Hasher, class CharT, class Traits, class Alloc>
|
||||
std::enable_if_t<IsContiguouslyHashable<CharT, Hasher>::value>
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept
|
||||
requires(IsContiguouslyHashable<CharT, Hasher>::value);
|
||||
|
||||
template <class Hasher, class T, class U>
|
||||
std::enable_if_t<!IsContiguouslyHashable<std::pair<T, U>, Hasher>::value>
|
||||
hash_append(Hasher& h, std::pair<T, U> const& p) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, std::pair<T, U> const& p) noexcept
|
||||
requires(!IsContiguouslyHashable<std::pair<T, U>, Hasher>::value);
|
||||
|
||||
template <class Hasher, class T, class Alloc>
|
||||
std::enable_if_t<!IsContiguouslyHashable<T, Hasher>::value>
|
||||
hash_append(Hasher& h, std::vector<T, Alloc> const& v) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, std::vector<T, Alloc> const& v) noexcept
|
||||
requires(!IsContiguouslyHashable<T, Hasher>::value);
|
||||
|
||||
template <class Hasher, class T, class Alloc>
|
||||
std::enable_if_t<IsContiguouslyHashable<T, Hasher>::value>
|
||||
hash_append(Hasher& h, std::vector<T, Alloc> const& v) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, std::vector<T, Alloc> const& v) noexcept
|
||||
requires(IsContiguouslyHashable<T, Hasher>::value);
|
||||
|
||||
template <class Hasher, class T, std::size_t N>
|
||||
std::enable_if_t<!IsContiguouslyHashable<std::array<T, N>, Hasher>::value>
|
||||
hash_append(Hasher& h, std::array<T, N> const& a) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, std::array<T, N> const& a) noexcept
|
||||
requires(!IsContiguouslyHashable<std::array<T, N>, Hasher>::value);
|
||||
|
||||
template <class Hasher, class... T>
|
||||
std::enable_if_t<!IsContiguouslyHashable<std::tuple<T...>, Hasher>::value>
|
||||
hash_append(Hasher& h, std::tuple<T...> const& t) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, std::tuple<T...> const& t) noexcept
|
||||
requires(!IsContiguouslyHashable<std::tuple<T...>, Hasher>::value);
|
||||
|
||||
template <class Hasher, class Key, class T, class Hash, class Pred, class Alloc>
|
||||
void
|
||||
@@ -279,11 +290,13 @@ void
|
||||
hash_append(Hasher& h, std::unordered_set<Key, Hash, Pred, Alloc> const& s);
|
||||
|
||||
template <class Hasher, class Key, class Compare, class Alloc>
|
||||
std::enable_if_t<!IsContiguouslyHashable<Key, Hasher>::value>
|
||||
hash_append(Hasher& h, boost::container::flat_set<Key, Compare, Alloc> const& v) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, boost::container::flat_set<Key, Compare, Alloc> const& v) noexcept
|
||||
requires(!IsContiguouslyHashable<Key, Hasher>::value);
|
||||
template <class Hasher, class Key, class Compare, class Alloc>
|
||||
std::enable_if_t<IsContiguouslyHashable<Key, Hasher>::value>
|
||||
hash_append(Hasher& h, boost::container::flat_set<Key, Compare, Alloc> const& v) noexcept;
|
||||
void
|
||||
hash_append(Hasher& h, boost::container::flat_set<Key, Compare, Alloc> const& v) noexcept
|
||||
requires(IsContiguouslyHashable<Key, Hasher>::value);
|
||||
template <class Hasher, class T0, class T1, class... T>
|
||||
void
|
||||
hash_append(Hasher& h, T0 const& t0, T1 const& t1, T const&... t) noexcept;
|
||||
@@ -291,8 +304,9 @@ hash_append(Hasher& h, T0 const& t0, T1 const& t1, T const&... t) noexcept;
|
||||
// c-array
|
||||
|
||||
template <class Hasher, class T, std::size_t N>
|
||||
std::enable_if_t<!IsContiguouslyHashable<T, Hasher>::value>
|
||||
void
|
||||
hash_append(Hasher& h, T (&a)[N]) noexcept
|
||||
requires(!IsContiguouslyHashable<T, Hasher>::value)
|
||||
{
|
||||
for (auto const& t : a)
|
||||
hash_append(h, t);
|
||||
@@ -301,8 +315,9 @@ hash_append(Hasher& h, T (&a)[N]) noexcept
|
||||
// basic_string
|
||||
|
||||
template <class Hasher, class CharT, class Traits, class Alloc>
|
||||
inline std::enable_if_t<!IsContiguouslyHashable<CharT, Hasher>::value>
|
||||
inline void
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept
|
||||
requires(!IsContiguouslyHashable<CharT, Hasher>::value)
|
||||
{
|
||||
for (auto c : s)
|
||||
hash_append(h, c);
|
||||
@@ -310,8 +325,9 @@ hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcep
|
||||
}
|
||||
|
||||
template <class Hasher, class CharT, class Traits, class Alloc>
|
||||
inline std::enable_if_t<IsContiguouslyHashable<CharT, Hasher>::value>
|
||||
inline void
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept
|
||||
requires(IsContiguouslyHashable<CharT, Hasher>::value)
|
||||
{
|
||||
h(s.data(), s.size() * sizeof(CharT));
|
||||
hash_append(h, s.size());
|
||||
@@ -320,8 +336,9 @@ hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcep
|
||||
// pair
|
||||
|
||||
template <class Hasher, class T, class U>
|
||||
inline std::enable_if_t<!IsContiguouslyHashable<std::pair<T, U>, Hasher>::value>
|
||||
inline void
|
||||
hash_append(Hasher& h, std::pair<T, U> const& p) noexcept
|
||||
requires(!IsContiguouslyHashable<std::pair<T, U>, Hasher>::value)
|
||||
{
|
||||
hash_append(h, p.first, p.second);
|
||||
}
|
||||
@@ -329,8 +346,9 @@ hash_append(Hasher& h, std::pair<T, U> const& p) noexcept
|
||||
// vector
|
||||
|
||||
template <class Hasher, class T, class Alloc>
|
||||
inline std::enable_if_t<!IsContiguouslyHashable<T, Hasher>::value>
|
||||
inline void
|
||||
hash_append(Hasher& h, std::vector<T, Alloc> const& v) noexcept
|
||||
requires(!IsContiguouslyHashable<T, Hasher>::value)
|
||||
{
|
||||
for (auto const& t : v)
|
||||
hash_append(h, t);
|
||||
@@ -338,8 +356,9 @@ hash_append(Hasher& h, std::vector<T, Alloc> const& v) noexcept
|
||||
}
|
||||
|
||||
template <class Hasher, class T, class Alloc>
|
||||
inline std::enable_if_t<IsContiguouslyHashable<T, Hasher>::value>
|
||||
inline void
|
||||
hash_append(Hasher& h, std::vector<T, Alloc> const& v) noexcept
|
||||
requires(IsContiguouslyHashable<T, Hasher>::value)
|
||||
{
|
||||
h(v.data(), v.size() * sizeof(T));
|
||||
hash_append(h, v.size());
|
||||
@@ -348,23 +367,26 @@ hash_append(Hasher& h, std::vector<T, Alloc> const& v) noexcept
|
||||
// array
|
||||
|
||||
template <class Hasher, class T, std::size_t N>
|
||||
std::enable_if_t<!IsContiguouslyHashable<std::array<T, N>, Hasher>::value>
|
||||
void
|
||||
hash_append(Hasher& h, std::array<T, N> const& a) noexcept
|
||||
requires(!IsContiguouslyHashable<std::array<T, N>, Hasher>::value)
|
||||
{
|
||||
for (auto const& t : a)
|
||||
hash_append(h, t);
|
||||
}
|
||||
|
||||
template <class Hasher, class Key, class Compare, class Alloc>
|
||||
std::enable_if_t<!IsContiguouslyHashable<Key, Hasher>::value>
|
||||
void
|
||||
hash_append(Hasher& h, boost::container::flat_set<Key, Compare, Alloc> const& v) noexcept
|
||||
requires(!IsContiguouslyHashable<Key, Hasher>::value)
|
||||
{
|
||||
for (auto const& t : v)
|
||||
hash_append(h, t);
|
||||
}
|
||||
template <class Hasher, class Key, class Compare, class Alloc>
|
||||
std::enable_if_t<IsContiguouslyHashable<Key, Hasher>::value>
|
||||
void
|
||||
hash_append(Hasher& h, boost::container::flat_set<Key, Compare, Alloc> const& v) noexcept
|
||||
requires(IsContiguouslyHashable<Key, Hasher>::value)
|
||||
{
|
||||
h(&(v.begin()), v.size() * sizeof(Key));
|
||||
}
|
||||
@@ -395,8 +417,9 @@ tuple_hash(Hasher& h, std::tuple<T...> const& t, std::index_sequence<I...>) noex
|
||||
} // namespace detail
|
||||
|
||||
template <class Hasher, class... T>
|
||||
inline std::enable_if_t<!IsContiguouslyHashable<std::tuple<T...>, Hasher>::value>
|
||||
inline void
|
||||
hash_append(Hasher& h, std::tuple<T...> const& t) noexcept
|
||||
requires(!IsContiguouslyHashable<std::tuple<T...>, Hasher>::value)
|
||||
{
|
||||
detail::tuple_hash(h, t, std::index_sequence_for<T...>{});
|
||||
}
|
||||
|
||||
@@ -124,14 +124,18 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <class Seed, std::enable_if_t<std::is_unsigned_v<Seed>>* = nullptr>
|
||||
explicit Xxhasher(Seed seed) : seed_(seed)
|
||||
template <class Seed>
|
||||
explicit Xxhasher(Seed seed)
|
||||
requires(std::is_unsigned_v<Seed>)
|
||||
: seed_(seed)
|
||||
{
|
||||
resetBuffers();
|
||||
}
|
||||
|
||||
template <class Seed, std::enable_if_t<std::is_unsigned_v<Seed>>* = nullptr>
|
||||
Xxhasher(Seed seed, Seed) : seed_(seed)
|
||||
template <class Seed>
|
||||
Xxhasher(Seed seed, Seed)
|
||||
requires(std::is_unsigned_v<Seed>)
|
||||
: seed_(seed)
|
||||
{
|
||||
resetBuffers();
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
#include <xrpl/beast/insight/Event.h>
|
||||
#include <xrpl/beast/insight/Gauge.h>
|
||||
#include <xrpl/beast/insight/Hook.h>
|
||||
#include <xrpl/beast/insight/HookImpl.h>
|
||||
#include <xrpl/beast/insight/Meter.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace beast::insight {
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/insight/Collector.h>
|
||||
#include <xrpl/beast/insight/Counter.h>
|
||||
#include <xrpl/beast/insight/CounterImpl.h>
|
||||
#include <xrpl/beast/insight/Event.h>
|
||||
#include <xrpl/beast/insight/EventImpl.h>
|
||||
#include <xrpl/beast/insight/Gauge.h>
|
||||
#include <xrpl/beast/insight/GaugeImpl.h>
|
||||
#include <xrpl/beast/insight/Group.h>
|
||||
#include <xrpl/beast/insight/Groups.h>
|
||||
#include <xrpl/beast/insight/Hook.h>
|
||||
#include <xrpl/beast/insight/HookImpl.h>
|
||||
#include <xrpl/beast/insight/NullCollector.h>
|
||||
#include <xrpl/beast/insight/StatsDCollector.h>
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <xrpl/beast/insight/Collector.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace beast::insight {
|
||||
|
||||
/** A Collector which does not collect metrics. */
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#include <xrpl/beast/net/IPEndpoint.h>
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace beast::insight {
|
||||
|
||||
/** A Collector that reports metrics to a StatsD server.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/hash/hash_append.h>
|
||||
|
||||
#include <boost/asio/ip/address_v4.hpp>
|
||||
|
||||
namespace beast::IP {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
|
||||
#include <boost/asio/ip/address_v6.hpp>
|
||||
|
||||
namespace beast::IP {
|
||||
|
||||
@@ -3,8 +3,13 @@
|
||||
#include <xrpl/beast/hash/hash_append.h>
|
||||
#include <xrpl/beast/hash/uhash.h>
|
||||
#include <xrpl/beast/net/IPAddress.h>
|
||||
#include <xrpl/beast/net/IPAddressV4.h>
|
||||
#include <xrpl/beast/net/IPAddressV6.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <istream>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <boost/thread/csbl/memory/allocator_arg.hpp>
|
||||
|
||||
#include <condition_variable>
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/unit_test/amount.h>
|
||||
#include <xrpl/beast/unit_test/global_suites.h>
|
||||
#include <xrpl/beast/unit_test/match.h>
|
||||
#include <xrpl/beast/unit_test/recorder.h>
|
||||
#include <xrpl/beast/unit_test/reporter.h>
|
||||
#include <xrpl/beast/unit_test/results.h>
|
||||
#include <xrpl/beast/unit_test/runner.h>
|
||||
#include <xrpl/beast/unit_test/suite.h>
|
||||
#include <xrpl/beast/unit_test/suite_info.h>
|
||||
#include <xrpl/beast/unit_test/suite_list.h>
|
||||
|
||||
#ifndef BEAST_EXPECT
|
||||
#define BEAST_EXPECT_S1(x) #x
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <xrpl/beast/unit_test/suite_info.h>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace beast::unit_test {
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
|
||||
#include <xrpl/beast/unit_test/results.h>
|
||||
#include <xrpl/beast/unit_test/runner.h>
|
||||
#include <xrpl/beast/unit_test/suite_info.h>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace beast::unit_test {
|
||||
|
||||
|
||||
@@ -5,18 +5,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/beast/unit_test/amount.h>
|
||||
#include <xrpl/beast/unit_test/recorder.h>
|
||||
#include <xrpl/beast/unit_test/runner.h>
|
||||
#include <xrpl/beast/unit_test/suite_info.h>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace beast::unit_test {
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <xrpl/beast/unit_test/detail/const_container.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@@ -634,7 +636,7 @@ Suite::run(Runner& r)
|
||||
#define BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Class, Module, Library, Priority)
|
||||
|
||||
#else
|
||||
#include <xrpl/beast/unit_test/global_suites.h>
|
||||
#include <xrpl/beast/unit_test/global_suites.h> // IWYU pragma: keep
|
||||
#define BEAST_DEFINE_TESTSUITE(Class, Module, Library) \
|
||||
BEAST_DEFINE_TESTSUITE_INSERT(Class, Module, Library, false, 0)
|
||||
#define BEAST_DEFINE_TESTSUITE_MANUAL(Class, Module, Library) \
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
namespace beast::unit_test {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user