Commit bec70a1a39

Andrew Kelley <andrew@ziglang.org>
2022-09-13 04:38:08
stage2: remove pointless discards from source code
Good riddance!
1 parent f8a9bc5
Changed files (9)
src/arch/aarch64/CodeGen.zig
@@ -2581,7 +2581,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
 }
 
 fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {
-    _ = inst;
     const result: MCValue = if (self.liveness.isUnused(inst))
         .dead
     else
@@ -3614,7 +3613,6 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void {
     const ptr = try self.resolveInst(un_op);
     const ptr_ty = self.air.typeOf(un_op);
     const ret_ty = self.fn_type.fnReturnType();
-    _ = ret_ty;
 
     switch (self.ret_mcv) {
         .none => {},
@@ -5099,7 +5097,6 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne
     } else {
         return self.fail("TODO codegen non-ELF const Decl pointer", .{});
     }
-    _ = tv;
 }
 
 fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue {
src/arch/arm/CodeGen.zig
@@ -2111,7 +2111,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
 }
 
 fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {
-    _ = inst;
     const result: MCValue = if (self.liveness.isUnused(inst))
         .dead
     else
@@ -3353,7 +3352,6 @@ fn divFloat(
 ) InnerError!MCValue {
     _ = lhs_bind;
     _ = rhs_bind;
-    _ = lhs_ty;
     _ = rhs_ty;
     _ = maybe_inst;
 
@@ -3420,7 +3418,6 @@ fn divExact(
 ) InnerError!MCValue {
     _ = lhs_bind;
     _ = rhs_bind;
-    _ = lhs_ty;
     _ = rhs_ty;
     _ = maybe_inst;
 
@@ -3506,7 +3503,6 @@ fn modulo(
 ) InnerError!MCValue {
     _ = lhs_bind;
     _ = rhs_bind;
-    _ = lhs_ty;
     _ = rhs_ty;
     _ = maybe_inst;
 
src/arch/riscv64/CodeGen.zig
@@ -1316,7 +1316,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
 }
 
 fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {
-    _ = inst;
     const result: MCValue = if (self.liveness.isUnused(inst))
         .dead
     else
@@ -1598,7 +1597,6 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void {
     return self.structFieldPtr(ty_op.operand, ty_op.ty, index);
 }
 fn structFieldPtr(self: *Self, operand: Air.Inst.Ref, ty: Air.Inst.Ref, index: u32) !void {
-    _ = self;
     _ = operand;
     _ = ty;
     _ = index;
@@ -1615,7 +1613,6 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
 }
 
 fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
-    _ = self;
     _ = inst;
     return self.fail("TODO implement codegen airFieldParentPtr", .{});
 }
src/arch/sparc64/CodeGen.zig
@@ -2084,9 +2084,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
 }
 
 fn airSwitch(self: *Self, inst: Air.Inst.Index) !void {
-    _ = self;
     _ = inst;
-
     return self.fail("TODO implement switch for {}", .{self.target.cpu.arch});
 }
 
src/arch/x86_64/CodeGen.zig
@@ -1960,7 +1960,6 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
 }
 
 fn airErrReturnTrace(self: *Self, inst: Air.Inst.Index) !void {
-    _ = inst;
     const result: MCValue = if (self.liveness.isUnused(inst))
         .dead
     else
@@ -6590,7 +6589,6 @@ fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {
 fn airCmpxchg(self: *Self, inst: Air.Inst.Index) !void {
     const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
     const extra = self.air.extraData(Air.Block, ty_pl.payload);
-    _ = ty_pl;
     _ = extra;
     return self.fail("TODO implement x86 airCmpxchg", .{});
     // return self.finishAir(inst, result, .{ extra.ptr, extra.expected_value, extra.new_value });
src/link/Plan9.zig
@@ -622,7 +622,6 @@ pub fn updateDeclExports(
 ) !void {
     try self.seeDecl(decl_index);
     // we do all the things in flush
-    _ = self;
     _ = module;
     _ = exports;
 }
src/Autodoc.zig
@@ -2506,7 +2506,6 @@ fn walkInstruction(
                         try self.srcLocInfo(file, sn, parent_src)
                     else
                         parent_src;
-                    _ = src_info;
 
                     const decls_len = if (small.has_decls_len) blk: {
                         const decls_len = file.zir.extra[extra_index];
@@ -2627,7 +2626,6 @@ fn walkInstruction(
                         extra_index += 1;
                         break :blk fields_len;
                     } else 0;
-                    _ = fields_len;
 
                     const decls_len = if (small.has_decls_len) blk: {
                         const decls_len = file.zir.extra[extra_index];
@@ -2759,7 +2757,6 @@ fn walkInstruction(
                         extra_index += 1;
                         break :blk fields_len;
                     } else 0;
-                    _ = fields_len;
 
                     const decls_len = if (small.has_decls_len) blk: {
                         const decls_len = file.zir.extra[extra_index];
@@ -2901,7 +2898,6 @@ fn walkInstruction(
                         extra_index += 1;
                         break :blk fields_len;
                     } else 0;
-                    _ = fields_len;
 
                     const decls_len = if (small.has_decls_len) blk: {
                         const decls_len = file.zir.extra[extra_index];
src/print_air.zig
@@ -324,7 +324,6 @@ const Writer = struct {
     fn writeNoOp(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void {
         _ = w;
         _ = inst;
-        _ = s;
         // no-op, no argument to write
     }
 
src/Sema.zig
@@ -19670,8 +19670,6 @@ fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
         if (try sema.resolveDefinedValue(block, src_src, src_ptr)) |src_ptr_val| {
             if (!src_ptr_val.isComptimeMutablePtr()) break :rs src_src;
             if (try sema.resolveDefinedValue(block, len_src, len)) |len_val| {
-                _ = dest_ptr_val;
-                _ = src_ptr_val;
                 _ = len_val;
                 return sema.fail(block, src, "TODO: Sema.zirMemcpy at comptime", .{});
             } else break :rs len_src;
@@ -19713,7 +19711,6 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
         if (!ptr_val.isComptimeMutablePtr()) break :rs dest_src;
         if (try sema.resolveDefinedValue(block, len_src, len)) |len_val| {
             if (try sema.resolveMaybeUndefVal(block, value_src, value)) |val| {
-                _ = ptr_val;
                 _ = len_val;
                 _ = val;
                 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
         if (val.tag() == .generic_poison) {
             break :blk FuncLinkSection{ .generic = {} };
         }
-        _ = val;
         return sema.fail(block, section_src, "TODO implement linksection on functions", .{});
     } else if (extra.data.bits.has_section_ref) blk: {
         const section_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);