diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-12-09 14:29:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-09 14:29:15 -0500 |
| commit | f2911948341e1ba1fc03ba2678eaf0a3c4508fa3 (patch) | |
| tree | 7a32f0ddd22c822456ae360f73ff7f51dbe023df /src | |
| parent | 676e416c86e2977f76b0cc1b9d3bc2b7ac6d7936 (diff) | |
| parent | 7e30e8390044fbd396966b6e21d2de980d6f915f (diff) | |
| download | zig-f2911948341e1ba1fc03ba2678eaf0a3c4508fa3.tar.gz zig-f2911948341e1ba1fc03ba2678eaf0a3c4508fa3.zip | |
Merge pull request #7362 from Vexu/std
zig fmt improvement and small miscellaneous fixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/link.zig | 4 | ||||
| -rw-r--r-- | src/link/Coff.zig | 6 | ||||
| -rw-r--r-- | src/link/Elf.zig | 6 | ||||
| -rw-r--r-- | src/link/MachO.zig | 20 | ||||
| -rw-r--r-- | src/link/Wasm.zig | 6 | ||||
| -rw-r--r-- | src/stage1/analyze.cpp | 7 | ||||
| -rw-r--r-- | src/stage1/ir.cpp | 18 |
7 files changed, 22 insertions, 45 deletions
diff --git a/src/link.zig b/src/link.zig index b1c837fc62..40d5ff9a7f 100644 --- a/src/link.zig +++ b/src/link.zig @@ -572,11 +572,11 @@ pub const File = struct { if (!base.options.disable_lld_caching) { Cache.writeSmallFile(directory.handle, id_symlink_basename, &digest) catch |err| { - std.log.warn("failed to save archive hash digest file: {}", .{@errorName(err)}); + log.warn("failed to save archive hash digest file: {}", .{@errorName(err)}); }; man.writeManifest() catch |err| { - std.log.warn("failed to write cache manifest when archiving: {}", .{@errorName(err)}); + log.warn("failed to write cache manifest when archiving: {}", .{@errorName(err)}); }; base.lock = man.toOwnedLock(); diff --git a/src/link/Coff.zig b/src/link/Coff.zig index b5eb645e5c..0ba12ca45d 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1205,7 +1205,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { } if (stderr.len != 0) { - std.log.warn("unexpected LLD stderr:\n{s}", .{stderr}); + log.warn("unexpected LLD stderr:\n{s}", .{stderr}); } } } @@ -1214,11 +1214,11 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { // Update the file with the digest. If it fails we can continue; it only // means that the next invocation will have an unnecessary cache miss. Cache.writeSmallFile(directory.handle, id_symlink_basename, &digest) catch |err| { - std.log.warn("failed to save linking hash digest file: {}", .{@errorName(err)}); + log.warn("failed to save linking hash digest file: {}", .{@errorName(err)}); }; // Again failure here only means an unnecessary cache miss. man.writeManifest() catch |err| { - std.log.warn("failed to write cache manifest when linking: {}", .{@errorName(err)}); + log.warn("failed to write cache manifest when linking: {}", .{@errorName(err)}); }; // We hang on to this lock so that the output file path can be used without // other processes clobbering it. diff --git a/src/link/Elf.zig b/src/link/Elf.zig index ba1a9f824d..852b51ece1 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1684,7 +1684,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { } if (stderr.len != 0) { - std.log.warn("unexpected LLD stderr:\n{s}", .{stderr}); + log.warn("unexpected LLD stderr:\n{s}", .{stderr}); } } @@ -1692,11 +1692,11 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { // Update the file with the digest. If it fails we can continue; it only // means that the next invocation will have an unnecessary cache miss. Cache.writeSmallFile(directory.handle, id_symlink_basename, &digest) catch |err| { - std.log.warn("failed to save linking hash digest file: {}", .{@errorName(err)}); + log.warn("failed to save linking hash digest file: {}", .{@errorName(err)}); }; // Again failure here only means an unnecessary cache miss. man.writeManifest() catch |err| { - std.log.warn("failed to write cache manifest when linking: {}", .{@errorName(err)}); + log.warn("failed to write cache manifest when linking: {}", .{@errorName(err)}); }; // We hang on to this lock so that the output file path can be used without // other processes clobbering it. diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 0767ad149f..a2925b3b6b 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -673,15 +673,15 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { self.base.allocator.free(result.stderr); } if (result.stdout.len != 0) { - std.log.warn("unexpected LD stdout: {}", .{result.stdout}); + log.warn("unexpected LD stdout: {}", .{result.stdout}); } if (result.stderr.len != 0) { - std.log.warn("unexpected LD stderr: {}", .{result.stderr}); + log.warn("unexpected LD stderr: {}", .{result.stderr}); } if (result.term != .Exited or result.term.Exited != 0) { // TODO parse this output and surface with the Compilation API rather than // directly outputting to stderr here. - std.log.err("{}", .{result.stderr}); + log.err("{}", .{result.stderr}); return error.LDReportedFailure; } } else { @@ -738,7 +738,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { } if (stderr.len != 0) { - std.log.warn("unexpected LLD stderr:\n{s}", .{stderr}); + log.warn("unexpected LLD stderr:\n{s}", .{stderr}); } } @@ -757,10 +757,10 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { // TODO We are in the position to be able to increase the padding by moving all sections // by the required offset, but this requires a little bit more thinking and bookkeeping. // For now, return an error informing the user of the problem. - std.log.err("Not enough padding between load commands and start of __text section:\n", .{}); - std.log.err("Offset after last load command: 0x{x}\n", .{after_last_cmd_offset}); - std.log.err("Beginning of __text section: 0x{x}\n", .{text_section.offset}); - std.log.err("Needed size: 0x{x}\n", .{needed_size}); + log.err("Not enough padding between load commands and start of __text section:\n", .{}); + log.err("Offset after last load command: 0x{x}\n", .{after_last_cmd_offset}); + log.err("Beginning of __text section: 0x{x}\n", .{text_section.offset}); + log.err("Needed size: 0x{x}\n", .{needed_size}); return error.NotEnoughPadding; } const linkedit_segment = self.load_commands.items[self.linkedit_segment_cmd_index.?].Segment; @@ -792,11 +792,11 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { // Update the file with the digest. If it fails we can continue; it only // means that the next invocation will have an unnecessary cache miss. Cache.writeSmallFile(directory.handle, id_symlink_basename, &digest) catch |err| { - std.log.warn("failed to save linking hash digest file: {}", .{@errorName(err)}); + log.warn("failed to save linking hash digest file: {}", .{@errorName(err)}); }; // Again failure here only means an unnecessary cache miss. man.writeManifest() catch |err| { - std.log.warn("failed to write cache manifest when linking: {}", .{@errorName(err)}); + log.warn("failed to write cache manifest when linking: {}", .{@errorName(err)}); }; // We hang on to this lock so that the output file path can be used without // other processes clobbering it. diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index cc57aee03d..74a6607051 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -455,7 +455,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { } if (stderr.len != 0) { - std.log.warn("unexpected LLD stderr:\n{s}", .{stderr}); + log.warn("unexpected LLD stderr:\n{s}", .{stderr}); } } @@ -463,11 +463,11 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { // Update the file with the digest. If it fails we can continue; it only // means that the next invocation will have an unnecessary cache miss. Cache.writeSmallFile(directory.handle, id_symlink_basename, &digest) catch |err| { - std.log.warn("failed to save linking hash digest symlink: {}", .{@errorName(err)}); + log.warn("failed to save linking hash digest symlink: {}", .{@errorName(err)}); }; // Again failure here only means an unnecessary cache miss. man.writeManifest() catch |err| { - std.log.warn("failed to write cache manifest when linking: {}", .{@errorName(err)}); + log.warn("failed to write cache manifest when linking: {}", .{@errorName(err)}); }; // We hang on to this lock so that the output file path can be used without // other processes clobbering it. diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp index 2638744dd7..ed0a033592 100644 --- a/src/stage1/analyze.cpp +++ b/src/stage1/analyze.cpp @@ -3936,12 +3936,6 @@ void update_compile_var(CodeGen *g, Buf *name, ZigValue *value) { void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node) { switch (node->type) { - case NodeTypeContainerDecl: - for (size_t i = 0; i < node->data.container_decl.decls.length; i += 1) { - AstNode *child = node->data.container_decl.decls.at(i); - scan_decls(g, decls_scope, child); - } - break; case NodeTypeFnDef: scan_decls(g, decls_scope, node->data.fn_def.fn_proto); break; @@ -3986,6 +3980,7 @@ void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node) { case NodeTypeCompTime: preview_comptime_decl(g, node, decls_scope); break; + case NodeTypeContainerDecl: case NodeTypeNoSuspend: case NodeTypeParamDecl: case NodeTypeReturnExpr: diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index 10ebf67e35..fb94762b05 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -25312,24 +25312,6 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa inner_fields[2]->data.x_union.payload = fn_decl_val; break; } - case TldIdContainer: - { - ZigType *type_entry = ((TldContainer *)curr_entry->value)->type_entry; - if ((err = type_resolve(ira->codegen, type_entry, ResolveStatusSizeKnown))) - return ErrorSemanticAnalyzeFail; - - // This is a type. - bigint_init_unsigned(&inner_fields[2]->data.x_union.tag, 0); - - ZigValue *payload = ira->codegen->pass1_arena->create<ZigValue>(); - payload->special = ConstValSpecialStatic; - payload->type = ira->codegen->builtin_types.entry_type; - payload->data.x_type = type_entry; - - inner_fields[2]->data.x_union.payload = payload; - - break; - } default: zig_unreachable(); } |
