stabilize c_variadic_naked_functions#159746
Draft
folkertdev wants to merge 1 commit into
Draft
Conversation
folkertdev
commented
Jul 22, 2026
Comment on lines
+293
to
+294
| /// of such functions via `extern` blocks and definition via naked functions; there's a | ||
| /// separate check during AST construction guarding *definitions* of variadic functions. |
Contributor
Author
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.
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.
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.