[Midnightbsd-cvs] [MidnightBSD/src] b0e975: libc: getopt{, _long}: const correctness for C23
Lucas Holt
noreply at github.com
Mon Aug 3 11:48:37 EDT 2026
Branch: refs/heads/stable/4.1
Home: https://github.com/MidnightBSD/src
Commit: b0e9758f1c94c3cc028ec08fa77682ee28b9f2b8
https://github.com/MidnightBSD/src/commit/b0e9758f1c94c3cc028ec08fa77682ee28b9f2b8
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: 9faadb4fafaf625383704d19115f956cdc71b0b0
https://github.com/MidnightBSD/src/commit/9faadb4fafaf625383704d19115f956cdc71b0b0
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/3bd8a2345909...9faadb4fafaf
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