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.
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 now rejected inside the parentheses too, like it already is before them. For example,
void (__stdcall *f)(void)now throws on x64.I updated
ffi_parser.cby hand, the same way LLK generates the other cases.