Page MenuHomeFreeBSD

sort: Const correctness for C23
ClosedPublic

Authored by ivy on Jul 27 2026, 10:40 PM.
Tags
None
Referenced Files
F173877169: D58491.id183307.diff
Tue, Sep 29, 1:43 AM
F173876961: D58491.id182854.diff
Tue, Sep 29, 1:41 AM
Unknown Object (File)
Sun, Sep 27, 7:23 PM
Unknown Object (File)
Sat, Sep 26, 7:03 AM
Unknown Object (File)
Thu, Sep 24, 8:30 PM
Unknown Object (File)
Sun, Sep 20, 8:52 PM
Unknown Object (File)
Thu, Sep 17, 9:58 AM
Unknown Object (File)
Tue, Sep 15, 6:18 AM
Subscribers

Details

Summary

On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr()
now implements the C23 behaviour where passing a const pointer to
strchr() also returns a const pointer. This breaks sort during
the bootstrap build, since it assumes the return value is always
a mutable pointer.

As the returned pointer is never used to modify the value, fix this
by making the temporary variable const.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable