From 679dabcc6d34b8267939a5cce062e97ce177ee3b Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 17 Jul 2025 14:14:35 +0200 Subject: [PATCH 1/2] update for more ABIs supporting c-variadics --- src/items/external-blocks.md | 11 +++++++++++ src/types/function-pointer.md | 5 +---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/items/external-blocks.md b/src/items/external-blocks.md index 0e048228d1..dbeb4796c6 100644 --- a/src/items/external-blocks.md +++ b/src/items/external-blocks.md @@ -189,6 +189,17 @@ 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"` +- `"sysv64"` +- `"win64"` + +This also includes the corresponding [`-unwind` variants][items.fn.extern.unwind]. + r[items.extern.attributes] ## Attributes on extern blocks diff --git a/src/types/function-pointer.md b/src/types/function-pointer.md index 03c8793662..41ee2030b1 100644 --- a/src/types/function-pointer.md +++ b/src/types/function-pointer.md @@ -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 From 596cfde86d059b97e700f195f768f5d93912e012 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 17 Sep 2025 06:16:12 +0000 Subject: [PATCH 2/2] Revise c-variadics changes editorially --- src/items/external-blocks.md | 5 ++--- src/types/function-pointer.md | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/items/external-blocks.md b/src/items/external-blocks.md index dbeb4796c6..afe6d1945f 100644 --- a/src/items/external-blocks.md +++ b/src/items/external-blocks.md @@ -190,7 +190,8 @@ unsafe extern "C" { > 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: +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"` @@ -198,8 +199,6 @@ Variadic parameters can only be specified with `extern` blocks with the followin - `"sysv64"` - `"win64"` -This also includes the corresponding [`-unwind` variants][items.fn.extern.unwind]. - r[items.extern.attributes] ## Attributes on extern blocks diff --git a/src/types/function-pointer.md b/src/types/function-pointer.md index 41ee2030b1..239638413f 100644 --- a/src/types/function-pointer.md +++ b/src/types/function-pointer.md @@ -50,7 +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] -For the function to be variadic, its `extern` ABI must be on the [list of ABIs that allow variadic calls][items.extern.variadic.conventions]. +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