diff options
| author | bors <bors@rust-lang.org> | 2019-02-28 15:00:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-02-28 15:00:25 +0000 |
| commit | 1999a2288123173b2e487865c9a04386173025f7 (patch) | |
| tree | 3fccdd2d553dbd4f0c44a8c4ef280e14a0f9ceee /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 190feb65290d39d7ab6d44e994bd99188d339f16 (diff) | |
| parent | f7dd4389f8145fe0f29c5b29784b244fa38d2bfb (diff) | |
| download | rust-1999a2288123173b2e487865c9a04386173025f7.tar.gz rust-1999a2288123173b2e487865c9a04386173025f7.zip | |
Auto merge of #57760 - dlrobertson:varargs1, r=alexreg
Support defining C compatible variadic functions
## Summary
Add support for defining C compatible variadic functions in unsafe rust with
`extern "C"` according to [RFC 2137].
## Details
### Parsing
When parsing a user defined function that is `unsafe` and `extern "C"` allow
variadic signatures and inject a "spoofed" `VaList` in the new functions
signature. This allows the user to interact with the variadic arguments via a
`VaList` instead of manually using `va_start` and `va_end` (See [RFC 2137] for
details).
### Codegen
When running codegen for a variadic function, remove the "spoofed" `VaList`
from the function signature and inject `va_start` when the arg local
references are created for the function and `va_end` on return.
## TODO
- [x] Get feedback on injecting `va_start/va_end` in MIR vs codegen
- [x] Properly inject `va_end` - It seems like it should be possible to inject
`va_end` on the `TerminatorKind::Return`. I just need to figure out how
to get the `LocalRef` here.
- [x] Properly call Rust defined C variadic functions in Rust - The spoofed
`VaList` causes problems here.
Related to: #44930
r? @ghost
[RFC 2137]: https://github.com/rust-lang/rfcs/blob/master/text/2137-variadic.md
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
