stabilize c_variadic_naked_functions - #159746
Conversation
| /// of such functions via `extern` blocks and definition via naked functions; there's a | ||
| /// separate check during AST construction guarding *definitions* of variadic functions. |
There was a problem hiding this comment.
in the reference we now have to differentiate between naked and non-naked (clothed?) definitions. I guess we'll figure out some terminology in the reference PR.
|
The reference PR for c-variadic is still in flight, but it would be neat if |
|
r? @tiif rustbot has assigned @tiif. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Thanks @folkertdev. @rfcbot fcp merge lang |
|
@traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
|
@rfcbot reviewed |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
tracking issue: #148767
reference PR: forthcoming
Stabilization report
Summary
Stabilize the ability to use
#[unsafe(naked)]functions to define c-variadic functions. These c-variadic naked functions accept the same set of ABIs as c-variadic foreign functions, this set is larger than what we currently accept for c-variadic definitions.Accepted ABIs
The set of accepted ABIs is the same as for c-variadic foreign functions, defined as rule
items.extern.variadic.conventions:"aapcs""C""cdecl""efiapi""system""sysv64""win64"And their corresponding
-unwindvariants. Given that naked functions desugar to a block of module assembly and a foreign definition, it makes sense to support the same set as source-level foreign definitions.For c-variadic definitions we only accept
"C"and"C-unwind".Multiple c-variadic ABIs in the same program
LLVM supports c-variadic calls of different ABIs in the same program. We test both an arm and x86 configuration
Note that GCC, Clang and LLVM do not support c-variadic definitions of multiple ABIs: the
va_start,va_argetc. macros are always expanded using the default C calling convention. Clang and GCC reject a variable argument list on definitions that use a non-default calling convention.History
feature(c_variadic_naked_functions)#148770The stabilization report of
feature(c_variadic)mentions this feature:Unresolved questions
None.