Page MenuHomeFreeBSD

sort: Const correctness for C23
ClosedPublic

Authored by ivy on Jul 27 2026, 10:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Sep 12, 1:58 PM
Unknown Object (File)
Wed, Sep 9, 8:04 AM
Unknown Object (File)
Mon, Sep 7, 11:24 AM
Unknown Object (File)
Tue, Sep 1, 7:37 PM
Unknown Object (File)
Thu, Aug 27, 2:10 PM
Unknown Object (File)
Thu, Aug 27, 1:46 AM
Unknown Object (File)
Mon, Aug 24, 9:49 PM
Unknown Object (File)
Sun, Aug 23, 10:09 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 75186
Build 72069: arc lint + arc unit