When doing successive matches, track the input start and current search
start positions separately to prevent the `^` anchor from matching in
the middle of the string. Add policy CMP0186 to provide compatibility.
Issue: #26629Fixes: #16899
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Issue: #26123
In commit 87fe031a07 (cmList class: various enhancements, 2023-04-26,
v3.27.0-rc1~142^2~1) this changed from `int` to `intptr_t`, but on some
systems (e.g. CHERI-enabled Arm or RISC-V), `intptr_t` is larger than 64
bits and using it for `index_type` here incurs an unnecessary
performance penalty. Additionally, using `intptr_t` here results in an
ambiguous overload while calling `cmStrCat` with `intptr_t`: `error:
conversion from '__intcap' to 'const cmAlphaNum' is ambiguous`.
Instead of adding `intptr_t` overloads for `cmAlphaNum` for CHERI
systems, we can change the type to `ptrdiff_t` (which will be the same
as `intptr_t` on all other systems) and avoid carrying diffs that only
compile with a CHERI enabled compiler.
Add some static casts to make explicit some sign conversions in order to
avoid warnings about the same. This is by no means an attempt to fix all
such warnings, but these instances were especially egregious as they
would be raised across many source files.
Also change a post-increment of an iterator to pre-increment. At worst,
this does nothing, but pre-increment is potentially more efficient.