authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-12 19:38:08-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-13 02:04:20-07:00
logbec70a1a39398a3f4e2b1edf914c4755a9ebb623
treede061fcc0fa035b79588e8e854a93100902de4d1
parentf8a9bc57ce1a2a5a1b90e9a33501b64f2dd79019

stage2: remove pointless discards from source code

Good riddance!

9 files changed, 0 insertions(+), 24 deletions(-)

src/Autodoc.zig-4
...@@ -2506,7 +2506,6 @@ fn walkInstruction(...@@ -2506,7 +2506,6 @@ fn walkInstruction(
2506 try self.srcLocInfo(file, sn, parent_src)2506 try self.srcLocInfo(file, sn, parent_src)
2507 else2507 else
2508 parent_src;2508 parent_src;
2509 _ = src_info;
25102509
2511 const decls_len = if (small.has_decls_len) blk: {2510 const decls_len = if (small.has_decls_len) blk: {
2512 const decls_len = file.zir.extra[extra_index];2511 const decls_len = file.zir.extra[extra_index];
...@@ -2627,7 +2626,6 @@ fn walkInstruction(...@@ -2627,7 +2626,6 @@ fn walkInstruction(
2627 extra_index += 1;2626 extra_index += 1;
2628 break :blk fields_len;2627 break :blk fields_len;
2629 } else 0;2628 } else 0;
2630 _ = fields_len;
26312629
2632 const decls_len = if (small.has_decls_len) blk: {2630 const decls_len = if (small.has_decls_len) blk: {
2633 const decls_len = file.zir.extra[extra_index];2631 const decls_len = file.zir.extra[extra_index];
...@@ -2759,7 +2757,6 @@ fn walkInstruction(...@@ -2759,7 +2757,6 @@ fn walkInstruction(
2759 extra_index += 1;2757 extra_index += 1;
2760 break :blk fields_len;2758 break :blk fields_len;
2761 } else 0;2759 } else 0;
2762 _ = fields_len;
27632760
2764 const decls_len = if (small.has_decls_len) blk: {2761 const decls_len = if (small.has_decls_len) blk: {
2765 const decls_len = file.zir.extra[extra_index];2762 const decls_len = file.zir.extra[extra_index];
...@@ -2901,7 +2898,6 @@ fn walkInstruction(...@@ -2901,7 +2898,6 @@ fn walkInstruction(
2901 extra_index += 1;2898 extra_index += 1;
2902 break :blk fields_len;2899 break :blk fields_len;
2903 } else 0;2900 } else 0;
2904 _ = fields_len;
29052901
2906 const decls_len = if (small.has_decls_len) blk: {2902 const decls_len = if (small.has_decls_len) blk: {
2907 const decls_len = file.zir.extra[extra_index];2903 const decls_len = file.zir.extra[extra_index];
src/Sema.zig-4
...@@ -19670,8 +19670,6 @@ fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void...@@ -19670,8 +19670,6 @@ fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
19670 if (try sema.resolveDefinedValue(block, src_src, src_ptr)) |src_ptr_val| {19670 if (try sema.resolveDefinedValue(block, src_src, src_ptr)) |src_ptr_val| {
19671 if (!src_ptr_val.isComptimeMutablePtr()) break :rs src_src;19671 if (!src_ptr_val.isComptimeMutablePtr()) break :rs src_src;
19672 if (try sema.resolveDefinedValue(block, len_src, len)) |len_val| {19672 if (try sema.resolveDefinedValue(block, len_src, len)) |len_val| {
19673 _ = dest_ptr_val;
19674 _ = src_ptr_val;
19675 _ = len_val;19673 _ = len_val;
19676 return sema.fail(block, src, "TODO: Sema.zirMemcpy at comptime", .{});19674 return sema.fail(block, src, "TODO: Sema.zirMemcpy at comptime", .{});
19677 } else break :rs len_src;19675 } else break :rs len_src;
...@@ -19713,7 +19711,6 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void...@@ -19713,7 +19711,6 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
19713 if (!ptr_val.isComptimeMutablePtr()) break :rs dest_src;19711 if (!ptr_val.isComptimeMutablePtr()) break :rs dest_src;
19714 if (try sema.resolveDefinedValue(block, len_src, len)) |len_val| {19712 if (try sema.resolveDefinedValue(block, len_src, len)) |len_val| {
19715 if (try sema.resolveMaybeUndefVal(block, value_src, value)) |val| {19713 if (try sema.resolveMaybeUndefVal(block, value_src, value)) |val| {
19716 _ = ptr_val;
19717 _ = len_val;19714 _ = len_val;
19718 _ = val;19715 _ = val;
19719 return sema.fail(block, src, "TODO: Sema.zirMemset at comptime", .{});19716 return sema.fail(block, src, "TODO: Sema.zirMemset at comptime", .{});
...@@ -19941,7 +19938,6 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -19941,7 +19938,6 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
19941 if (val.tag() == .generic_poison) {19938 if (val.tag() == .generic_poison) {
19942 break :blk FuncLinkSection{ .generic = {} };19939 break :blk FuncLinkSection{ .generic = {} };
19943 }19940 }
19944 _ = val;
19945 return sema.fail(block, section_src, "TODO implement linksection on functions", .{});19941 return sema.fail(block, section_src, "TODO implement linksection on functions", .{});
19946 } else if (extra.data.bits.has_section_ref) blk: {19942 } else if (extra.data.bits.has_section_ref) blk: {
19947 const section_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);19943 const section_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);
src/arch/aarch64/CodeGen.zig-3
...@@ -2581,7 +2581,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {...@@ -2581,7 +2581,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
2581}2581}
25822582
2583fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {2583fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {
2584 _ = inst;
2585 const result: MCValue = if (self.liveness.isUnused(inst))2584 const result: MCValue = if (self.liveness.isUnused(inst))
2586 .dead2585 .dead
2587 else2586 else
...@@ -3614,7 +3613,6 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void {...@@ -3614,7 +3613,6 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void {
3614 const ptr = try self.resolveInst(un_op);3613 const ptr = try self.resolveInst(un_op);
3615 const ptr_ty = self.air.typeOf(un_op);3614 const ptr_ty = self.air.typeOf(un_op);
3616 const ret_ty = self.fn_type.fnReturnType();3615 const ret_ty = self.fn_type.fnReturnType();
3617 _ = ret_ty;
36183616
3619 switch (self.ret_mcv) {3617 switch (self.ret_mcv) {
3620 .none => {},3618 .none => {},
...@@ -5099,7 +5097,6 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne...@@ -5099,7 +5097,6 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne
5099 } else {5097 } else {
5100 return self.fail("TODO codegen non-ELF const Decl pointer", .{});5098 return self.fail("TODO codegen non-ELF const Decl pointer", .{});
5101 }5099 }
5102 _ = tv;
5103}5100}
51045101
5105fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue {5102fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue {
src/arch/arm/CodeGen.zig-4
...@@ -2111,7 +2111,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {...@@ -2111,7 +2111,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
2111}2111}
21122112
2113fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {2113fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {
2114 _ = inst;
2115 const result: MCValue = if (self.liveness.isUnused(inst))2114 const result: MCValue = if (self.liveness.isUnused(inst))
2116 .dead2115 .dead
2117 else2116 else
...@@ -3353,7 +3352,6 @@ fn divFloat(...@@ -3353,7 +3352,6 @@ fn divFloat(
3353) InnerError!MCValue {3352) InnerError!MCValue {
3354 _ = lhs_bind;3353 _ = lhs_bind;
3355 _ = rhs_bind;3354 _ = rhs_bind;
3356 _ = lhs_ty;
3357 _ = rhs_ty;3355 _ = rhs_ty;
3358 _ = maybe_inst;3356 _ = maybe_inst;
33593357
...@@ -3420,7 +3418,6 @@ fn divExact(...@@ -3420,7 +3418,6 @@ fn divExact(
3420) InnerError!MCValue {3418) InnerError!MCValue {
3421 _ = lhs_bind;3419 _ = lhs_bind;
3422 _ = rhs_bind;3420 _ = rhs_bind;
3423 _ = lhs_ty;
3424 _ = rhs_ty;3421 _ = rhs_ty;
3425 _ = maybe_inst;3422 _ = maybe_inst;
34263423
...@@ -3506,7 +3503,6 @@ fn modulo(...@@ -3506,7 +3503,6 @@ fn modulo(
3506) InnerError!MCValue {3503) InnerError!MCValue {
3507 _ = lhs_bind;3504 _ = lhs_bind;
3508 _ = rhs_bind;3505 _ = rhs_bind;
3509 _ = lhs_ty;
3510 _ = rhs_ty;3506 _ = rhs_ty;
3511 _ = maybe_inst;3507 _ = maybe_inst;
35123508
src/arch/riscv64/CodeGen.zig-3
...@@ -1316,7 +1316,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {...@@ -1316,7 +1316,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
1316}1316}
13171317
1318fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {1318fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {
1319 _ = inst;
1320 const result: MCValue = if (self.liveness.isUnused(inst))1319 const result: MCValue = if (self.liveness.isUnused(inst))
1321 .dead1320 .dead
1322 else1321 else
...@@ -1598,7 +1597,6 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void {...@@ -1598,7 +1597,6 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void {
1598 return self.structFieldPtr(ty_op.operand, ty_op.ty, index);1597 return self.structFieldPtr(ty_op.operand, ty_op.ty, index);
1599}1598}
1600fn structFieldPtr(self: *Self, operand: Air.Inst.Ref, ty: Air.Inst.Ref, index: u32) !void {1599fn structFieldPtr(self: *Self, operand: Air.Inst.Ref, ty: Air.Inst.Ref, index: u32) !void {
1601 _ = self;
1602 _ = operand;1600 _ = operand;
1603 _ = ty;1601 _ = ty;
1604 _ = index;1602 _ = index;
...@@ -1615,7 +1613,6 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {...@@ -1615,7 +1613,6 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
1615}1613}
16161614
1617fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {1615fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
1618 _ = self;
1619 _ = inst;1616 _ = inst;
1620 return self.fail("TODO implement codegen airFieldParentPtr", .{});1617 return self.fail("TODO implement codegen airFieldParentPtr", .{});
1621}1618}
src/arch/sparc64/CodeGen.zig-2
...@@ -2084,9 +2084,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {...@@ -2084,9 +2084,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
2084}2084}
20852085
2086fn airSwitch(self: *Self, inst: Air.Inst.Index) !void {2086fn airSwitch(self: *Self, inst: Air.Inst.Index) !void {
2087 _ = self;
2088 _ = inst;2087 _ = inst;
2089
2090 return self.fail("TODO implement switch for {}", .{self.target.cpu.arch});2088 return self.fail("TODO implement switch for {}", .{self.target.cpu.arch});
2091}2089}
20922090
src/arch/x86_64/CodeGen.zig-2
...@@ -1960,7 +1960,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {...@@ -1960,7 +1960,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
1960}1960}
19611961
1962fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {1962fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {
1963 _ = inst;
1964 const result: MCValue = if (self.liveness.isUnused(inst))1963 const result: MCValue = if (self.liveness.isUnused(inst))
1965 .dead1964 .dead
1966 else1965 else
...@@ -6590,7 +6589,6 @@ fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {...@@ -6590,7 +6589,6 @@ fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {
6590fn airCmpxchg(self: *Self, inst: Air.Inst.Index) !void {6589fn airCmpxchg(self: *Self, inst: Air.Inst.Index) !void {
6591 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;6590 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
6592 const extra = self.air.extraData(Air.Block, ty_pl.payload);6591 const extra = self.air.extraData(Air.Block, ty_pl.payload);
6593 _ = ty_pl;
6594 _ = extra;6592 _ = extra;
6595 return self.fail("TODO implement x86 airCmpxchg", .{});6593 return self.fail("TODO implement x86 airCmpxchg", .{});
6596 // return self.finishAir(inst, result, .{ extra.ptr, extra.expected_value, extra.new_value });6594 // return self.finishAir(inst, result, .{ extra.ptr, extra.expected_value, extra.new_value });
src/link/Plan9.zig-1
...@@ -622,7 +622,6 @@ pub fn updateDeclExports(...@@ -622,7 +622,6 @@ pub fn updateDeclExports(
622) !void {622) !void {
623 try self.seeDecl(decl_index);623 try self.seeDecl(decl_index);
624 // we do all the things in flush624 // we do all the things in flush
625 _ = self;
626 _ = module;625 _ = module;
627 _ = exports;626 _ = exports;
628}627}
src/print_air.zig-1
...@@ -324,7 +324,6 @@ const Writer = struct {...@@ -324,7 +324,6 @@ const Writer = struct {
324 fn writeNoOp(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void {324 fn writeNoOp(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void {
325 _ = w;325 _ = w;
326 _ = inst;326 _ = inst;
327 _ = s;
328 // no-op, no argument to write327 // no-op, no argument to write
329 }328 }
330329