Skip to content

build(clang-tidy): allow increment/decrement in pro-bounds-pointer-arithmetic - #1325

Merged
castler merged 1 commit into
eclipse-score:mainfrom
castler:cfg_ptr_arith_incdec
Oct 7, 2026
Merged

castler merged 1 commit into
eclipse-score:mainfrom
castler:cfg_ptr_arith_incdec

Conversation

@castler

@castler castler commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Enables cppcoreguidelines-pro-bounds-pointer-arithmetic.AllowIncrementDecrementOperators.

Plain ++/-- is the idiomatic way to iterate a range and cannot skip past the end by a miscomputed offset. p + n, p += n and p[n] stay flagged.

Verified locally with clang-tidy 22.1.7: for ++p; p++; p+=1; the check reports 3 warnings with the option off and 1 (p += 1) with it on.

Expected effect: removes the it++ loop findings in transaction_log_set.cpp and application_id_pid_mapping.cpp (4 alerts); other findings are unchanged.

@castler
castler marked this pull request as ready for review October 7, 2026 06:22
@castler
castler enabled auto-merge October 7, 2026 06:22
@castler
castler added this pull request to the merge queue Oct 7, 2026
…ithmetic

Set cppcoreguidelines-pro-bounds-pointer-arithmetic.AllowIncrementDecrementOperators
to true. Stepping a pointer or iterator by exactly one with ++/-- is the
idiomatic way to walk a range and, unlike arbitrary offsets (p + n, p += n,
p[n]), cannot jump out of bounds by a miscomputed amount. Indexing and
additive arithmetic remain flagged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merged via the queue into eclipse-score:main with commit ddce696 Oct 7, 2026
18 checks passed
@castler
castler deleted the cfg_ptr_arith_incdec branch October 7, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants