Repository navigation
Fix FFI calling conventions inside nested declarators - #25126
Open
nicolas-grekas wants to merge 1 commit into
Open
nicolas-grekas wants to merge 1 commit into
nicolas-grekas wants to merge 1 commit into
Conversation
FFI ignored the calling convention in "void (__stdcall *f)(void)", and failed to parse it in parameters and type names. A convention that the platform doesn't support stays ignored inside the parentheses, so that such declarations keep parsing on x64.
nicolas-grekas
force-pushed
the
ffi-nested-callconv
branch
from
November 12, 2026 17:24
63983ad to
ff308fc
Compare
Contributor
Author
|
PR updated. A calling convention that the platform doesn't support is ignored inside the parentheses again, as before this PR. The x86 Windows job only runs with the "CI: All variations" label. Could someone add it? /cc @shivammathur @ndossche since this fixes the cause of #25125 |
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.
FFI ignores the calling convention in
void (__stdcall *f)(void). That's how Windows headers declare callbacks, for examplePAPCFUNC. On x86, such a callback is created as cdecl. The callback then doesn't pop its argument and the stdcall caller crashes. That's whysleep_alertable_win32.phptfrom #24399 crashes on nightly (#25125 changes the test).In a parameter or a type name, as in
FFI::type('void (__stdcall *)(int)'), the same syntax fails with "Unsupported type specifier combination".A convention that the platform doesn't support is still ignored inside the parentheses. For example,
void (__stdcall *f)(void)keeps parsing on x64, like before.I updated
ffi_parser.cby hand, the same way LLK generates the other cases.