mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
Add back comptime check for wasm
This commit is contained in:
parent
5a004ed834
commit
e91522b875
@ -252,6 +252,12 @@ extern fn @"llvm.wasm.memory.size.i32"(u32) u32;
|
||||
extern fn @"llvm.wasm.memory.grow.i32"(u32, u32) i32;
|
||||
|
||||
const WasmPageAllocator = struct {
|
||||
comptime {
|
||||
if (!std.Target.current.isWasm()) {
|
||||
@compileError("WasmPageAllocator is only available for wasm32 arch");
|
||||
}
|
||||
}
|
||||
|
||||
const PageStatus = enum(u1) {
|
||||
used = 0,
|
||||
free = 1,
|
||||
@ -797,7 +803,7 @@ test "c_allocator" {
|
||||
}
|
||||
|
||||
test "WasmPageAllocator internals" {
|
||||
if (std.Target.current.isWasm()) {
|
||||
if (comptime std.Target.current.isWasm()) {
|
||||
const none_free = WasmPageAllocator.PageStatus.none_free;
|
||||
std.debug.assert(none_free == WasmPageAllocator.conventional.data[0]); // Passes if this test runs first
|
||||
std.debug.assert(!WasmPageAllocator.extended.isInitialized()); // Passes if this test runs first
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user