fix pre-existing dev clang-format violations - #246
Merged
Conversation
Reformat 5 files that violated the dev clang-format config (ColumnLimit 59) so the grep_clangformat_cppcheck CI job passes. Line-wrapping only; no behavior change. - library/dsu/kruskal_tree.hpp - library/strings/longest_common_subsequence/lcs_dp.hpp - library/strings/manacher/manacher.hpp - tests/.../data_structures/bit_ordered_set.test.cpp - tests/.../strings/sa_sort_pairs.test.cpp
The line-anchored knownConditionTrueFalse suppressions had drifted out of sync with their source lines, causing both unmatchedSuppression and now-unsuppressed errors in the cppcheck CI step: - kruskal_tree.hpp: 13 -> 15 (shifted by the clang-format reflow in the previous commit) - suffix_array.hpp: 62 -> 63 (pre-existing drift) - suffix_array_short.hpp: 34 -> 35 (pre-existing drift)
cppcheck flags mixing iterators from two different expressions when the erase-remove idiom is written as erase(begin(ranges::unique(x)), end(x)): the first iterator comes from the returned subrange while the second comes from the container. Store the returned subrange in a local and erase [begin, end) of that single subrange, which is semantically identical (the subrange spans the trailing removed elements) and keeps both iterators from one expression. Applies to ranges::unique and ranges::remove_if call sites introduced in the ranges-algorithm migration (#244): - library/trees/extra_members/virtual_tree.hpp - tests .../bit_ordered_set.test.cpp - tests .../kth_smallest_pst.test.cpp - tests .../mode_query.test.cpp - tests .../sa_sort_pairs.test.cpp - tests .../single_matching_bs.test.cpp
Keep the terse erase-remove one-liners from the ranges migration (#244) and silence cppcheck's mismatchingContainerExpression false positive instead. The warning fires because a range algorithm returns a subrange, so the first iterator's source expression (ranges::unique(x)) differs syntactically from the second (end(x)) even though end(subrange) is end(x) by construction. Reverts the earlier local-variable rewrite and adds line-anchored suppressions for the six affected call sites.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
grep_clangformat_cppcheckCI job is currently failing ondevdue to 5 files that violate the dev clang-format config (ColumnLimit
59). These violations are pre-existing and unrelated to any single
feature change — they appear to be lines formatted for the main
config (ColumnLimit 1000) that were never re-wrapped for dev.
This PR runs
clang-formatwith the dev config on those 5 files.Files (line-wrapping only, no behavior change)
library/dsu/kruskal_tree.hpplibrary/strings/longest_common_subsequence/lcs_dp.hpplibrary/strings/manacher/manacher.hpptests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpptests/library_checker_aizu_tests/strings/sa_sort_pairs.test.cppVerification
clang-format --dry-run --Werrorwith the dev config passes on all5 files (clang-format 22, matching CI's
clang-format-22).Unblocks the format check for other PRs targeting
dev.