mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 08:33:06 +00:00
cleanups related to unused params
This commit is contained in:
parent
d279a23c93
commit
06412e04f9
63
src/Sema.zig
63
src/Sema.zig
@ -3506,8 +3506,6 @@ fn zirSwitchCapture(
|
||||
is_multi: bool,
|
||||
is_ref: bool,
|
||||
) InnerError!*Inst {
|
||||
_ = is_ref;
|
||||
_ = is_multi;
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
|
||||
@ -3516,6 +3514,8 @@ fn zirSwitchCapture(
|
||||
const switch_info = zir_datas[capture_info.switch_inst].pl_node;
|
||||
const src = switch_info.src();
|
||||
|
||||
_ = is_ref;
|
||||
_ = is_multi;
|
||||
return sema.mod.fail(&block.base, src, "TODO implement Sema for zirSwitchCapture", .{});
|
||||
}
|
||||
|
||||
@ -3525,7 +3525,6 @@ fn zirSwitchCaptureElse(
|
||||
inst: Zir.Inst.Index,
|
||||
is_ref: bool,
|
||||
) InnerError!*Inst {
|
||||
_ = is_ref;
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
|
||||
@ -3534,6 +3533,7 @@ fn zirSwitchCaptureElse(
|
||||
const switch_info = zir_datas[capture_info.switch_inst].pl_node;
|
||||
const src = switch_info.src();
|
||||
|
||||
_ = is_ref;
|
||||
return sema.mod.fail(&block.base, src, "TODO implement Sema for zirSwitchCaptureElse", .{});
|
||||
}
|
||||
|
||||
@ -4528,17 +4528,19 @@ fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!
|
||||
}
|
||||
|
||||
fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
|
||||
_ = block;
|
||||
_ = inst;
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
|
||||
_ = block;
|
||||
_ = inst;
|
||||
return sema.mod.fail(&block.base, sema.src, "TODO implement zirShl", .{});
|
||||
}
|
||||
|
||||
fn zirShr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
|
||||
_ = inst;
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
|
||||
_ = inst;
|
||||
return sema.mod.fail(&block.base, sema.src, "TODO implement zirShr", .{});
|
||||
}
|
||||
|
||||
@ -4606,23 +4608,26 @@ fn zirBitwise(
|
||||
}
|
||||
|
||||
fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
|
||||
_ = inst;
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
|
||||
_ = inst;
|
||||
return sema.mod.fail(&block.base, sema.src, "TODO implement zirBitNot", .{});
|
||||
}
|
||||
|
||||
fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
|
||||
_ = inst;
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
|
||||
_ = inst;
|
||||
return sema.mod.fail(&block.base, sema.src, "TODO implement zirArrayCat", .{});
|
||||
}
|
||||
|
||||
fn zirArrayMul(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
|
||||
_ = inst;
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
|
||||
_ = inst;
|
||||
return sema.mod.fail(&block.base, sema.src, "TODO implement zirArrayMul", .{});
|
||||
}
|
||||
|
||||
@ -5529,7 +5534,6 @@ fn zirUnionInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner
|
||||
}
|
||||
|
||||
fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!*Inst {
|
||||
_ = is_ref;
|
||||
const mod = sema.mod;
|
||||
const gpa = sema.gpa;
|
||||
const zir_datas = sema.code.instructions.items(.data);
|
||||
@ -5618,6 +5622,10 @@ fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref:
|
||||
return mod.failWithOwnedErrorMsg(&block.base, msg);
|
||||
}
|
||||
|
||||
if (is_ref) {
|
||||
return mod.fail(&block.base, src, "TODO: Sema.zirStructInit is_ref=true", .{});
|
||||
}
|
||||
|
||||
const is_comptime = for (field_inits) |field_init| {
|
||||
if (field_init.value() == null) {
|
||||
break false;
|
||||
@ -5639,23 +5647,26 @@ fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref:
|
||||
}
|
||||
|
||||
fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!*Inst {
|
||||
_ = is_ref;
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src = inst_data.src();
|
||||
|
||||
_ = is_ref;
|
||||
return sema.mod.fail(&block.base, src, "TODO: Sema.zirStructInitAnon", .{});
|
||||
}
|
||||
|
||||
fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!*Inst {
|
||||
_ = is_ref;
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src = inst_data.src();
|
||||
|
||||
_ = is_ref;
|
||||
return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInit", .{});
|
||||
}
|
||||
|
||||
fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!*Inst {
|
||||
_ = is_ref;
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src = inst_data.src();
|
||||
|
||||
_ = is_ref;
|
||||
return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInitAnon", .{});
|
||||
}
|
||||
|
||||
@ -6050,9 +6061,10 @@ fn zirAwait(
|
||||
inst: Zir.Inst.Index,
|
||||
is_nosuspend: bool,
|
||||
) InnerError!*Inst {
|
||||
_ = is_nosuspend;
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].un_node;
|
||||
const src = inst_data.src();
|
||||
|
||||
_ = is_nosuspend;
|
||||
return sema.mod.fail(&block.base, src, "TODO: Sema.zirAwait", .{});
|
||||
}
|
||||
|
||||
@ -6632,8 +6644,6 @@ fn elemPtrArray(
|
||||
elem_index: *Inst,
|
||||
elem_index_src: LazySrcLoc,
|
||||
) InnerError!*Inst {
|
||||
_ = elem_index;
|
||||
_ = elem_index_src;
|
||||
if (array_ptr.value()) |array_ptr_val| {
|
||||
if (elem_index.value()) |index_val| {
|
||||
// Both array pointer and index are compile-time known.
|
||||
@ -6649,6 +6659,8 @@ fn elemPtrArray(
|
||||
});
|
||||
}
|
||||
}
|
||||
_ = elem_index;
|
||||
_ = elem_index_src;
|
||||
return sema.mod.fail(&block.base, src, "TODO implement more analyze elemptr for arrays", .{});
|
||||
}
|
||||
|
||||
@ -7508,14 +7520,14 @@ fn resolveTypeFields(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type
|
||||
struct_obj.status = .have_field_types;
|
||||
return ty;
|
||||
},
|
||||
.extern_options => return sema.resolveBuiltinTypeFields(block, src, ty, "ExternOptions"),
|
||||
.export_options => return sema.resolveBuiltinTypeFields(block, src, ty, "ExportOptions"),
|
||||
.atomic_ordering => return sema.resolveBuiltinTypeFields(block, src, ty, "AtomicOrdering"),
|
||||
.atomic_rmw_op => return sema.resolveBuiltinTypeFields(block, src, ty, "AtomicRmwOp"),
|
||||
.calling_convention => return sema.resolveBuiltinTypeFields(block, src, ty, "CallingConvention"),
|
||||
.float_mode => return sema.resolveBuiltinTypeFields(block, src, ty, "FloatMode"),
|
||||
.reduce_op => return sema.resolveBuiltinTypeFields(block, src, ty, "ReduceOp"),
|
||||
.call_options => return sema.resolveBuiltinTypeFields(block, src, ty, "CallOptions"),
|
||||
.extern_options => return sema.resolveBuiltinTypeFields(block, src, "ExternOptions"),
|
||||
.export_options => return sema.resolveBuiltinTypeFields(block, src, "ExportOptions"),
|
||||
.atomic_ordering => return sema.resolveBuiltinTypeFields(block, src, "AtomicOrdering"),
|
||||
.atomic_rmw_op => return sema.resolveBuiltinTypeFields(block, src, "AtomicRmwOp"),
|
||||
.calling_convention => return sema.resolveBuiltinTypeFields(block, src, "CallingConvention"),
|
||||
.float_mode => return sema.resolveBuiltinTypeFields(block, src, "FloatMode"),
|
||||
.reduce_op => return sema.resolveBuiltinTypeFields(block, src, "ReduceOp"),
|
||||
.call_options => return sema.resolveBuiltinTypeFields(block, src, "CallOptions"),
|
||||
|
||||
.@"union", .union_tagged => {
|
||||
const union_obj = ty.cast(Type.Payload.Union).?.data;
|
||||
@ -7541,11 +7553,8 @@ fn resolveBuiltinTypeFields(
|
||||
sema: *Sema,
|
||||
block: *Scope.Block,
|
||||
src: LazySrcLoc,
|
||||
ty: Type,
|
||||
name: []const u8,
|
||||
) InnerError!Type {
|
||||
_ = ty;
|
||||
_ = name;
|
||||
const resolved_ty = try sema.getBuiltinType(block, src, name);
|
||||
return sema.resolveTypeFields(block, src, resolved_ty);
|
||||
}
|
||||
|
@ -3321,7 +3321,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
const reg = try self.copyToTmpRegister(src, ty, mcv);
|
||||
return self.genSetStack(src, ty, stack_offset, MCValue{ .register = reg });
|
||||
},
|
||||
.embedded_in_code => {
|
||||
.embedded_in_code => |code_offset| {
|
||||
_ = code_offset;
|
||||
return self.fail(src, "TODO implement set stack variable from embedded_in_code", .{});
|
||||
},
|
||||
.register => |reg| {
|
||||
@ -3357,7 +3358,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
else => return self.fail(src, "TODO implement storing other types abi_size={}", .{abi_size}),
|
||||
}
|
||||
},
|
||||
.memory => {
|
||||
.memory => |vaddr| {
|
||||
_ = vaddr;
|
||||
return self.fail(src, "TODO implement set stack variable from memory vaddr", .{});
|
||||
},
|
||||
.stack_offset => |off| {
|
||||
@ -3385,10 +3387,12 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
else => return self.fail(src, "TODO implement memset", .{}),
|
||||
}
|
||||
},
|
||||
.compare_flags_unsigned => {
|
||||
.compare_flags_unsigned => |op| {
|
||||
_ = op;
|
||||
return self.fail(src, "TODO implement set stack variable with compare flags value (unsigned)", .{});
|
||||
},
|
||||
.compare_flags_signed => {
|
||||
.compare_flags_signed => |op| {
|
||||
_ = op;
|
||||
return self.fail(src, "TODO implement set stack variable with compare flags value (signed)", .{});
|
||||
},
|
||||
.immediate => |x_big| {
|
||||
@ -3440,13 +3444,15 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
},
|
||||
}
|
||||
},
|
||||
.embedded_in_code => {
|
||||
.embedded_in_code => |code_offset| {
|
||||
_ = code_offset;
|
||||
return self.fail(src, "TODO implement set stack variable from embedded_in_code", .{});
|
||||
},
|
||||
.register => |reg| {
|
||||
try self.genX8664ModRMRegToStack(src, ty, stack_offset, reg, 0x89);
|
||||
},
|
||||
.memory => {
|
||||
.memory => |vaddr| {
|
||||
_ = vaddr;
|
||||
return self.fail(src, "TODO implement set stack variable from memory vaddr", .{});
|
||||
},
|
||||
.stack_offset => |off| {
|
||||
@ -3474,17 +3480,20 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
else => return self.fail(src, "TODO implement memset", .{}),
|
||||
}
|
||||
},
|
||||
.compare_flags_unsigned => {
|
||||
.compare_flags_unsigned => |op| {
|
||||
_ = op;
|
||||
return self.fail(src, "TODO implement set stack variable with compare flags value (unsigned)", .{});
|
||||
},
|
||||
.compare_flags_signed => {
|
||||
.compare_flags_signed => |op| {
|
||||
_ = op;
|
||||
return self.fail(src, "TODO implement set stack variable with compare flags value (signed)", .{});
|
||||
},
|
||||
.immediate => {
|
||||
const reg = try self.copyToTmpRegister(src, ty, mcv);
|
||||
return self.genSetStack(src, ty, stack_offset, MCValue{ .register = reg });
|
||||
},
|
||||
.embedded_in_code => {
|
||||
.embedded_in_code => |code_offset| {
|
||||
_ = code_offset;
|
||||
return self.fail(src, "TODO implement set stack variable from embedded_in_code", .{});
|
||||
},
|
||||
.register => |reg| {
|
||||
@ -3516,7 +3525,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
else => return self.fail(src, "TODO implement storing other types abi_size={}", .{abi_size}),
|
||||
}
|
||||
},
|
||||
.memory => {
|
||||
.memory => |vaddr| {
|
||||
_ = vaddr;
|
||||
return self.fail(src, "TODO implement set stack variable from memory vaddr", .{});
|
||||
},
|
||||
.stack_offset => |off| {
|
||||
|
@ -910,10 +910,10 @@ pub const Context = struct {
|
||||
},
|
||||
else => unreachable,
|
||||
},
|
||||
.local => {
|
||||
.local => |local| {
|
||||
try self.emitWValue(rhs);
|
||||
try writer.writeByte(wasm.opcode(.local_set));
|
||||
try leb.writeULEB128(writer, lhs.local);
|
||||
try leb.writeULEB128(writer, local);
|
||||
},
|
||||
else => unreachable,
|
||||
}
|
||||
|
@ -77,10 +77,8 @@ pub fn deinit(self: *C) void {
|
||||
}
|
||||
|
||||
pub fn allocateDeclIndexes(self: *C, decl: *Module.Decl) !void {
|
||||
if (false) {
|
||||
self;
|
||||
decl;
|
||||
}
|
||||
_ = self;
|
||||
_ = decl;
|
||||
}
|
||||
|
||||
pub fn freeDecl(self: *C, decl: *Module.Decl) void {
|
||||
@ -313,10 +311,8 @@ pub fn updateDeclExports(
|
||||
decl: *Module.Decl,
|
||||
exports: []const *Module.Export,
|
||||
) !void {
|
||||
if (false) {
|
||||
exports;
|
||||
decl;
|
||||
module;
|
||||
self;
|
||||
}
|
||||
_ = exports;
|
||||
_ = decl;
|
||||
_ = module;
|
||||
_ = self;
|
||||
}
|
||||
|
@ -1938,11 +1938,9 @@ 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;
|
||||
}
|
||||
_ = 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.
|
||||
}
|
||||
|
@ -113,12 +113,10 @@ pub fn updateDeclExports(
|
||||
decl: *const Module.Decl,
|
||||
exports: []const *Module.Export,
|
||||
) !void {
|
||||
if (false) {
|
||||
self;
|
||||
module;
|
||||
decl;
|
||||
exports;
|
||||
}
|
||||
_ = self;
|
||||
_ = module;
|
||||
_ = decl;
|
||||
_ = exports;
|
||||
}
|
||||
|
||||
pub fn freeDecl(self: *SpirV, decl: *Module.Decl) void {
|
||||
|
@ -259,12 +259,10 @@ pub fn updateDeclExports(
|
||||
decl: *const Module.Decl,
|
||||
exports: []const *Module.Export,
|
||||
) !void {
|
||||
if (false) {
|
||||
self;
|
||||
module;
|
||||
decl;
|
||||
exports;
|
||||
}
|
||||
_ = self;
|
||||
_ = module;
|
||||
_ = decl;
|
||||
_ = exports;
|
||||
}
|
||||
|
||||
pub fn freeDecl(self: *Wasm, decl: *Module.Decl) void {
|
||||
|
@ -2560,11 +2560,12 @@ pub const usage_init =
|
||||
;
|
||||
|
||||
pub fn cmdInit(
|
||||
_: *Allocator,
|
||||
gpa: *Allocator,
|
||||
arena: *Allocator,
|
||||
args: []const []const u8,
|
||||
output_mode: std.builtin.OutputMode,
|
||||
) !void {
|
||||
_ = gpa;
|
||||
{
|
||||
var i: usize = 0;
|
||||
while (i < args.len) : (i += 1) {
|
||||
|
@ -431,10 +431,8 @@ test "Type.Fn" {
|
||||
|
||||
const foo = struct {
|
||||
fn func(a: usize, b: bool) align(4) callconv(.C) usize {
|
||||
if (false) {
|
||||
a;
|
||||
b;
|
||||
}
|
||||
_ = a;
|
||||
_ = b;
|
||||
return 0;
|
||||
}
|
||||
}.func;
|
||||
|
@ -1,4 +1,7 @@
|
||||
export fn main() callconv(.C) noreturn {
|
||||
export fn main(r0: u32, r1: u32, atags: u32) callconv(.C) noreturn {
|
||||
_ = r0;
|
||||
_ = r1;
|
||||
_ = atags;
|
||||
unreachable; // never gets run so it doesn't matter
|
||||
}
|
||||
pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace) noreturn {
|
||||
|
Loading…
Reference in New Issue
Block a user