authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-10-26 16:07:46-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-10-26 16:07:46-07:00
loge2caf5752791cb81cd1110617d646e87f360e11b
tree05ab938c8898eb737198391dd0ceddb3784e0aba
parentc1ae9f40c728e769e804eabfcab0b40d6c0f67f2
parent435c8ad703503e4dcc102b0907b45459d2693822

Merge branch 'frmdstryr-import-empty-file'


4 files changed, 8 insertions(+), 2 deletions(-)

src/stage1.zig+2
......@@ -428,5 +428,7 @@ export fn stage2_fetch_file(
428428 const max_file_size = std.math.maxInt(u32);
429429 const contents = comp.stage1_cache_manifest.addFilePostFetch(file_path, max_file_size) catch return null;
430430 result_len.* = contents.len;
431 // TODO https://github.com/ziglang/zig/issues/3328#issuecomment-716749475
432 if (contents.len == 0) return @intToPtr(?[*]const u8, 0x1);
431433 return contents.ptr;
432434}
src/stage1/analyze.cpp+2-2
......@@ -1988,7 +1988,7 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc
19881988 // behaviour when checking expected alignment with `@ptrToInt(fn_ptr)`
19891989 // or similar. This commit proposes to make `align` expressions a
19901990 // compile error when compiled to Wasm architecture.
1991 //
1991 //
19921992 // Some references:
19931993 // [1] [Mozilla: WebAssembly Tables](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format#WebAssembly_tables)
19941994 // [2] [Sunfishcode's Wasm Ref Manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md#indirect-call)
......@@ -9044,7 +9044,7 @@ static void resolve_llvm_types_optional(CodeGen *g, ZigType *type, ResolveStatus
90449044 8 * child_type->abi_align,
90459045 val_offset_in_bits,
90469046 ZigLLVM_DIFlags_Zero, child_llvm_di_type);
9047 di_element_types[maybe_null_index] =
9047 di_element_types[maybe_null_index] =
90489048 ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(type->llvm_di_type),
90499049 "maybe", di_file, line,
90509050 8*g->builtin_types.entry_bool->abi_size,
test/stage1/behavior/import.zig+4
......@@ -16,3 +16,7 @@ test "import in non-toplevel scope" {
1616 };
1717 expectEqual(@as(i32, 1234), S.foo());
1818}
19
20test "import empty file" {
21 const empty = @import("import/empty.zig");
22}
test/stage1/behavior/import/empty.zig created