Files
rust/tests/codegen-llvm/cffi/c-variadic-opt.rs
Jacob Pratt fcfdcb86a3 Rollup merge of #157627 - folkertdev:remove-llvm-va_end, r=RalfJung
remove LLVM `va_end` calls

tracking issue: https://github.com/rust-lang/rust/issues/44930

The operation is a no-op, so we skip it.
2026-06-15 16:16:08 -04:00

22 lines
582 B
Rust

//@ compile-flags: -C opt-level=3
//@ ignore-bpf: BPF does not support C variadics
#![crate_type = "lib"]
#![feature(c_variadic)]
#![no_std]
use core::ffi::VaList;
extern "C" {
fn vprintf(fmt: *const i8, ap: VaList) -> i32;
}
// Ensure that `va_start` and `va_end` are properly injected even
// when the "spoofed" `VaList` is not used.
#[no_mangle]
pub unsafe extern "C" fn c_variadic_no_use(fmt: *const i8, mut ap: ...) -> i32 {
// CHECK: call void @llvm.va_start
vprintf(fmt, ap)
// We no longer call the LLVM va_end.
// CHECK-NOT: call void @llvm.va_end
}