Skip to content

update for more ABIs supporting c-variadics #1936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/items/external-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ unsafe extern "C" {
> [!WARNING]
> The `safe` qualifier should not be used on a function in an `extern` block unless that function guarantees that it will not access the variadic arguments at all. Passing an unexpected number of arguments or arguments of unexpected type to a variadic function may lead to [undefined behavior][undefined].

r[items.extern.variadic.conventions]
Variadic parameters can only be specified with `extern` blocks with the following ABI strings:
- `"aapcs"`
- `"C"`
- `"cdecl"`
- `"efiapi"`
- `"system"`
- `"sysv64"`
- `"win64"`

This also includes the corresponding [`-unwind` variants][items.fn.extern.unwind].

r[items.extern.attributes]
## Attributes on extern blocks

Expand Down
5 changes: 1 addition & 4 deletions src/types/function-pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ The `unsafe` qualifier indicates that the type's value is an [unsafe
function], and the `extern` qualifier indicates it is an [extern function].

r[type.fn-pointer.constraint-variadic]
Variadic parameters can only be specified with [`extern`] function types with
the `"C"` or `"cdecl"` calling convention.

This also includes the corresponding [`-unwind` variants][items.fn.extern.unwind].
For the function to be variadic, its `extern` ABI must be on the [list of ABIs that allow variadic calls][items.extern.variadic.conventions].

r[type.fn-pointer.attributes]
## Attributes on function pointer parameters
Expand Down