Page MenuHomeFreeBSD

libelftc: Const correctness for C23
ClosedPublic

Authored by ivy on Mon, Jul 27, 11:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Aug 3, 12:50 AM
Unknown Object (File)
Sat, Aug 1, 8:39 PM
Unknown Object (File)
Sat, Aug 1, 5:00 AM
Unknown Object (File)
Fri, Jul 31, 10:21 PM
Unknown Object (File)
Fri, Jul 31, 9:56 AM
Unknown Object (File)
Fri, Jul 31, 7:03 AM
Unknown Object (File)
Fri, Jul 31, 6:59 AM
Unknown Object (File)
Fri, Jul 31, 1:38 AM

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 libelftc during
the bootstrap build, since it assumes the return value is always
a mutable pointer.

Since the returned pointer is never modified in either case, make
it 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

Event Timeline

ivy requested review of this revision.Mon, Jul 27, 11:07 PM

i think this should be upstreamed, but i'm not sure who's in charge of this -- @emaste?

This revision is now accepted and ready to land.Mon, Jul 27, 11:09 PM

I'll take care of upstreaming later on if jkoshy@ doesn't pick it up -- CC @jkoshy @jkoshy_users.sourceforge.net

LGTM.

@emaste, @ivy : I'll take care of folding it in upstream, thanks for the heads-up.

This revision was automatically updated to reflect the committed changes.