diff options
| author | Jacob G-W <jacoblevgw@gmail.com> | 2021-06-19 21:10:22 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-06-21 17:03:03 -0700 |
| commit | 9fffffb07b081858db0c2102a0680aa166b48263 (patch) | |
| tree | 36caed31c5b2aaa8e08bb8e6e90e9b2c30910ff3 /src/link | |
| parent | b83b3883ba0b5e965f8f7f1298c77c6d766741af (diff) | |
| download | zig-9fffffb07b081858db0c2102a0680aa166b48263.tar.gz zig-9fffffb07b081858db0c2102a0680aa166b48263.zip | |
fix code broken from previous commit
Diffstat (limited to 'src/link')
| -rw-r--r-- | src/link/C.zig | 16 | ||||
| -rw-r--r-- | src/link/Coff.zig | 5 | ||||
| -rw-r--r-- | src/link/Elf.zig | 13 | ||||
| -rw-r--r-- | src/link/MachO.zig | 6 | ||||
| -rw-r--r-- | src/link/MachO/DebugSymbols.zig | 6 | ||||
| -rw-r--r-- | src/link/MachO/Zld.zig | 7 | ||||
| -rw-r--r-- | src/link/MachO/bind.zig | 1 | ||||
| -rw-r--r-- | src/link/SpirV.zig | 10 | ||||
| -rw-r--r-- | src/link/Wasm.zig | 14 |
9 files changed, 64 insertions, 14 deletions
diff --git a/src/link/C.zig b/src/link/C.zig index 6cb219db41..bf18710cf5 100644 --- a/src/link/C.zig +++ b/src/link/C.zig @@ -76,7 +76,12 @@ pub fn deinit(self: *C) void { self.decl_table.deinit(self.base.allocator); } -pub fn allocateDeclIndexes(self: *C, decl: *Module.Decl) !void {} +pub fn allocateDeclIndexes(self: *C, decl: *Module.Decl) !void { + if (false) { + self; + decl; + } +} pub fn freeDecl(self: *C, decl: *Module.Decl) void { _ = self.decl_table.swapRemove(decl); @@ -307,4 +312,11 @@ pub fn updateDeclExports( module: *Module, decl: *Module.Decl, exports: []const *Module.Export, -) !void {} +) !void { + if (false) { + exports; + decl; + module; + self; + } +} diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 9ab1c6d78a..b466cf9136 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -831,7 +831,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { .target = self.base.options.target, .output_mode = .Obj, }); - const o_directory = self.base.options.module.?.zig_cache_artifact_directory; + const o_directory = module.zig_cache_artifact_directory; const full_obj_path = try o_directory.join(arena, &[_][]const u8{obj_basename}); break :blk full_obj_path; } @@ -1340,6 +1340,9 @@ pub fn getDeclVAddr(self: *Coff, decl: *const Module.Decl) u64 { } pub fn updateDeclLineNumber(self: *Coff, module: *Module, decl: *Module.Decl) !void { + _ = self; + _ = module; + _ = decl; // TODO Implement this } diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 84068ffeca..f046e8104f 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1262,7 +1262,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { .target = self.base.options.target, .output_mode = .Obj, }); - const o_directory = self.base.options.module.?.zig_cache_artifact_directory; + const o_directory = module.zig_cache_artifact_directory; const full_obj_path = try o_directory.join(arena, &[_][]const u8{obj_basename}); break :blk full_obj_path; } @@ -1938,6 +1938,11 @@ fn freeTextBlock(self: *Elf, text_block: *TextBlock) void { } fn shrinkTextBlock(self: *Elf, text_block: *TextBlock, new_block_size: u64) void { + if (false) { + self; + text_block; + new_block_size; + } // TODO check the new capacity, and if it crosses the size threshold into a big enough // capacity, insert a free list node for it. } @@ -2706,6 +2711,7 @@ pub fn updateDeclExports( /// Must be called only after a successful call to `updateDecl`. pub fn updateDeclLineNumber(self: *Elf, module: *Module, decl: *const Module.Decl) !void { + _ = module; const tracy = trace(@src()); defer tracy.end(); @@ -2979,6 +2985,7 @@ fn dbgLineNeededHeaderBytes(self: Elf) u32 { } fn dbgInfoNeededHeaderBytes(self: Elf) u32 { + _ = self; return 120; } @@ -3372,7 +3379,7 @@ const CsuObjects = struct { if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ gcc_dir_path, obj.* }); }, else => { - inline for (std.meta.fields(@TypeOf(result))) |f, i| { + inline for (std.meta.fields(@TypeOf(result))) |f| { if (@field(result, f.name)) |*obj| { obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); } @@ -3380,7 +3387,7 @@ const CsuObjects = struct { }, } } else { - inline for (std.meta.fields(@TypeOf(result))) |f, i| { + inline for (std.meta.fields(@TypeOf(result))) |f| { if (@field(result, f.name)) |*obj| { if (comp.crt_files.get(obj.*)) |crtf| { obj.* = crtf.full_object_path; diff --git a/src/link/MachO.zig b/src/link/MachO.zig index e82589f144..6e1996f9ff 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -441,6 +441,7 @@ pub fn flush(self: *MachO, comp: *Compilation) !void { } pub fn flushModule(self: *MachO, comp: *Compilation) !void { + _ = comp; const tracy = trace(@src()); defer tracy.end(); @@ -533,7 +534,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { .target = self.base.options.target, .output_mode = .Obj, }); - const o_directory = self.base.options.module.?.zig_cache_artifact_directory; + const o_directory = module.zig_cache_artifact_directory; const full_obj_path = try o_directory.join(arena, &[_][]const u8{obj_basename}); break :blk full_obj_path; } @@ -1254,6 +1255,9 @@ fn freeTextBlock(self: *MachO, text_block: *TextBlock) void { } fn shrinkTextBlock(self: *MachO, text_block: *TextBlock, new_block_size: u64) void { + _ = self; + _ = text_block; + _ = new_block_size; // TODO check the new capacity, and if it crosses the size threshold into a big enough // capacity, insert a free list node for it. } diff --git a/src/link/MachO/DebugSymbols.zig b/src/link/MachO/DebugSymbols.zig index 218911f7ab..2b10f3307b 100644 --- a/src/link/MachO/DebugSymbols.zig +++ b/src/link/MachO/DebugSymbols.zig @@ -899,6 +899,7 @@ fn writeStringTable(self: *DebugSymbols) !void { } pub fn updateDeclLineNumber(self: *DebugSymbols, module: *Module, decl: *const Module.Decl) !void { + _ = module; const tracy = trace(@src()); defer tracy.end(); @@ -926,6 +927,8 @@ pub fn initDeclDebugBuffers( module: *Module, decl: *Module.Decl, ) !DeclDebugBuffers { + _ = self; + _ = module; const tracy = trace(@src()); defer tracy.end(); @@ -1188,6 +1191,7 @@ fn addDbgInfoType( dbg_info_buffer: *std.ArrayList(u8), target: std.Target, ) !void { + _ = self; switch (ty.zigTypeTag()) { .Void => unreachable, .NoReturn => unreachable, @@ -1364,6 +1368,7 @@ fn getRelocDbgInfoSubprogramHighPC() u32 { } fn dbgLineNeededHeaderBytes(self: DebugSymbols, module: *Module) u32 { + _ = self; const directory_entry_format_count = 1; const file_name_entry_format_count = 1; const directory_count = 1; @@ -1378,6 +1383,7 @@ fn dbgLineNeededHeaderBytes(self: DebugSymbols, module: *Module) u32 { } fn dbgInfoNeededHeaderBytes(self: DebugSymbols) u32 { + _ = self; return 120; } diff --git a/src/link/MachO/Zld.zig b/src/link/MachO/Zld.zig index 4b19891c77..9d9a1315bb 100644 --- a/src/link/MachO/Zld.zig +++ b/src/link/MachO/Zld.zig @@ -108,6 +108,7 @@ const TlvOffset = struct { offset: u64, fn cmp(context: void, a: TlvOffset, b: TlvOffset) bool { + _ = context; return a.source_addr < b.source_addr; } }; @@ -437,7 +438,7 @@ fn updateMetadata(self: *Zld) !void { const data_seg = &self.load_commands.items[self.data_segment_cmd_index.?].Segment; // Create missing metadata - for (object.sections.items) |sect, sect_id| { + for (object.sections.items) |sect| { const segname = sect.segname(); const sectname = sect.sectname(); @@ -1373,7 +1374,7 @@ fn allocateTentativeSymbols(self: *Zld) !void { } // Convert tentative definitions into regular symbols. - for (self.tentatives.values()) |sym, i| { + for (self.tentatives.values()) |sym| { const tent = sym.cast(Symbol.Tentative) orelse unreachable; const reg = try self.allocator.create(Symbol.Regular); errdefer self.allocator.destroy(reg); @@ -1758,7 +1759,7 @@ fn resolveSymbolsInObject(self: *Zld, object: *Object) !void { t_sym.alias = sym; sym_ptr.* = sym; - } else if (sym.cast(Symbol.Unresolved)) |und| { + } else if (sym.cast(Symbol.Unresolved)) |_| { if (self.globals.get(sym.name)) |g_sym| { sym.alias = g_sym; continue; diff --git a/src/link/MachO/bind.zig b/src/link/MachO/bind.zig index d234fa8242..402e74d776 100644 --- a/src/link/MachO/bind.zig +++ b/src/link/MachO/bind.zig @@ -10,6 +10,7 @@ pub const Pointer = struct { }; pub fn pointerCmp(context: void, a: Pointer, b: Pointer) bool { + _ = context; if (a.segment_id < b.segment_id) return true; if (a.segment_id == b.segment_id) { return a.offset < b.offset; diff --git a/src/link/SpirV.zig b/src/link/SpirV.zig index 9d64245bbb..c0b4e5ebcb 100644 --- a/src/link/SpirV.zig +++ b/src/link/SpirV.zig @@ -102,6 +102,7 @@ pub fn deinit(self: *SpirV) void { } pub fn updateDecl(self: *SpirV, module: *Module, decl: *Module.Decl) !void { + _ = module; // Keep track of all decls so we can iterate over them on flush(). _ = try self.decl_table.getOrPut(self.base.allocator, decl); } @@ -111,7 +112,14 @@ pub fn updateDeclExports( module: *Module, decl: *const Module.Decl, exports: []const *Module.Export, -) !void {} +) !void { + if (false) { + self; + module; + decl; + exports; + } +} pub fn freeDecl(self: *SpirV, decl: *Module.Decl) void { assert(self.decl_table.swapRemove(decl)); diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 35da20291d..50b320d7f6 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -216,7 +216,7 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { try module.failed_decls.put(module.gpa, decl, context.err_msg); return; }, - else => |e| return err, + else => |e| return e, }; const code: []const u8 = switch (result) { @@ -258,7 +258,14 @@ pub fn updateDeclExports( module: *Module, decl: *const Module.Decl, exports: []const *Module.Export, -) !void {} +) !void { + if (false) { + self; + module; + decl; + exports; + } +} pub fn freeDecl(self: *Wasm, decl: *Module.Decl) void { if (self.getFuncidx(decl)) |func_idx| { @@ -300,6 +307,7 @@ pub fn flush(self: *Wasm, comp: *Compilation) !void { } pub fn flushModule(self: *Wasm, comp: *Compilation) !void { + _ = comp; const tracy = trace(@src()); defer tracy.end(); @@ -557,7 +565,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { .target = self.base.options.target, .output_mode = .Obj, }); - const o_directory = self.base.options.module.?.zig_cache_artifact_directory; + const o_directory = module.zig_cache_artifact_directory; const full_obj_path = try o_directory.join(arena, &[_][]const u8{obj_basename}); break :blk full_obj_path; } |
