Page MenuHomeFreeBSD

sort: Const correctness for C23
ClosedPublic

Authored by ivy on Jul 27 2026, 10:40 PM.
Tags
None
Referenced Files
F174930515: D58491.diff
Wed, Oct 7, 1:14 AM
F174928881: D58491.diff
Wed, Oct 7, 1:01 AM
F174815514: D58491.diff
Tue, Oct 6, 4:27 AM
Unknown Object (File)
Wed, Sep 30, 1:56 PM
Unknown Object (File)
Tue, Sep 29, 6:07 PM
Unknown Object (File)
Tue, Sep 29, 1:43 AM
Unknown Object (File)
Tue, Sep 29, 1:41 AM
Unknown Object (File)
Sun, Sep 27, 7:23 PM
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