Skip to content

Commit

Permalink
+ adding compiler features for no_std environments other than wasm (i…
Browse files Browse the repository at this point in the history
….e. SGX) (paritytech#2421)
  • Loading branch information
brenzi authored and bkchr committed May 1, 2019
1 parent a29f2d0 commit f3d4a18
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/sr-io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ std = [
nightly = []
strict = []
wasm-nice-panic-message = []
no_panic_handler = []
no_oom = []
2 changes: 2 additions & 0 deletions core/sr-io/without_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use core::{intrinsics, panic::PanicInfo};
use rstd::{vec::Vec, cell::Cell};
use primitives::Blake2Hasher;

#[cfg(not(feature = "no_panic_handler"))]
#[panic_handler]
#[no_mangle]
pub fn panic(info: &PanicInfo) -> ! {
Expand All @@ -43,6 +44,7 @@ pub fn panic(info: &PanicInfo) -> ! {
}
}

#[cfg(not(feature = "no_oom"))]
#[alloc_error_handler]
pub extern fn oom(_: ::core::alloc::Layout) -> ! {
static OOM_MSG: &str = "Runtime memory exhausted. Aborting";
Expand Down
1 change: 1 addition & 0 deletions core/sr-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ default = ["std"]
std = []
nightly = []
strict = []
no_global_allocator = []
1 change: 1 addition & 0 deletions core/sr-std/without_std.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern "C" {
/// Wasm allocator
pub struct WasmAllocator;

#[cfg(not(feature = "no_global_allocator"))]
#[global_allocator]
static ALLOCATOR: WasmAllocator = WasmAllocator;

Expand Down

0 comments on commit f3d4a18

Please sign in to comment.