These two checks (and portability-template-virtual-member-function) were disabled in #4489 (November 2024) "only removed to get the CI going". portability-template-virtual-member-function is a separate, still-open cleanup (#5725 item 3 on its own branch) and stays disabled here; this commit only re-enables the move/forward checks and cleans up what they flag on this branch. The move constructor (json.hpp) already casts to the base type instead of forwarding the whole object (#5724 item 9), so it no longer trips either check. The at(KeyType&&) double-forward this check used to flag was reduced to a single forward with the now-unforwarded reuse annotated by a NOLINTNEXTLINE in #5724 item 3's object_at() helper (clang-tidy 22 still flags that reuse even after a single forward; see that commit's message). What is left here: - from_json_inplace_array_impl(), from_json_tuple_impl_base() and the std::pair overload of from_json_tuple_impl() forwarded j into every j.at(...) call in a pack expansion or a pair of calls. at() has no ref-qualified overloads, so the forward was a no-op; call j.at(...) directly. - container_input_adapter_factory::create() forwards container twice on purpose, into begin() and end(), so both see the same value category and produce matching iterator types. Annotate it with NOLINTNEXTLINE and a comment instead of changing it. - unit-class_parser.cpp's "move constructor resets the moved-from value to npos" test still pointed at the pre-static_cast move constructor by line number and mentioned the cppcheck-suppress annotation that #5724 item 9 already removed; update the comment. No behavior change anywhere in include/. Verified with clang-tidy 22.1.8 (Docker silkeh/clang:22, --platform linux/amd64) against a TU including json.hpp with the repo's .clang-tidy: bugprone-use-after-move and hicpp-invalid-access-moved report nothing unsuppressed. Overlaps #5737 (open PR for the rest of #5725 item 3: the from_json.hpp/input_adapters.hpp cleanup above, and portability-template-virtual-member-function), which currently keeps both checks disabled pending this move-constructor change; whichever of this commit and that PR lands second will need a small rebase of .clang-tidy. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
84 lines
3.2 KiB
YAML
84 lines
3.2 KiB
YAML
# TODO: portability-template-virtual-member-function is only removed to get the CI going. It has to be addressed at some point.
|
|
# TODO: portability-avoid-pragma-once: should be fixed eventually
|
|
|
|
Checks: '*,
|
|
|
|
-portability-template-virtual-member-function,
|
|
|
|
-altera-id-dependent-backward-branch,
|
|
-altera-struct-pack-align,
|
|
-altera-unroll-loops,
|
|
-android-cloexec-fopen,
|
|
-boost-use-ranges,
|
|
-bugprone-easily-swappable-parameters,
|
|
-cert-err58-cpp,
|
|
-clang-analyzer-webkit.NoUncountedMemberChecker,
|
|
-concurrency-mt-unsafe,
|
|
-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-macro-usage,
|
|
-cppcoreguidelines-pro-bounds-avoid-unchecked-container-access,
|
|
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
|
-cppcoreguidelines-pro-bounds-constant-array-index,
|
|
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
|
-cppcoreguidelines-pro-type-reinterpret-cast,
|
|
-cppcoreguidelines-pro-type-union-access,
|
|
-cppcoreguidelines-rvalue-reference-param-not-moved,
|
|
-cppcoreguidelines-virtual-class-destructor,
|
|
-fuchsia-default-arguments-calls,
|
|
-fuchsia-default-arguments-declarations,
|
|
-fuchsia-overloaded-operator,
|
|
-google-explicit-constructor,
|
|
-google-readability-function-size,
|
|
-google-runtime-float,
|
|
-google-runtime-int,
|
|
-google-runtime-references,
|
|
-hicpp-avoid-goto,
|
|
-hicpp-explicit-conversions,
|
|
-hicpp-function-size,
|
|
-hicpp-no-array-decay,
|
|
-hicpp-no-assembler,
|
|
-hicpp-signed-bitwise,
|
|
-hicpp-uppercase-literal-suffix,
|
|
-llvm-header-guard,
|
|
-llvm-include-order,
|
|
-llvm-prefer-static-over-anonymous-namespace,
|
|
-llvm-use-ranges,
|
|
-llvmlibc-*,
|
|
-misc-use-anonymous-namespace,
|
|
-misc-confusable-identifiers,
|
|
-misc-include-cleaner,
|
|
-misc-no-recursion,
|
|
-misc-non-private-member-variables-in-classes,
|
|
-modernize-concat-nested-namespaces,
|
|
-modernize-type-traits,
|
|
-modernize-use-constraints,
|
|
-modernize-use-designated-initializers,
|
|
-modernize-use-nodiscard,
|
|
-modernize-use-ranges,
|
|
-modernize-use-std-numbers,
|
|
-modernize-use-trailing-return-type,
|
|
-performance-enum-size,
|
|
-portability-avoid-pragma-once,
|
|
-readability-function-cognitive-complexity,
|
|
-readability-function-size,
|
|
-readability-identifier-length,
|
|
-readability-magic-numbers,
|
|
-readability-redundant-access-specifiers,
|
|
-readability-redundant-parentheses,
|
|
-readability-simplify-boolean-expr,
|
|
-readability-uppercase-literal-suffix,
|
|
-readability-use-concise-preprocessor-directives'
|
|
|
|
CheckOptions:
|
|
- key: hicpp-special-member-functions.AllowSoleDefaultDtor
|
|
value: 1
|
|
|
|
WarningsAsErrors: '*'
|
|
|
|
#HeaderFilterRegex: '.*nlohmann.*'
|
|
HeaderFilterRegex: '.*hpp$'
|