add description

avec
Avril 4 years ago
parent dfd1a025bd
commit c003bb9643
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,6 +1,7 @@
[package] [package]
name = "stackalloc" name = "stackalloc"
version = "0.1.0" version = "0.1.0"
description = "allocate arbitrary bytes on the stack at runtime"
authors = ["Avril <flanchan@cumallover.me>"] authors = ["Avril <flanchan@cumallover.me>"]
edition = "2018" edition = "2018"

@ -16,7 +16,7 @@ extern "C" {
/// * `cb` is guaranteed to be called unless allocating `size` bytes on the stack causes a stack overflow, in which case the program will terminate. /// * `cb` is guaranteed to be called unless allocating `size` bytes on the stack causes a stack overflow, in which case the program will terminate.
/// * The data pointed to by `ptr` is guaranteed to be popped from the stack once this function returns (even in the case of a `longjmp`, but `panic!()` within the callback is still undefined behaviour). /// * The data pointed to by `ptr` is guaranteed to be popped from the stack once this function returns (even in the case of a `longjmp`, but `panic!()` within the callback is still undefined behaviour).
// Never inline this, in case LTO inlines the call to `_alloca_trampoline`, we always want this function to pop the alloca'd memory. // Never inline this, in case LTO inlines the call to `_alloca_trampoline`, we always want this function to pop the alloca'd memory.
// (NOTE: Test to see if this can ever happen. If it can't, the change this to `inline(always)` or remove the `inline` attribute // (NOTE: Test to see if this can ever happen. If it can't, the change this to `inline(always)` or remove the `inline` attribute.)
#[inline(never)] pub unsafe fn alloca_trampoline(size: usize, cb: CallbackRaw, data: *mut c_void) #[inline(never)] pub unsafe fn alloca_trampoline(size: usize, cb: CallbackRaw, data: *mut c_void)
{ {
_alloca_trampoline(size, Some(cb), data); _alloca_trampoline(size, Some(cb), data);

Loading…
Cancel
Save