authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-21 13:07:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-21 17:03:03-07:00
log7a595f2e6c299afc8830c851b1797babc6087206
treebd8103bc7f4d6324d03b9d04a50ce195c4cb7487
parent3d8aa97165feacc96d4a27f17b826293e57fc4c7

remove unused parameters


3 files changed, 25 insertions(+), 52 deletions(-)

lib/std/special/compiler_rt/comparedf2_test.zig+1-2
......@@ -100,8 +100,7 @@ const test_vectors = init: {
100100};
101101
102102test "compare f64" {
103 for (test_vectors) |vector, i| {
104 _ = i;
103 for (test_vectors) |vector| {
105104 try std.testing.expect(test__cmpdf2(vector));
106105 }
107106}
lib/std/special/compiler_rt/comparesf2_test.zig+1-2
......@@ -100,8 +100,7 @@ const test_vectors = init: {
100100};
101101
102102test "compare f32" {
103 for (test_vectors) |vector, i| {
104 _ = i;
103 for (test_vectors) |vector| {
105104 try std.testing.expect(test__cmpsf2(vector));
106105 }
107106}
src/AstGen.zig+23-48
......@@ -844,7 +844,7 @@ fn expr(gz: *GenZir, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) InnerEr
844844 .@"switch", .switch_comma => return switchExpr(gz, scope, rl, node),
845845
846846 .@"nosuspend" => return nosuspendExpr(gz, scope, rl, node),
847 .@"suspend" => return suspendExpr(gz, scope, rl, node),
847 .@"suspend" => return suspendExpr(gz, scope, node),
848848 .@"await" => return awaitExpr(gz, scope, rl, node),
849849 .@"resume" => return resumeExpr(gz, scope, rl, node),
850850
......@@ -922,10 +922,8 @@ fn nosuspendExpr(
922922fn suspendExpr(
923923 gz: *GenZir,
924924 scope: *Scope,
925 rl: ResultLoc,
926925 node: ast.Node.Index,
927926) InnerError!Zir.Inst.Ref {
928 _ = rl;
929927 const astgen = gz.astgen;
930928 const gpa = astgen.gpa;
931929 const tree = astgen.tree;
......@@ -1171,32 +1169,32 @@ fn arrayInitExpr(
11711169 },
11721170 .ref => {
11731171 if (types.array != .none) {
1174 return arrayInitExprRlTy(gz, scope, rl, node, array_init.ast.elements, types.array, types.elem, .array_init_ref);
1172 return arrayInitExprRlTy(gz, scope, node, array_init.ast.elements, types.elem, .array_init_ref);
11751173 } else {
1176 return arrayInitExprRlNone(gz, scope, rl, node, array_init.ast.elements, .array_init_anon_ref);
1174 return arrayInitExprRlNone(gz, scope, node, array_init.ast.elements, .array_init_anon_ref);
11771175 }
11781176 },
11791177 .none, .none_or_ref => {
11801178 if (types.array != .none) {
1181 return arrayInitExprRlTy(gz, scope, rl, node, array_init.ast.elements, types.array, types.elem, .array_init);
1179 return arrayInitExprRlTy(gz, scope, node, array_init.ast.elements, types.elem, .array_init);
11821180 } else {
1183 return arrayInitExprRlNone(gz, scope, rl, node, array_init.ast.elements, .array_init_anon);
1181 return arrayInitExprRlNone(gz, scope, node, array_init.ast.elements, .array_init_anon);
11841182 }
11851183 },
11861184 .ty => |ty_inst| {
11871185 if (types.array != .none) {
1188 const result = try arrayInitExprRlTy(gz, scope, rl, node, array_init.ast.elements, types.array, types.elem, .array_init);
1186 const result = try arrayInitExprRlTy(gz, scope, node, array_init.ast.elements, types.elem, .array_init);
11891187 return rvalue(gz, scope, rl, result, node);
11901188 } else {
11911189 const elem_type = try gz.addUnNode(.elem_type, ty_inst, node);
1192 return arrayInitExprRlTy(gz, scope, rl, node, array_init.ast.elements, ty_inst, elem_type, .array_init);
1190 return arrayInitExprRlTy(gz, scope, node, array_init.ast.elements, elem_type, .array_init);
11931191 }
11941192 },
11951193 .ptr, .inferred_ptr => |ptr_inst| {
1196 return arrayInitExprRlPtr(gz, scope, rl, node, array_init.ast.elements, ptr_inst);
1194 return arrayInitExprRlPtr(gz, scope, node, array_init.ast.elements, ptr_inst);
11971195 },
11981196 .block_ptr => |block_gz| {
1199 return arrayInitExprRlPtr(gz, scope, rl, node, array_init.ast.elements, block_gz.rl_ptr);
1197 return arrayInitExprRlPtr(gz, scope, node, array_init.ast.elements, block_gz.rl_ptr);
12001198 },
12011199 }
12021200}
......@@ -1204,12 +1202,10 @@ fn arrayInitExpr(
12041202fn arrayInitExprRlNone(
12051203 gz: *GenZir,
12061204 scope: *Scope,
1207 rl: ResultLoc,
12081205 node: ast.Node.Index,
12091206 elements: []const ast.Node.Index,
12101207 tag: Zir.Inst.Tag,
12111208) InnerError!Zir.Inst.Ref {
1212 _ = rl;
12131209 const astgen = gz.astgen;
12141210 const gpa = astgen.gpa;
12151211 const elem_list = try gpa.alloc(Zir.Inst.Ref, elements.len);
......@@ -1228,16 +1224,11 @@ fn arrayInitExprRlNone(
12281224fn arrayInitExprRlTy(
12291225 gz: *GenZir,
12301226 scope: *Scope,
1231 rl: ResultLoc,
12321227 node: ast.Node.Index,
12331228 elements: []const ast.Node.Index,
1234 array_ty_inst: Zir.Inst.Ref,
12351229 elem_ty_inst: Zir.Inst.Ref,
12361230 tag: Zir.Inst.Tag,
12371231) InnerError!Zir.Inst.Ref {
1238 _ = rl;
1239 _ = array_ty_inst;
1240 _ = elem_ty_inst;
12411232 const astgen = gz.astgen;
12421233 const gpa = astgen.gpa;
12431234
......@@ -1259,12 +1250,10 @@ fn arrayInitExprRlTy(
12591250fn arrayInitExprRlPtr(
12601251 gz: *GenZir,
12611252 scope: *Scope,
1262 rl: ResultLoc,
12631253 node: ast.Node.Index,
12641254 elements: []const ast.Node.Index,
12651255 result_ptr: Zir.Inst.Ref,
12661256) InnerError!Zir.Inst.Ref {
1267 _ = rl;
12681257 const astgen = gz.astgen;
12691258 const gpa = astgen.gpa;
12701259
......@@ -1340,41 +1329,39 @@ fn structInitExpr(
13401329 .ref => {
13411330 if (struct_init.ast.type_expr != 0) {
13421331 const ty_inst = try typeExpr(gz, scope, struct_init.ast.type_expr);
1343 return structInitExprRlTy(gz, scope, rl, node, struct_init, ty_inst, .struct_init_ref);
1332 return structInitExprRlTy(gz, scope, node, struct_init, ty_inst, .struct_init_ref);
13441333 } else {
1345 return structInitExprRlNone(gz, scope, rl, node, struct_init, .struct_init_anon_ref);
1334 return structInitExprRlNone(gz, scope, node, struct_init, .struct_init_anon_ref);
13461335 }
13471336 },
13481337 .none, .none_or_ref => {
13491338 if (struct_init.ast.type_expr != 0) {
13501339 const ty_inst = try typeExpr(gz, scope, struct_init.ast.type_expr);
1351 return structInitExprRlTy(gz, scope, rl, node, struct_init, ty_inst, .struct_init);
1340 return structInitExprRlTy(gz, scope, node, struct_init, ty_inst, .struct_init);
13521341 } else {
1353 return structInitExprRlNone(gz, scope, rl, node, struct_init, .struct_init_anon);
1342 return structInitExprRlNone(gz, scope, node, struct_init, .struct_init_anon);
13541343 }
13551344 },
13561345 .ty => |ty_inst| {
13571346 if (struct_init.ast.type_expr == 0) {
1358 return structInitExprRlTy(gz, scope, rl, node, struct_init, ty_inst, .struct_init);
1347 return structInitExprRlTy(gz, scope, node, struct_init, ty_inst, .struct_init);
13591348 }
13601349 const inner_ty_inst = try typeExpr(gz, scope, struct_init.ast.type_expr);
1361 const result = try structInitExprRlTy(gz, scope, rl, node, struct_init, inner_ty_inst, .struct_init);
1350 const result = try structInitExprRlTy(gz, scope, node, struct_init, inner_ty_inst, .struct_init);
13621351 return rvalue(gz, scope, rl, result, node);
13631352 },
1364 .ptr, .inferred_ptr => |ptr_inst| return structInitExprRlPtr(gz, scope, rl, node, struct_init, ptr_inst),
1365 .block_ptr => |block_gz| return structInitExprRlPtr(gz, scope, rl, node, struct_init, block_gz.rl_ptr),
1353 .ptr, .inferred_ptr => |ptr_inst| return structInitExprRlPtr(gz, scope, node, struct_init, ptr_inst),
1354 .block_ptr => |block_gz| return structInitExprRlPtr(gz, scope, node, struct_init, block_gz.rl_ptr),
13661355 }
13671356}
13681357
13691358fn structInitExprRlNone(
13701359 gz: *GenZir,
13711360 scope: *Scope,
1372 rl: ResultLoc,
13731361 node: ast.Node.Index,
13741362 struct_init: ast.full.StructInit,
13751363 tag: Zir.Inst.Tag,
13761364) InnerError!Zir.Inst.Ref {
1377 _ = rl;
13781365 const astgen = gz.astgen;
13791366 const gpa = astgen.gpa;
13801367 const tree = astgen.tree;
......@@ -1405,12 +1392,10 @@ fn structInitExprRlNone(
14051392fn structInitExprRlPtr(
14061393 gz: *GenZir,
14071394 scope: *Scope,
1408 rl: ResultLoc,
14091395 node: ast.Node.Index,
14101396 struct_init: ast.full.StructInit,
14111397 result_ptr: Zir.Inst.Ref,
14121398) InnerError!Zir.Inst.Ref {
1413 _ = rl;
14141399 const astgen = gz.astgen;
14151400 const gpa = astgen.gpa;
14161401 const tree = astgen.tree;
......@@ -1441,13 +1426,11 @@ fn structInitExprRlPtr(
14411426fn structInitExprRlTy(
14421427 gz: *GenZir,
14431428 scope: *Scope,
1444 rl: ResultLoc,
14451429 node: ast.Node.Index,
14461430 struct_init: ast.full.StructInit,
14471431 ty_inst: Zir.Inst.Ref,
14481432 tag: Zir.Inst.Tag,
14491433) InnerError!Zir.Inst.Ref {
1450 _ = rl;
14511434 const astgen = gz.astgen;
14521435 const gpa = astgen.gpa;
14531436 const tree = astgen.tree;
......@@ -1667,7 +1650,7 @@ fn blockExpr(
16671650 return labeledBlockExpr(gz, scope, rl, block_node, statements, .block);
16681651 }
16691652
1670 try blockExprStmts(gz, scope, block_node, statements);
1653 try blockExprStmts(gz, scope, statements);
16711654 return rvalue(gz, scope, rl, .void_value, block_node);
16721655}
16731656
......@@ -1742,7 +1725,7 @@ fn labeledBlockExpr(
17421725 defer block_scope.labeled_breaks.deinit(astgen.gpa);
17431726 defer block_scope.labeled_store_to_block_ptr_list.deinit(astgen.gpa);
17441727
1745 try blockExprStmts(&block_scope, &block_scope.base, block_node, statements);
1728 try blockExprStmts(&block_scope, &block_scope.base, statements);
17461729
17471730 if (!block_scope.label.?.used) {
17481731 return astgen.failTok(label_token, "unused block label", .{});
......@@ -1784,13 +1767,7 @@ fn labeledBlockExpr(
17841767 }
17851768}
17861769
1787fn blockExprStmts(
1788 gz: *GenZir,
1789 parent_scope: *Scope,
1790 node: ast.Node.Index,
1791 statements: []const ast.Node.Index,
1792) !void {
1793 _ = node;
1770fn blockExprStmts(gz: *GenZir, parent_scope: *Scope, statements: []const ast.Node.Index) !void {
17941771 const astgen = gz.astgen;
17951772 const tree = astgen.tree;
17961773 const node_tags = tree.nodes.items(.tag);
......@@ -1807,8 +1784,8 @@ fn blockExprStmts(
18071784 .simple_var_decl => scope = try varDecl(gz, scope, statement, &block_arena.allocator, tree.simpleVarDecl(statement)),
18081785 .aligned_var_decl => scope = try varDecl(gz, scope, statement, &block_arena.allocator, tree.alignedVarDecl(statement)),
18091786
1810 .@"defer" => scope = try deferStmt(gz, scope, statement, &block_arena.allocator, .defer_normal),
1811 .@"errdefer" => scope = try deferStmt(gz, scope, statement, &block_arena.allocator, .defer_error),
1787 .@"defer" => scope = try makeDeferScope(scope, statement, &block_arena.allocator, .defer_normal),
1788 .@"errdefer" => scope = try makeDeferScope(scope, statement, &block_arena.allocator, .defer_error),
18121789
18131790 .assign => try assign(gz, scope, statement),
18141791
......@@ -2205,14 +2182,12 @@ fn checkUsed(
22052182 }
22062183}
22072184
2208fn deferStmt(
2209 gz: *GenZir,
2185fn makeDeferScope(
22102186 scope: *Scope,
22112187 node: ast.Node.Index,
22122188 block_arena: *Allocator,
22132189 scope_tag: Scope.Tag,
22142190) InnerError!*Scope {
2215 _ = gz;
22162191 const defer_scope = try block_arena.create(Scope.Defer);
22172192 defer_scope.* = .{
22182193 .base = .{ .tag = scope_tag },