Repository navigation
fix: posix.flow function names that are libc macros - #551
Merged
Merged
Conversation
stdin, stdout and stderr are macros. On macOS `stdin` expands to `__stdinp`,
so the generated C declared `FileDescriptor __stdinp(void)` against libc's
`FILE *__stdinp` and every program importing the module failed to compile:
error: redefinition of '__stdinp' as different kind of symbol
Renamed to stdin_fd / stdout_fd / stderr_fd, with a comment saying why so
nobody renames them back. No callers anywhere in lib/, examples/, tests/ or
docs/, and the module has never been parseable, so nothing can depend on the
old spelling.
This does not make the module usable on its own. The prototype and constant
collisions behind that need a decision about how Flow binds to POSIX, which
is written up in #550.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small, unambiguous piece split out of #550.
lib/stdlib/posix.flowdefines functions namedstdin,stdoutandstderr. Those are libc macros. On macOSstdinexpands to__stdinp, so the generated C declares:against libc's
FILE *__stdinp, and every program importing the module fails:Renamed to
stdin_fd/stdout_fd/stderr_fd, with a comment recording why so they do not get renamed back. There are no callers anywhere inlib/,examples/,tests/ordocs/, and the module has never been parseable, so nothing can depend on the old spelling.This does not make the module usable on its own. The remaining blockers are prototype conflicts (
conflicting types for 'read', because Flow'si32signature meets libc'sssize_tand<unistd.h>is always included) and constants that shadow macros (O_RDONLY,SEEK_SET). Those need a decision about how Flow binds to POSIX, written up in #550 with three options and the tradeoffs. I did not want to guess at a stdlib API in passing.Splitting this out because it is the one part with no design content.
Validation
--check-ledgerreports no new unverified examples