[Midnightbsd-cvs] [MidnightBSD/src] 8e09eb: libc: getopt{, _long}: const correctness for C23
Lucas Holt
noreply at github.com
Mon Aug 3 11:56:49 EDT 2026
Branch: refs/heads/stable/4.0
Home: https://github.com/MidnightBSD/src
Commit: 8e09eb4629ed21a0185838cae246828a1ea69841
https://github.com/MidnightBSD/src/commit/8e09eb4629ed21a0185838cae246828a1ea69841
Author: Lucas Holt <luke at foolishgames.com>
Date: 2026-08-03 (Mon, 03 Aug 2026)
Changed paths:
M lib/libc/stdlib/getopt.c
M lib/libc/stdlib/getopt_long.c
Log Message:
-----------
libc: getopt{,_long}: const correctness for C23
C23 makes strchr() preserve the constness of its argument, returning a
const pointer when it is passed one. getopt() and getopt_internal()
assign that result to a plain char *, which breaks the bootstrap build
on hosts whose libc has adopted the new behaviour: tools/build/Makefile
compiles both of these files out of lib/libc against the host's headers,
precisely so that cross-builds from Linux and macOS do not pick up the
host getopt().
The pointed-to string is only ever read -- oli is dereferenced for
oli[1] and oli[2], and the ++ in *++oli advances the pointer rather than
the string -- so declaring it const is enough, and assigning from
strchr() remains valid under both the old and the C23 signatures.
Obtained from: FreeBSD (f1d98862044f)
AI-Assisted-by: Claude Opus 5
Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
Signed-off-by: Lucas Holt <luke at foolishgames.com>
Commit: 302cfe092747b218c5e3563a99e80f4a15d0158f
https://github.com/MidnightBSD/src/commit/302cfe092747b218c5e3563a99e80f4a15d0158f
Author: Lucas Holt <luke at foolishgames.com>
Date: 2026-08-03 (Mon, 03 Aug 2026)
Changed paths:
M AI_POLICY.md
M CLAUDE.md
Log Message:
-----------
Document that the AI-Assisted-by trailer names the model actually used
Both AI_POLICY.md and CLAUDE.md gave a specific model in the example
trailer, and CLAUDE.md presented it as the trailer to use rather than as
an example. Read literally that instructs contributors to record a model
that is not the one they used, which defeats the point of the trailer.
State that the name is an example and that the model in use at the time
of the commit should be recorded, and refresh both examples.
AI-Assisted-by: Claude Opus 5
Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
Signed-off-by: Lucas Holt <luke at foolishgames.com>
Compare: https://github.com/MidnightBSD/src/compare/498c4a63d712...302cfe092747
To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/src/settings/notifications
More information about the Midnightbsd-cvs
mailing list