HomeFreeBSD

mandoc: Const correctness for C23

Description

mandoc: Const correctness for C23

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

In read.c, make the existing temporary pointer const, and for the
mandoc_asprintf() call, add a new mutable local.

In mdoc.c and out.c, since the data is mutable and is mutated here,
remove const from the temporary pointers.

MFC after: 1 week
Reviewed by: fuz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58495

Details

Provenance
ivyAuthored on Aug 3 2026, 2:09 PM
Reviewer
fuz
Differential Revision
D58495: mandoc: Const correctness for C23
Parents
rG1d94e2e0f2ee: m4: Const correctness for C23
Branches
Unknown
Tags
Unknown