Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-stack-size-control-i2490

This commit is contained in:
Brian Carroll 2022-08-08 22:39:26 +01:00
commit 86b5db10d5
No known key found for this signature in database
GPG key ID: 9CF4E3BF9C4722C7
42 changed files with 1202 additions and 704 deletions

View file

@ -269,3 +269,51 @@ pub const DEBUG_SETTINGS: WasmDebugSettings = WasmDebugSettings {
keep_test_binary: false && cfg!(debug_assertions),
skip_dead_code_elim: false && cfg!(debug_assertions),
};
#[cfg(test)]
mod dummy_platform_functions {
// `cargo test` produces an executable. At least on Windows, this means that extern symbols must be defined. This crate imports roc_std which
// defines a bunch of externs, and uses the three below. We provide dummy implementations because these functions are not called.
use core::ffi::c_void;
/// # Safety
/// This is only marked unsafe to typecheck without warnings in the rest of the code here.
#[no_mangle]
pub unsafe extern "C" fn roc_alloc(_size: usize, _alignment: u32) -> *mut c_void {
unimplemented!("It is not valid to call roc alloc from within the compiler. Please use the \"platform\" feature if this is a platform.")
}
/// # Safety
/// This is only marked unsafe to typecheck without warnings in the rest of the code here.
#[no_mangle]
pub unsafe extern "C" fn roc_realloc(
_ptr: *mut c_void,
_new_size: usize,
_old_size: usize,
_alignment: u32,
) -> *mut c_void {
unimplemented!("It is not valid to call roc realloc from within the compiler. Please use the \"platform\" feature if this is a platform.")
}
/// # Safety
/// This is only marked unsafe to typecheck without warnings in the rest of the code here.
#[no_mangle]
pub unsafe extern "C" fn roc_dealloc(_ptr: *mut c_void, _alignment: u32) {
unimplemented!("It is not valid to call roc dealloc from within the compiler. Please use the \"platform\" feature if this is a platform.")
}
#[no_mangle]
pub unsafe extern "C" fn roc_panic(_c_ptr: *mut c_void, _tag_id: u32) {
unimplemented!("It is not valid to call roc panic from within the compiler. Please use the \"platform\" feature if this is a platform.")
}
#[no_mangle]
pub fn roc_memcpy(_dst: *mut c_void, _src: *mut c_void, _n: usize) -> *mut c_void {
unimplemented!("It is not valid to call roc memcpy from within the compiler. Please use the \"platform\" feature if this is a platform.")
}
#[no_mangle]
pub fn roc_memset(_dst: *mut c_void, _c: i32, _n: usize) -> *mut c_void {
unimplemented!("It is not valid to call roc memset from within the compiler. Please use the \"platform\" feature if this is a platform.")
}
}