Skip to content
Merged
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
10 changes: 10 additions & 0 deletions src/items/external-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@ 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 within `extern` blocks with the following ABI strings or their corresponding [`-unwind` variants][items.fn.extern.unwind]:

- `"aapcs"`
- `"C"`
- `"cdecl"`
- `"efiapi"`
- `"sysv64"`
- `"win64"`

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 one of those listed in [items.extern.variadic.conventions].

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