Skip to content

Claude/upgrade ape c library mm z gd - #607

Merged
staalmannen merged 2 commits into
mainfrom
claude/upgrade-ape-c-library-mmZGd
Oct 7, 2026
Merged

staalmannen merged 2 commits into
mainfrom
claude/upgrade-ape-c-library-mmZGd

Conversation

@staalmannen

Copy link
Copy Markdown
Owner

No description provided.

claude added 2 commits October 7, 2026 17:37
`kencc_targ.h' existed only in a scratch directory. It is the one
input to `sys/src/external/edg' that is neither upstream's nor
generated -- the whole target configuration, 181 lines -- so losing
it with the container would have made the 133 committed files
unreproducible. The NOTE referred to it and the tree did not have it.

The NOTE's list of staged header edits was also stale. Four of its
eight were fixed in APExp's own header tree later in the same session,
for their own reasons, so a re-translation does not have to repeat
them: `signal()' is prototyped, the SIG_* macros moved with it,
`features.h' no longer defines `hidden', and `bsd.h' has POSIX's
`getopt'. Verified against the tree rather than assumed. The four that
remain are each a parameter name or a keyword and so invisible to a C
caller.

CLAUDE.md's EDG entry still said "investigated, not started" and "No
mkfile written" with both risks open. Both are closed: the target
description is EDG's own win64 integer model, and the self-translation
produced 133 files that gcc accepts. What is open is the link model --
3,094 COMDAT symbols named in more than one of the 75 files -- and
that nothing here has been through pcc.

Also records that the reject revert builds on the VM.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
The last four items on EDG's staging list, each a parameter name or a
keyword, so none of them changes what a C caller sees:

  stdlib.h  _Noreturn is a C11 keyword with no C++ spelling
  stdlib.h  parameter named `template'
  unistd.h  parameter named `new'
  signal.h  `restrict' with no parameter name reads in C++ as the
            name itself, and two per prototype is then a duplicate

THE OBVIOUS FIX FOR TWO OF THEM WAS THE ONE THAT BROKE THE BUILD ONE
ROUND AGO. `#define _Noreturn' or `#define restrict' under __cplusplus
puts an unreserved name in a public APE header that external packages
define themselves -- gnulib ships a whole _Noreturn.h, and a dozen
config.h here define `restrict'. That is `reject' again. The bare-word
sweep was run first this time and it is what chose the spellings:
everything used is in the reserved double-underscore space.

Three of the four need no macro at all. `restrict' becomes
`__restrict', which costs nothing because kencc lexes all three
spellings to the same LRESTRICT (cc/lex.c:1652,1678-1679), and where a
package's own cdefs.h defines __restrict (twelve do) it expands to the
qualifier or to nothing, correct either way. The two parameters are
renamed. `__ape_template' was not invented here -- the generated C
under sys/src/external/edg already carries it, so the tree now matches
its own output.

Control, a before-and-after pair on identical staging: a C++
translation unit including the three headers gives 12 errors before and
1 after; the same unit as C gives 0 both ways, which is the half that
could have cost the tree. apehdr-sweep 148 headers / 0 findings with
the together-case at its recorded 8; apdecl-sweep 0.

The survivor is a ninth item the staging list never named: stddef.h:50
typedefs `wchar_t', a built-in type in C++. Present in both runs, so
pre-existing. Recorded, not fixed -- it blocks nothing in the EDG
directory, which uses --no_standard_includes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
@staalmannen
staalmannen merged commit e3a1611 into main Oct 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants