Skip to content

php: the config.h template has an epilogue too, and it carries <strin… - #724

Merged
staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd
Nov 5, 2026
Merged

staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd

Conversation

@staalmannen

Copy link
Copy Markdown
Owner

…g.h>

Past ZEND_API, and stopped at zend_operators.h:308 -- incompatible types: "IND VOID" and "INT" for op "RETURN"' on return mempcpy(dest, src, n);'.

mempcpy is declared unguarded at sys/include/ape/string.h:62, and <string.h> was not reachable in that translation unit at all. zend_operators.h does not include it, and the only thing that does is main/php.h:208, which a Zend file never reaches. memcpy, memcmp and strncasecmp were undeclared in the same unit and said nothing, because an implicit int converts to size_t in silence: the pointer return was the only one loud enough to notice.

php_config.h.in:2225-2236 ends with four #includes -- stdlib.h, sys/types.h, sys/select.h, string.h -- and that is how every unit in php sees them. The same category as the prologue, missed for the same reason, and copied verbatim now with its guards.

cfghdr-sweep could not see it either: its first version compared macro NAMES, which is the prologue's shape and not the epilogue's. The category is verbatim template text, and an #include is as verbatim as a #define. It compares both now and its control carries both shapes, so a run reports 2 where it reported 1.

The host reproduced the whole thing -- gcc -fsyntax-only on block_pass.c with the real flags listed the same implicit declarations -- which is how it was diagnosed without a second round trip. One residual host-only artifact is recorded so nobody fixes it: memrchr still warns there, because glibc guards it behind _GNU_SOURCE while APE declares it unguarded.

Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs

…g.h>

Past ZEND_API, and stopped at zend_operators.h:308 --
`incompatible types: "IND VOID" and "INT" for op "RETURN"' on
`return mempcpy(dest, src, n);'.

mempcpy is declared unguarded at sys/include/ape/string.h:62, and
<string.h> was not reachable in that translation unit at all.
zend_operators.h does not include it, and the only thing that does
is main/php.h:208, which a Zend file never reaches.  memcpy, memcmp
and strncasecmp were undeclared in the same unit and said nothing,
because an implicit int converts to size_t in silence: the pointer
return was the only one loud enough to notice.

php_config.h.in:2225-2236 ends with four #includes -- stdlib.h,
sys/types.h, sys/select.h, string.h -- and that is how every unit in
php sees them.  The same category as the prologue, missed for the
same reason, and copied verbatim now with its guards.

cfghdr-sweep could not see it either: its first version compared
macro NAMES, which is the prologue's shape and not the epilogue's.
The category is verbatim template text, and an #include is as
verbatim as a #define.  It compares both now and its control carries
both shapes, so a run reports 2 where it reported 1.

The host reproduced the whole thing -- gcc -fsyntax-only on
block_pass.c with the real flags listed the same implicit
declarations -- which is how it was diagnosed without a second round
trip.  One residual host-only artifact is recorded so nobody fixes
it: memrchr still warns there, because glibc guards it behind
_GNU_SOURCE while APE declares it unguarded.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
@staalmannen
staalmannen merged commit 0e9d472 into main Nov 5, 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