| author | |
| committer | |
| log | 9fffffb07b081858db0c2102a0680aa166b48263 |
| tree | 36caed31c5b2aaa8e08bb8e6e90e9b2c30910ff3 |
| parent | b83b3883ba0b5e965f8f7f1298c77c6d766741af |
162 files changed, 720 insertions(+), 148 deletions(-)
lib/std/Progress.zig+1-1| ... | ... | @@ -295,7 +295,7 @@ fn refreshWithHeldLock(self: *Progress) void { |
| 295 | 295 | end += 1; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | _ = file.write(self.output_buffer[0..end]) catch |e| { | |
| 298 | _ = file.write(self.output_buffer[0..end]) catch { | |
| 299 | 299 | // Stop trying to write to this file once it errors. |
| 300 | 300 | self.terminal = null; |
| 301 | 301 | }; |
lib/std/SemanticVersion.zig+2-1| ... | ... | @@ -162,6 +162,7 @@ pub fn format( |
| 162 | 162 | options: std.fmt.FormatOptions, |
| 163 | 163 | out_stream: anytype, |
| 164 | 164 | ) !void { |
| 165 | _ = options; | |
| 165 | 166 | if (fmt.len != 0) @compileError("Unknown format string: '" ++ fmt ++ "'"); |
| 166 | 167 | try std.fmt.format(out_stream, "{d}.{d}.{d}", .{ self.major, self.minor, self.patch }); |
| 167 | 168 | if (self.pre) |pre| try std.fmt.format(out_stream, "-{s}", .{pre}); |
| ... | ... | @@ -259,7 +260,7 @@ test "SemanticVersion format" { |
| 259 | 260 | |
| 260 | 261 | // Invalid version string that may overflow. |
| 261 | 262 | const big_invalid = "99999999999999999999999.999999999999999999.99999999999999999----RC-SNAPSHOT.12.09.1--------------------------------..12"; |
| 262 | if (parse(big_invalid)) |ver| std.debug.panic("expected error, found {}", .{ver}) else |err| {} | |
| 263 | if (parse(big_invalid)) |ver| std.debug.panic("expected error, found {}", .{ver}) else |_| {} | |
| 263 | 264 | } |
| 264 | 265 | |
| 265 | 266 | test "SemanticVersion precedence" { |
lib/std/Thread/Condition.zig+8-2| ... | ... | @@ -40,12 +40,18 @@ else |
| 40 | 40 | |
| 41 | 41 | pub const SingleThreadedCondition = struct { |
| 42 | 42 | pub fn wait(cond: *SingleThreadedCondition, mutex: *Mutex) void { |
| 43 | _ = cond; | |
| 44 | _ = mutex; | |
| 43 | 45 | unreachable; // deadlock detected |
| 44 | 46 | } |
| 45 | 47 | |
| 46 | pub fn signal(cond: *SingleThreadedCondition) void {} | |
| 48 | pub fn signal(cond: *SingleThreadedCondition) void { | |
| 49 | _ = cond; | |
| 50 | } | |
| 47 | 51 | |
| 48 | pub fn broadcast(cond: *SingleThreadedCondition) void {} | |
| 52 | pub fn broadcast(cond: *SingleThreadedCondition) void { | |
| 53 | _ = cond; | |
| 54 | } | |
| 49 | 55 | }; |
| 50 | 56 | |
| 51 | 57 | pub const WindowsCondition = struct { |
lib/std/Thread/StaticResetEvent.zig+6-1| ... | ... | @@ -105,6 +105,7 @@ pub const DebugEvent = struct { |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | pub fn timedWait(ev: *DebugEvent, timeout: u64) TimedWaitResult { |
| 108 | _ = timeout; | |
| 108 | 109 | switch (ev.state) { |
| 109 | 110 | .unset => return .timed_out, |
| 110 | 111 | .set => return .event_set, |
| ... | ... | @@ -174,7 +175,10 @@ pub const AtomicEvent = struct { |
| 174 | 175 | }; |
| 175 | 176 | |
| 176 | 177 | pub const SpinFutex = struct { |
| 177 | fn wake(waiters: *u32, wake_count: u32) void {} | |
| 178 | fn wake(waiters: *u32, wake_count: u32) void { | |
| 179 | _ = waiters; | |
| 180 | _ = wake_count; | |
| 181 | } | |
| 178 | 182 | |
| 179 | 183 | fn wait(waiters: *u32, timeout: ?u64) !void { |
| 180 | 184 | var timer: time.Timer = undefined; |
| ... | ... | @@ -193,6 +197,7 @@ pub const AtomicEvent = struct { |
| 193 | 197 | |
| 194 | 198 | pub const LinuxFutex = struct { |
| 195 | 199 | fn wake(waiters: *u32, wake_count: u32) void { |
| 200 | _ = wake_count; | |
| 196 | 201 | const waiting = std.math.maxInt(i32); // wake_count |
| 197 | 202 | const ptr = @ptrCast(*const i32, waiters); |
| 198 | 203 | const rc = linux.futex_wake(ptr, linux.FUTEX_WAKE | linux.FUTEX_PRIVATE_FLAG, waiting); |
lib/std/array_hash_map.zig+11-2| ... | ... | @@ -40,9 +40,11 @@ pub fn StringArrayHashMapUnmanaged(comptime V: type) type { |
| 40 | 40 | |
| 41 | 41 | pub const StringContext = struct { |
| 42 | 42 | pub fn hash(self: @This(), s: []const u8) u32 { |
| 43 | _ = self; | |
| 43 | 44 | return hashString(s); |
| 44 | 45 | } |
| 45 | 46 | pub fn eql(self: @This(), a: []const u8, b: []const u8) bool { |
| 47 | _ = self; | |
| 46 | 48 | return eqlString(a, b); |
| 47 | 49 | } |
| 48 | 50 | }; |
| ... | ... | @@ -1335,6 +1337,7 @@ pub fn ArrayHashMapUnmanaged( |
| 1335 | 1337 | } |
| 1336 | 1338 | |
| 1337 | 1339 | fn removeSlot(self: *Self, removed_slot: usize, header: *IndexHeader, comptime I: type, indexes: []Index(I)) void { |
| 1340 | _ = self; | |
| 1338 | 1341 | const start_index = removed_slot +% 1; |
| 1339 | 1342 | const end_index = start_index +% indexes.len; |
| 1340 | 1343 | |
| ... | ... | @@ -1626,6 +1629,7 @@ pub fn ArrayHashMapUnmanaged( |
| 1626 | 1629 | } |
| 1627 | 1630 | } |
| 1628 | 1631 | fn dumpIndex(self: Self, header: *IndexHeader, comptime I: type) void { |
| 1632 | _ = self; | |
| 1629 | 1633 | const p = std.debug.print; |
| 1630 | 1634 | p(" index len=0x{x} type={}\n", .{ header.length(), header.capacityIndexType() }); |
| 1631 | 1635 | const indexes = header.indexes(I); |
| ... | ... | @@ -1918,7 +1922,7 @@ test "iterator hash map" { |
| 1918 | 1922 | try testing.expect(count == 3); |
| 1919 | 1923 | try testing.expect(it.next() == null); |
| 1920 | 1924 | |
| 1921 | for (buffer) |v, i| { | |
| 1925 | for (buffer) |_, i| { | |
| 1922 | 1926 | try testing.expect(buffer[@intCast(usize, keys[i])] == values[i]); |
| 1923 | 1927 | } |
| 1924 | 1928 | |
| ... | ... | @@ -1930,7 +1934,7 @@ test "iterator hash map" { |
| 1930 | 1934 | if (count >= 2) break; |
| 1931 | 1935 | } |
| 1932 | 1936 | |
| 1933 | for (buffer[0..2]) |v, i| { | |
| 1937 | for (buffer[0..2]) |_, i| { | |
| 1934 | 1938 | try testing.expect(buffer[@intCast(usize, keys[i])] == values[i]); |
| 1935 | 1939 | } |
| 1936 | 1940 | |
| ... | ... | @@ -2154,6 +2158,7 @@ test "compile everything" { |
| 2154 | 2158 | pub fn getHashPtrAddrFn(comptime K: type, comptime Context: type) (fn (Context, K) u32) { |
| 2155 | 2159 | return struct { |
| 2156 | 2160 | fn hash(ctx: Context, key: K) u32 { |
| 2161 | _ = ctx; | |
| 2157 | 2162 | return getAutoHashFn(usize, void)({}, @ptrToInt(key)); |
| 2158 | 2163 | } |
| 2159 | 2164 | }.hash; |
| ... | ... | @@ -2162,6 +2167,7 @@ pub fn getHashPtrAddrFn(comptime K: type, comptime Context: type) (fn (Context, |
| 2162 | 2167 | pub fn getTrivialEqlFn(comptime K: type, comptime Context: type) (fn (Context, K, K) bool) { |
| 2163 | 2168 | return struct { |
| 2164 | 2169 | fn eql(ctx: Context, a: K, b: K) bool { |
| 2170 | _ = ctx; | |
| 2165 | 2171 | return a == b; |
| 2166 | 2172 | } |
| 2167 | 2173 | }.eql; |
| ... | ... | @@ -2177,6 +2183,7 @@ pub fn AutoContext(comptime K: type) type { |
| 2177 | 2183 | pub fn getAutoHashFn(comptime K: type, comptime Context: type) (fn (Context, K) u32) { |
| 2178 | 2184 | return struct { |
| 2179 | 2185 | fn hash(ctx: Context, key: K) u32 { |
| 2186 | _ = ctx; | |
| 2180 | 2187 | if (comptime trait.hasUniqueRepresentation(K)) { |
| 2181 | 2188 | return @truncate(u32, Wyhash.hash(0, std.mem.asBytes(&key))); |
| 2182 | 2189 | } else { |
| ... | ... | @@ -2191,6 +2198,7 @@ pub fn getAutoHashFn(comptime K: type, comptime Context: type) (fn (Context, K) |
| 2191 | 2198 | pub fn getAutoEqlFn(comptime K: type, comptime Context: type) (fn (Context, K, K) bool) { |
| 2192 | 2199 | return struct { |
| 2193 | 2200 | fn eql(ctx: Context, a: K, b: K) bool { |
| 2201 | _ = ctx; | |
| 2194 | 2202 | return meta.eql(a, b); |
| 2195 | 2203 | } |
| 2196 | 2204 | }.eql; |
| ... | ... | @@ -2217,6 +2225,7 @@ pub fn autoEqlIsCheap(comptime K: type) bool { |
| 2217 | 2225 | pub fn getAutoHashStratFn(comptime K: type, comptime Context: type, comptime strategy: std.hash.Strategy) (fn (Context, K) u32) { |
| 2218 | 2226 | return struct { |
| 2219 | 2227 | fn hash(ctx: Context, key: K) u32 { |
| 2228 | _ = ctx; | |
| 2220 | 2229 | var hasher = Wyhash.init(0); |
| 2221 | 2230 | std.hash.autoHashStrat(&hasher, key, strategy); |
| 2222 | 2231 | return @truncate(u32, hasher.final()); |
lib/std/atomic/Atomic.zig+2| ... | ... | @@ -232,6 +232,7 @@ test "Atomic.loadUnchecked" { |
| 232 | 232 | |
| 233 | 233 | test "Atomic.storeUnchecked" { |
| 234 | 234 | inline for (atomicIntTypes()) |Int| { |
| 235 | _ = Int; | |
| 235 | 236 | var x = Atomic(usize).init(5); |
| 236 | 237 | x.storeUnchecked(10); |
| 237 | 238 | try testing.expectEqual(x.loadUnchecked(), 10); |
| ... | ... | @@ -250,6 +251,7 @@ test "Atomic.load" { |
| 250 | 251 | test "Atomic.store" { |
| 251 | 252 | inline for (atomicIntTypes()) |Int| { |
| 252 | 253 | inline for (.{ .Unordered, .Monotonic, .Release, .SeqCst }) |ordering| { |
| 254 | _ = Int; | |
| 253 | 255 | var x = Atomic(usize).init(5); |
| 254 | 256 | x.store(10, ordering); |
| 255 | 257 | try testing.expectEqual(x.load(.SeqCst), 10); |
lib/std/bit_set.zig+4-2| ... | ... | @@ -84,6 +84,7 @@ pub fn IntegerBitSet(comptime size: u16) type { |
| 84 | 84 | |
| 85 | 85 | /// Returns the number of bits in this bit set |
| 86 | 86 | pub inline fn capacity(self: Self) usize { |
| 87 | _ = self; | |
| 87 | 88 | return bit_length; |
| 88 | 89 | } |
| 89 | 90 | |
| ... | ... | @@ -311,6 +312,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type { |
| 311 | 312 | |
| 312 | 313 | /// Returns the number of bits in this bit set |
| 313 | 314 | pub inline fn capacity(self: Self) usize { |
| 315 | _ = self; | |
| 314 | 316 | return bit_length; |
| 315 | 317 | } |
| 316 | 318 | |
| ... | ... | @@ -373,7 +375,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type { |
| 373 | 375 | |
| 374 | 376 | /// Flips every bit in the bit set. |
| 375 | 377 | pub fn toggleAll(self: *Self) void { |
| 376 | for (self.masks) |*mask, i| { | |
| 378 | for (self.masks) |*mask| { | |
| 377 | 379 | mask.* = ~mask.*; |
| 378 | 380 | } |
| 379 | 381 | |
| ... | ... | @@ -642,7 +644,7 @@ pub const DynamicBitSetUnmanaged = struct { |
| 642 | 644 | if (bit_length == 0) return; |
| 643 | 645 | |
| 644 | 646 | const num_masks = numMasks(self.bit_length); |
| 645 | for (self.masks[0..num_masks]) |*mask, i| { | |
| 647 | for (self.masks[0..num_masks]) |*mask| { | |
| 646 | 648 | mask.* = ~mask.*; |
| 647 | 649 | } |
| 648 | 650 |
lib/std/build.zig+5-2| ... | ... | @@ -390,6 +390,7 @@ pub const Builder = struct { |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | pub fn version(self: *const Builder, major: u32, minor: u32, patch: u32) LibExeObjStep.SharedLibKind { |
| 393 | _ = self; | |
| 393 | 394 | return .{ |
| 394 | 395 | .versioned = .{ |
| 395 | 396 | .major = major, |
| ... | ... | @@ -543,7 +544,7 @@ pub const Builder = struct { |
| 543 | 544 | return null; |
| 544 | 545 | }, |
| 545 | 546 | .scalar => |s| { |
| 546 | const n = std.fmt.parseFloat(T, s) catch |err| { | |
| 547 | const n = std.fmt.parseFloat(T, s) catch { | |
| 547 | 548 | warn("Expected -D{s} to be a float of type {s}.\n\n", .{ name, @typeName(T) }); |
| 548 | 549 | self.markInvalidUserInput(); |
| 549 | 550 | return null; |
| ... | ... | @@ -3129,7 +3130,9 @@ pub const Step = struct { |
| 3129 | 3130 | self.dependencies.append(other) catch unreachable; |
| 3130 | 3131 | } |
| 3131 | 3132 | |
| 3132 | fn makeNoOp(self: *Step) anyerror!void {} | |
| 3133 | fn makeNoOp(self: *Step) anyerror!void { | |
| 3134 | _ = self; | |
| 3135 | } | |
| 3133 | 3136 | |
| 3134 | 3137 | pub fn cast(step: *Step, comptime T: type) ?*T { |
| 3135 | 3138 | if (step.id == T.base_id) { |
lib/std/build/InstallRawStep.zig+2| ... | ... | @@ -139,6 +139,7 @@ const BinaryElfOutput = struct { |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | fn segmentSortCompare(context: void, left: *BinaryElfSegment, right: *BinaryElfSegment) bool { |
| 142 | _ = context; | |
| 142 | 143 | if (left.physicalAddress < right.physicalAddress) { |
| 143 | 144 | return true; |
| 144 | 145 | } |
| ... | ... | @@ -149,6 +150,7 @@ const BinaryElfOutput = struct { |
| 149 | 150 | } |
| 150 | 151 | |
| 151 | 152 | fn sectionSortCompare(context: void, left: *BinaryElfSection, right: *BinaryElfSection) bool { |
| 153 | _ = context; | |
| 152 | 154 | return left.binaryOffset < right.binaryOffset; |
| 153 | 155 | } |
| 154 | 156 | }; |
lib/std/builtin.zig+3| ... | ... | @@ -65,6 +65,8 @@ pub const StackTrace = struct { |
| 65 | 65 | options: std.fmt.FormatOptions, |
| 66 | 66 | writer: anytype, |
| 67 | 67 | ) !void { |
| 68 | _ = fmt; | |
| 69 | _ = options; | |
| 68 | 70 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 69 | 71 | defer arena.deinit(); |
| 70 | 72 | const debug_info = std.debug.getSelfDebugInfo() catch |err| { |
| ... | ... | @@ -521,6 +523,7 @@ pub const Version = struct { |
| 521 | 523 | options: std.fmt.FormatOptions, |
| 522 | 524 | out_stream: anytype, |
| 523 | 525 | ) !void { |
| 526 | _ = options; | |
| 524 | 527 | if (fmt.len == 0) { |
| 525 | 528 | if (self.patch == 0) { |
| 526 | 529 | if (self.minor == 0) { |
lib/std/comptime_string_map.zig+1| ... | ... | @@ -23,6 +23,7 @@ pub fn ComptimeStringMap(comptime V: type, comptime kvs: anytype) type { |
| 23 | 23 | var sorted_kvs: [kvs.len]KV = undefined; |
| 24 | 24 | const lenAsc = (struct { |
| 25 | 25 | fn lenAsc(context: void, a: KV, b: KV) bool { |
| 26 | _ = context; | |
| 26 | 27 | return a.key.len < b.key.len; |
| 27 | 28 | } |
| 28 | 29 | }).lenAsc; |
lib/std/crypto/25519/ed25519.zig+1-1| ... | ... | @@ -346,7 +346,7 @@ test "ed25519 test vectors" { |
| 346 | 346 | .expected = error.IdentityElement, // 11 - small-order A |
| 347 | 347 | }, |
| 348 | 348 | }; |
| 349 | for (entries) |entry, i| { | |
| 349 | for (entries) |entry| { | |
| 350 | 350 | var msg: [entry.msg_hex.len / 2]u8 = undefined; |
| 351 | 351 | _ = try fmt.hexToBytes(&msg, entry.msg_hex); |
| 352 | 352 | var public_key: [32]u8 = undefined; |
lib/std/crypto/blake3.zig+1| ... | ... | @@ -394,6 +394,7 @@ pub const Blake3 = struct { |
| 394 | 394 | /// Construct a new `Blake3` for the key derivation function. The context |
| 395 | 395 | /// string should be hardcoded, globally unique, and application-specific. |
| 396 | 396 | pub fn initKdf(context: []const u8, options: KdfOptions) Blake3 { |
| 397 | _ = options; | |
| 397 | 398 | var context_hasher = Blake3.init_internal(IV, DERIVE_KEY_CONTEXT); |
| 398 | 399 | context_hasher.update(context); |
| 399 | 400 | var context_key: [KEY_LEN]u8 = undefined; |
lib/std/crypto/gimli.zig+1| ... | ... | @@ -219,6 +219,7 @@ pub const Hash = struct { |
| 219 | 219 | const Self = @This(); |
| 220 | 220 | |
| 221 | 221 | pub fn init(options: Options) Self { |
| 222 | _ = options; | |
| 222 | 223 | return Self{ |
| 223 | 224 | .state = State{ .data = [_]u32{0} ** (State.BLOCKBYTES / 4) }, |
| 224 | 225 | .buf_off = 0, |
lib/std/crypto/md5.zig+1| ... | ... | @@ -45,6 +45,7 @@ pub const Md5 = struct { |
| 45 | 45 | total_len: u64, |
| 46 | 46 | |
| 47 | 47 | pub fn init(options: Options) Self { |
| 48 | _ = options; | |
| 48 | 49 | return Self{ |
| 49 | 50 | .s = [_]u32{ |
| 50 | 51 | 0x67452301, |
lib/std/crypto/pcurves/p256/scalar.zig+1| ... | ... | @@ -63,6 +63,7 @@ pub fn add(a: CompressedScalar, b: CompressedScalar, endian: builtin.Endian) Non |
| 63 | 63 | |
| 64 | 64 | /// Return -s (mod L) |
| 65 | 65 | pub fn neg(s: CompressedScalar, endian: builtin.Endian) NonCanonicalError!CompressedScalar { |
| 66 | _ = s; | |
| 66 | 67 | return (try Scalar.fromBytes(a, endian)).neg().toBytes(endian); |
| 67 | 68 | } |
| 68 | 69 |
lib/std/crypto/sha1.zig+1| ... | ... | @@ -43,6 +43,7 @@ pub const Sha1 = struct { |
| 43 | 43 | total_len: u64 = 0, |
| 44 | 44 | |
| 45 | 45 | pub fn init(options: Options) Self { |
| 46 | _ = options; | |
| 46 | 47 | return Self{ |
| 47 | 48 | .s = [_]u32{ |
| 48 | 49 | 0x67452301, |
lib/std/crypto/sha2.zig+2| ... | ... | @@ -95,6 +95,7 @@ fn Sha2x32(comptime params: Sha2Params32) type { |
| 95 | 95 | total_len: u64 = 0, |
| 96 | 96 | |
| 97 | 97 | pub fn init(options: Options) Self { |
| 98 | _ = options; | |
| 98 | 99 | return Self{ |
| 99 | 100 | .s = [_]u32{ |
| 100 | 101 | params.iv0, |
| ... | ... | @@ -462,6 +463,7 @@ fn Sha2x64(comptime params: Sha2Params64) type { |
| 462 | 463 | total_len: u128 = 0, |
| 463 | 464 | |
| 464 | 465 | pub fn init(options: Options) Self { |
| 466 | _ = options; | |
| 465 | 467 | return Self{ |
| 466 | 468 | .s = [_]u64{ |
| 467 | 469 | params.iv0, |
lib/std/crypto/sha3.zig+1| ... | ... | @@ -28,6 +28,7 @@ fn Keccak(comptime bits: usize, comptime delim: u8) type { |
| 28 | 28 | rate: usize, |
| 29 | 29 | |
| 30 | 30 | pub fn init(options: Options) Self { |
| 31 | _ = options; | |
| 31 | 32 | return Self{ .s = [_]u8{0} ** 200, .offset = 0, .rate = 200 - (bits / 4) }; |
| 32 | 33 | } |
| 33 | 34 |
lib/std/crypto/tlcsprng.zig+1-1| ... | ... | @@ -84,7 +84,7 @@ fn tlsCsprngFill(_: *const std.rand.Random, buffer: []u8) void { |
| 84 | 84 | os.MAP_PRIVATE | os.MAP_ANONYMOUS, |
| 85 | 85 | -1, |
| 86 | 86 | 0, |
| 87 | ) catch |err| { | |
| 87 | ) catch { | |
| 88 | 88 | // Could not allocate memory for the local state, fall back to |
| 89 | 89 | // the OS syscall. |
| 90 | 90 | return fillWithOsEntropy(buffer); |
lib/std/debug.zig+5| ... | ... | @@ -325,6 +325,7 @@ pub fn writeStackTrace( |
| 325 | 325 | debug_info: *DebugInfo, |
| 326 | 326 | tty_config: TTY.Config, |
| 327 | 327 | ) !void { |
| 328 | _ = allocator; | |
| 328 | 329 | if (builtin.strip_debug_info) return error.MissingDebugInfo; |
| 329 | 330 | var frame_index: usize = 0; |
| 330 | 331 | var frames_left: usize = std.math.min(stack_trace.index, stack_trace.instruction_addresses.len); |
| ... | ... | @@ -930,6 +931,7 @@ const MachoSymbol = struct { |
| 930 | 931 | } |
| 931 | 932 | |
| 932 | 933 | fn addressLessThan(context: void, lhs: MachoSymbol, rhs: MachoSymbol) bool { |
| 934 | _ = context; | |
| 933 | 935 | return lhs.address() < rhs.address(); |
| 934 | 936 | } |
| 935 | 937 | }; |
| ... | ... | @@ -1134,6 +1136,7 @@ pub const DebugInfo = struct { |
| 1134 | 1136 | |
| 1135 | 1137 | if (os.dl_iterate_phdr(&ctx, anyerror, struct { |
| 1136 | 1138 | fn callback(info: *os.dl_phdr_info, size: usize, context: *CtxTy) !void { |
| 1139 | _ = size; | |
| 1137 | 1140 | // The base address is too high |
| 1138 | 1141 | if (context.address < info.dlpi_addr) |
| 1139 | 1142 | return; |
| ... | ... | @@ -1189,6 +1192,8 @@ pub const DebugInfo = struct { |
| 1189 | 1192 | } |
| 1190 | 1193 | |
| 1191 | 1194 | fn lookupModuleHaiku(self: *DebugInfo, address: usize) !*ModuleDebugInfo { |
| 1195 | _ = self; | |
| 1196 | _ = address; | |
| 1192 | 1197 | @panic("TODO implement lookup module for Haiku"); |
| 1193 | 1198 | } |
| 1194 | 1199 | }; |
lib/std/dwarf.zig+4-2| ... | ... | @@ -283,6 +283,7 @@ fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: anytype, endian: bu |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: anytype, signed: bool, endian: builtin.Endian, comptime size: i32) !FormValue { |
| 286 | _ = allocator; | |
| 286 | 287 | // TODO: Please forgive me, I've worked around zig not properly spilling some intermediate values here. |
| 287 | 288 | // `nosuspend` should be removed from all the function calls once it is fixed. |
| 288 | 289 | return FormValue{ |
| ... | ... | @@ -310,6 +311,7 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: anytype, signed: |
| 310 | 311 | |
| 311 | 312 | // TODO the nosuspends here are workarounds |
| 312 | 313 | fn parseFormValueRef(allocator: *mem.Allocator, in_stream: anytype, endian: builtin.Endian, size: i32) !FormValue { |
| 314 | _ = allocator; | |
| 313 | 315 | return FormValue{ |
| 314 | 316 | .Ref = switch (size) { |
| 315 | 317 | 1 => try nosuspend in_stream.readInt(u8, endian), |
| ... | ... | @@ -453,13 +455,13 @@ pub const DwarfInfo = struct { |
| 453 | 455 | if (this_die_obj.getAttr(AT_name)) |_| { |
| 454 | 456 | const name = try this_die_obj.getAttrString(di, AT_name); |
| 455 | 457 | break :x name; |
| 456 | } else if (this_die_obj.getAttr(AT_abstract_origin)) |ref| { | |
| 458 | } else if (this_die_obj.getAttr(AT_abstract_origin)) |_| { | |
| 457 | 459 | // Follow the DIE it points to and repeat |
| 458 | 460 | const ref_offset = try this_die_obj.getAttrRef(AT_abstract_origin); |
| 459 | 461 | if (ref_offset > next_offset) return error.InvalidDebugInfo; |
| 460 | 462 | try seekable.seekTo(this_unit_offset + ref_offset); |
| 461 | 463 | this_die_obj = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo; |
| 462 | } else if (this_die_obj.getAttr(AT_specification)) |ref| { | |
| 464 | } else if (this_die_obj.getAttr(AT_specification)) |_| { | |
| 463 | 465 | // Follow the DIE it points to and repeat |
| 464 | 466 | const ref_offset = try this_die_obj.getAttrRef(AT_specification); |
| 465 | 467 | if (ref_offset > next_offset) return error.InvalidDebugInfo; |
lib/std/dynamic_library.zig+1| ... | ... | @@ -66,6 +66,7 @@ pub fn get_DYNAMIC() ?[*]elf.Dyn { |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | pub fn linkmap_iterator(phdrs: []elf.Phdr) !LinkMap.Iterator { |
| 69 | _ = phdrs; | |
| 69 | 70 | const _DYNAMIC = get_DYNAMIC() orelse { |
| 70 | 71 | // No PT_DYNAMIC means this is either a statically-linked program or a |
| 71 | 72 | // badly corrupted dynamically-linked one. |
lib/std/enums.zig+6-2| ... | ... | @@ -18,7 +18,7 @@ const EnumField = std.builtin.TypeInfo.EnumField; |
| 18 | 18 | pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_default: ?Data) type { |
| 19 | 19 | const StructField = std.builtin.TypeInfo.StructField; |
| 20 | 20 | var fields: []const StructField = &[_]StructField{}; |
| 21 | for (std.meta.fields(E)) |field, i| { | |
| 21 | for (std.meta.fields(E)) |field| { | |
| 22 | 22 | fields = fields ++ &[_]StructField{.{ |
| 23 | 23 | .name = field.name, |
| 24 | 24 | .field_type = Data, |
| ... | ... | @@ -144,7 +144,7 @@ pub fn directEnumArrayDefault( |
| 144 | 144 | ) [directEnumArrayLen(E, max_unused_slots)]Data { |
| 145 | 145 | const len = comptime directEnumArrayLen(E, max_unused_slots); |
| 146 | 146 | var result: [len]Data = if (default) |d| [_]Data{d} ** len else undefined; |
| 147 | inline for (@typeInfo(@TypeOf(init_values)).Struct.fields) |f, i| { | |
| 147 | inline for (@typeInfo(@TypeOf(init_values)).Struct.fields) |f| { | |
| 148 | 148 | const enum_value = @field(E, f.name); |
| 149 | 149 | const index = @intCast(usize, @enumToInt(enum_value)); |
| 150 | 150 | result[index] = @field(init_values, f.name); |
| ... | ... | @@ -334,6 +334,7 @@ pub fn EnumArray(comptime E: type, comptime V: type) type { |
| 334 | 334 | /// TODO: Once #8169 is fixed, consider switching this param |
| 335 | 335 | /// back to an optional. |
| 336 | 336 | pub fn NoExtension(comptime Self: type) type { |
| 337 | _ = Self; | |
| 337 | 338 | return NoExt; |
| 338 | 339 | } |
| 339 | 340 | const NoExt = struct {}; |
| ... | ... | @@ -729,6 +730,7 @@ test "std.enums.ensureIndexer" { |
| 729 | 730 | } |
| 730 | 731 | |
| 731 | 732 | fn ascByValue(ctx: void, comptime a: EnumField, comptime b: EnumField) bool { |
| 733 | _ = ctx; | |
| 732 | 734 | return a.value < b.value; |
| 733 | 735 | } |
| 734 | 736 | pub fn EnumIndexer(comptime E: type) type { |
| ... | ... | @@ -743,9 +745,11 @@ pub fn EnumIndexer(comptime E: type) type { |
| 743 | 745 | pub const Key = E; |
| 744 | 746 | pub const count: usize = 0; |
| 745 | 747 | pub fn indexOf(e: E) usize { |
| 748 | _ = e; | |
| 746 | 749 | unreachable; |
| 747 | 750 | } |
| 748 | 751 | pub fn keyForIndex(i: usize) E { |
| 752 | _ = i; | |
| 749 | 753 | unreachable; |
| 750 | 754 | } |
| 751 | 755 | }; |
lib/std/event/loop.zig+1-1| ... | ... | @@ -345,7 +345,7 @@ pub const Loop = struct { |
| 345 | 345 | ); |
| 346 | 346 | errdefer windows.CloseHandle(self.os_data.io_port); |
| 347 | 347 | |
| 348 | for (self.eventfd_resume_nodes) |*eventfd_node, i| { | |
| 348 | for (self.eventfd_resume_nodes) |*eventfd_node| { | |
| 349 | 349 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ |
| 350 | 350 | .data = ResumeNode.EventFd{ |
| 351 | 351 | .base = ResumeNode{ |
lib/std/fmt.zig+12-1| ... | ... | @@ -369,6 +369,7 @@ pub fn format( |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @TypeOf(writer).Error!void { |
| 372 | _ = options; | |
| 372 | 373 | const T = @TypeOf(value); |
| 373 | 374 | |
| 374 | 375 | switch (@typeInfo(T)) { |
| ... | ... | @@ -553,7 +554,7 @@ pub fn formatType( |
| 553 | 554 | .Many, .C => { |
| 554 | 555 | if (actual_fmt.len == 0) |
| 555 | 556 | @compileError("cannot format pointer without a specifier (i.e. {s} or {*})"); |
| 556 | if (ptr_info.sentinel) |sentinel| { | |
| 557 | if (ptr_info.sentinel) |_| { | |
| 557 | 558 | return formatType(mem.span(value), actual_fmt, options, writer, max_depth); |
| 558 | 559 | } |
| 559 | 560 | if (ptr_info.child == u8) { |
| ... | ... | @@ -741,6 +742,8 @@ fn formatSliceHexImpl(comptime case: Case) type { |
| 741 | 742 | options: std.fmt.FormatOptions, |
| 742 | 743 | writer: anytype, |
| 743 | 744 | ) !void { |
| 745 | _ = fmt; | |
| 746 | _ = options; | |
| 744 | 747 | var buf: [2]u8 = undefined; |
| 745 | 748 | |
| 746 | 749 | for (bytes) |c| { |
| ... | ... | @@ -777,6 +780,8 @@ fn formatSliceEscapeImpl(comptime case: Case) type { |
| 777 | 780 | options: std.fmt.FormatOptions, |
| 778 | 781 | writer: anytype, |
| 779 | 782 | ) !void { |
| 783 | _ = fmt; | |
| 784 | _ = options; | |
| 780 | 785 | var buf: [4]u8 = undefined; |
| 781 | 786 | |
| 782 | 787 | buf[0] = '\\'; |
| ... | ... | @@ -820,6 +825,7 @@ fn formatSizeImpl(comptime radix: comptime_int) type { |
| 820 | 825 | options: FormatOptions, |
| 821 | 826 | writer: anytype, |
| 822 | 827 | ) !void { |
| 828 | _ = fmt; | |
| 823 | 829 | if (value == 0) { |
| 824 | 830 | return writer.writeAll("0B"); |
| 825 | 831 | } |
| ... | ... | @@ -903,6 +909,7 @@ pub fn formatAsciiChar( |
| 903 | 909 | options: FormatOptions, |
| 904 | 910 | writer: anytype, |
| 905 | 911 | ) !void { |
| 912 | _ = options; | |
| 906 | 913 | return writer.writeAll(@as(*const [1]u8, &c)); |
| 907 | 914 | } |
| 908 | 915 | |
| ... | ... | @@ -1362,6 +1369,8 @@ pub fn formatIntBuf(out_buf: []u8, value: anytype, base: u8, case: Case, options |
| 1362 | 1369 | } |
| 1363 | 1370 | |
| 1364 | 1371 | fn formatDuration(ns: u64, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 1372 | _ = fmt; | |
| 1373 | _ = options; | |
| 1365 | 1374 | var ns_remaining = ns; |
| 1366 | 1375 | inline for (.{ |
| 1367 | 1376 | .{ .ns = 365 * std.time.ns_per_day, .sep = 'y' }, |
| ... | ... | @@ -2152,6 +2161,7 @@ test "custom" { |
| 2152 | 2161 | options: FormatOptions, |
| 2153 | 2162 | writer: anytype, |
| 2154 | 2163 | ) !void { |
| 2164 | _ = options; | |
| 2155 | 2165 | if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "p")) { |
| 2156 | 2166 | return std.fmt.format(writer, "({d:.3},{d:.3})", .{ self.x, self.y }); |
| 2157 | 2167 | } else if (comptime std.mem.eql(u8, fmt, "d")) { |
| ... | ... | @@ -2340,6 +2350,7 @@ test "formatType max_depth" { |
| 2340 | 2350 | options: FormatOptions, |
| 2341 | 2351 | writer: anytype, |
| 2342 | 2352 | ) !void { |
| 2353 | _ = options; | |
| 2343 | 2354 | if (fmt.len == 0) { |
| 2344 | 2355 | return std.fmt.format(writer, "({d:.3},{d:.3})", .{ self.x, self.y }); |
| 2345 | 2356 | } else { |
lib/std/fs.zig+2-1| ... | ... | @@ -1541,7 +1541,7 @@ pub const Dir = struct { |
| 1541 | 1541 | self: Dir, |
| 1542 | 1542 | target_path: []const u8, |
| 1543 | 1543 | sym_link_path: []const u8, |
| 1544 | flags: SymLinkFlags, | |
| 1544 | _: SymLinkFlags, | |
| 1545 | 1545 | ) !void { |
| 1546 | 1546 | return os.symlinkatWasi(target_path, self.fd, sym_link_path); |
| 1547 | 1547 | } |
| ... | ... | @@ -1879,6 +1879,7 @@ pub const Dir = struct { |
| 1879 | 1879 | /// * NtDll prefixed |
| 1880 | 1880 | /// TODO currently this ignores `flags`. |
| 1881 | 1881 | pub fn accessW(self: Dir, sub_path_w: [*:0]const u16, flags: File.OpenFlags) AccessError!void { |
| 1882 | _ = flags; | |
| 1882 | 1883 | return os.faccessatW(self.fd, sub_path_w, 0, 0); |
| 1883 | 1884 | } |
| 1884 | 1885 |
lib/std/fs/path.zig+2-2| ... | ... | @@ -579,7 +579,7 @@ pub fn resolveWindows(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 579 | 579 | // Now we know the disk designator to use, if any, and what kind it is. And our result |
| 580 | 580 | // is big enough to append all the paths to. |
| 581 | 581 | var correct_disk_designator = true; |
| 582 | for (paths[first_index..]) |p, i| { | |
| 582 | for (paths[first_index..]) |p| { | |
| 583 | 583 | const parsed = windowsParsePath(p); |
| 584 | 584 | |
| 585 | 585 | if (parsed.kind != WindowsPath.Kind.None) { |
| ... | ... | @@ -660,7 +660,7 @@ pub fn resolvePosix(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 660 | 660 | } |
| 661 | 661 | errdefer allocator.free(result); |
| 662 | 662 | |
| 663 | for (paths[first_index..]) |p, i| { | |
| 663 | for (paths[first_index..]) |p| { | |
| 664 | 664 | var it = mem.tokenize(p, "/"); |
| 665 | 665 | while (it.next()) |component| { |
| 666 | 666 | if (mem.eql(u8, component, ".")) { |
lib/std/fs/test.zig+2| ... | ... | @@ -541,6 +541,7 @@ test "makePath, put some files in it, deleteTree" { |
| 541 | 541 | try tmp.dir.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "file2.txt", "blah"); |
| 542 | 542 | try tmp.dir.deleteTree("os_test_tmp"); |
| 543 | 543 | if (tmp.dir.openDir("os_test_tmp", .{})) |dir| { |
| 544 | _ = dir; | |
| 544 | 545 | @panic("expected error"); |
| 545 | 546 | } else |err| { |
| 546 | 547 | try testing.expect(err == error.FileNotFound); |
| ... | ... | @@ -638,6 +639,7 @@ test "access file" { |
| 638 | 639 | |
| 639 | 640 | try tmp.dir.makePath("os_test_tmp"); |
| 640 | 641 | if (tmp.dir.access("os_test_tmp" ++ fs.path.sep_str ++ "file.txt", .{})) |ok| { |
| 642 | _ = ok; | |
| 641 | 643 | @panic("expected error"); |
| 642 | 644 | } else |err| { |
| 643 | 645 | try testing.expect(err == error.FileNotFound); |
lib/std/fs/wasi.zig+2| ... | ... | @@ -36,6 +36,8 @@ pub const PreopenType = union(PreopenTypeTag) { |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | pub fn format(self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, out_stream: anytype) !void { |
| 39 | _ = fmt; | |
| 40 | _ = options; | |
| 39 | 41 | try out_stream.print("PreopenType{{ ", .{}); |
| 40 | 42 | switch (self) { |
| 41 | 43 | PreopenType.Dir => |path| try out_stream.print(".Dir = '{}'", .{std.zig.fmtId(path)}), |
lib/std/hash/cityhash.zig+1| ... | ... | @@ -375,6 +375,7 @@ fn SMHasherTest(comptime hash_fn: anytype) u32 { |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | fn CityHash32hashIgnoreSeed(str: []const u8, seed: u32) u32 { |
| 378 | _ = seed; | |
| 378 | 379 | return CityHash32.hash(str); |
| 379 | 380 | } |
| 380 | 381 |
lib/std/hash_map.zig+6| ... | ... | @@ -29,6 +29,7 @@ pub fn getAutoHashFn(comptime K: type, comptime Context: type) (fn (Context, K) |
| 29 | 29 | |
| 30 | 30 | return struct { |
| 31 | 31 | fn hash(ctx: Context, key: K) u64 { |
| 32 | _ = ctx; | |
| 32 | 33 | if (comptime trait.hasUniqueRepresentation(K)) { |
| 33 | 34 | return Wyhash.hash(0, std.mem.asBytes(&key)); |
| 34 | 35 | } else { |
| ... | ... | @@ -43,6 +44,7 @@ pub fn getAutoHashFn(comptime K: type, comptime Context: type) (fn (Context, K) |
| 43 | 44 | pub fn getAutoEqlFn(comptime K: type, comptime Context: type) (fn (Context, K, K) bool) { |
| 44 | 45 | return struct { |
| 45 | 46 | fn eql(ctx: Context, a: K, b: K) bool { |
| 47 | _ = ctx; | |
| 46 | 48 | return meta.eql(a, b); |
| 47 | 49 | } |
| 48 | 50 | }.eql; |
| ... | ... | @@ -78,9 +80,11 @@ pub fn StringHashMapUnmanaged(comptime V: type) type { |
| 78 | 80 | |
| 79 | 81 | pub const StringContext = struct { |
| 80 | 82 | pub fn hash(self: @This(), s: []const u8) u64 { |
| 83 | _ = self; | |
| 81 | 84 | return hashString(s); |
| 82 | 85 | } |
| 83 | 86 | pub fn eql(self: @This(), a: []const u8, b: []const u8) bool { |
| 87 | _ = self; | |
| 84 | 88 | return eqlString(a, b); |
| 85 | 89 | } |
| 86 | 90 | }; |
| ... | ... | @@ -1887,9 +1891,11 @@ test "std.hash_map clone" { |
| 1887 | 1891 | test "std.hash_map getOrPutAdapted" { |
| 1888 | 1892 | const AdaptedContext = struct { |
| 1889 | 1893 | fn eql(self: @This(), adapted_key: []const u8, test_key: u64) bool { |
| 1894 | _ = self; | |
| 1890 | 1895 | return std.fmt.parseInt(u64, adapted_key, 10) catch unreachable == test_key; |
| 1891 | 1896 | } |
| 1892 | 1897 | fn hash(self: @This(), adapted_key: []const u8) u64 { |
| 1898 | _ = self; | |
| 1893 | 1899 | const key = std.fmt.parseInt(u64, adapted_key, 10) catch unreachable; |
| 1894 | 1900 | return (AutoContext(u64){}).hash(key); |
| 1895 | 1901 | } |
lib/std/heap.zig+30| ... | ... | @@ -108,6 +108,8 @@ const CAllocator = struct { |
| 108 | 108 | len_align: u29, |
| 109 | 109 | return_address: usize, |
| 110 | 110 | ) error{OutOfMemory}![]u8 { |
| 111 | _ = allocator; | |
| 112 | _ = return_address; | |
| 111 | 113 | assert(len > 0); |
| 112 | 114 | assert(std.math.isPowerOfTwo(alignment)); |
| 113 | 115 | |
| ... | ... | @@ -134,6 +136,9 @@ const CAllocator = struct { |
| 134 | 136 | len_align: u29, |
| 135 | 137 | return_address: usize, |
| 136 | 138 | ) Allocator.Error!usize { |
| 139 | _ = allocator; | |
| 140 | _ = buf_align; | |
| 141 | _ = return_address; | |
| 137 | 142 | if (new_len == 0) { |
| 138 | 143 | alignedFree(buf.ptr); |
| 139 | 144 | return 0; |
| ... | ... | @@ -178,6 +183,9 @@ fn rawCAlloc( |
| 178 | 183 | len_align: u29, |
| 179 | 184 | ret_addr: usize, |
| 180 | 185 | ) Allocator.Error![]u8 { |
| 186 | _ = self; | |
| 187 | _ = len_align; | |
| 188 | _ = ret_addr; | |
| 181 | 189 | assert(ptr_align <= @alignOf(std.c.max_align_t)); |
| 182 | 190 | const ptr = @ptrCast([*]u8, c.malloc(len) orelse return error.OutOfMemory); |
| 183 | 191 | return ptr[0..len]; |
| ... | ... | @@ -191,6 +199,9 @@ fn rawCResize( |
| 191 | 199 | len_align: u29, |
| 192 | 200 | ret_addr: usize, |
| 193 | 201 | ) Allocator.Error!usize { |
| 202 | _ = self; | |
| 203 | _ = old_align; | |
| 204 | _ = ret_addr; | |
| 194 | 205 | if (new_len == 0) { |
| 195 | 206 | c.free(buf.ptr); |
| 196 | 207 | return 0; |
| ... | ... | @@ -231,6 +242,8 @@ pub var next_mmap_addr_hint: ?[*]align(mem.page_size) u8 = null; |
| 231 | 242 | |
| 232 | 243 | const PageAllocator = struct { |
| 233 | 244 | fn alloc(allocator: *Allocator, n: usize, alignment: u29, len_align: u29, ra: usize) error{OutOfMemory}![]u8 { |
| 245 | _ = allocator; | |
| 246 | _ = ra; | |
| 234 | 247 | assert(n > 0); |
| 235 | 248 | const aligned_len = mem.alignForward(n, mem.page_size); |
| 236 | 249 | |
| ... | ... | @@ -334,6 +347,9 @@ const PageAllocator = struct { |
| 334 | 347 | len_align: u29, |
| 335 | 348 | return_address: usize, |
| 336 | 349 | ) Allocator.Error!usize { |
| 350 | _ = allocator; | |
| 351 | _ = buf_align; | |
| 352 | _ = return_address; | |
| 337 | 353 | const new_size_aligned = mem.alignForward(new_size, mem.page_size); |
| 338 | 354 | |
| 339 | 355 | if (builtin.os.tag == .windows) { |
| ... | ... | @@ -482,6 +498,8 @@ const WasmPageAllocator = struct { |
| 482 | 498 | } |
| 483 | 499 | |
| 484 | 500 | fn alloc(allocator: *Allocator, len: usize, alignment: u29, len_align: u29, ra: usize) error{OutOfMemory}![]u8 { |
| 501 | _ = allocator; | |
| 502 | _ = ra; | |
| 485 | 503 | const page_count = nPages(len); |
| 486 | 504 | const page_idx = try allocPages(page_count, alignment); |
| 487 | 505 | return @intToPtr([*]u8, page_idx * mem.page_size)[0..alignPageAllocLen(page_count * mem.page_size, len, len_align)]; |
| ... | ... | @@ -542,6 +560,9 @@ const WasmPageAllocator = struct { |
| 542 | 560 | len_align: u29, |
| 543 | 561 | return_address: usize, |
| 544 | 562 | ) error{OutOfMemory}!usize { |
| 563 | _ = allocator; | |
| 564 | _ = buf_align; | |
| 565 | _ = return_address; | |
| 545 | 566 | const aligned_len = mem.alignForward(buf.len, mem.page_size); |
| 546 | 567 | if (new_len > aligned_len) return error.OutOfMemory; |
| 547 | 568 | const current_n = nPages(aligned_len); |
| ... | ... | @@ -588,6 +609,7 @@ pub const HeapAllocator = switch (builtin.os.tag) { |
| 588 | 609 | len_align: u29, |
| 589 | 610 | return_address: usize, |
| 590 | 611 | ) error{OutOfMemory}![]u8 { |
| 612 | _ = return_address; | |
| 591 | 613 | const self = @fieldParentPtr(HeapAllocator, "allocator", allocator); |
| 592 | 614 | |
| 593 | 615 | const amt = n + ptr_align - 1 + @sizeOf(usize); |
| ... | ... | @@ -622,6 +644,8 @@ pub const HeapAllocator = switch (builtin.os.tag) { |
| 622 | 644 | len_align: u29, |
| 623 | 645 | return_address: usize, |
| 624 | 646 | ) error{OutOfMemory}!usize { |
| 647 | _ = buf_align; | |
| 648 | _ = return_address; | |
| 625 | 649 | const self = @fieldParentPtr(HeapAllocator, "allocator", allocator); |
| 626 | 650 | if (new_size == 0) { |
| 627 | 651 | os.windows.HeapFree(self.heap_handle.?, 0, @intToPtr(*c_void, getRecordPtr(buf).*)); |
| ... | ... | @@ -694,6 +718,8 @@ pub const FixedBufferAllocator = struct { |
| 694 | 718 | } |
| 695 | 719 | |
| 696 | 720 | fn alloc(allocator: *Allocator, n: usize, ptr_align: u29, len_align: u29, ra: usize) ![]u8 { |
| 721 | _ = len_align; | |
| 722 | _ = ra; | |
| 697 | 723 | const self = @fieldParentPtr(FixedBufferAllocator, "allocator", allocator); |
| 698 | 724 | const adjust_off = mem.alignPointerOffset(self.buffer.ptr + self.end_index, ptr_align) orelse |
| 699 | 725 | return error.OutOfMemory; |
| ... | ... | @@ -716,6 +742,8 @@ pub const FixedBufferAllocator = struct { |
| 716 | 742 | len_align: u29, |
| 717 | 743 | return_address: usize, |
| 718 | 744 | ) Allocator.Error!usize { |
| 745 | _ = buf_align; | |
| 746 | _ = return_address; | |
| 719 | 747 | const self = @fieldParentPtr(FixedBufferAllocator, "allocator", allocator); |
| 720 | 748 | assert(self.ownsSlice(buf)); // sanity check |
| 721 | 749 | |
| ... | ... | @@ -766,6 +794,8 @@ pub const ThreadSafeFixedBufferAllocator = blk: { |
| 766 | 794 | } |
| 767 | 795 | |
| 768 | 796 | fn alloc(allocator: *Allocator, n: usize, ptr_align: u29, len_align: u29, ra: usize) ![]u8 { |
| 797 | _ = len_align; | |
| 798 | _ = ra; | |
| 769 | 799 | const self = @fieldParentPtr(ThreadSafeFixedBufferAllocator, "allocator", allocator); |
| 770 | 800 | var end_index = @atomicLoad(usize, &self.end_index, builtin.AtomicOrder.SeqCst); |
| 771 | 801 | while (true) { |
lib/std/heap/arena_allocator.zig+5| ... | ... | @@ -66,6 +66,8 @@ pub const ArenaAllocator = struct { |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | fn alloc(allocator: *Allocator, n: usize, ptr_align: u29, len_align: u29, ra: usize) ![]u8 { |
| 69 | _ = len_align; | |
| 70 | _ = ra; | |
| 69 | 71 | const self = @fieldParentPtr(ArenaAllocator, "allocator", allocator); |
| 70 | 72 | |
| 71 | 73 | var cur_node = if (self.state.buffer_list.first) |first_node| first_node else try self.createNode(0, n + ptr_align); |
| ... | ... | @@ -95,6 +97,9 @@ pub const ArenaAllocator = struct { |
| 95 | 97 | } |
| 96 | 98 | |
| 97 | 99 | fn resize(allocator: *Allocator, buf: []u8, buf_align: u29, new_len: usize, len_align: u29, ret_addr: usize) Allocator.Error!usize { |
| 100 | _ = buf_align; | |
| 101 | _ = len_align; | |
| 102 | _ = ret_addr; | |
| 98 | 103 | const self = @fieldParentPtr(ArenaAllocator, "allocator", allocator); |
| 99 | 104 | |
| 100 | 105 | const cur_node = self.state.buffer_list.first orelse return error.OutOfMemory; |
lib/std/heap/log_to_writer_allocator.zig+2-2| ... | ... | @@ -37,9 +37,9 @@ pub fn LogToWriterAllocator(comptime Writer: type) type { |
| 37 | 37 | const self = @fieldParentPtr(Self, "allocator", allocator); |
| 38 | 38 | self.writer.print("alloc : {}", .{len}) catch {}; |
| 39 | 39 | const result = self.parent_allocator.allocFn(self.parent_allocator, len, ptr_align, len_align, ra); |
| 40 | if (result) |buff| { | |
| 40 | if (result) |_| { | |
| 41 | 41 | self.writer.print(" success!\n", .{}) catch {}; |
| 42 | } else |err| { | |
| 42 | } else |_| { | |
| 43 | 43 | self.writer.print(" failure!\n", .{}) catch {}; |
| 44 | 44 | } |
| 45 | 45 | return result; |
lib/std/heap/logging_allocator.zig+1-1| ... | ... | @@ -65,7 +65,7 @@ pub fn ScopedLoggingAllocator( |
| 65 | 65 | ) error{OutOfMemory}![]u8 { |
| 66 | 66 | const self = @fieldParentPtr(Self, "allocator", allocator); |
| 67 | 67 | const result = self.parent_allocator.allocFn(self.parent_allocator, len, ptr_align, len_align, ra); |
| 68 | if (result) |buff| { | |
| 68 | if (result) |_| { | |
| 69 | 69 | logHelper( |
| 70 | 70 | success_log_level, |
| 71 | 71 | "alloc - success - len: {}, ptr_align: {}, len_align: {}", |
lib/std/io.zig+1| ... | ... | @@ -161,6 +161,7 @@ pub const null_writer = @as(NullWriter, .{ .context = {} }); |
| 161 | 161 | |
| 162 | 162 | const NullWriter = Writer(void, error{}, dummyWrite); |
| 163 | 163 | fn dummyWrite(context: void, data: []const u8) error{}!usize { |
| 164 | _ = context; | |
| 164 | 165 | return data.len; |
| 165 | 166 | } |
| 166 | 167 |
lib/std/io/bit_reader.zig+1-1| ... | ... | @@ -149,7 +149,7 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type { |
| 149 | 149 | var out_bits_total = @as(usize, 0); |
| 150 | 150 | //@NOTE: I'm not sure this is a good idea, maybe alignToByte should be forced |
| 151 | 151 | if (self.bit_count > 0) { |
| 152 | for (buffer) |*b, i| { | |
| 152 | for (buffer) |*b| { | |
| 153 | 153 | b.* = try self.readBits(u8, u8_bit_count, &out_bits); |
| 154 | 154 | out_bits_total += out_bits; |
| 155 | 155 | } |
lib/std/io/bit_writer.zig+1-1| ... | ... | @@ -128,7 +128,7 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type { |
| 128 | 128 | pub fn write(self: *Self, buffer: []const u8) Error!usize { |
| 129 | 129 | // TODO: I'm not sure this is a good idea, maybe flushBits should be forced |
| 130 | 130 | if (self.bit_count > 0) { |
| 131 | for (buffer) |b, i| | |
| 131 | for (buffer) |b| | |
| 132 | 132 | try self.writeBits(b, u8_bit_count); |
| 133 | 133 | return buffer.len; |
| 134 | 134 | } |
lib/std/json.zig+8-6| ... | ... | @@ -1221,11 +1221,11 @@ test "json.token premature object close" { |
| 1221 | 1221 | pub fn validate(s: []const u8) bool { |
| 1222 | 1222 | var p = StreamingParser.init(); |
| 1223 | 1223 | |
| 1224 | for (s) |c, i| { | |
| 1224 | for (s) |c| { | |
| 1225 | 1225 | var token1: ?Token = undefined; |
| 1226 | 1226 | var token2: ?Token = undefined; |
| 1227 | 1227 | |
| 1228 | p.feed(c, &token1, &token2) catch |err| { | |
| 1228 | p.feed(c, &token1, &token2) catch { | |
| 1229 | 1229 | return false; |
| 1230 | 1230 | }; |
| 1231 | 1231 | } |
| ... | ... | @@ -1410,7 +1410,7 @@ fn parsedEqual(a: anytype, b: @TypeOf(a)) bool { |
| 1410 | 1410 | if (a == null or b == null) return false; |
| 1411 | 1411 | return parsedEqual(a.?, b.?); |
| 1412 | 1412 | }, |
| 1413 | .Union => |unionInfo| { | |
| 1413 | .Union => { | |
| 1414 | 1414 | if (info.tag_type) |UnionTag| { |
| 1415 | 1415 | const tag_a = std.meta.activeTag(a); |
| 1416 | 1416 | const tag_b = std.meta.activeTag(b); |
| ... | ... | @@ -1771,7 +1771,7 @@ fn parseInternal(comptime T: type, token: Token, tokens: *TokenStream, options: |
| 1771 | 1771 | const source_slice = stringToken.slice(tokens.slice, tokens.i - 1); |
| 1772 | 1772 | switch (stringToken.escapes) { |
| 1773 | 1773 | .None => return allocator.dupe(u8, source_slice), |
| 1774 | .Some => |some_escapes| { | |
| 1774 | .Some => { | |
| 1775 | 1775 | const output = try allocator.alloc(u8, stringToken.decodedLength()); |
| 1776 | 1776 | errdefer allocator.free(output); |
| 1777 | 1777 | try unescapeValidString(output, source_slice); |
| ... | ... | @@ -2391,7 +2391,7 @@ pub const Parser = struct { |
| 2391 | 2391 | const slice = s.slice(input, i); |
| 2392 | 2392 | switch (s.escapes) { |
| 2393 | 2393 | .None => return Value{ .String = if (p.copy_strings) try allocator.dupe(u8, slice) else slice }, |
| 2394 | .Some => |some_escapes| { | |
| 2394 | .Some => { | |
| 2395 | 2395 | const output = try allocator.alloc(u8, s.decodedLength()); |
| 2396 | 2396 | errdefer allocator.free(output); |
| 2397 | 2397 | try unescapeValidString(output, slice); |
| ... | ... | @@ -2401,6 +2401,7 @@ pub const Parser = struct { |
| 2401 | 2401 | } |
| 2402 | 2402 | |
| 2403 | 2403 | fn parseNumber(p: *Parser, n: std.meta.TagPayload(Token, Token.Number), input: []const u8, i: usize) !Value { |
| 2404 | _ = p; | |
| 2404 | 2405 | return if (n.is_integer) |
| 2405 | 2406 | Value{ |
| 2406 | 2407 | .Integer = std.fmt.parseInt(i64, n.slice(input, i), 10) catch |e| switch (e) { |
| ... | ... | @@ -2815,7 +2816,7 @@ pub fn stringify( |
| 2815 | 2816 | if (child_options.whitespace) |*child_whitespace| { |
| 2816 | 2817 | child_whitespace.indent_level += 1; |
| 2817 | 2818 | } |
| 2818 | inline for (S.fields) |Field, field_i| { | |
| 2819 | inline for (S.fields) |Field| { | |
| 2819 | 2820 | // don't include void fields |
| 2820 | 2821 | if (Field.field_type == void) continue; |
| 2821 | 2822 | |
| ... | ... | @@ -3114,6 +3115,7 @@ test "stringify struct with custom stringifier" { |
| 3114 | 3115 | options: StringifyOptions, |
| 3115 | 3116 | out_stream: anytype, |
| 3116 | 3117 | ) !void { |
| 3118 | _ = value; | |
| 3117 | 3119 | try out_stream.writeAll("[\"something special\","); |
| 3118 | 3120 | try stringify(42, options, out_stream); |
| 3119 | 3121 | try out_stream.writeByte(']'); |
lib/std/linked_list.zig+1-1| ... | ... | @@ -63,7 +63,7 @@ pub fn SinglyLinkedList(comptime T: type) type { |
| 63 | 63 | pub fn countChildren(node: *const Node) usize { |
| 64 | 64 | var count: usize = 0; |
| 65 | 65 | var it: ?*const Node = node.next; |
| 66 | while (it) |n| : (it = n.next) { | |
| 66 | while (it) |_| : (it = n.next) { | |
| 67 | 67 | count += 1; |
| 68 | 68 | } |
| 69 | 69 | return count; |
lib/std/math/big/int.zig+4| ... | ... | @@ -458,6 +458,7 @@ pub const Mutable = struct { |
| 458 | 458 | /// If `allocator` is provided, it will be used for temporary storage to improve |
| 459 | 459 | /// multiplication performance. `error.OutOfMemory` is handled with a fallback algorithm. |
| 460 | 460 | pub fn sqrNoAlias(rma: *Mutable, a: Const, opt_allocator: ?*Allocator) void { |
| 461 | _ = opt_allocator; | |
| 461 | 462 | assert(rma.limbs.ptr != a.limbs.ptr); // illegal aliasing |
| 462 | 463 | |
| 463 | 464 | mem.set(Limb, rma.limbs, 0); |
| ... | ... | @@ -676,6 +677,7 @@ pub const Mutable = struct { |
| 676 | 677 | /// |
| 677 | 678 | /// `limbs_buffer` is used for temporary storage during the operation. |
| 678 | 679 | pub fn gcdNoAlias(rma: *Mutable, x: Const, y: Const, limbs_buffer: *std.ArrayList(Limb)) !void { |
| 680 | _ = limbs_buffer; | |
| 679 | 681 | assert(rma.limbs.ptr != x.limbs.ptr); // illegal aliasing |
| 680 | 682 | assert(rma.limbs.ptr != y.limbs.ptr); // illegal aliasing |
| 681 | 683 | return gcdLehmer(rma, x, y, allocator); |
| ... | ... | @@ -1141,6 +1143,7 @@ pub const Const = struct { |
| 1141 | 1143 | options: std.fmt.FormatOptions, |
| 1142 | 1144 | out_stream: anytype, |
| 1143 | 1145 | ) !void { |
| 1146 | _ = options; | |
| 1144 | 1147 | comptime var radix = 10; |
| 1145 | 1148 | comptime var case: std.fmt.Case = .lower; |
| 1146 | 1149 | |
| ... | ... | @@ -1618,6 +1621,7 @@ pub const Managed = struct { |
| 1618 | 1621 | /// Converts self to a string in the requested base. Memory is allocated from the provided |
| 1619 | 1622 | /// allocator and not the one present in self. |
| 1620 | 1623 | pub fn toString(self: Managed, allocator: *Allocator, base: u8, case: std.fmt.Case) ![]u8 { |
| 1624 | _ = allocator; | |
| 1621 | 1625 | if (base < 2 or base > 16) return error.InvalidBase; |
| 1622 | 1626 | return self.toConst().toStringAlloc(self.allocator, base, case); |
| 1623 | 1627 | } |
lib/std/mem.zig+5| ... | ... | @@ -139,6 +139,11 @@ var failAllocator = Allocator{ |
| 139 | 139 | .resizeFn = Allocator.noResize, |
| 140 | 140 | }; |
| 141 | 141 | fn failAllocatorAlloc(self: *Allocator, n: usize, alignment: u29, len_align: u29, ra: usize) Allocator.Error![]u8 { |
| 142 | _ = self; | |
| 143 | _ = n; | |
| 144 | _ = alignment; | |
| 145 | _ = len_align; | |
| 146 | _ = ra; | |
| 142 | 147 | return error.OutOfMemory; |
| 143 | 148 | } |
| 144 | 149 |
lib/std/mem/Allocator.zig+4| ... | ... | @@ -55,6 +55,10 @@ pub fn noResize( |
| 55 | 55 | len_align: u29, |
| 56 | 56 | ret_addr: usize, |
| 57 | 57 | ) Error!usize { |
| 58 | _ = self; | |
| 59 | _ = buf_align; | |
| 60 | _ = len_align; | |
| 61 | _ = ret_addr; | |
| 58 | 62 | if (new_len > buf.len) |
| 59 | 63 | return error.OutOfMemory; |
| 60 | 64 | return new_len; |
lib/std/meta.zig+1| ... | ... | @@ -843,6 +843,7 @@ pub const refAllDecls = @compileError("refAllDecls has been moved from std.meta |
| 843 | 843 | pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const Decl { |
| 844 | 844 | const S = struct { |
| 845 | 845 | fn declNameLessThan(context: void, lhs: *const Decl, rhs: *const Decl) bool { |
| 846 | _ = context; | |
| 846 | 847 | return mem.lessThan(u8, lhs.name, rhs.name); |
| 847 | 848 | } |
| 848 | 849 | }; |
lib/std/meta/trailer_flags.zig+1| ... | ... | @@ -108,6 +108,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | pub fn offset(self: Self, p: [*]align(@alignOf(Fields)) const u8, comptime field: FieldEnum) usize { |
| 111 | _ = p; | |
| 111 | 112 | var off: usize = 0; |
| 112 | 113 | inline for (@typeInfo(Fields).Struct.fields) |field_info, i| { |
| 113 | 114 | const active = (self.bits & (1 << i)) != 0; |
lib/std/multi_array_list.zig+3-2| ... | ... | @@ -92,6 +92,7 @@ pub fn MultiArrayList(comptime S: type) type { |
| 92 | 92 | } |
| 93 | 93 | const Sort = struct { |
| 94 | 94 | fn lessThan(trash: *i32, lhs: Data, rhs: Data) bool { |
| 95 | _ = trash; | |
| 95 | 96 | return lhs.alignment > rhs.alignment; |
| 96 | 97 | } |
| 97 | 98 | }; |
| ... | ... | @@ -221,7 +222,7 @@ pub fn MultiArrayList(comptime S: type) type { |
| 221 | 222 | /// retain list ordering. |
| 222 | 223 | pub fn swapRemove(self: *Self, index: usize) void { |
| 223 | 224 | const slices = self.slice(); |
| 224 | inline for (fields) |field_info, i| { | |
| 225 | inline for (fields) |_, i| { | |
| 225 | 226 | const field_slice = slices.items(@intToEnum(Field, i)); |
| 226 | 227 | field_slice[index] = field_slice[self.len - 1]; |
| 227 | 228 | field_slice[self.len - 1] = undefined; |
| ... | ... | @@ -233,7 +234,7 @@ pub fn MultiArrayList(comptime S: type) type { |
| 233 | 234 | /// after it to preserve order. |
| 234 | 235 | pub fn orderedRemove(self: *Self, index: usize) void { |
| 235 | 236 | const slices = self.slice(); |
| 236 | inline for (fields) |field_info, field_index| { | |
| 237 | inline for (fields) |_, field_index| { | |
| 237 | 238 | const field_slice = slices.items(@intToEnum(Field, field_index)); |
| 238 | 239 | var i = index; |
| 239 | 240 | while (i < self.len - 1) : (i += 1) { |
lib/std/net.zig+7| ... | ... | @@ -270,6 +270,8 @@ pub const Ip4Address = extern struct { |
| 270 | 270 | options: std.fmt.FormatOptions, |
| 271 | 271 | out_stream: anytype, |
| 272 | 272 | ) !void { |
| 273 | _ = fmt; | |
| 274 | _ = options; | |
| 273 | 275 | const bytes = @ptrCast(*const [4]u8, &self.sa.addr); |
| 274 | 276 | try std.fmt.format(out_stream, "{}.{}.{}.{}:{}", .{ |
| 275 | 277 | bytes[0], |
| ... | ... | @@ -281,6 +283,7 @@ pub const Ip4Address = extern struct { |
| 281 | 283 | } |
| 282 | 284 | |
| 283 | 285 | pub fn getOsSockLen(self: Ip4Address) os.socklen_t { |
| 286 | _ = self; | |
| 284 | 287 | return @sizeOf(os.sockaddr_in); |
| 285 | 288 | } |
| 286 | 289 | }; |
| ... | ... | @@ -556,6 +559,8 @@ pub const Ip6Address = extern struct { |
| 556 | 559 | options: std.fmt.FormatOptions, |
| 557 | 560 | out_stream: anytype, |
| 558 | 561 | ) !void { |
| 562 | _ = fmt; | |
| 563 | _ = options; | |
| 559 | 564 | const port = mem.bigToNative(u16, self.sa.port); |
| 560 | 565 | if (mem.eql(u8, self.sa.addr[0..12], &[_]u8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff })) { |
| 561 | 566 | try std.fmt.format(out_stream, "[::ffff:{}.{}.{}.{}]:{}", .{ |
| ... | ... | @@ -598,6 +603,7 @@ pub const Ip6Address = extern struct { |
| 598 | 603 | } |
| 599 | 604 | |
| 600 | 605 | pub fn getOsSockLen(self: Ip6Address) os.socklen_t { |
| 606 | _ = self; | |
| 601 | 607 | return @sizeOf(os.sockaddr_in6); |
| 602 | 608 | } |
| 603 | 609 | }; |
| ... | ... | @@ -1062,6 +1068,7 @@ fn IN6_IS_ADDR_SITELOCAL(a: [16]u8) bool { |
| 1062 | 1068 | |
| 1063 | 1069 | // Parameters `b` and `a` swapped to make this descending. |
| 1064 | 1070 | fn addrCmpLessThan(context: void, b: LookupAddr, a: LookupAddr) bool { |
| 1071 | _ = context; | |
| 1065 | 1072 | return a.sortkey < b.sortkey; |
| 1066 | 1073 | } |
| 1067 | 1074 |
lib/std/once.zig+1| ... | ... | @@ -61,6 +61,7 @@ test "Once executes its function just once" { |
| 61 | 61 | for (threads) |*handle| { |
| 62 | 62 | handle.* = try std.Thread.spawn(struct { |
| 63 | 63 | fn thread_fn(x: u8) void { |
| 64 | _ = x; | |
| 64 | 65 | global_once.call(); |
| 65 | 66 | } |
| 66 | 67 | }.thread_fn, 0); |
lib/std/os.zig+10| ... | ... | @@ -1164,6 +1164,7 @@ fn openOptionsFromFlags(flags: u32) windows.OpenFileOptions { |
| 1164 | 1164 | /// TODO currently, this function does not handle all flag combinations |
| 1165 | 1165 | /// or makes use of perm argument. |
| 1166 | 1166 | pub fn openW(file_path_w: []const u16, flags: u32, perm: mode_t) OpenError!fd_t { |
| 1167 | _ = perm; | |
| 1167 | 1168 | var options = openOptionsFromFlags(flags); |
| 1168 | 1169 | options.dir = std.fs.cwd().fd; |
| 1169 | 1170 | return windows.OpenFile(file_path_w, options) catch |err| switch (err) { |
| ... | ... | @@ -1273,6 +1274,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: u32, mode: mode_t) |
| 1273 | 1274 | /// TODO currently, this function does not handle all flag combinations |
| 1274 | 1275 | /// or makes use of perm argument. |
| 1275 | 1276 | pub fn openatW(dir_fd: fd_t, file_path_w: []const u16, flags: u32, mode: mode_t) OpenError!fd_t { |
| 1277 | _ = mode; | |
| 1276 | 1278 | var options = openOptionsFromFlags(flags); |
| 1277 | 1279 | options.dir = dir_fd; |
| 1278 | 1280 | return windows.OpenFile(file_path_w, options) catch |err| switch (err) { |
| ... | ... | @@ -2169,6 +2171,7 @@ pub fn mkdirat(dir_fd: fd_t, sub_dir_path: []const u8, mode: u32) MakeDirError!v |
| 2169 | 2171 | pub const mkdiratC = @compileError("deprecated: renamed to mkdiratZ"); |
| 2170 | 2172 | |
| 2171 | 2173 | pub fn mkdiratWasi(dir_fd: fd_t, sub_dir_path: []const u8, mode: u32) MakeDirError!void { |
| 2174 | _ = mode; | |
| 2172 | 2175 | switch (wasi.path_create_directory(dir_fd, sub_dir_path.ptr, sub_dir_path.len)) { |
| 2173 | 2176 | wasi.ESUCCESS => return, |
| 2174 | 2177 | wasi.EACCES => return error.AccessDenied, |
| ... | ... | @@ -2216,6 +2219,7 @@ pub fn mkdiratZ(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: u32) MakeDirErr |
| 2216 | 2219 | } |
| 2217 | 2220 | |
| 2218 | 2221 | pub fn mkdiratW(dir_fd: fd_t, sub_path_w: []const u16, mode: u32) MakeDirError!void { |
| 2222 | _ = mode; | |
| 2219 | 2223 | const sub_dir_handle = windows.OpenFile(sub_path_w, .{ |
| 2220 | 2224 | .dir = dir_fd, |
| 2221 | 2225 | .access_mask = windows.GENERIC_READ | windows.SYNCHRONIZE, |
| ... | ... | @@ -2291,6 +2295,7 @@ pub fn mkdirZ(dir_path: [*:0]const u8, mode: u32) MakeDirError!void { |
| 2291 | 2295 | |
| 2292 | 2296 | /// Windows-only. Same as `mkdir` but the parameters is WTF16 encoded. |
| 2293 | 2297 | pub fn mkdirW(dir_path_w: []const u16, mode: u32) MakeDirError!void { |
| 2298 | _ = mode; | |
| 2294 | 2299 | const sub_dir_handle = windows.OpenFile(dir_path_w, .{ |
| 2295 | 2300 | .dir = std.fs.cwd().fd, |
| 2296 | 2301 | .access_mask = windows.GENERIC_READ | windows.SYNCHRONIZE, |
| ... | ... | @@ -3868,6 +3873,7 @@ pub fn accessZ(path: [*:0]const u8, mode: u32) AccessError!void { |
| 3868 | 3873 | /// Otherwise use `access` or `accessC`. |
| 3869 | 3874 | /// TODO currently this ignores `mode`. |
| 3870 | 3875 | pub fn accessW(path: [*:0]const u16, mode: u32) windows.GetFileAttributesError!void { |
| 3876 | _ = mode; | |
| 3871 | 3877 | const ret = try windows.GetFileAttributesW(path); |
| 3872 | 3878 | if (ret != windows.INVALID_FILE_ATTRIBUTES) { |
| 3873 | 3879 | return; |
| ... | ... | @@ -3918,6 +3924,8 @@ pub fn faccessatZ(dirfd: fd_t, path: [*:0]const u8, mode: u32, flags: u32) Acces |
| 3918 | 3924 | /// is NtDll-prefixed, null-terminated, WTF-16 encoded. |
| 3919 | 3925 | /// TODO currently this ignores `mode` and `flags` |
| 3920 | 3926 | pub fn faccessatW(dirfd: fd_t, sub_path_w: [*:0]const u16, mode: u32, flags: u32) AccessError!void { |
| 3927 | _ = mode; | |
| 3928 | _ = flags; | |
| 3921 | 3929 | if (sub_path_w[0] == '.' and sub_path_w[1] == 0) { |
| 3922 | 3930 | return; |
| 3923 | 3931 | } |
| ... | ... | @@ -4895,6 +4903,8 @@ pub fn res_mkquery( |
| 4895 | 4903 | newrr: ?[*]const u8, |
| 4896 | 4904 | buf: []u8, |
| 4897 | 4905 | ) usize { |
| 4906 | _ = data; | |
| 4907 | _ = newrr; | |
| 4898 | 4908 | // This implementation is ported from musl libc. |
| 4899 | 4909 | // A more idiomatic "ziggy" implementation would be welcome. |
| 4900 | 4910 | var name = dname; |
lib/std/os/bits/linux.zig+1-1| ... | ... | @@ -1286,7 +1286,7 @@ pub const CAP_BLOCK_SUSPEND = 36; |
| 1286 | 1286 | pub const CAP_AUDIT_READ = 37; |
| 1287 | 1287 | pub const CAP_LAST_CAP = CAP_AUDIT_READ; |
| 1288 | 1288 | |
| 1289 | pub fn cap_valid(u8: x) bool { | |
| 1289 | pub fn cap_valid(x: u8) bool { | |
| 1290 | 1290 | return x >= 0 and x <= CAP_LAST_CAP; |
| 1291 | 1291 | } |
| 1292 | 1292 |
lib/std/os/linux.zig+2-1| ... | ... | @@ -70,6 +70,7 @@ fn splitValueLE64(val: i64) [2]u32 { |
| 70 | 70 | }; |
| 71 | 71 | } |
| 72 | 72 | fn splitValueBE64(val: i64) [2]u32 { |
| 73 | _ = val; | |
| 73 | 74 | return [2]u32{ |
| 74 | 75 | @truncate(u32, u >> 32), |
| 75 | 76 | @truncate(u32, u), |
| ... | ... | @@ -1022,7 +1023,7 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize |
| 1022 | 1023 | for (msgvec[0..kvlen]) |*msg, i| { |
| 1023 | 1024 | var size: i32 = 0; |
| 1024 | 1025 | const msg_iovlen = @intCast(usize, msg.msg_hdr.msg_iovlen); // kernel side this is treated as unsigned |
| 1025 | for (msg.msg_hdr.msg_iov[0..msg_iovlen]) |iov, j| { | |
| 1026 | for (msg.msg_hdr.msg_iov[0..msg_iovlen]) |iov| { | |
| 1026 | 1027 | if (iov.iov_len > std.math.maxInt(i32) or @addWithOverflow(i32, size, @intCast(i32, iov.iov_len), &size)) { |
| 1027 | 1028 | // batch-send all messages up to the current message |
| 1028 | 1029 | if (next_unsent < i) { |
lib/std/os/linux/bpf.zig+2-2| ... | ... | @@ -1513,7 +1513,7 @@ pub fn map_create(map_type: MapType, key_size: u32, value_size: u32, max_entries |
| 1513 | 1513 | EINVAL => error.MapTypeOrAttrInvalid, |
| 1514 | 1514 | ENOMEM => error.SystemResources, |
| 1515 | 1515 | EPERM => error.AccessDenied, |
| 1516 | else => |err| unexpectedErrno(rc), | |
| 1516 | else => unexpectedErrno(rc), | |
| 1517 | 1517 | }; |
| 1518 | 1518 | } |
| 1519 | 1519 | |
| ... | ... | @@ -1539,7 +1539,7 @@ pub fn map_lookup_elem(fd: fd_t, key: []const u8, value: []u8) !void { |
| 1539 | 1539 | EINVAL => return error.FieldInAttrNeedsZeroing, |
| 1540 | 1540 | ENOENT => return error.NotFound, |
| 1541 | 1541 | EPERM => return error.AccessDenied, |
| 1542 | else => |err| return unexpectedErrno(rc), | |
| 1542 | else => return unexpectedErrno(rc), | |
| 1543 | 1543 | } |
| 1544 | 1544 | } |
| 1545 | 1545 |
lib/std/os/linux/io_uring.zig+3| ... | ... | @@ -284,6 +284,7 @@ pub const IO_Uring = struct { |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | fn copy_cqes_ready(self: *IO_Uring, cqes: []io_uring_cqe, wait_nr: u32) u32 { |
| 287 | _ = wait_nr; | |
| 287 | 288 | const ready = self.cq_ready(); |
| 288 | 289 | const count = std.math.min(cqes.len, ready); |
| 289 | 290 | var head = self.cq.head.*; |
| ... | ... | @@ -320,6 +321,7 @@ pub const IO_Uring = struct { |
| 320 | 321 | /// Not idempotent, calling more than once will result in other CQEs being lost. |
| 321 | 322 | /// Matches the implementation of cqe_seen() in liburing. |
| 322 | 323 | pub fn cqe_seen(self: *IO_Uring, cqe: *io_uring_cqe) void { |
| 324 | _ = cqe; | |
| 323 | 325 | self.cq_advance(1); |
| 324 | 326 | } |
| 325 | 327 | |
| ... | ... | @@ -728,6 +730,7 @@ pub const CompletionQueue = struct { |
| 728 | 730 | } |
| 729 | 731 | |
| 730 | 732 | pub fn deinit(self: *CompletionQueue) void { |
| 733 | _ = self; | |
| 731 | 734 | // A no-op since we now share the mmap with the submission queue. |
| 732 | 735 | // Here for symmetry with the submission queue, and for any future feature support. |
| 733 | 736 | } |
lib/std/os/linux/mips.zig+1| ... | ... | @@ -18,6 +18,7 @@ pub fn syscall0(number: SYS) usize { |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | pub fn syscall_pipe(fd: *[2]i32) usize { |
| 21 | _ = fd; | |
| 21 | 22 | return asm volatile ( |
| 22 | 23 | \\ .set noat |
| 23 | 24 | \\ .set noreorder |
lib/std/os/test.zig+4| ... | ... | @@ -353,6 +353,7 @@ test "spawn threads" { |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | fn start1(ctx: void) u8 { |
| 356 | _ = ctx; | |
| 356 | 357 | return 0; |
| 357 | 358 | } |
| 358 | 359 | |
| ... | ... | @@ -379,6 +380,7 @@ test "thread local storage" { |
| 379 | 380 | |
| 380 | 381 | threadlocal var x: i32 = 1234; |
| 381 | 382 | fn testTls(context: void) !void { |
| 383 | _ = context; | |
| 382 | 384 | if (x != 1234) return error.TlsBadStartValue; |
| 383 | 385 | x += 1; |
| 384 | 386 | if (x != 1235) return error.TlsBadEndValue; |
| ... | ... | @@ -425,6 +427,7 @@ const IterFnError = error{ |
| 425 | 427 | }; |
| 426 | 428 | |
| 427 | 429 | fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void { |
| 430 | _ = size; | |
| 428 | 431 | // Count how many libraries are loaded |
| 429 | 432 | counter.* += @as(usize, 1); |
| 430 | 433 | |
| ... | ... | @@ -731,6 +734,7 @@ test "sigaction" { |
| 731 | 734 | |
| 732 | 735 | const S = struct { |
| 733 | 736 | fn handler(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const c_void) callconv(.C) void { |
| 737 | _ = ctx_ptr; | |
| 734 | 738 | // Check that we received the correct signal. |
| 735 | 739 | switch (native_os) { |
| 736 | 740 | .netbsd => { |
lib/std/os/uefi.zig+1| ... | ... | @@ -37,6 +37,7 @@ pub const Guid = extern struct { |
| 37 | 37 | options: std.fmt.FormatOptions, |
| 38 | 38 | writer: anytype, |
| 39 | 39 | ) !void { |
| 40 | _ = options; | |
| 40 | 41 | if (f.len == 0) { |
| 41 | 42 | return std.fmt.format(writer, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{ |
| 42 | 43 | self.time_low, |
lib/std/os/uefi/protocols/managed_network_protocol.zig+1| ... | ... | @@ -35,6 +35,7 @@ pub const ManagedNetworkProtocol = extern struct { |
| 35 | 35 | /// Translates an IP multicast address to a hardware (MAC) multicast address. |
| 36 | 36 | /// This function may be unsupported in some MNP implementations. |
| 37 | 37 | pub fn mcastIpToMac(self: *const ManagedNetworkProtocol, ipv6flag: bool, ipaddress: *const c_void, mac_address: *MacAddress) Status { |
| 38 | _ = mac_address; | |
| 38 | 39 | return self._mcast_ip_to_mac(self, ipv6flag, ipaddress); |
| 39 | 40 | } |
| 40 | 41 |
lib/std/packed_int_array.zig+1| ... | ... | @@ -194,6 +194,7 @@ pub fn PackedIntArrayEndian(comptime Int: type, comptime endian: Endian, comptim |
| 194 | 194 | |
| 195 | 195 | ///Returns the number of elements in the packed array |
| 196 | 196 | pub fn len(self: Self) usize { |
| 197 | _ = self; | |
| 197 | 198 | return int_count; |
| 198 | 199 | } |
| 199 | 200 |
lib/std/pdb.zig+2-1| ... | ... | @@ -675,6 +675,7 @@ pub const Pdb = struct { |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | pub fn getSymbolName(self: *Pdb, module: *Module, address: u64) ?[]const u8 { |
| 678 | _ = self; | |
| 678 | 679 | std.debug.assert(module.populated); |
| 679 | 680 | |
| 680 | 681 | var symbol_i: usize = 0; |
| ... | ... | @@ -906,7 +907,7 @@ const Msf = struct { |
| 906 | 907 | // These streams are not used, but still participate in the file |
| 907 | 908 | // and must be taken into account when resolving stream indices. |
| 908 | 909 | const Nil = 0xFFFFFFFF; |
| 909 | for (stream_sizes) |*s, i| { | |
| 910 | for (stream_sizes) |*s| { | |
| 910 | 911 | const size = try directory.reader().readIntLittle(u32); |
| 911 | 912 | s.* = if (size == Nil) 0 else blockCountFromSize(size, superblock.BlockSize); |
| 912 | 913 | } |
lib/std/priority_dequeue.zig+1-1| ... | ... | @@ -428,7 +428,7 @@ pub fn PriorityDequeue(comptime T: type) type { |
| 428 | 428 | warn("{}, ", .{e}); |
| 429 | 429 | } |
| 430 | 430 | warn("array: ", .{}); |
| 431 | for (self.items) |e, i| { | |
| 431 | for (self.items) |e| { | |
| 432 | 432 | warn("{}, ", .{e}); |
| 433 | 433 | } |
| 434 | 434 | warn("len: {} ", .{self.len}); |
lib/std/priority_queue.zig+1-1| ... | ... | @@ -249,7 +249,7 @@ pub fn PriorityQueue(comptime T: type) type { |
| 249 | 249 | warn("{}, ", .{e}); |
| 250 | 250 | } |
| 251 | 251 | warn("array: ", .{}); |
| 252 | for (self.items) |e, i| { | |
| 252 | for (self.items) |e| { | |
| 253 | 253 | warn("{}, ", .{e}); |
| 254 | 254 | } |
| 255 | 255 | warn("len: {} ", .{self.len}); |
lib/std/process.zig+2| ... | ... | @@ -419,6 +419,7 @@ pub const ArgIteratorWindows = struct { |
| 419 | 419 | }; |
| 420 | 420 | } |
| 421 | 421 | fn emitBackslashes(self: *ArgIteratorWindows, buf: *std.ArrayList(u16), emit_count: usize) !void { |
| 422 | _ = self; | |
| 422 | 423 | var i: usize = 0; |
| 423 | 424 | while (i < emit_count) : (i += 1) { |
| 424 | 425 | try buf.append(std.mem.nativeToLittle(u16, '\\')); |
| ... | ... | @@ -748,6 +749,7 @@ pub fn getSelfExeSharedLibPaths(allocator: *Allocator) error{OutOfMemory}![][:0] |
| 748 | 749 | } |
| 749 | 750 | try os.dl_iterate_phdr(&paths, error{OutOfMemory}, struct { |
| 750 | 751 | fn callback(info: *os.dl_phdr_info, size: usize, list: *List) !void { |
| 752 | _ = size; | |
| 751 | 753 | const name = info.dlpi_name orelse return; |
| 752 | 754 | if (name[0] == '/') { |
| 753 | 755 | const item = try list.allocator.dupeZ(u8, mem.spanZ(name)); |
lib/std/sort.zig+4| ... | ... | @@ -37,9 +37,11 @@ pub fn binarySearch( |
| 37 | 37 | test "binarySearch" { |
| 38 | 38 | const S = struct { |
| 39 | 39 | fn order_u32(context: void, lhs: u32, rhs: u32) math.Order { |
| 40 | _ = context; | |
| 40 | 41 | return math.order(lhs, rhs); |
| 41 | 42 | } |
| 42 | 43 | fn order_i32(context: void, lhs: i32, rhs: i32) math.Order { |
| 44 | _ = context; | |
| 43 | 45 | return math.order(lhs, rhs); |
| 44 | 46 | } |
| 45 | 47 | }; |
| ... | ... | @@ -1133,6 +1135,7 @@ fn swap( |
| 1133 | 1135 | pub fn asc(comptime T: type) fn (void, T, T) bool { |
| 1134 | 1136 | const impl = struct { |
| 1135 | 1137 | fn inner(context: void, a: T, b: T) bool { |
| 1138 | _ = context; | |
| 1136 | 1139 | return a < b; |
| 1137 | 1140 | } |
| 1138 | 1141 | }; |
| ... | ... | @@ -1144,6 +1147,7 @@ pub fn asc(comptime T: type) fn (void, T, T) bool { |
| 1144 | 1147 | pub fn desc(comptime T: type) fn (void, T, T) bool { |
| 1145 | 1148 | const impl = struct { |
| 1146 | 1149 | fn inner(context: void, a: T, b: T) bool { |
| 1150 | _ = context; | |
| 1147 | 1151 | return a > b; |
| 1148 | 1152 | } |
| 1149 | 1153 | }; |
lib/std/special/c.zig+2| ... | ... | @@ -160,6 +160,7 @@ fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) callconv(.C) c_int { |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | fn strerror(errnum: c_int) callconv(.C) [*:0]const u8 { |
| 163 | _ = errnum; | |
| 163 | 164 | return "TODO strerror implementation"; |
| 164 | 165 | } |
| 165 | 166 | |
| ... | ... | @@ -173,6 +174,7 @@ test "strncmp" { |
| 173 | 174 | // Avoid dragging in the runtime safety mechanisms into this .o file, |
| 174 | 175 | // unless we're trying to test this file. |
| 175 | 176 | pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn { |
| 177 | _ = error_return_trace; | |
| 176 | 178 | if (builtin.is_test) { |
| 177 | 179 | @setCold(true); |
| 178 | 180 | std.debug.panic("{s}", .{msg}); |
lib/std/special/compiler_rt.zig+1| ... | ... | @@ -602,6 +602,7 @@ pub usingnamespace @import("compiler_rt/atomics.zig"); |
| 602 | 602 | // Avoid dragging in the runtime safety mechanisms into this .o file, |
| 603 | 603 | // unless we're trying to test this file. |
| 604 | 604 | pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn { |
| 605 | _ = error_return_trace; | |
| 605 | 606 | @setCold(true); |
| 606 | 607 | if (is_test) { |
| 607 | 608 | std.debug.panic("{s}", .{msg}); |
lib/std/special/compiler_rt/atomics.zig+11| ... | ... | @@ -80,18 +80,21 @@ var spinlocks: SpinlockTable = SpinlockTable{}; |
| 80 | 80 | // Those work on any object no matter the pointer alignment nor its size. |
| 81 | 81 | |
| 82 | 82 | fn __atomic_load(size: u32, src: [*]u8, dest: [*]u8, model: i32) callconv(.C) void { |
| 83 | _ = model; | |
| 83 | 84 | var sl = spinlocks.get(@ptrToInt(src)); |
| 84 | 85 | defer sl.release(); |
| 85 | 86 | @memcpy(dest, src, size); |
| 86 | 87 | } |
| 87 | 88 | |
| 88 | 89 | fn __atomic_store(size: u32, dest: [*]u8, src: [*]u8, model: i32) callconv(.C) void { |
| 90 | _ = model; | |
| 89 | 91 | var sl = spinlocks.get(@ptrToInt(dest)); |
| 90 | 92 | defer sl.release(); |
| 91 | 93 | @memcpy(dest, src, size); |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | fn __atomic_exchange(size: u32, ptr: [*]u8, val: [*]u8, old: [*]u8, model: i32) callconv(.C) void { |
| 97 | _ = model; | |
| 95 | 98 | var sl = spinlocks.get(@ptrToInt(ptr)); |
| 96 | 99 | defer sl.release(); |
| 97 | 100 | @memcpy(old, ptr, size); |
| ... | ... | @@ -106,6 +109,8 @@ fn __atomic_compare_exchange( |
| 106 | 109 | success: i32, |
| 107 | 110 | failure: i32, |
| 108 | 111 | ) callconv(.C) i32 { |
| 112 | _ = success; | |
| 113 | _ = failure; | |
| 109 | 114 | var sl = spinlocks.get(@ptrToInt(ptr)); |
| 110 | 115 | defer sl.release(); |
| 111 | 116 | for (ptr[0..size]) |b, i| { |
| ... | ... | @@ -135,6 +140,7 @@ comptime { |
| 135 | 140 | fn atomicLoadFn(comptime T: type) fn (*T, i32) callconv(.C) T { |
| 136 | 141 | return struct { |
| 137 | 142 | fn atomic_load_N(src: *T, model: i32) callconv(.C) T { |
| 143 | _ = model; | |
| 138 | 144 | if (@sizeOf(T) > largest_atomic_size) { |
| 139 | 145 | var sl = spinlocks.get(@ptrToInt(src)); |
| 140 | 146 | defer sl.release(); |
| ... | ... | @@ -162,6 +168,7 @@ comptime { |
| 162 | 168 | fn atomicStoreFn(comptime T: type) fn (*T, T, i32) callconv(.C) void { |
| 163 | 169 | return struct { |
| 164 | 170 | fn atomic_store_N(dst: *T, value: T, model: i32) callconv(.C) void { |
| 171 | _ = model; | |
| 165 | 172 | if (@sizeOf(T) > largest_atomic_size) { |
| 166 | 173 | var sl = spinlocks.get(@ptrToInt(dst)); |
| 167 | 174 | defer sl.release(); |
| ... | ... | @@ -189,6 +196,7 @@ comptime { |
| 189 | 196 | fn atomicExchangeFn(comptime T: type) fn (*T, T, i32) callconv(.C) T { |
| 190 | 197 | return struct { |
| 191 | 198 | fn atomic_exchange_N(ptr: *T, val: T, model: i32) callconv(.C) T { |
| 199 | _ = model; | |
| 192 | 200 | if (@sizeOf(T) > largest_atomic_size) { |
| 193 | 201 | var sl = spinlocks.get(@ptrToInt(ptr)); |
| 194 | 202 | defer sl.release(); |
| ... | ... | @@ -218,6 +226,8 @@ comptime { |
| 218 | 226 | fn atomicCompareExchangeFn(comptime T: type) fn (*T, *T, T, i32, i32) callconv(.C) i32 { |
| 219 | 227 | return struct { |
| 220 | 228 | fn atomic_compare_exchange_N(ptr: *T, expected: *T, desired: T, success: i32, failure: i32) callconv(.C) i32 { |
| 229 | _ = success; | |
| 230 | _ = failure; | |
| 221 | 231 | if (@sizeOf(T) > largest_atomic_size) { |
| 222 | 232 | var sl = spinlocks.get(@ptrToInt(ptr)); |
| 223 | 233 | defer sl.release(); |
| ... | ... | @@ -255,6 +265,7 @@ comptime { |
| 255 | 265 | fn fetchFn(comptime T: type, comptime op: builtin.AtomicRmwOp) fn (*T, T, i32) callconv(.C) T { |
| 256 | 266 | return struct { |
| 257 | 267 | pub fn fetch_op_N(ptr: *T, val: T, model: i32) callconv(.C) T { |
| 268 | _ = model; | |
| 258 | 269 | if (@sizeOf(T) > largest_atomic_size) { |
| 259 | 270 | var sl = spinlocks.get(@ptrToInt(ptr)); |
| 260 | 271 | defer sl.release(); |
lib/std/special/compiler_rt/comparedf2_test.zig+1| ... | ... | @@ -101,6 +101,7 @@ const test_vectors = init: { |
| 101 | 101 | |
| 102 | 102 | test "compare f64" { |
| 103 | 103 | for (test_vectors) |vector, i| { |
| 104 | _ = i; | |
| 104 | 105 | try std.testing.expect(test__cmpdf2(vector)); |
| 105 | 106 | } |
| 106 | 107 | } |
lib/std/special/compiler_rt/comparesf2_test.zig+1| ... | ... | @@ -101,6 +101,7 @@ const test_vectors = init: { |
| 101 | 101 | |
| 102 | 102 | test "compare f32" { |
| 103 | 103 | for (test_vectors) |vector, i| { |
| 104 | _ = i; | |
| 104 | 105 | try std.testing.expect(test__cmpsf2(vector)); |
| 105 | 106 | } |
| 106 | 107 | } |
lib/std/special/ssp.zig+2| ... | ... | @@ -27,6 +27,8 @@ extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8 |
| 27 | 27 | |
| 28 | 28 | // Avoid dragging in the runtime safety mechanisms into this .o file. |
| 29 | 29 | pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn { |
| 30 | _ = msg; | |
| 31 | _ = error_return_trace; | |
| 30 | 32 | @setCold(true); |
| 31 | 33 | if (@hasDecl(std.os, "abort")) |
| 32 | 34 | std.os.abort(); |
lib/std/target.zig+1-1| ... | ... | @@ -157,7 +157,7 @@ pub const Target = struct { |
| 157 | 157 | pub fn format( |
| 158 | 158 | self: WindowsVersion, |
| 159 | 159 | comptime fmt: []const u8, |
| 160 | options: std.fmt.FormatOptions, | |
| 160 | _: std.fmt.FormatOptions, | |
| 161 | 161 | out_stream: anytype, |
| 162 | 162 | ) !void { |
| 163 | 163 | if (fmt.len > 0 and fmt[0] == 's') { |
lib/std/unicode.zig+1-1| ... | ... | @@ -210,7 +210,7 @@ pub fn utf8ValidateSlice(s: []const u8) bool { |
| 210 | 210 | return false; |
| 211 | 211 | } |
| 212 | 212 | i += cp_len; |
| 213 | } else |err| { | |
| 213 | } else |_| { | |
| 214 | 214 | return false; |
| 215 | 215 | } |
| 216 | 216 | } |
lib/std/x/net/ip.zig+2| ... | ... | @@ -53,6 +53,8 @@ pub const Address = union(enum) { |
| 53 | 53 | opts: fmt.FormatOptions, |
| 54 | 54 | writer: anytype, |
| 55 | 55 | ) !void { |
| 56 | _ = opts; | |
| 57 | _ = layout; | |
| 56 | 58 | switch (self) { |
| 57 | 59 | .ipv4 => |address| try fmt.format(writer, "{}:{}", .{ address.host, address.port }), |
| 58 | 60 | .ipv6 => |address| try fmt.format(writer, "{}:{}", .{ address.host, address.port }), |
lib/std/x/os/net.zig+2| ... | ... | @@ -143,6 +143,7 @@ pub const IPv4 = extern struct { |
| 143 | 143 | opts: fmt.FormatOptions, |
| 144 | 144 | writer: anytype, |
| 145 | 145 | ) !void { |
| 146 | _ = opts; | |
| 146 | 147 | if (comptime layout.len != 0 and layout[0] != 's') { |
| 147 | 148 | @compileError("Unsupported format specifier for IPv4 type '" ++ layout ++ "'."); |
| 148 | 149 | } |
| ... | ... | @@ -352,6 +353,7 @@ pub const IPv6 = extern struct { |
| 352 | 353 | opts: fmt.FormatOptions, |
| 353 | 354 | writer: anytype, |
| 354 | 355 | ) !void { |
| 356 | _ = opts; | |
| 355 | 357 | const specifier = comptime &[_]u8{if (layout.len == 0) 'x' else switch (layout[0]) { |
| 356 | 358 | 'x', 'X' => |specifier| specifier, |
| 357 | 359 | 's' => 'x', |
lib/std/x/os/socket.zig+4-2| ... | ... | @@ -117,7 +117,7 @@ pub const Socket = struct { |
| 117 | 117 | }; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | /// Returns the number of bytes that make up the `sockaddr` equivalent to the address. | |
| 120 | /// Returns the number of bytes that make up the `sockaddr` equivalent to the address. | |
| 121 | 121 | pub fn getNativeSize(self: Socket.Address) u32 { |
| 122 | 122 | return switch (self) { |
| 123 | 123 | .ipv4 => @sizeOf(os.sockaddr_in), |
| ... | ... | @@ -132,6 +132,8 @@ pub const Socket = struct { |
| 132 | 132 | opts: fmt.FormatOptions, |
| 133 | 133 | writer: anytype, |
| 134 | 134 | ) !void { |
| 135 | _ = opts; | |
| 136 | _ = layout; | |
| 135 | 137 | switch (self) { |
| 136 | 138 | .ipv4 => |address| try fmt.format(writer, "{}:{}", .{ address.host, address.port }), |
| 137 | 139 | .ipv6 => |address| try fmt.format(writer, "{}:{}", .{ address.host, address.port }), |
| ... | ... | @@ -280,7 +282,7 @@ pub const Socket = struct { |
| 280 | 282 | /// |
| 281 | 283 | /// Microsoft's documentation and glibc denote the fields to be unsigned |
| 282 | 284 | /// short's on Windows, whereas glibc and musl denote the fields to be |
| 283 | /// int's on every other platform. | |
| 285 | /// int's on every other platform. | |
| 284 | 286 | pub const Linger = extern struct { |
| 285 | 287 | pub const Field = switch (native_os.tag) { |
| 286 | 288 | .windows => c_ushort, |
lib/std/x/os/socket_windows.zig+7-3| ... | ... | @@ -292,6 +292,7 @@ pub fn Mixin(comptime Socket: type) type { |
| 292 | 292 | /// with a set of flags specified. It returns the number of bytes that were |
| 293 | 293 | /// read into the buffer provided. |
| 294 | 294 | pub fn readMessage(self: Socket, msg: *Socket.Message, flags: u32) !usize { |
| 295 | _ = flags; | |
| 295 | 296 | const call = try windows.loadWinsockExtensionFunction(ws2_32.LPFN_WSARECVMSG, self.fd, ws2_32.WSAID_WSARECVMSG); |
| 296 | 297 | |
| 297 | 298 | var num_bytes: u32 = undefined; |
| ... | ... | @@ -367,16 +368,19 @@ pub fn Mixin(comptime Socket: type) type { |
| 367 | 368 | |
| 368 | 369 | /// Query and return the latest cached error on the socket. |
| 369 | 370 | pub fn getError(self: Socket) !void { |
| 371 | _ = self; | |
| 370 | 372 | return {}; |
| 371 | 373 | } |
| 372 | 374 | |
| 373 | 375 | /// Query the read buffer size of the socket. |
| 374 | 376 | pub fn getReadBufferSize(self: Socket) !u32 { |
| 377 | _ = self; | |
| 375 | 378 | return 0; |
| 376 | 379 | } |
| 377 | 380 | |
| 378 | 381 | /// Query the write buffer size of the socket. |
| 379 | 382 | pub fn getWriteBufferSize(self: Socket) !u32 { |
| 383 | _ = self; | |
| 380 | 384 | return 0; |
| 381 | 385 | } |
| 382 | 386 | |
| ... | ... | @@ -406,7 +410,7 @@ pub fn Mixin(comptime Socket: type) type { |
| 406 | 410 | |
| 407 | 411 | /// On connection-oriented sockets, have keep-alive messages be sent periodically. The timing in which keep-alive |
| 408 | 412 | /// messages are sent are dependant on operating system settings. It returns `error.UnsupportedSocketOption` if |
| 409 | /// the host does not support periodically sending keep-alive messages on connection-oriented sockets. | |
| 413 | /// the host does not support periodically sending keep-alive messages on connection-oriented sockets. | |
| 410 | 414 | pub fn setKeepAlive(self: Socket, enabled: bool) !void { |
| 411 | 415 | return self.setOption(ws2_32.SOL_SOCKET, ws2_32.SO_KEEPALIVE, mem.asBytes(&@as(u32, @boolToInt(enabled)))); |
| 412 | 416 | } |
| ... | ... | @@ -438,7 +442,7 @@ pub fn Mixin(comptime Socket: type) type { |
| 438 | 442 | |
| 439 | 443 | /// WARNING: Timeouts only affect blocking sockets. It is undefined behavior if a timeout is |
| 440 | 444 | /// set on a non-blocking socket. |
| 441 | /// | |
| 445 | /// | |
| 442 | 446 | /// Set a timeout on the socket that is to occur if no messages are successfully written |
| 443 | 447 | /// to its bound destination after a specified number of milliseconds. A subsequent write |
| 444 | 448 | /// to the socket will thereafter return `error.WouldBlock` should the timeout be exceeded. |
| ... | ... | @@ -448,7 +452,7 @@ pub fn Mixin(comptime Socket: type) type { |
| 448 | 452 | |
| 449 | 453 | /// WARNING: Timeouts only affect blocking sockets. It is undefined behavior if a timeout is |
| 450 | 454 | /// set on a non-blocking socket. |
| 451 | /// | |
| 455 | /// | |
| 452 | 456 | /// Set a timeout on the socket that is to occur if no messages are successfully read |
| 453 | 457 | /// from its bound destination after a specified number of milliseconds. A subsequent |
| 454 | 458 | /// read from the socket will thereafter return `error.WouldBlock` should the timeout be |
lib/std/zig/ast.zig+1| ... | ... | @@ -1866,6 +1866,7 @@ pub const Tree = struct { |
| 1866 | 1866 | } |
| 1867 | 1867 | |
| 1868 | 1868 | fn fullStructInit(tree: Tree, info: full.StructInit.Ast) full.StructInit { |
| 1869 | _ = tree; | |
| 1869 | 1870 | var result: full.StructInit = .{ |
| 1870 | 1871 | .ast = info, |
| 1871 | 1872 | }; |
lib/std/zig/c_builtins.zig+2| ... | ... | @@ -136,6 +136,7 @@ pub inline fn __builtin_strcmp(s1: [*c]const u8, s2: [*c]const u8) c_int { |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | pub inline fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) usize { |
| 139 | _ = ptr; | |
| 139 | 140 | // clang semantics match gcc's: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html |
| 140 | 141 | // If it is not possible to determine which objects ptr points to at compile time, |
| 141 | 142 | // __builtin_object_size should return (size_t) -1 for type 0 or 1 and (size_t) 0 |
| ... | ... | @@ -186,6 +187,7 @@ pub inline fn __builtin_memcpy( |
| 186 | 187 | /// The return value of __builtin_expect is `expr`. `c` is the expected value |
| 187 | 188 | /// of `expr` and is used as a hint to the compiler in C. Here it is unused. |
| 188 | 189 | pub inline fn __builtin_expect(expr: c_long, c: c_long) c_long { |
| 190 | _ = c; | |
| 189 | 191 | return expr; |
| 190 | 192 | } |
| 191 | 193 |
lib/std/zig/fmt.zig+2| ... | ... | @@ -8,6 +8,7 @@ pub fn formatId( |
| 8 | 8 | options: std.fmt.FormatOptions, |
| 9 | 9 | writer: anytype, |
| 10 | 10 | ) !void { |
| 11 | _ = fmt; | |
| 11 | 12 | if (isValidId(bytes)) { |
| 12 | 13 | return writer.writeAll(bytes); |
| 13 | 14 | } |
| ... | ... | @@ -41,6 +42,7 @@ pub fn formatEscapes( |
| 41 | 42 | options: std.fmt.FormatOptions, |
| 42 | 43 | writer: anytype, |
| 43 | 44 | ) !void { |
| 45 | _ = options; | |
| 44 | 46 | for (bytes) |byte| switch (byte) { |
| 45 | 47 | '\n' => try writer.writeAll("\\n"), |
| 46 | 48 | '\r' => try writer.writeAll("\\r"), |
lib/std/zig/parse.zig+1-1| ... | ... | @@ -2104,7 +2104,7 @@ const Parser = struct { |
| 2104 | 2104 | /// FnCallArguments <- LPAREN ExprList RPAREN |
| 2105 | 2105 | /// ExprList <- (Expr COMMA)* Expr? |
| 2106 | 2106 | fn parseSuffixExpr(p: *Parser) !Node.Index { |
| 2107 | if (p.eatToken(.keyword_async)) |async_token| { | |
| 2107 | if (p.eatToken(.keyword_async)) |_| { | |
| 2108 | 2108 | var res = try p.expectPrimaryTypeExpr(); |
| 2109 | 2109 | while (true) { |
| 2110 | 2110 | const node = try p.parseSuffixOp(res); |
lib/std/zig/system.zig+2-1| ... | ... | @@ -200,6 +200,7 @@ pub const NativePaths = struct { |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | fn appendArray(self: *NativePaths, array: *ArrayList([:0]u8), s: []const u8) !void { |
| 203 | _ = self; | |
| 203 | 204 | const item = try array.allocator.dupeZ(u8, s); |
| 204 | 205 | errdefer array.allocator.free(item); |
| 205 | 206 | try array.append(item); |
| ... | ... | @@ -332,7 +333,7 @@ pub const NativeTargetInfo = struct { |
| 332 | 333 | if (std.builtin.Version.parse(buf[0 .. len - 1])) |ver| { |
| 333 | 334 | os.version_range.semver.min = ver; |
| 334 | 335 | os.version_range.semver.max = ver; |
| 335 | } else |err| { | |
| 336 | } else |_| { | |
| 336 | 337 | return error.OSVersionDetectionFail; |
| 337 | 338 | } |
| 338 | 339 | }, |
lib/std/zig/system/macos.zig+2-2| ... | ... | @@ -68,10 +68,10 @@ pub fn detect(target_os: *Target.Os) !void { |
| 68 | 68 | return; |
| 69 | 69 | } |
| 70 | 70 | continue; |
| 71 | } else |err| { | |
| 71 | } else |_| { | |
| 72 | 72 | return error.OSVersionDetectionFail; |
| 73 | 73 | } |
| 74 | } else |err| { | |
| 74 | } else |_| { | |
| 75 | 75 | return error.OSVersionDetectionFail; |
| 76 | 76 | } |
| 77 | 77 | } |
lib/std/zig/system/x86.zig+1| ... | ... | @@ -28,6 +28,7 @@ inline fn hasMask(input: u32, mask: u32) bool { |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | pub fn detectNativeCpuAndFeatures(arch: Target.Cpu.Arch, os: Target.Os, cross_target: CrossTarget) Target.Cpu { |
| 31 | _ = cross_target; | |
| 31 | 32 | var cpu = Target.Cpu{ |
| 32 | 33 | .arch = arch, |
| 33 | 34 | .model = Target.Cpu.Model.generic(arch), |
src/AstGen.zig+22-4| ... | ... | @@ -925,6 +925,7 @@ fn suspendExpr( |
| 925 | 925 | rl: ResultLoc, |
| 926 | 926 | node: ast.Node.Index, |
| 927 | 927 | ) InnerError!Zir.Inst.Ref { |
| 928 | _ = rl; | |
| 928 | 929 | const astgen = gz.astgen; |
| 929 | 930 | const gpa = astgen.gpa; |
| 930 | 931 | const tree = astgen.tree; |
| ... | ... | @@ -1208,6 +1209,7 @@ fn arrayInitExprRlNone( |
| 1208 | 1209 | elements: []const ast.Node.Index, |
| 1209 | 1210 | tag: Zir.Inst.Tag, |
| 1210 | 1211 | ) InnerError!Zir.Inst.Ref { |
| 1212 | _ = rl; | |
| 1211 | 1213 | const astgen = gz.astgen; |
| 1212 | 1214 | const gpa = astgen.gpa; |
| 1213 | 1215 | const elem_list = try gpa.alloc(Zir.Inst.Ref, elements.len); |
| ... | ... | @@ -1233,6 +1235,9 @@ fn arrayInitExprRlTy( |
| 1233 | 1235 | elem_ty_inst: Zir.Inst.Ref, |
| 1234 | 1236 | tag: Zir.Inst.Tag, |
| 1235 | 1237 | ) InnerError!Zir.Inst.Ref { |
| 1238 | _ = rl; | |
| 1239 | _ = array_ty_inst; | |
| 1240 | _ = elem_ty_inst; | |
| 1236 | 1241 | const astgen = gz.astgen; |
| 1237 | 1242 | const gpa = astgen.gpa; |
| 1238 | 1243 | |
| ... | ... | @@ -1259,6 +1264,7 @@ fn arrayInitExprRlPtr( |
| 1259 | 1264 | elements: []const ast.Node.Index, |
| 1260 | 1265 | result_ptr: Zir.Inst.Ref, |
| 1261 | 1266 | ) InnerError!Zir.Inst.Ref { |
| 1267 | _ = rl; | |
| 1262 | 1268 | const astgen = gz.astgen; |
| 1263 | 1269 | const gpa = astgen.gpa; |
| 1264 | 1270 | |
| ... | ... | @@ -1368,6 +1374,7 @@ fn structInitExprRlNone( |
| 1368 | 1374 | struct_init: ast.full.StructInit, |
| 1369 | 1375 | tag: Zir.Inst.Tag, |
| 1370 | 1376 | ) InnerError!Zir.Inst.Ref { |
| 1377 | _ = rl; | |
| 1371 | 1378 | const astgen = gz.astgen; |
| 1372 | 1379 | const gpa = astgen.gpa; |
| 1373 | 1380 | const tree = astgen.tree; |
| ... | ... | @@ -1403,6 +1410,7 @@ fn structInitExprRlPtr( |
| 1403 | 1410 | struct_init: ast.full.StructInit, |
| 1404 | 1411 | result_ptr: Zir.Inst.Ref, |
| 1405 | 1412 | ) InnerError!Zir.Inst.Ref { |
| 1413 | _ = rl; | |
| 1406 | 1414 | const astgen = gz.astgen; |
| 1407 | 1415 | const gpa = astgen.gpa; |
| 1408 | 1416 | const tree = astgen.tree; |
| ... | ... | @@ -1439,6 +1447,7 @@ fn structInitExprRlTy( |
| 1439 | 1447 | ty_inst: Zir.Inst.Ref, |
| 1440 | 1448 | tag: Zir.Inst.Tag, |
| 1441 | 1449 | ) InnerError!Zir.Inst.Ref { |
| 1450 | _ = rl; | |
| 1442 | 1451 | const astgen = gz.astgen; |
| 1443 | 1452 | const gpa = astgen.gpa; |
| 1444 | 1453 | const tree = astgen.tree; |
| ... | ... | @@ -1781,6 +1790,7 @@ fn blockExprStmts( |
| 1781 | 1790 | node: ast.Node.Index, |
| 1782 | 1791 | statements: []const ast.Node.Index, |
| 1783 | 1792 | ) !void { |
| 1793 | _ = node; | |
| 1784 | 1794 | const astgen = gz.astgen; |
| 1785 | 1795 | const tree = astgen.tree; |
| 1786 | 1796 | const node_tags = tree.nodes.items(.tag); |
| ... | ... | @@ -2117,6 +2127,7 @@ fn genDefers( |
| 2117 | 2127 | inner_scope: *Scope, |
| 2118 | 2128 | err_code: Zir.Inst.Ref, |
| 2119 | 2129 | ) InnerError!void { |
| 2130 | _ = err_code; | |
| 2120 | 2131 | const astgen = gz.astgen; |
| 2121 | 2132 | const tree = astgen.tree; |
| 2122 | 2133 | const node_datas = tree.nodes.items(.data); |
| ... | ... | @@ -2201,6 +2212,7 @@ fn deferStmt( |
| 2201 | 2212 | block_arena: *Allocator, |
| 2202 | 2213 | scope_tag: Scope.Tag, |
| 2203 | 2214 | ) InnerError!*Scope { |
| 2215 | _ = gz; | |
| 2204 | 2216 | const defer_scope = try block_arena.create(Scope.Defer); |
| 2205 | 2217 | defer_scope.* = .{ |
| 2206 | 2218 | .base = .{ .tag = scope_tag }, |
| ... | ... | @@ -4703,6 +4715,8 @@ fn finishThenElseBlock( |
| 4703 | 4715 | then_break_block: Zir.Inst.Index, |
| 4704 | 4716 | break_tag: Zir.Inst.Tag, |
| 4705 | 4717 | ) InnerError!Zir.Inst.Ref { |
| 4718 | _ = then_src; | |
| 4719 | _ = else_src; | |
| 4706 | 4720 | // We now have enough information to decide whether the result instruction should |
| 4707 | 4721 | // be communicated via result location pointer or break instructions. |
| 4708 | 4722 | const strat = rl.strategy(block_scope); |
| ... | ... | @@ -4886,7 +4900,7 @@ fn ifExpr( |
| 4886 | 4900 | inst: Zir.Inst.Ref, |
| 4887 | 4901 | bool_bit: Zir.Inst.Ref, |
| 4888 | 4902 | } = c: { |
| 4889 | if (if_full.error_token) |error_token| { | |
| 4903 | if (if_full.error_token) |_| { | |
| 4890 | 4904 | const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none; |
| 4891 | 4905 | const err_union = try expr(&block_scope, &block_scope.base, cond_rl, if_full.ast.cond_expr); |
| 4892 | 4906 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_err_ptr else .is_err; |
| ... | ... | @@ -4894,7 +4908,7 @@ fn ifExpr( |
| 4894 | 4908 | .inst = err_union, |
| 4895 | 4909 | .bool_bit = try block_scope.addUnNode(tag, err_union, node), |
| 4896 | 4910 | }; |
| 4897 | } else if (if_full.payload_token) |payload_token| { | |
| 4911 | } else if (if_full.payload_token) |_| { | |
| 4898 | 4912 | const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none; |
| 4899 | 4913 | const optional = try expr(&block_scope, &block_scope.base, cond_rl, if_full.ast.cond_expr); |
| 4900 | 4914 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_null_ptr else .is_non_null; |
| ... | ... | @@ -5146,7 +5160,7 @@ fn whileExpr( |
| 5146 | 5160 | inst: Zir.Inst.Ref, |
| 5147 | 5161 | bool_bit: Zir.Inst.Ref, |
| 5148 | 5162 | } = c: { |
| 5149 | if (while_full.error_token) |error_token| { | |
| 5163 | if (while_full.error_token) |_| { | |
| 5150 | 5164 | const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none; |
| 5151 | 5165 | const err_union = try expr(&continue_scope, &continue_scope.base, cond_rl, while_full.ast.cond_expr); |
| 5152 | 5166 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_err_ptr else .is_err; |
| ... | ... | @@ -5154,7 +5168,7 @@ fn whileExpr( |
| 5154 | 5168 | .inst = err_union, |
| 5155 | 5169 | .bool_bit = try continue_scope.addUnNode(tag, err_union, node), |
| 5156 | 5170 | }; |
| 5157 | } else if (while_full.payload_token) |payload_token| { | |
| 5171 | } else if (while_full.payload_token) |_| { | |
| 5158 | 5172 | const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none; |
| 5159 | 5173 | const optional = try expr(&continue_scope, &continue_scope.base, cond_rl, while_full.ast.cond_expr); |
| 5160 | 5174 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_null_ptr else .is_non_null; |
| ... | ... | @@ -6665,6 +6679,7 @@ fn unionInitRlPtr( |
| 6665 | 6679 | union_type: Zir.Inst.Ref, |
| 6666 | 6680 | field_name: Zir.Inst.Ref, |
| 6667 | 6681 | ) InnerError!Zir.Inst.Ref { |
| 6682 | _ = rl; | |
| 6668 | 6683 | const union_init_ptr = try parent_gz.addPlNode(.union_init_ptr, node, Zir.Inst.UnionInitPtr{ |
| 6669 | 6684 | .result_ptr = result_ptr, |
| 6670 | 6685 | .union_type = union_type, |
| ... | ... | @@ -6753,6 +6768,8 @@ fn bitCastRlPtr( |
| 6753 | 6768 | result_ptr: Zir.Inst.Ref, |
| 6754 | 6769 | rhs: ast.Node.Index, |
| 6755 | 6770 | ) InnerError!Zir.Inst.Ref { |
| 6771 | _ = rl; | |
| 6772 | _ = scope; | |
| 6756 | 6773 | const casted_result_ptr = try gz.addPlNode(.bitcast_result_ptr, node, Zir.Inst.Bin{ |
| 6757 | 6774 | .lhs = dest_type, |
| 6758 | 6775 | .rhs = result_ptr, |
| ... | ... | @@ -8013,6 +8030,7 @@ fn rvalue( |
| 8013 | 8030 | result: Zir.Inst.Ref, |
| 8014 | 8031 | src_node: ast.Node.Index, |
| 8015 | 8032 | ) InnerError!Zir.Inst.Ref { |
| 8033 | _ = scope; | |
| 8016 | 8034 | switch (rl) { |
| 8017 | 8035 | .none, .none_or_ref => return result, |
| 8018 | 8036 | .discard => { |
src/Compilation.zig+1| ... | ... | @@ -523,6 +523,7 @@ pub const AllErrors = struct { |
| 523 | 523 | errors: *std.ArrayList(Message), |
| 524 | 524 | msg: []const u8, |
| 525 | 525 | ) !void { |
| 526 | _ = arena; | |
| 526 | 527 | try errors.append(.{ .plain = .{ .msg = msg } }); |
| 527 | 528 | } |
| 528 | 529 |
src/Module.zig+17-2| ... | ... | @@ -774,7 +774,10 @@ pub const Fn = struct { |
| 774 | 774 | ir.dumpFn(mod, func); |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | pub fn deinit(func: *Fn, gpa: *Allocator) void {} | |
| 777 | pub fn deinit(func: *Fn, gpa: *Allocator) void { | |
| 778 | _ = func; | |
| 779 | _ = gpa; | |
| 780 | } | |
| 778 | 781 | }; |
| 779 | 782 | |
| 780 | 783 | pub const Var = struct { |
| ... | ... | @@ -2209,6 +2212,7 @@ comptime { |
| 2209 | 2212 | } |
| 2210 | 2213 | |
| 2211 | 2214 | pub fn astGenFile(mod: *Module, file: *Scope.File, prog_node: *std.Progress.Node) !void { |
| 2215 | _ = prog_node; | |
| 2212 | 2216 | const tracy = trace(@src()); |
| 2213 | 2217 | defer tracy.end(); |
| 2214 | 2218 | |
| ... | ... | @@ -3128,6 +3132,7 @@ pub const ImportFileResult = struct { |
| 3128 | 3132 | }; |
| 3129 | 3133 | |
| 3130 | 3134 | pub fn importPkg(mod: *Module, cur_pkg: *Package, pkg: *Package) !ImportFileResult { |
| 3135 | _ = cur_pkg; | |
| 3131 | 3136 | const gpa = mod.gpa; |
| 3132 | 3137 | |
| 3133 | 3138 | // The resolved path is used as the key in the import table, to detect if |
| ... | ... | @@ -3384,7 +3389,7 @@ fn scanDecl(iter: *ScanDeclIter, decl_sub_index: usize, flags: u4) InnerError!vo |
| 3384 | 3389 | decl.has_align = has_align; |
| 3385 | 3390 | decl.has_linksection = has_linksection; |
| 3386 | 3391 | decl.zir_decl_index = @intCast(u32, decl_sub_index); |
| 3387 | if (decl.getFunction()) |func| { | |
| 3392 | if (decl.getFunction()) |_| { | |
| 3388 | 3393 | switch (mod.comp.bin_file.tag) { |
| 3389 | 3394 | .coff => { |
| 3390 | 3395 | // TODO Implement for COFF |
| ... | ... | @@ -3753,6 +3758,7 @@ pub fn analyzeExport( |
| 3753 | 3758 | errdefer de_gop.value_ptr.* = mod.gpa.shrink(de_gop.value_ptr.*, de_gop.value_ptr.len - 1); |
| 3754 | 3759 | } |
| 3755 | 3760 | pub fn constInst(mod: *Module, arena: *Allocator, src: LazySrcLoc, typed_value: TypedValue) !*ir.Inst { |
| 3761 | _ = mod; | |
| 3756 | 3762 | const const_inst = try arena.create(ir.Inst.Constant); |
| 3757 | 3763 | const_inst.* = .{ |
| 3758 | 3764 | .base = .{ |
| ... | ... | @@ -4121,6 +4127,7 @@ pub fn floatAdd( |
| 4121 | 4127 | lhs: Value, |
| 4122 | 4128 | rhs: Value, |
| 4123 | 4129 | ) !Value { |
| 4130 | _ = src; | |
| 4124 | 4131 | switch (float_type.tag()) { |
| 4125 | 4132 | .f16 => { |
| 4126 | 4133 | @panic("TODO add __trunctfhf2 to compiler-rt"); |
| ... | ... | @@ -4154,6 +4161,7 @@ pub fn floatSub( |
| 4154 | 4161 | lhs: Value, |
| 4155 | 4162 | rhs: Value, |
| 4156 | 4163 | ) !Value { |
| 4164 | _ = src; | |
| 4157 | 4165 | switch (float_type.tag()) { |
| 4158 | 4166 | .f16 => { |
| 4159 | 4167 | @panic("TODO add __trunctfhf2 to compiler-rt"); |
| ... | ... | @@ -4187,6 +4195,7 @@ pub fn floatDiv( |
| 4187 | 4195 | lhs: Value, |
| 4188 | 4196 | rhs: Value, |
| 4189 | 4197 | ) !Value { |
| 4198 | _ = src; | |
| 4190 | 4199 | switch (float_type.tag()) { |
| 4191 | 4200 | .f16 => { |
| 4192 | 4201 | @panic("TODO add __trunctfhf2 to compiler-rt"); |
| ... | ... | @@ -4220,6 +4229,7 @@ pub fn floatMul( |
| 4220 | 4229 | lhs: Value, |
| 4221 | 4230 | rhs: Value, |
| 4222 | 4231 | ) !Value { |
| 4232 | _ = src; | |
| 4223 | 4233 | switch (float_type.tag()) { |
| 4224 | 4234 | .f16 => { |
| 4225 | 4235 | @panic("TODO add __trunctfhf2 to compiler-rt"); |
| ... | ... | @@ -4253,6 +4263,7 @@ pub fn simplePtrType( |
| 4253 | 4263 | mutable: bool, |
| 4254 | 4264 | size: std.builtin.TypeInfo.Pointer.Size, |
| 4255 | 4265 | ) Allocator.Error!Type { |
| 4266 | _ = mod; | |
| 4256 | 4267 | if (!mutable and size == .Slice and elem_ty.eql(Type.initTag(.u8))) { |
| 4257 | 4268 | return Type.initTag(.const_slice_u8); |
| 4258 | 4269 | } |
| ... | ... | @@ -4287,6 +4298,7 @@ pub fn ptrType( |
| 4287 | 4298 | @"volatile": bool, |
| 4288 | 4299 | size: std.builtin.TypeInfo.Pointer.Size, |
| 4289 | 4300 | ) Allocator.Error!Type { |
| 4301 | _ = mod; | |
| 4290 | 4302 | assert(host_size == 0 or bit_offset < host_size * 8); |
| 4291 | 4303 | |
| 4292 | 4304 | // TODO check if type can be represented by simplePtrType |
| ... | ... | @@ -4304,6 +4316,7 @@ pub fn ptrType( |
| 4304 | 4316 | } |
| 4305 | 4317 | |
| 4306 | 4318 | pub fn optionalType(mod: *Module, arena: *Allocator, child_type: Type) Allocator.Error!Type { |
| 4319 | _ = mod; | |
| 4307 | 4320 | switch (child_type.tag()) { |
| 4308 | 4321 | .single_const_pointer => return Type.Tag.optional_single_const_pointer.create( |
| 4309 | 4322 | arena, |
| ... | ... | @@ -4324,6 +4337,7 @@ pub fn arrayType( |
| 4324 | 4337 | sentinel: ?Value, |
| 4325 | 4338 | elem_type: Type, |
| 4326 | 4339 | ) Allocator.Error!Type { |
| 4340 | _ = mod; | |
| 4327 | 4341 | if (elem_type.eql(Type.initTag(.u8))) { |
| 4328 | 4342 | if (sentinel) |some| { |
| 4329 | 4343 | if (some.eql(Value.initTag(.zero))) { |
| ... | ... | @@ -4354,6 +4368,7 @@ pub fn errorUnionType( |
| 4354 | 4368 | error_set: Type, |
| 4355 | 4369 | payload: Type, |
| 4356 | 4370 | ) Allocator.Error!Type { |
| 4371 | _ = mod; | |
| 4357 | 4372 | assert(error_set.zigTypeTag() == .ErrorSet); |
| 4358 | 4373 | if (error_set.eql(Type.initTag(.anyerror)) and payload.eql(Type.initTag(.void))) { |
| 4359 | 4374 | return Type.initTag(.anyerror_void_error_union); |
src/Sema.zig+34| ... | ... | @@ -702,6 +702,7 @@ fn zirBitcastResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) I |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | fn zirCoerceResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 705 | _ = inst; | |
| 705 | 706 | const tracy = trace(@src()); |
| 706 | 707 | defer tracy.end(); |
| 707 | 708 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirCoerceResultPtr", .{}); |
| ... | ... | @@ -776,6 +777,7 @@ fn zirStructDecl( |
| 776 | 777 | } |
| 777 | 778 | |
| 778 | 779 | fn createTypeName(sema: *Sema, block: *Scope.Block, name_strategy: Zir.Inst.NameStrategy) ![:0]u8 { |
| 780 | _ = block; | |
| 779 | 781 | switch (name_strategy) { |
| 780 | 782 | .anon => { |
| 781 | 783 | // It would be neat to have "struct:line:column" but this name has |
| ... | ... | @@ -1067,6 +1069,7 @@ fn zirOpaqueDecl( |
| 1067 | 1069 | inst: Zir.Inst.Index, |
| 1068 | 1070 | name_strategy: Zir.Inst.NameStrategy, |
| 1069 | 1071 | ) InnerError!*Inst { |
| 1072 | _ = name_strategy; | |
| 1070 | 1073 | const tracy = trace(@src()); |
| 1071 | 1074 | defer tracy.end(); |
| 1072 | 1075 | |
| ... | ... | @@ -1242,6 +1245,7 @@ fn zirArg(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*In |
| 1242 | 1245 | // TODO check if arg_name shadows a Decl |
| 1243 | 1246 | |
| 1244 | 1247 | if (block.inlining) |inlining| { |
| 1248 | _ = inlining; | |
| 1245 | 1249 | return sema.param_inst_list[arg_index]; |
| 1246 | 1250 | } |
| 1247 | 1251 | |
| ... | ... | @@ -1640,6 +1644,7 @@ fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*In |
| 1640 | 1644 | } |
| 1641 | 1645 | |
| 1642 | 1646 | fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 1647 | _ = block; | |
| 1643 | 1648 | const tracy = trace(@src()); |
| 1644 | 1649 | defer tracy.end(); |
| 1645 | 1650 | |
| ... | ... | @@ -1648,6 +1653,7 @@ fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*In |
| 1648 | 1653 | } |
| 1649 | 1654 | |
| 1650 | 1655 | fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 1656 | _ = block; | |
| 1651 | 1657 | const tracy = trace(@src()); |
| 1652 | 1658 | defer tracy.end(); |
| 1653 | 1659 | |
| ... | ... | @@ -1665,6 +1671,7 @@ fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 1665 | 1671 | } |
| 1666 | 1672 | |
| 1667 | 1673 | fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 1674 | _ = block; | |
| 1668 | 1675 | const arena = sema.arena; |
| 1669 | 1676 | const inst_data = sema.code.instructions.items(.data)[inst].float; |
| 1670 | 1677 | const src = inst_data.src(); |
| ... | ... | @@ -1677,6 +1684,7 @@ fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!* |
| 1677 | 1684 | } |
| 1678 | 1685 | |
| 1679 | 1686 | fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 1687 | _ = block; | |
| 1680 | 1688 | const arena = sema.arena; |
| 1681 | 1689 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 1682 | 1690 | const extra = sema.code.extraData(Zir.Inst.Float128, inst_data.payload_index).data; |
| ... | ... | @@ -2358,6 +2366,7 @@ fn analyzeCall( |
| 2358 | 2366 | } |
| 2359 | 2367 | |
| 2360 | 2368 | fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 2369 | _ = block; | |
| 2361 | 2370 | const tracy = trace(@src()); |
| 2362 | 2371 | defer tracy.end(); |
| 2363 | 2372 | |
| ... | ... | @@ -2466,6 +2475,7 @@ fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inn |
| 2466 | 2475 | } |
| 2467 | 2476 | |
| 2468 | 2477 | fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 2478 | _ = block; | |
| 2469 | 2479 | const tracy = trace(@src()); |
| 2470 | 2480 | defer tracy.end(); |
| 2471 | 2481 | |
| ... | ... | @@ -2626,6 +2636,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inn |
| 2626 | 2636 | } |
| 2627 | 2637 | |
| 2628 | 2638 | fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 2639 | _ = block; | |
| 2629 | 2640 | const tracy = trace(@src()); |
| 2630 | 2641 | defer tracy.end(); |
| 2631 | 2642 | |
| ... | ... | @@ -3056,6 +3067,7 @@ fn funcCommon( |
| 3056 | 3067 | src_locs: Zir.Inst.Func.SrcLocs, |
| 3057 | 3068 | opt_lib_name: ?[]const u8, |
| 3058 | 3069 | ) InnerError!*Inst { |
| 3070 | _ = inferred_error_set; | |
| 3059 | 3071 | const src: LazySrcLoc = .{ .node_offset = src_node_offset }; |
| 3060 | 3072 | const ret_ty_src: LazySrcLoc = .{ .node_offset_fn_type_ret_ty = src_node_offset }; |
| 3061 | 3073 | const return_type = try sema.resolveType(block, ret_ty_src, zir_return_type); |
| ... | ... | @@ -3492,6 +3504,8 @@ fn zirSwitchCapture( |
| 3492 | 3504 | is_multi: bool, |
| 3493 | 3505 | is_ref: bool, |
| 3494 | 3506 | ) InnerError!*Inst { |
| 3507 | _ = is_ref; | |
| 3508 | _ = is_multi; | |
| 3495 | 3509 | const tracy = trace(@src()); |
| 3496 | 3510 | defer tracy.end(); |
| 3497 | 3511 | |
| ... | ... | @@ -3509,6 +3523,7 @@ fn zirSwitchCaptureElse( |
| 3509 | 3523 | inst: Zir.Inst.Index, |
| 3510 | 3524 | is_ref: bool, |
| 3511 | 3525 | ) InnerError!*Inst { |
| 3526 | _ = is_ref; | |
| 3512 | 3527 | const tracy = trace(@src()); |
| 3513 | 3528 | defer tracy.end(); |
| 3514 | 3529 | |
| ... | ... | @@ -4511,12 +4526,15 @@ fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 4511 | 4526 | } |
| 4512 | 4527 | |
| 4513 | 4528 | fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 4529 | _ = block; | |
| 4530 | _ = inst; | |
| 4514 | 4531 | const tracy = trace(@src()); |
| 4515 | 4532 | defer tracy.end(); |
| 4516 | 4533 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirShl", .{}); |
| 4517 | 4534 | } |
| 4518 | 4535 | |
| 4519 | 4536 | fn zirShr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 4537 | _ = inst; | |
| 4520 | 4538 | const tracy = trace(@src()); |
| 4521 | 4539 | defer tracy.end(); |
| 4522 | 4540 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirShr", .{}); |
| ... | ... | @@ -4586,18 +4604,21 @@ fn zirBitwise( |
| 4586 | 4604 | } |
| 4587 | 4605 | |
| 4588 | 4606 | fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 4607 | _ = inst; | |
| 4589 | 4608 | const tracy = trace(@src()); |
| 4590 | 4609 | defer tracy.end(); |
| 4591 | 4610 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirBitNot", .{}); |
| 4592 | 4611 | } |
| 4593 | 4612 | |
| 4594 | 4613 | fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 4614 | _ = inst; | |
| 4595 | 4615 | const tracy = trace(@src()); |
| 4596 | 4616 | defer tracy.end(); |
| 4597 | 4617 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirArrayCat", .{}); |
| 4598 | 4618 | } |
| 4599 | 4619 | |
| 4600 | 4620 | fn zirArrayMul(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 4621 | _ = inst; | |
| 4601 | 4622 | const tracy = trace(@src()); |
| 4602 | 4623 | defer tracy.end(); |
| 4603 | 4624 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirArrayMul", .{}); |
| ... | ... | @@ -5059,6 +5080,7 @@ fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 5059 | 5080 | } |
| 5060 | 5081 | |
| 5061 | 5082 | fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 5083 | _ = block; | |
| 5062 | 5084 | const zir_datas = sema.code.instructions.items(.data); |
| 5063 | 5085 | const inst_data = zir_datas[inst].un_node; |
| 5064 | 5086 | const src = inst_data.src(); |
| ... | ... | @@ -5067,6 +5089,7 @@ fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 5067 | 5089 | } |
| 5068 | 5090 | |
| 5069 | 5091 | fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst { |
| 5092 | _ = block; | |
| 5070 | 5093 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5071 | 5094 | const src = inst_data.src(); |
| 5072 | 5095 | const operand_ptr = try sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -5504,6 +5527,7 @@ fn zirUnionInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner |
| 5504 | 5527 | } |
| 5505 | 5528 | |
| 5506 | 5529 | fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!*Inst { |
| 5530 | _ = is_ref; | |
| 5507 | 5531 | const mod = sema.mod; |
| 5508 | 5532 | const gpa = sema.gpa; |
| 5509 | 5533 | const zir_datas = sema.code.instructions.items(.data); |
| ... | ... | @@ -5613,18 +5637,21 @@ fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: |
| 5613 | 5637 | } |
| 5614 | 5638 | |
| 5615 | 5639 | fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!*Inst { |
| 5640 | _ = is_ref; | |
| 5616 | 5641 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5617 | 5642 | const src = inst_data.src(); |
| 5618 | 5643 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirStructInitAnon", .{}); |
| 5619 | 5644 | } |
| 5620 | 5645 | |
| 5621 | 5646 | fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!*Inst { |
| 5647 | _ = is_ref; | |
| 5622 | 5648 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5623 | 5649 | const src = inst_data.src(); |
| 5624 | 5650 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInit", .{}); |
| 5625 | 5651 | } |
| 5626 | 5652 | |
| 5627 | 5653 | fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!*Inst { |
| 5654 | _ = is_ref; | |
| 5628 | 5655 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5629 | 5656 | const src = inst_data.src(); |
| 5630 | 5657 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInitAnon", .{}); |
| ... | ... | @@ -6021,6 +6048,7 @@ fn zirAwait( |
| 6021 | 6048 | inst: Zir.Inst.Index, |
| 6022 | 6049 | is_nosuspend: bool, |
| 6023 | 6050 | ) InnerError!*Inst { |
| 6051 | _ = is_nosuspend; | |
| 6024 | 6052 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6025 | 6053 | const src = inst_data.src(); |
| 6026 | 6054 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAwait", .{}); |
| ... | ... | @@ -6302,6 +6330,8 @@ fn addSafetyCheck(sema: *Sema, parent_block: *Scope.Block, ok: *Inst, panic_id: |
| 6302 | 6330 | } |
| 6303 | 6331 | |
| 6304 | 6332 | fn safetyPanic(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, panic_id: PanicId) !Zir.Inst.Index { |
| 6333 | _ = sema; | |
| 6334 | _ = panic_id; | |
| 6305 | 6335 | // TODO Once we have a panic function to call, call it here instead of breakpoint. |
| 6306 | 6336 | _ = try block.addNoOp(src, Type.initTag(.void), .breakpoint); |
| 6307 | 6337 | _ = try block.addNoOp(src, Type.initTag(.noreturn), .unreach); |
| ... | ... | @@ -6600,6 +6630,8 @@ fn elemPtrArray( |
| 6600 | 6630 | elem_index: *Inst, |
| 6601 | 6631 | elem_index_src: LazySrcLoc, |
| 6602 | 6632 | ) InnerError!*Inst { |
| 6633 | _ = elem_index; | |
| 6634 | _ = elem_index_src; | |
| 6603 | 6635 | if (array_ptr.value()) |array_ptr_val| { |
| 6604 | 6636 | if (elem_index.value()) |index_val| { |
| 6605 | 6637 | // Both array pointer and index are compile-time known. |
| ... | ... | @@ -7510,6 +7542,8 @@ fn resolveBuiltinTypeFields( |
| 7510 | 7542 | ty: Type, |
| 7511 | 7543 | name: []const u8, |
| 7512 | 7544 | ) InnerError!Type { |
| 7545 | _ = ty; | |
| 7546 | _ = name; | |
| 7513 | 7547 | const resolved_ty = try sema.getBuiltinType(block, src, name); |
| 7514 | 7548 | return sema.resolveTypeFields(block, src, resolved_ty); |
| 7515 | 7549 | } |
src/Zir.zig+2| ... | ... | @@ -4433,6 +4433,7 @@ const Writer = struct { |
| 4433 | 4433 | } |
| 4434 | 4434 | |
| 4435 | 4435 | fn writeInstIndex(self: *Writer, stream: anytype, inst: Inst.Index) !void { |
| 4436 | _ = self; | |
| 4436 | 4437 | return stream.print("%{d}", .{inst}); |
| 4437 | 4438 | } |
| 4438 | 4439 | |
| ... | ... | @@ -4453,6 +4454,7 @@ const Writer = struct { |
| 4453 | 4454 | name: []const u8, |
| 4454 | 4455 | flag: bool, |
| 4455 | 4456 | ) !void { |
| 4457 | _ = self; | |
| 4456 | 4458 | if (!flag) return; |
| 4457 | 4459 | try stream.writeAll(name); |
| 4458 | 4460 | } |
src/air.zig+36| ... | ... | @@ -304,9 +304,12 @@ pub const Inst = struct { |
| 304 | 304 | base: Inst, |
| 305 | 305 | |
| 306 | 306 | pub fn operandCount(self: *const NoOp) usize { |
| 307 | _ = self; | |
| 307 | 308 | return 0; |
| 308 | 309 | } |
| 309 | 310 | pub fn getOperand(self: *const NoOp, index: usize) ?*Inst { |
| 311 | _ = self; | |
| 312 | _ = index; | |
| 310 | 313 | return null; |
| 311 | 314 | } |
| 312 | 315 | }; |
| ... | ... | @@ -316,6 +319,7 @@ pub const Inst = struct { |
| 316 | 319 | operand: *Inst, |
| 317 | 320 | |
| 318 | 321 | pub fn operandCount(self: *const UnOp) usize { |
| 322 | _ = self; | |
| 319 | 323 | return 1; |
| 320 | 324 | } |
| 321 | 325 | pub fn getOperand(self: *const UnOp, index: usize) ?*Inst { |
| ... | ... | @@ -331,6 +335,7 @@ pub const Inst = struct { |
| 331 | 335 | rhs: *Inst, |
| 332 | 336 | |
| 333 | 337 | pub fn operandCount(self: *const BinOp) usize { |
| 338 | _ = self; | |
| 334 | 339 | return 2; |
| 335 | 340 | } |
| 336 | 341 | pub fn getOperand(self: *const BinOp, index: usize) ?*Inst { |
| ... | ... | @@ -356,9 +361,12 @@ pub const Inst = struct { |
| 356 | 361 | name: [*:0]const u8, |
| 357 | 362 | |
| 358 | 363 | pub fn operandCount(self: *const Arg) usize { |
| 364 | _ = self; | |
| 359 | 365 | return 0; |
| 360 | 366 | } |
| 361 | 367 | pub fn getOperand(self: *const Arg, index: usize) ?*Inst { |
| 368 | _ = self; | |
| 369 | _ = index; | |
| 362 | 370 | return null; |
| 363 | 371 | } |
| 364 | 372 | }; |
| ... | ... | @@ -391,9 +399,12 @@ pub const Inst = struct { |
| 391 | 399 | body: Body, |
| 392 | 400 | |
| 393 | 401 | pub fn operandCount(self: *const Block) usize { |
| 402 | _ = self; | |
| 394 | 403 | return 0; |
| 395 | 404 | } |
| 396 | 405 | pub fn getOperand(self: *const Block, index: usize) ?*Inst { |
| 406 | _ = self; | |
| 407 | _ = index; | |
| 397 | 408 | return null; |
| 398 | 409 | } |
| 399 | 410 | }; |
| ... | ... | @@ -412,9 +423,12 @@ pub const Inst = struct { |
| 412 | 423 | body: Body, |
| 413 | 424 | |
| 414 | 425 | pub fn operandCount(self: *const BrBlockFlat) usize { |
| 426 | _ = self; | |
| 415 | 427 | return 0; |
| 416 | 428 | } |
| 417 | 429 | pub fn getOperand(self: *const BrBlockFlat, index: usize) ?*Inst { |
| 430 | _ = self; | |
| 431 | _ = index; | |
| 418 | 432 | return null; |
| 419 | 433 | } |
| 420 | 434 | }; |
| ... | ... | @@ -427,9 +441,11 @@ pub const Inst = struct { |
| 427 | 441 | operand: *Inst, |
| 428 | 442 | |
| 429 | 443 | pub fn operandCount(self: *const Br) usize { |
| 444 | _ = self; | |
| 430 | 445 | return 1; |
| 431 | 446 | } |
| 432 | 447 | pub fn getOperand(self: *const Br, index: usize) ?*Inst { |
| 448 | _ = self; | |
| 433 | 449 | if (index == 0) |
| 434 | 450 | return self.operand; |
| 435 | 451 | return null; |
| ... | ... | @@ -443,9 +459,12 @@ pub const Inst = struct { |
| 443 | 459 | block: *Block, |
| 444 | 460 | |
| 445 | 461 | pub fn operandCount(self: *const BrVoid) usize { |
| 462 | _ = self; | |
| 446 | 463 | return 0; |
| 447 | 464 | } |
| 448 | 465 | pub fn getOperand(self: *const BrVoid, index: usize) ?*Inst { |
| 466 | _ = self; | |
| 467 | _ = index; | |
| 449 | 468 | return null; |
| 450 | 469 | } |
| 451 | 470 | }; |
| ... | ... | @@ -490,6 +509,7 @@ pub const Inst = struct { |
| 490 | 509 | else_death_count: u32 = 0, |
| 491 | 510 | |
| 492 | 511 | pub fn operandCount(self: *const CondBr) usize { |
| 512 | _ = self; | |
| 493 | 513 | return 1; |
| 494 | 514 | } |
| 495 | 515 | pub fn getOperand(self: *const CondBr, index: usize) ?*Inst { |
| ... | ... | @@ -516,9 +536,12 @@ pub const Inst = struct { |
| 516 | 536 | val: Value, |
| 517 | 537 | |
| 518 | 538 | pub fn operandCount(self: *const Constant) usize { |
| 539 | _ = self; | |
| 519 | 540 | return 0; |
| 520 | 541 | } |
| 521 | 542 | pub fn getOperand(self: *const Constant, index: usize) ?*Inst { |
| 543 | _ = self; | |
| 544 | _ = index; | |
| 522 | 545 | return null; |
| 523 | 546 | } |
| 524 | 547 | }; |
| ... | ... | @@ -530,9 +553,12 @@ pub const Inst = struct { |
| 530 | 553 | body: Body, |
| 531 | 554 | |
| 532 | 555 | pub fn operandCount(self: *const Loop) usize { |
| 556 | _ = self; | |
| 533 | 557 | return 0; |
| 534 | 558 | } |
| 535 | 559 | pub fn getOperand(self: *const Loop, index: usize) ?*Inst { |
| 560 | _ = self; | |
| 561 | _ = index; | |
| 536 | 562 | return null; |
| 537 | 563 | } |
| 538 | 564 | }; |
| ... | ... | @@ -544,9 +570,12 @@ pub const Inst = struct { |
| 544 | 570 | variable: *Module.Var, |
| 545 | 571 | |
| 546 | 572 | pub fn operandCount(self: *const VarPtr) usize { |
| 573 | _ = self; | |
| 547 | 574 | return 0; |
| 548 | 575 | } |
| 549 | 576 | pub fn getOperand(self: *const VarPtr, index: usize) ?*Inst { |
| 577 | _ = self; | |
| 578 | _ = index; | |
| 550 | 579 | return null; |
| 551 | 580 | } |
| 552 | 581 | }; |
| ... | ... | @@ -559,9 +588,12 @@ pub const Inst = struct { |
| 559 | 588 | field_index: usize, |
| 560 | 589 | |
| 561 | 590 | pub fn operandCount(self: *const StructFieldPtr) usize { |
| 591 | _ = self; | |
| 562 | 592 | return 1; |
| 563 | 593 | } |
| 564 | 594 | pub fn getOperand(self: *const StructFieldPtr, index: usize) ?*Inst { |
| 595 | _ = self; | |
| 596 | _ = index; | |
| 565 | 597 | var i = index; |
| 566 | 598 | |
| 567 | 599 | if (i < 1) |
| ... | ... | @@ -593,6 +625,7 @@ pub const Inst = struct { |
| 593 | 625 | }; |
| 594 | 626 | |
| 595 | 627 | pub fn operandCount(self: *const SwitchBr) usize { |
| 628 | _ = self; | |
| 596 | 629 | return 1; |
| 597 | 630 | } |
| 598 | 631 | pub fn getOperand(self: *const SwitchBr, index: usize) ?*Inst { |
| ... | ... | @@ -621,9 +654,12 @@ pub const Inst = struct { |
| 621 | 654 | column: u32, |
| 622 | 655 | |
| 623 | 656 | pub fn operandCount(self: *const DbgStmt) usize { |
| 657 | _ = self; | |
| 624 | 658 | return 0; |
| 625 | 659 | } |
| 626 | 660 | pub fn getOperand(self: *const DbgStmt, index: usize) ?*Inst { |
| 661 | _ = self; | |
| 662 | _ = index; | |
| 627 | 663 | return null; |
| 628 | 664 | } |
| 629 | 665 | }; |
src/codegen.zig+22-15| ... | ... | @@ -564,7 +564,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 564 | 564 | .r11 = true, // fp |
| 565 | 565 | .r14 = true, // lr |
| 566 | 566 | }; |
| 567 | inline for (callee_preserved_regs) |reg, i| { | |
| 567 | inline for (callee_preserved_regs) |reg| { | |
| 568 | 568 | if (self.register_manager.isRegAllocated(reg)) { |
| 569 | 569 | @field(saved_regs, @tagName(reg)) = true; |
| 570 | 570 | } |
| ... | ... | @@ -602,7 +602,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 602 | 602 | } else { |
| 603 | 603 | if (math.cast(i26, amt)) |offset| { |
| 604 | 604 | writeInt(u32, self.code.items[jmp_reloc..][0..4], Instruction.b(.al, offset).toU32()); |
| 605 | } else |err| { | |
| 605 | } else |_| { | |
| 606 | 606 | return self.failSymbol("exitlude jump is too large", .{}); |
| 607 | 607 | } |
| 608 | 608 | } |
| ... | ... | @@ -675,7 +675,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 675 | 675 | } else { |
| 676 | 676 | if (math.cast(i28, amt)) |offset| { |
| 677 | 677 | writeInt(u32, self.code.items[jmp_reloc..][0..4], Instruction.b(offset).toU32()); |
| 678 | } else |err| { | |
| 678 | } else |_| { | |
| 679 | 679 | return self.failSymbol("exitlude jump is too large", .{}); |
| 680 | 680 | } |
| 681 | 681 | } |
| ... | ... | @@ -1497,6 +1497,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1497 | 1497 | swap_lhs_and_rhs: bool, |
| 1498 | 1498 | op: ir.Inst.Tag, |
| 1499 | 1499 | ) !void { |
| 1500 | _ = src; | |
| 1500 | 1501 | assert(lhs_mcv == .register or rhs_mcv == .register); |
| 1501 | 1502 | |
| 1502 | 1503 | const op1 = if (swap_lhs_and_rhs) rhs_mcv.register else lhs_mcv.register; |
| ... | ... | @@ -1905,6 +1906,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1905 | 1906 | try self.genX8664ModRMRegToStack(src, dst_ty, off, src_reg, mr + 0x1); |
| 1906 | 1907 | }, |
| 1907 | 1908 | .immediate => |imm| { |
| 1909 | _ = imm; | |
| 1908 | 1910 | return self.fail(src, "TODO implement x86 ADD/SUB/CMP source immediate", .{}); |
| 1909 | 1911 | }, |
| 1910 | 1912 | .embedded_in_code, .memory, .stack_offset => { |
| ... | ... | @@ -2054,6 +2056,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 2054 | 2056 | return self.genSetStack(src, dst_ty, off, MCValue{ .register = dst_reg }); |
| 2055 | 2057 | }, |
| 2056 | 2058 | .immediate => |imm| { |
| 2059 | _ = imm; | |
| 2057 | 2060 | return self.fail(src, "TODO implement x86 multiply source immediate", .{}); |
| 2058 | 2061 | }, |
| 2059 | 2062 | .embedded_in_code, .memory, .stack_offset => { |
| ... | ... | @@ -2982,14 +2985,14 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 2982 | 2985 | .arm, .armeb => { |
| 2983 | 2986 | if (math.cast(i26, @intCast(i32, index) - @intCast(i32, self.code.items.len + 8))) |delta| { |
| 2984 | 2987 | writeInt(u32, try self.code.addManyAsArray(4), Instruction.b(.al, delta).toU32()); |
| 2985 | } else |err| { | |
| 2988 | } else |_| { | |
| 2986 | 2989 | return self.fail(src, "TODO: enable larger branch offset", .{}); |
| 2987 | 2990 | } |
| 2988 | 2991 | }, |
| 2989 | 2992 | .aarch64, .aarch64_be, .aarch64_32 => { |
| 2990 | 2993 | if (math.cast(i28, @intCast(i32, index) - @intCast(i32, self.code.items.len + 8))) |delta| { |
| 2991 | 2994 | writeInt(u32, try self.code.addManyAsArray(4), Instruction.b(delta).toU32()); |
| 2992 | } else |err| { | |
| 2995 | } else |_| { | |
| 2993 | 2996 | return self.fail(src, "TODO: enable larger branch offset", .{}); |
| 2994 | 2997 | } |
| 2995 | 2998 | }, |
| ... | ... | @@ -3307,16 +3310,18 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 3307 | 3310 | } |
| 3308 | 3311 | }, |
| 3309 | 3312 | .compare_flags_unsigned => |op| { |
| 3313 | _ = op; | |
| 3310 | 3314 | return self.fail(src, "TODO implement set stack variable with compare flags value (unsigned)", .{}); |
| 3311 | 3315 | }, |
| 3312 | 3316 | .compare_flags_signed => |op| { |
| 3317 | _ = op; | |
| 3313 | 3318 | return self.fail(src, "TODO implement set stack variable with compare flags value (signed)", .{}); |
| 3314 | 3319 | }, |
| 3315 | 3320 | .immediate => { |
| 3316 | 3321 | const reg = try self.copyToTmpRegister(src, ty, mcv); |
| 3317 | 3322 | return self.genSetStack(src, ty, stack_offset, MCValue{ .register = reg }); |
| 3318 | 3323 | }, |
| 3319 | .embedded_in_code => |code_offset| { | |
| 3324 | .embedded_in_code => { | |
| 3320 | 3325 | return self.fail(src, "TODO implement set stack variable from embedded_in_code", .{}); |
| 3321 | 3326 | }, |
| 3322 | 3327 | .register => |reg| { |
| ... | ... | @@ -3352,7 +3357,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 3352 | 3357 | else => return self.fail(src, "TODO implement storing other types abi_size={}", .{abi_size}), |
| 3353 | 3358 | } |
| 3354 | 3359 | }, |
| 3355 | .memory => |vaddr| { | |
| 3360 | .memory => { | |
| 3356 | 3361 | return self.fail(src, "TODO implement set stack variable from memory vaddr", .{}); |
| 3357 | 3362 | }, |
| 3358 | 3363 | .stack_offset => |off| { |
| ... | ... | @@ -3380,10 +3385,10 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 3380 | 3385 | else => return self.fail(src, "TODO implement memset", .{}), |
| 3381 | 3386 | } |
| 3382 | 3387 | }, |
| 3383 | .compare_flags_unsigned => |op| { | |
| 3388 | .compare_flags_unsigned => { | |
| 3384 | 3389 | return self.fail(src, "TODO implement set stack variable with compare flags value (unsigned)", .{}); |
| 3385 | 3390 | }, |
| 3386 | .compare_flags_signed => |op| { | |
| 3391 | .compare_flags_signed => { | |
| 3387 | 3392 | return self.fail(src, "TODO implement set stack variable with compare flags value (signed)", .{}); |
| 3388 | 3393 | }, |
| 3389 | 3394 | .immediate => |x_big| { |
| ... | ... | @@ -3435,13 +3440,13 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 3435 | 3440 | }, |
| 3436 | 3441 | } |
| 3437 | 3442 | }, |
| 3438 | .embedded_in_code => |code_offset| { | |
| 3443 | .embedded_in_code => { | |
| 3439 | 3444 | return self.fail(src, "TODO implement set stack variable from embedded_in_code", .{}); |
| 3440 | 3445 | }, |
| 3441 | 3446 | .register => |reg| { |
| 3442 | 3447 | try self.genX8664ModRMRegToStack(src, ty, stack_offset, reg, 0x89); |
| 3443 | 3448 | }, |
| 3444 | .memory => |vaddr| { | |
| 3449 | .memory => { | |
| 3445 | 3450 | return self.fail(src, "TODO implement set stack variable from memory vaddr", .{}); |
| 3446 | 3451 | }, |
| 3447 | 3452 | .stack_offset => |off| { |
| ... | ... | @@ -3469,17 +3474,17 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 3469 | 3474 | else => return self.fail(src, "TODO implement memset", .{}), |
| 3470 | 3475 | } |
| 3471 | 3476 | }, |
| 3472 | .compare_flags_unsigned => |op| { | |
| 3477 | .compare_flags_unsigned => { | |
| 3473 | 3478 | return self.fail(src, "TODO implement set stack variable with compare flags value (unsigned)", .{}); |
| 3474 | 3479 | }, |
| 3475 | .compare_flags_signed => |op| { | |
| 3480 | .compare_flags_signed => { | |
| 3476 | 3481 | return self.fail(src, "TODO implement set stack variable with compare flags value (signed)", .{}); |
| 3477 | 3482 | }, |
| 3478 | 3483 | .immediate => { |
| 3479 | 3484 | const reg = try self.copyToTmpRegister(src, ty, mcv); |
| 3480 | 3485 | return self.genSetStack(src, ty, stack_offset, MCValue{ .register = reg }); |
| 3481 | 3486 | }, |
| 3482 | .embedded_in_code => |code_offset| { | |
| 3487 | .embedded_in_code => { | |
| 3483 | 3488 | return self.fail(src, "TODO implement set stack variable from embedded_in_code", .{}); |
| 3484 | 3489 | }, |
| 3485 | 3490 | .register => |reg| { |
| ... | ... | @@ -3511,7 +3516,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 3511 | 3516 | else => return self.fail(src, "TODO implement storing other types abi_size={}", .{abi_size}), |
| 3512 | 3517 | } |
| 3513 | 3518 | }, |
| 3514 | .memory => |vaddr| { | |
| 3519 | .memory => { | |
| 3515 | 3520 | return self.fail(src, "TODO implement set stack variable from memory vaddr", .{}); |
| 3516 | 3521 | }, |
| 3517 | 3522 | .stack_offset => |off| { |
| ... | ... | @@ -3842,6 +3847,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 3842 | 3847 | ); |
| 3843 | 3848 | }, |
| 3844 | 3849 | .compare_flags_signed => |op| { |
| 3850 | _ = op; | |
| 3845 | 3851 | return self.fail(src, "TODO set register with compare flags value (signed)", .{}); |
| 3846 | 3852 | }, |
| 3847 | 3853 | .immediate => |x| { |
| ... | ... | @@ -4460,6 +4466,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 4460 | 4466 | dummy, |
| 4461 | 4467 | |
| 4462 | 4468 | pub fn allocIndex(self: Register) ?u4 { |
| 4469 | _ = self; | |
| 4463 | 4470 | return null; |
| 4464 | 4471 | } |
| 4465 | 4472 | }; |
src/codegen/arm.zig+1-1| ... | ... | @@ -674,7 +674,7 @@ pub const Instruction = union(enum) { |
| 674 | 674 | }; |
| 675 | 675 | const imm4h: u4 = switch (offset) { |
| 676 | 676 | .immediate => |imm| @truncate(u4, imm >> 4), |
| 677 | .register => |reg| 0b0000, | |
| 677 | .register => 0b0000, | |
| 678 | 678 | }; |
| 679 | 679 | |
| 680 | 680 | return Instruction{ |
src/codegen/c.zig+9| ... | ... | @@ -47,6 +47,8 @@ fn formatTypeAsCIdentifier( |
| 47 | 47 | options: std.fmt.FormatOptions, |
| 48 | 48 | writer: anytype, |
| 49 | 49 | ) !void { |
| 50 | _ = fmt; | |
| 51 | _ = options; | |
| 50 | 52 | var buffer = [1]u8{0} ** 128; |
| 51 | 53 | // We don't care if it gets cut off, it's still more unique than a number |
| 52 | 54 | var buf = std.fmt.bufPrint(&buffer, "{}", .{data}) catch &buffer; |
| ... | ... | @@ -63,6 +65,8 @@ fn formatIdent( |
| 63 | 65 | options: std.fmt.FormatOptions, |
| 64 | 66 | writer: anytype, |
| 65 | 67 | ) !void { |
| 68 | _ = fmt; | |
| 69 | _ = options; | |
| 66 | 70 | for (ident) |c, i| { |
| 67 | 71 | switch (c) { |
| 68 | 72 | 'a'...'z', 'A'...'Z', '_' => try writer.writeByte(c), |
| ... | ... | @@ -747,6 +751,7 @@ pub fn genBody(o: *Object, body: ir.Body) error{ AnalysisFail, OutOfMemory }!voi |
| 747 | 751 | } |
| 748 | 752 | |
| 749 | 753 | fn genVarPtr(o: *Object, inst: *Inst.VarPtr) !CValue { |
| 754 | _ = o; | |
| 750 | 755 | return CValue{ .decl_ref = inst.variable.owner_decl }; |
| 751 | 756 | } |
| 752 | 757 | |
| ... | ... | @@ -937,6 +942,8 @@ fn genCall(o: *Object, inst: *Inst.Call) !CValue { |
| 937 | 942 | } |
| 938 | 943 | |
| 939 | 944 | fn genDbgStmt(o: *Object, inst: *Inst.DbgStmt) !CValue { |
| 945 | _ = o; | |
| 946 | _ = inst; | |
| 940 | 947 | // TODO emit #line directive here with line number and filename |
| 941 | 948 | return CValue.none; |
| 942 | 949 | } |
| ... | ... | @@ -1016,11 +1023,13 @@ fn genBitcast(o: *Object, inst: *Inst.UnOp) !CValue { |
| 1016 | 1023 | } |
| 1017 | 1024 | |
| 1018 | 1025 | fn genBreakpoint(o: *Object, inst: *Inst.NoOp) !CValue { |
| 1026 | _ = inst; | |
| 1019 | 1027 | try o.writer().writeAll("zig_breakpoint();\n"); |
| 1020 | 1028 | return CValue.none; |
| 1021 | 1029 | } |
| 1022 | 1030 | |
| 1023 | 1031 | fn genUnreach(o: *Object, inst: *Inst.NoOp) !CValue { |
| 1032 | _ = inst; | |
| 1024 | 1033 | try o.writer().writeAll("zig_unreachable();\n"); |
| 1025 | 1034 | return CValue.none; |
| 1026 | 1035 | } |
src/codegen/llvm.zig+4| ... | ... | @@ -154,6 +154,7 @@ pub const Object = struct { |
| 154 | 154 | object_pathZ: [:0]const u8, |
| 155 | 155 | |
| 156 | 156 | pub fn create(allocator: *Allocator, sub_path: []const u8, options: link.Options) !*Object { |
| 157 | _ = sub_path; | |
| 157 | 158 | const self = try allocator.create(Object); |
| 158 | 159 | errdefer allocator.destroy(self); |
| 159 | 160 | |
| ... | ... | @@ -742,6 +743,7 @@ pub const FuncGen = struct { |
| 742 | 743 | } |
| 743 | 744 | |
| 744 | 745 | fn genRetVoid(self: *FuncGen, inst: *Inst.NoOp) ?*const llvm.Value { |
| 746 | _ = inst; | |
| 745 | 747 | _ = self.builder.buildRetVoid(); |
| 746 | 748 | return null; |
| 747 | 749 | } |
| ... | ... | @@ -873,6 +875,7 @@ pub const FuncGen = struct { |
| 873 | 875 | } |
| 874 | 876 | |
| 875 | 877 | fn genUnreach(self: *FuncGen, inst: *Inst.NoOp) ?*const llvm.Value { |
| 878 | _ = inst; | |
| 876 | 879 | _ = self.builder.buildUnreachable(); |
| 877 | 880 | return null; |
| 878 | 881 | } |
| ... | ... | @@ -1013,6 +1016,7 @@ pub const FuncGen = struct { |
| 1013 | 1016 | } |
| 1014 | 1017 | |
| 1015 | 1018 | fn genBreakpoint(self: *FuncGen, inst: *Inst.NoOp) !?*const llvm.Value { |
| 1019 | _ = inst; | |
| 1016 | 1020 | const llvn_fn = self.getIntrinsic("llvm.debugtrap"); |
| 1017 | 1021 | _ = self.builder.buildCall(llvn_fn, null, 0, ""); |
| 1018 | 1022 | return null; |
src/codegen/wasm.zig+7-3| ... | ... | @@ -702,7 +702,7 @@ pub const Context = struct { |
| 702 | 702 | try writer.writeByte(wasm.valtype(.i32)); // error code is always an i32 integer. |
| 703 | 703 | try writer.writeByte(val_type); |
| 704 | 704 | }, |
| 705 | else => |ret_type| { | |
| 705 | else => { | |
| 706 | 706 | try leb.writeULEB128(writer, @as(u32, 1)); |
| 707 | 707 | // Can we maybe get the source index of the return type? |
| 708 | 708 | const val_type = try self.genValtype(.{ .node_offset = 0 }, return_type); |
| ... | ... | @@ -721,7 +721,7 @@ pub const Context = struct { |
| 721 | 721 | // TODO: check for and handle death of instructions |
| 722 | 722 | const mod_fn = blk: { |
| 723 | 723 | if (typed_value.val.castTag(.function)) |func| break :blk func.data; |
| 724 | if (typed_value.val.castTag(.extern_fn)) |ext_fn| return Result.appended; // don't need code body for extern functions | |
| 724 | if (typed_value.val.castTag(.extern_fn)) |_| return Result.appended; // don't need code body for extern functions | |
| 725 | 725 | unreachable; |
| 726 | 726 | }; |
| 727 | 727 | |
| ... | ... | @@ -910,7 +910,7 @@ pub const Context = struct { |
| 910 | 910 | }, |
| 911 | 911 | else => unreachable, |
| 912 | 912 | }, |
| 913 | .local => |local| { | |
| 913 | .local => { | |
| 914 | 914 | try self.emitWValue(rhs); |
| 915 | 915 | try writer.writeByte(wasm.opcode(.local_set)); |
| 916 | 916 | try leb.writeULEB128(writer, lhs.local); |
| ... | ... | @@ -925,6 +925,7 @@ pub const Context = struct { |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | 927 | fn genArg(self: *Context, inst: *Inst.Arg) InnerError!WValue { |
| 928 | _ = inst; | |
| 928 | 929 | // arguments share the index with locals |
| 929 | 930 | defer self.local_index += 1; |
| 930 | 931 | return WValue{ .local = self.local_index }; |
| ... | ... | @@ -1213,12 +1214,15 @@ pub const Context = struct { |
| 1213 | 1214 | } |
| 1214 | 1215 | |
| 1215 | 1216 | fn genBreakpoint(self: *Context, breakpoint: *Inst.NoOp) InnerError!WValue { |
| 1217 | _ = self; | |
| 1218 | _ = breakpoint; | |
| 1216 | 1219 | // unsupported by wasm itself. Can be implemented once we support DWARF |
| 1217 | 1220 | // for wasm |
| 1218 | 1221 | return .none; |
| 1219 | 1222 | } |
| 1220 | 1223 | |
| 1221 | 1224 | fn genUnreachable(self: *Context, unreach: *Inst.NoOp) InnerError!WValue { |
| 1225 | _ = unreach; | |
| 1222 | 1226 | try self.code.append(wasm.opcode(.@"unreachable")); |
| 1223 | 1227 | return .none; |
| 1224 | 1228 | } |
src/link.zig+1-1| ... | ... | @@ -517,7 +517,7 @@ pub const File = struct { |
| 517 | 517 | .target = base.options.target, |
| 518 | 518 | .output_mode = .Obj, |
| 519 | 519 | }); |
| 520 | const o_directory = base.options.module.?.zig_cache_artifact_directory; | |
| 520 | const o_directory = module.zig_cache_artifact_directory; | |
| 521 | 521 | const full_obj_path = try o_directory.join(arena, &[_][]const u8{obj_basename}); |
| 522 | 522 | break :blk full_obj_path; |
| 523 | 523 | } |
src/link/C.zig+14-2| ... | ... | @@ -76,7 +76,12 @@ pub fn deinit(self: *C) void { |
| 76 | 76 | self.decl_table.deinit(self.base.allocator); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | pub fn allocateDeclIndexes(self: *C, decl: *Module.Decl) !void {} | |
| 79 | pub fn allocateDeclIndexes(self: *C, decl: *Module.Decl) !void { | |
| 80 | if (false) { | |
| 81 | self; | |
| 82 | decl; | |
| 83 | } | |
| 84 | } | |
| 80 | 85 | |
| 81 | 86 | pub fn freeDecl(self: *C, decl: *Module.Decl) void { |
| 82 | 87 | _ = self.decl_table.swapRemove(decl); |
| ... | ... | @@ -307,4 +312,11 @@ pub fn updateDeclExports( |
| 307 | 312 | module: *Module, |
| 308 | 313 | decl: *Module.Decl, |
| 309 | 314 | exports: []const *Module.Export, |
| 310 | ) !void {} | |
| 315 | ) !void { | |
| 316 | if (false) { | |
| 317 | exports; | |
| 318 | decl; | |
| 319 | module; | |
| 320 | self; | |
| 321 | } | |
| 322 | } |
src/link/Coff.zig+4-1| ... | ... | @@ -831,7 +831,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { |
| 831 | 831 | .target = self.base.options.target, |
| 832 | 832 | .output_mode = .Obj, |
| 833 | 833 | }); |
| 834 | const o_directory = self.base.options.module.?.zig_cache_artifact_directory; | |
| 834 | const o_directory = module.zig_cache_artifact_directory; | |
| 835 | 835 | const full_obj_path = try o_directory.join(arena, &[_][]const u8{obj_basename}); |
| 836 | 836 | break :blk full_obj_path; |
| 837 | 837 | } |
| ... | ... | @@ -1340,6 +1340,9 @@ pub fn getDeclVAddr(self: *Coff, decl: *const Module.Decl) u64 { |
| 1340 | 1340 | } |
| 1341 | 1341 | |
| 1342 | 1342 | pub fn updateDeclLineNumber(self: *Coff, module: *Module, decl: *Module.Decl) !void { |
| 1343 | _ = self; | |
| 1344 | _ = module; | |
| 1345 | _ = decl; | |
| 1343 | 1346 | // TODO Implement this |
| 1344 | 1347 | } |
| 1345 | 1348 |
src/link/Elf.zig+10-3| ... | ... | @@ -1262,7 +1262,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1262 | 1262 | .target = self.base.options.target, |
| 1263 | 1263 | .output_mode = .Obj, |
| 1264 | 1264 | }); |
| 1265 | const o_directory = self.base.options.module.?.zig_cache_artifact_directory; | |
| 1265 | const o_directory = module.zig_cache_artifact_directory; | |
| 1266 | 1266 | const full_obj_path = try o_directory.join(arena, &[_][]const u8{obj_basename}); |
| 1267 | 1267 | break :blk full_obj_path; |
| 1268 | 1268 | } |
| ... | ... | @@ -1938,6 +1938,11 @@ fn freeTextBlock(self: *Elf, text_block: *TextBlock) void { |
| 1938 | 1938 | } |
| 1939 | 1939 | |
| 1940 | 1940 | fn shrinkTextBlock(self: *Elf, text_block: *TextBlock, new_block_size: u64) void { |
| 1941 | if (false) { | |
| 1942 | self; | |
| 1943 | text_block; | |
| 1944 | new_block_size; | |
| 1945 | } | |
| 1941 | 1946 | // TODO check the new capacity, and if it crosses the size threshold into a big enough |
| 1942 | 1947 | // capacity, insert a free list node for it. |
| 1943 | 1948 | } |
| ... | ... | @@ -2706,6 +2711,7 @@ pub fn updateDeclExports( |
| 2706 | 2711 | |
| 2707 | 2712 | /// Must be called only after a successful call to `updateDecl`. |
| 2708 | 2713 | pub fn updateDeclLineNumber(self: *Elf, module: *Module, decl: *const Module.Decl) !void { |
| 2714 | _ = module; | |
| 2709 | 2715 | const tracy = trace(@src()); |
| 2710 | 2716 | defer tracy.end(); |
| 2711 | 2717 | |
| ... | ... | @@ -2979,6 +2985,7 @@ fn dbgLineNeededHeaderBytes(self: Elf) u32 { |
| 2979 | 2985 | } |
| 2980 | 2986 | |
| 2981 | 2987 | fn dbgInfoNeededHeaderBytes(self: Elf) u32 { |
| 2988 | _ = self; | |
| 2982 | 2989 | return 120; |
| 2983 | 2990 | } |
| 2984 | 2991 | |
| ... | ... | @@ -3372,7 +3379,7 @@ const CsuObjects = struct { |
| 3372 | 3379 | if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ gcc_dir_path, obj.* }); |
| 3373 | 3380 | }, |
| 3374 | 3381 | else => { |
| 3375 | inline for (std.meta.fields(@TypeOf(result))) |f, i| { | |
| 3382 | inline for (std.meta.fields(@TypeOf(result))) |f| { | |
| 3376 | 3383 | if (@field(result, f.name)) |*obj| { |
| 3377 | 3384 | obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); |
| 3378 | 3385 | } |
| ... | ... | @@ -3380,7 +3387,7 @@ const CsuObjects = struct { |
| 3380 | 3387 | }, |
| 3381 | 3388 | } |
| 3382 | 3389 | } else { |
| 3383 | inline for (std.meta.fields(@TypeOf(result))) |f, i| { | |
| 3390 | inline for (std.meta.fields(@TypeOf(result))) |f| { | |
| 3384 | 3391 | if (@field(result, f.name)) |*obj| { |
| 3385 | 3392 | if (comp.crt_files.get(obj.*)) |crtf| { |
| 3386 | 3393 | obj.* = crtf.full_object_path; |
src/link/MachO.zig+5-1| ... | ... | @@ -441,6 +441,7 @@ pub fn flush(self: *MachO, comp: *Compilation) !void { |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | pub fn flushModule(self: *MachO, comp: *Compilation) !void { |
| 444 | _ = comp; | |
| 444 | 445 | const tracy = trace(@src()); |
| 445 | 446 | defer tracy.end(); |
| 446 | 447 | |
| ... | ... | @@ -533,7 +534,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { |
| 533 | 534 | .target = self.base.options.target, |
| 534 | 535 | .output_mode = .Obj, |
| 535 | 536 | }); |
| 536 | const o_directory = self.base.options.module.?.zig_cache_artifact_directory; | |
| 537 | const o_directory = module.zig_cache_artifact_directory; | |
| 537 | 538 | const full_obj_path = try o_directory.join(arena, &[_][]const u8{obj_basename}); |
| 538 | 539 | break :blk full_obj_path; |
| 539 | 540 | } |
| ... | ... | @@ -1254,6 +1255,9 @@ fn freeTextBlock(self: *MachO, text_block: *TextBlock) void { |
| 1254 | 1255 | } |
| 1255 | 1256 | |
| 1256 | 1257 | fn shrinkTextBlock(self: *MachO, text_block: *TextBlock, new_block_size: u64) void { |
| 1258 | _ = self; | |
| 1259 | _ = text_block; | |
| 1260 | _ = new_block_size; | |
| 1257 | 1261 | // TODO check the new capacity, and if it crosses the size threshold into a big enough |
| 1258 | 1262 | // capacity, insert a free list node for it. |
| 1259 | 1263 | } |
src/link/MachO/DebugSymbols.zig+6| ... | ... | @@ -899,6 +899,7 @@ fn writeStringTable(self: *DebugSymbols) !void { |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | pub fn updateDeclLineNumber(self: *DebugSymbols, module: *Module, decl: *const Module.Decl) !void { |
| 902 | _ = module; | |
| 902 | 903 | const tracy = trace(@src()); |
| 903 | 904 | defer tracy.end(); |
| 904 | 905 | |
| ... | ... | @@ -926,6 +927,8 @@ pub fn initDeclDebugBuffers( |
| 926 | 927 | module: *Module, |
| 927 | 928 | decl: *Module.Decl, |
| 928 | 929 | ) !DeclDebugBuffers { |
| 930 | _ = self; | |
| 931 | _ = module; | |
| 929 | 932 | const tracy = trace(@src()); |
| 930 | 933 | defer tracy.end(); |
| 931 | 934 | |
| ... | ... | @@ -1188,6 +1191,7 @@ fn addDbgInfoType( |
| 1188 | 1191 | dbg_info_buffer: *std.ArrayList(u8), |
| 1189 | 1192 | target: std.Target, |
| 1190 | 1193 | ) !void { |
| 1194 | _ = self; | |
| 1191 | 1195 | switch (ty.zigTypeTag()) { |
| 1192 | 1196 | .Void => unreachable, |
| 1193 | 1197 | .NoReturn => unreachable, |
| ... | ... | @@ -1364,6 +1368,7 @@ fn getRelocDbgInfoSubprogramHighPC() u32 { |
| 1364 | 1368 | } |
| 1365 | 1369 | |
| 1366 | 1370 | fn dbgLineNeededHeaderBytes(self: DebugSymbols, module: *Module) u32 { |
| 1371 | _ = self; | |
| 1367 | 1372 | const directory_entry_format_count = 1; |
| 1368 | 1373 | const file_name_entry_format_count = 1; |
| 1369 | 1374 | const directory_count = 1; |
| ... | ... | @@ -1378,6 +1383,7 @@ fn dbgLineNeededHeaderBytes(self: DebugSymbols, module: *Module) u32 { |
| 1378 | 1383 | } |
| 1379 | 1384 | |
| 1380 | 1385 | fn dbgInfoNeededHeaderBytes(self: DebugSymbols) u32 { |
| 1386 | _ = self; | |
| 1381 | 1387 | return 120; |
| 1382 | 1388 | } |
| 1383 | 1389 |
src/link/MachO/Zld.zig+4-3| ... | ... | @@ -108,6 +108,7 @@ const TlvOffset = struct { |
| 108 | 108 | offset: u64, |
| 109 | 109 | |
| 110 | 110 | fn cmp(context: void, a: TlvOffset, b: TlvOffset) bool { |
| 111 | _ = context; | |
| 111 | 112 | return a.source_addr < b.source_addr; |
| 112 | 113 | } |
| 113 | 114 | }; |
| ... | ... | @@ -437,7 +438,7 @@ fn updateMetadata(self: *Zld) !void { |
| 437 | 438 | const data_seg = &self.load_commands.items[self.data_segment_cmd_index.?].Segment; |
| 438 | 439 | |
| 439 | 440 | // Create missing metadata |
| 440 | for (object.sections.items) |sect, sect_id| { | |
| 441 | for (object.sections.items) |sect| { | |
| 441 | 442 | const segname = sect.segname(); |
| 442 | 443 | const sectname = sect.sectname(); |
| 443 | 444 | |
| ... | ... | @@ -1373,7 +1374,7 @@ fn allocateTentativeSymbols(self: *Zld) !void { |
| 1373 | 1374 | } |
| 1374 | 1375 | |
| 1375 | 1376 | // Convert tentative definitions into regular symbols. |
| 1376 | for (self.tentatives.values()) |sym, i| { | |
| 1377 | for (self.tentatives.values()) |sym| { | |
| 1377 | 1378 | const tent = sym.cast(Symbol.Tentative) orelse unreachable; |
| 1378 | 1379 | const reg = try self.allocator.create(Symbol.Regular); |
| 1379 | 1380 | errdefer self.allocator.destroy(reg); |
| ... | ... | @@ -1758,7 +1759,7 @@ fn resolveSymbolsInObject(self: *Zld, object: *Object) !void { |
| 1758 | 1759 | |
| 1759 | 1760 | t_sym.alias = sym; |
| 1760 | 1761 | sym_ptr.* = sym; |
| 1761 | } else if (sym.cast(Symbol.Unresolved)) |und| { | |
| 1762 | } else if (sym.cast(Symbol.Unresolved)) |_| { | |
| 1762 | 1763 | if (self.globals.get(sym.name)) |g_sym| { |
| 1763 | 1764 | sym.alias = g_sym; |
| 1764 | 1765 | continue; |
src/link/MachO/bind.zig+1| ... | ... | @@ -10,6 +10,7 @@ pub const Pointer = struct { |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | 12 | pub fn pointerCmp(context: void, a: Pointer, b: Pointer) bool { |
| 13 | _ = context; | |
| 13 | 14 | if (a.segment_id < b.segment_id) return true; |
| 14 | 15 | if (a.segment_id == b.segment_id) { |
| 15 | 16 | return a.offset < b.offset; |
src/link/SpirV.zig+9-1| ... | ... | @@ -102,6 +102,7 @@ pub fn deinit(self: *SpirV) void { |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | pub fn updateDecl(self: *SpirV, module: *Module, decl: *Module.Decl) !void { |
| 105 | _ = module; | |
| 105 | 106 | // Keep track of all decls so we can iterate over them on flush(). |
| 106 | 107 | _ = try self.decl_table.getOrPut(self.base.allocator, decl); |
| 107 | 108 | } |
| ... | ... | @@ -111,7 +112,14 @@ pub fn updateDeclExports( |
| 111 | 112 | module: *Module, |
| 112 | 113 | decl: *const Module.Decl, |
| 113 | 114 | exports: []const *Module.Export, |
| 114 | ) !void {} | |
| 115 | ) !void { | |
| 116 | if (false) { | |
| 117 | self; | |
| 118 | module; | |
| 119 | decl; | |
| 120 | exports; | |
| 121 | } | |
| 122 | } | |
| 115 | 123 | |
| 116 | 124 | pub fn freeDecl(self: *SpirV, decl: *Module.Decl) void { |
| 117 | 125 | assert(self.decl_table.swapRemove(decl)); |
src/link/Wasm.zig+11-3| ... | ... | @@ -216,7 +216,7 @@ pub fn updateDecl(self: *Wasm, module: *Module, decl: *Module.Decl) !void { |
| 216 | 216 | try module.failed_decls.put(module.gpa, decl, context.err_msg); |
| 217 | 217 | return; |
| 218 | 218 | }, |
| 219 | else => |e| return err, | |
| 219 | else => |e| return e, | |
| 220 | 220 | }; |
| 221 | 221 | |
| 222 | 222 | const code: []const u8 = switch (result) { |
| ... | ... | @@ -258,7 +258,14 @@ pub fn updateDeclExports( |
| 258 | 258 | module: *Module, |
| 259 | 259 | decl: *const Module.Decl, |
| 260 | 260 | exports: []const *Module.Export, |
| 261 | ) !void {} | |
| 261 | ) !void { | |
| 262 | if (false) { | |
| 263 | self; | |
| 264 | module; | |
| 265 | decl; | |
| 266 | exports; | |
| 267 | } | |
| 268 | } | |
| 262 | 269 | |
| 263 | 270 | pub fn freeDecl(self: *Wasm, decl: *Module.Decl) void { |
| 264 | 271 | if (self.getFuncidx(decl)) |func_idx| { |
| ... | ... | @@ -300,6 +307,7 @@ pub fn flush(self: *Wasm, comp: *Compilation) !void { |
| 300 | 307 | } |
| 301 | 308 | |
| 302 | 309 | pub fn flushModule(self: *Wasm, comp: *Compilation) !void { |
| 310 | _ = comp; | |
| 303 | 311 | const tracy = trace(@src()); |
| 304 | 312 | defer tracy.end(); |
| 305 | 313 | |
| ... | ... | @@ -557,7 +565,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { |
| 557 | 565 | .target = self.base.options.target, |
| 558 | 566 | .output_mode = .Obj, |
| 559 | 567 | }); |
| 560 | const o_directory = self.base.options.module.?.zig_cache_artifact_directory; | |
| 568 | const o_directory = module.zig_cache_artifact_directory; | |
| 561 | 569 | const full_obj_path = try o_directory.join(arena, &[_][]const u8{obj_basename}); |
| 562 | 570 | break :blk full_obj_path; |
| 563 | 571 | } |
src/main.zig+2-2| ... | ... | @@ -500,7 +500,7 @@ const Emit = union(enum) { |
| 500 | 500 | }; |
| 501 | 501 | |
| 502 | 502 | fn optionalBoolEnvVar(arena: *Allocator, name: []const u8) !bool { |
| 503 | if (std.process.getEnvVarOwned(arena, name)) |value| { | |
| 503 | if (std.process.getEnvVarOwned(arena, name)) |_| { | |
| 504 | 504 | return true; |
| 505 | 505 | } else |err| switch (err) { |
| 506 | 506 | error.EnvironmentVariableNotFound => return false, |
| ... | ... | @@ -2560,7 +2560,7 @@ pub const usage_init = |
| 2560 | 2560 | ; |
| 2561 | 2561 | |
| 2562 | 2562 | pub fn cmdInit( |
| 2563 | gpa: *Allocator, | |
| 2563 | _: *Allocator, | |
| 2564 | 2564 | arena: *Allocator, |
| 2565 | 2565 | args: []const []const u8, |
| 2566 | 2566 | output_mode: std.builtin.OutputMode, |
src/print_env.zig+1| ... | ... | @@ -5,6 +5,7 @@ const Allocator = std.mem.Allocator; |
| 5 | 5 | const fatal = @import("main.zig").fatal; |
| 6 | 6 | |
| 7 | 7 | pub fn cmdEnv(gpa: *Allocator, args: []const []const u8, stdout: std.fs.File.Writer) !void { |
| 8 | _ = args; | |
| 8 | 9 | const self_exe_path = try std.fs.selfExePathAlloc(gpa); |
| 9 | 10 | defer gpa.free(self_exe_path); |
| 10 | 11 |
src/print_targets.zig+1| ... | ... | @@ -17,6 +17,7 @@ pub fn cmdTargets( |
| 17 | 17 | stdout: anytype, |
| 18 | 18 | native_target: Target, |
| 19 | 19 | ) !void { |
| 20 | _ = args; | |
| 20 | 21 | var zig_lib_directory = introspect.findZigLibDir(allocator) catch |err| { |
| 21 | 22 | fatal("unable to find zig installation directory: {s}\n", .{@errorName(err)}); |
| 22 | 23 | }; |
src/register_manager.zig+2| ... | ... | @@ -265,6 +265,8 @@ fn MockFunction(comptime Register: type) type { |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | pub fn spillInstruction(self: *Self, src: LazySrcLoc, reg: Register, inst: *ir.Inst) !void { |
| 268 | _ = src; | |
| 269 | _ = inst; | |
| 268 | 270 | try self.spilled.append(self.allocator, reg); |
| 269 | 271 | } |
| 270 | 272 | }; |
src/stage1.zig+2| ... | ... | @@ -407,6 +407,8 @@ export fn stage2_add_link_lib( |
| 407 | 407 | symbol_name_ptr: [*c]const u8, |
| 408 | 408 | symbol_name_len: usize, |
| 409 | 409 | ) ?[*:0]const u8 { |
| 410 | _ = symbol_name_len; | |
| 411 | _ = symbol_name_ptr; | |
| 410 | 412 | const comp = @intToPtr(*Compilation, stage1.userdata); |
| 411 | 413 | const lib_name = std.ascii.allocLowerString(comp.gpa, lib_name_ptr[0..lib_name_len]) catch return "out of memory"; |
| 412 | 414 | const target = comp.getTarget(); |
src/test.zig+3| ... | ... | @@ -70,6 +70,8 @@ const ErrorMsg = union(enum) { |
| 70 | 70 | options: std.fmt.FormatOptions, |
| 71 | 71 | writer: anytype, |
| 72 | 72 | ) !void { |
| 73 | _ = fmt; | |
| 74 | _ = options; | |
| 73 | 75 | switch (self) { |
| 74 | 76 | .src => |src| { |
| 75 | 77 | return writer.print("{s}:{d}:{d}: {s}: {s}", .{ |
| ... | ... | @@ -592,6 +594,7 @@ pub const TestContext = struct { |
| 592 | 594 | thread_pool: *ThreadPool, |
| 593 | 595 | global_cache_directory: Compilation.Directory, |
| 594 | 596 | ) !void { |
| 597 | _ = self; | |
| 595 | 598 | const target_info = try std.zig.system.NativeTargetInfo.detect(allocator, case.target); |
| 596 | 599 | const target = target_info.target; |
| 597 | 600 |
src/tracy.zig+3-1| ... | ... | @@ -28,7 +28,9 @@ pub const ___tracy_c_zone_context = extern struct { |
| 28 | 28 | }; |
| 29 | 29 | |
| 30 | 30 | pub const Ctx = if (enable) ___tracy_c_zone_context else struct { |
| 31 | pub fn end(self: Ctx) void {} | |
| 31 | pub fn end(self: Ctx) void { | |
| 32 | _ = self; | |
| 33 | } | |
| 32 | 34 | }; |
| 33 | 35 | |
| 34 | 36 | pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx { |
src/translate_c.zig+15-5| ... | ... | @@ -206,6 +206,7 @@ const Scope = struct { |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | fn findBlockReturnType(inner: *Scope, c: *Context) clang.QualType { |
| 209 | _ = c; | |
| 209 | 210 | var scope = inner; |
| 210 | 211 | while (true) { |
| 211 | 212 | switch (scope.id) { |
| ... | ... | @@ -601,7 +602,7 @@ fn visitFnDecl(c: *Context, fn_decl: *const clang.FunctionDecl) Error!void { |
| 601 | 602 | var scope = &block_scope.base; |
| 602 | 603 | |
| 603 | 604 | var param_id: c_uint = 0; |
| 604 | for (proto_node.data.params) |*param, i| { | |
| 605 | for (proto_node.data.params) |*param| { | |
| 605 | 606 | const param_name = param.name orelse { |
| 606 | 607 | proto_node.data.is_extern = true; |
| 607 | 608 | proto_node.data.is_export = false; |
| ... | ... | @@ -785,7 +786,7 @@ const builtin_typedef_map = std.ComptimeStringMap([]const u8, .{ |
| 785 | 786 | }); |
| 786 | 787 | |
| 787 | 788 | fn transTypeDef(c: *Context, scope: *Scope, typedef_decl: *const clang.TypedefNameDecl) Error!void { |
| 788 | if (c.decl_table.get(@ptrToInt(typedef_decl.getCanonicalDecl()))) |name| | |
| 789 | if (c.decl_table.get(@ptrToInt(typedef_decl.getCanonicalDecl()))) |_| | |
| 789 | 790 | return; // Avoid processing this decl twice |
| 790 | 791 | const toplevel = scope.id == .root; |
| 791 | 792 | const bs: *Scope.Block = if (!toplevel) try scope.findBlockScope(c) else undefined; |
| ... | ... | @@ -935,7 +936,7 @@ fn hasFlexibleArrayField(c: *Context, record_def: *const clang.RecordDecl) bool |
| 935 | 936 | } |
| 936 | 937 | |
| 937 | 938 | fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordDecl) Error!void { |
| 938 | if (c.decl_table.get(@ptrToInt(record_decl.getCanonicalDecl()))) |name| | |
| 939 | if (c.decl_table.get(@ptrToInt(record_decl.getCanonicalDecl()))) |_| | |
| 939 | 940 | return; // Avoid processing this decl twice |
| 940 | 941 | const record_loc = record_decl.getLocation(); |
| 941 | 942 | const toplevel = scope.id == .root; |
| ... | ... | @@ -1080,7 +1081,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1080 | 1081 | } |
| 1081 | 1082 | |
| 1082 | 1083 | fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const clang.EnumDecl) Error!void { |
| 1083 | if (c.decl_table.get(@ptrToInt(enum_decl.getCanonicalDecl()))) |name| | |
| 1084 | if (c.decl_table.get(@ptrToInt(enum_decl.getCanonicalDecl()))) |_| | |
| 1084 | 1085 | return; // Avoid processing this decl twice |
| 1085 | 1086 | const enum_loc = enum_decl.getLocation(); |
| 1086 | 1087 | const toplevel = scope.id == .root; |
| ... | ... | @@ -1312,6 +1313,7 @@ fn transConvertVectorExpr( |
| 1312 | 1313 | source_loc: clang.SourceLocation, |
| 1313 | 1314 | expr: *const clang.ConvertVectorExpr, |
| 1314 | 1315 | ) TransError!Node { |
| 1316 | _ = source_loc; | |
| 1315 | 1317 | const base_stmt = @ptrCast(*const clang.Stmt, expr); |
| 1316 | 1318 | |
| 1317 | 1319 | var block_scope = try Scope.Block.init(c, scope, true); |
| ... | ... | @@ -1433,6 +1435,7 @@ fn transSimpleOffsetOfExpr( |
| 1433 | 1435 | scope: *Scope, |
| 1434 | 1436 | expr: *const clang.OffsetOfExpr, |
| 1435 | 1437 | ) TransError!Node { |
| 1438 | _ = scope; | |
| 1436 | 1439 | assert(expr.getNumComponents() == 1); |
| 1437 | 1440 | const component = expr.getComponent(0); |
| 1438 | 1441 | if (component.getKind() == .Field) { |
| ... | ... | @@ -2269,6 +2272,7 @@ fn transStringLiteralInitializer( |
| 2269 | 2272 | /// both operands resolve to addresses. The C standard requires that both operands |
| 2270 | 2273 | /// point to elements of the same array object, but we do not verify that here. |
| 2271 | 2274 | fn cIsPointerDiffExpr(c: *Context, stmt: *const clang.BinaryOperator) bool { |
| 2275 | _ = c; | |
| 2272 | 2276 | const lhs = @ptrCast(*const clang.Stmt, stmt.getLHS()); |
| 2273 | 2277 | const rhs = @ptrCast(*const clang.Stmt, stmt.getRHS()); |
| 2274 | 2278 | return stmt.getOpcode() == .Sub and |
| ... | ... | @@ -2572,6 +2576,7 @@ fn transInitListExprVector( |
| 2572 | 2576 | expr: *const clang.InitListExpr, |
| 2573 | 2577 | ty: *const clang.Type, |
| 2574 | 2578 | ) TransError!Node { |
| 2579 | _ = ty; | |
| 2575 | 2580 | const qt = getExprQualType(c, @ptrCast(*const clang.Expr, expr)); |
| 2576 | 2581 | const vector_type = try transQualType(c, scope, qt, loc); |
| 2577 | 2582 | const init_count = expr.getNumInits(); |
| ... | ... | @@ -2721,6 +2726,7 @@ fn transImplicitValueInitExpr( |
| 2721 | 2726 | expr: *const clang.Expr, |
| 2722 | 2727 | used: ResultUsed, |
| 2723 | 2728 | ) TransError!Node { |
| 2729 | _ = used; | |
| 2724 | 2730 | const source_loc = expr.getBeginLoc(); |
| 2725 | 2731 | const qt = getExprQualType(c, expr); |
| 2726 | 2732 | const ty = qt.getTypePtr(); |
| ... | ... | @@ -3407,6 +3413,7 @@ fn transUnaryExprOrTypeTraitExpr( |
| 3407 | 3413 | stmt: *const clang.UnaryExprOrTypeTraitExpr, |
| 3408 | 3414 | result_used: ResultUsed, |
| 3409 | 3415 | ) TransError!Node { |
| 3416 | _ = result_used; | |
| 3410 | 3417 | const loc = stmt.getBeginLoc(); |
| 3411 | 3418 | const type_node = try transQualType(c, scope, stmt.getTypeOfArgument(), loc); |
| 3412 | 3419 | |
| ... | ... | @@ -3893,6 +3900,7 @@ fn maybeSuppressResult( |
| 3893 | 3900 | used: ResultUsed, |
| 3894 | 3901 | result: Node, |
| 3895 | 3902 | ) TransError!Node { |
| 3903 | _ = scope; | |
| 3896 | 3904 | if (used == .used) return result; |
| 3897 | 3905 | return Tag.discard.create(c.arena, result); |
| 3898 | 3906 | } |
| ... | ... | @@ -4337,7 +4345,7 @@ fn transCreateNodeMacroFn(c: *Context, name: []const u8, ref: Node, proto_alias: |
| 4337 | 4345 | var fn_params = std.ArrayList(ast.Payload.Param).init(c.gpa); |
| 4338 | 4346 | defer fn_params.deinit(); |
| 4339 | 4347 | |
| 4340 | for (proto_alias.data.params) |param, i| { | |
| 4348 | for (proto_alias.data.params) |param| { | |
| 4341 | 4349 | const param_name = param.name orelse |
| 4342 | 4350 | try std.fmt.allocPrint(c.arena, "arg_{d}", .{c.getMangle()}); |
| 4343 | 4351 | |
| ... | ... | @@ -5653,6 +5661,7 @@ fn parseCSpecifierQualifierList(c: *Context, m: *MacroCtx, scope: *Scope, allow_ |
| 5653 | 5661 | } |
| 5654 | 5662 | |
| 5655 | 5663 | fn parseCNumericType(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 5664 | _ = scope; | |
| 5656 | 5665 | const KwCounter = struct { |
| 5657 | 5666 | double: u8 = 0, |
| 5658 | 5667 | long: u8 = 0, |
| ... | ... | @@ -5754,6 +5763,7 @@ fn parseCNumericType(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 5754 | 5763 | } |
| 5755 | 5764 | |
| 5756 | 5765 | fn parseCAbstractDeclarator(c: *Context, m: *MacroCtx, scope: *Scope, node: Node) ParseError!Node { |
| 5766 | _ = scope; | |
| 5757 | 5767 | switch (m.next().?) { |
| 5758 | 5768 | .Asterisk => { |
| 5759 | 5769 | // last token of `node` |
src/type.zig+3| ... | ... | @@ -600,9 +600,11 @@ pub const Type = extern union { |
| 600 | 600 | |
| 601 | 601 | pub const HashContext = struct { |
| 602 | 602 | pub fn hash(self: @This(), t: Type) u64 { |
| 603 | _ = self; | |
| 603 | 604 | return t.hash(); |
| 604 | 605 | } |
| 605 | 606 | pub fn eql(self: @This(), a: Type, b: Type) bool { |
| 607 | _ = self; | |
| 606 | 608 | return a.eql(b); |
| 607 | 609 | } |
| 608 | 610 | }; |
| ... | ... | @@ -777,6 +779,7 @@ pub const Type = extern union { |
| 777 | 779 | options: std.fmt.FormatOptions, |
| 778 | 780 | writer: anytype, |
| 779 | 781 | ) @TypeOf(writer).Error!void { |
| 782 | _ = options; | |
| 780 | 783 | comptime assert(fmt.len == 0); |
| 781 | 784 | var ty = start_type; |
| 782 | 785 | while (true) { |
src/value.zig+8| ... | ... | @@ -626,6 +626,7 @@ pub const Value = extern union { |
| 626 | 626 | return std.mem.dupe(allocator, u8, payload.data); |
| 627 | 627 | } |
| 628 | 628 | if (self.castTag(.repeated)) |payload| { |
| 629 | _ = payload; | |
| 629 | 630 | @panic("TODO implement toAllocatedBytes for this Value tag"); |
| 630 | 631 | } |
| 631 | 632 | if (self.castTag(.decl_ref)) |payload| { |
| ... | ... | @@ -747,6 +748,7 @@ pub const Value = extern union { |
| 747 | 748 | |
| 748 | 749 | /// Asserts the type is an enum type. |
| 749 | 750 | pub fn toEnum(val: Value, enum_ty: Type, comptime E: type) E { |
| 751 | _ = enum_ty; | |
| 750 | 752 | // TODO this needs to resolve other kinds of Value tags rather than |
| 751 | 753 | // assuming the tag will be .enum_field_index. |
| 752 | 754 | const field_index = val.castTag(.enum_field_index).?.data; |
| ... | ... | @@ -935,6 +937,7 @@ pub const Value = extern union { |
| 935 | 937 | /// Converts an integer or a float to a float. |
| 936 | 938 | /// Returns `error.Overflow` if the value does not fit in the new type. |
| 937 | 939 | pub fn floatCast(self: Value, allocator: *Allocator, ty: Type, target: Target) !Value { |
| 940 | _ = target; | |
| 938 | 941 | switch (ty.tag()) { |
| 939 | 942 | .f16 => { |
| 940 | 943 | @panic("TODO add __trunctfhf2 to compiler-rt"); |
| ... | ... | @@ -1292,17 +1295,21 @@ pub const Value = extern union { |
| 1292 | 1295 | |
| 1293 | 1296 | pub const ArrayHashContext = struct { |
| 1294 | 1297 | pub fn hash(self: @This(), v: Value) u32 { |
| 1298 | _ = self; | |
| 1295 | 1299 | return v.hash_u32(); |
| 1296 | 1300 | } |
| 1297 | 1301 | pub fn eql(self: @This(), a: Value, b: Value) bool { |
| 1302 | _ = self; | |
| 1298 | 1303 | return a.eql(b); |
| 1299 | 1304 | } |
| 1300 | 1305 | }; |
| 1301 | 1306 | pub const HashContext = struct { |
| 1302 | 1307 | pub fn hash(self: @This(), v: Value) u64 { |
| 1308 | _ = self; | |
| 1303 | 1309 | return v.hash(); |
| 1304 | 1310 | } |
| 1305 | 1311 | pub fn eql(self: @This(), a: Value, b: Value) bool { |
| 1312 | _ = self; | |
| 1306 | 1313 | return a.eql(b); |
| 1307 | 1314 | } |
| 1308 | 1315 | }; |
| ... | ... | @@ -1345,6 +1352,7 @@ pub const Value = extern union { |
| 1345 | 1352 | } |
| 1346 | 1353 | |
| 1347 | 1354 | pub fn fieldValue(val: Value, allocator: *Allocator, index: usize) error{OutOfMemory}!Value { |
| 1355 | _ = allocator; | |
| 1348 | 1356 | switch (val.tag()) { |
| 1349 | 1357 | .@"struct" => { |
| 1350 | 1358 | const field_values = val.castTag(.@"struct").?.data; |
test/behavior/align.zig+1| ... | ... | @@ -167,6 +167,7 @@ test "generic function with align param" { |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | fn whyWouldYouEverDoThis(comptime align_bytes: u8) align(align_bytes) u8 { |
| 170 | _ = align_bytes; | |
| 170 | 171 | return 0x1; |
| 171 | 172 | } |
| 172 | 173 |
test/behavior/async_fn.zig+10| ... | ... | @@ -133,6 +133,7 @@ test "@frameSize" { |
| 133 | 133 | other(1); |
| 134 | 134 | } |
| 135 | 135 | fn other(param: i32) void { |
| 136 | _ = param; | |
| 136 | 137 | var local: i32 = undefined; |
| 137 | 138 | _ = local; |
| 138 | 139 | suspend {} |
| ... | ... | @@ -635,6 +636,8 @@ test "returning a const error from async function" { |
| 635 | 636 | } |
| 636 | 637 | |
| 637 | 638 | fn fetchUrl(unused: i32, url: []const u8) ![]u8 { |
| 639 | _ = unused; | |
| 640 | _ = url; | |
| 638 | 641 | frame = @frame(); |
| 639 | 642 | suspend {} |
| 640 | 643 | ok = true; |
| ... | ... | @@ -711,6 +714,7 @@ fn testAsyncAwaitTypicalUsage( |
| 711 | 714 | |
| 712 | 715 | var global_download_frame: anyframe = undefined; |
| 713 | 716 | fn fetchUrl(allocator: *std.mem.Allocator, url: []const u8) anyerror![]u8 { |
| 717 | _ = url; | |
| 714 | 718 | const result = try std.mem.dupe(allocator, u8, "expected download text"); |
| 715 | 719 | errdefer allocator.free(result); |
| 716 | 720 | if (suspend_download) { |
| ... | ... | @@ -724,6 +728,7 @@ fn testAsyncAwaitTypicalUsage( |
| 724 | 728 | |
| 725 | 729 | var global_file_frame: anyframe = undefined; |
| 726 | 730 | fn readFile(allocator: *std.mem.Allocator, filename: []const u8) anyerror![]u8 { |
| 731 | _ = filename; | |
| 727 | 732 | const result = try std.mem.dupe(allocator, u8, "expected file text"); |
| 728 | 733 | errdefer allocator.free(result); |
| 729 | 734 | if (suspend_file) { |
| ... | ... | @@ -1226,6 +1231,7 @@ test "suspend in while loop" { |
| 1226 | 1231 | suspend {} |
| 1227 | 1232 | return val; |
| 1228 | 1233 | } else |err| { |
| 1234 | err catch {}; | |
| 1229 | 1235 | return 0; |
| 1230 | 1236 | } |
| 1231 | 1237 | } |
| ... | ... | @@ -1355,6 +1361,7 @@ test "async function passed 0-bit arg after non-0-bit arg" { |
| 1355 | 1361 | } |
| 1356 | 1362 | |
| 1357 | 1363 | fn bar(x: i32, args: anytype) anyerror!void { |
| 1364 | _ = args; | |
| 1358 | 1365 | global_frame = @frame(); |
| 1359 | 1366 | suspend {} |
| 1360 | 1367 | global_int = x; |
| ... | ... | @@ -1650,6 +1657,8 @@ test "@asyncCall with pass-by-value arguments" { |
| 1650 | 1657 | pub const AT = [5]u8; |
| 1651 | 1658 | |
| 1652 | 1659 | pub fn f(_fill0: u64, s: ST, _fill1: u64, a: AT, _fill2: u64) callconv(.Async) void { |
| 1660 | _ = s; | |
| 1661 | _ = a; | |
| 1653 | 1662 | // Check that the array and struct arguments passed by value don't |
| 1654 | 1663 | // end up overflowing the adjacent fields in the frame structure. |
| 1655 | 1664 | expectEqual(F0, _fill0) catch @panic("test failure"); |
| ... | ... | @@ -1677,6 +1686,7 @@ test "@asyncCall with arguments having non-standard alignment" { |
| 1677 | 1686 | |
| 1678 | 1687 | const S = struct { |
| 1679 | 1688 | pub fn f(_fill0: u32, s: struct { x: u64 align(16) }, _fill1: u64) callconv(.Async) void { |
| 1689 | _ = s; | |
| 1680 | 1690 | // The compiler inserts extra alignment for s, check that the |
| 1681 | 1691 | // generated code picks the right slot for fill1. |
| 1682 | 1692 | expectEqual(F0, _fill0) catch @panic("test failure"); |
test/behavior/bugs/1310.zig+2| ... | ... | @@ -16,6 +16,8 @@ pub const InvocationTable_ = struct_InvocationTable_; |
| 16 | 16 | pub const VM_ = struct_VM_; |
| 17 | 17 | |
| 18 | 18 | fn agent_callback(_vm: [*]VM, options: [*]u8) callconv(.C) i32 { |
| 19 | _ = _vm; | |
| 20 | _ = options; | |
| 19 | 21 | return 11; |
| 20 | 22 | } |
| 21 | 23 |
test/behavior/bugs/2578.zig+3-1| ... | ... | @@ -5,7 +5,9 @@ const Foo = struct { |
| 5 | 5 | var foo: Foo = undefined; |
| 6 | 6 | const t = &foo; |
| 7 | 7 | |
| 8 | fn bar(pointer: ?*c_void) void {} | |
| 8 | fn bar(pointer: ?*c_void) void { | |
| 9 | _ = pointer; | |
| 10 | } | |
| 9 | 11 | |
| 10 | 12 | test "fixed" { |
| 11 | 13 | bar(t); |
test/behavior/bugs/2692.zig+3-1| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | fn foo(a: []u8) void {} | |
| 1 | fn foo(a: []u8) void { | |
| 2 | _ = a; | |
| 3 | } | |
| 2 | 4 | |
| 3 | 5 | test "address of 0 length array" { |
| 4 | 6 | var pt: [0]u8 = undefined; |
test/behavior/bugs/3367.zig+3-1| ... | ... | @@ -3,7 +3,9 @@ const Foo = struct { |
| 3 | 3 | }; |
| 4 | 4 | |
| 5 | 5 | const Mixin = struct { |
| 6 | pub fn two(self: Foo) void {} | |
| 6 | pub fn two(self: Foo) void { | |
| 7 | _ = self; | |
| 8 | } | |
| 7 | 9 | }; |
| 8 | 10 | |
| 9 | 11 | test "container member access usingnamespace decls" { |
test/behavior/bugs/4328.zig+2| ... | ... | @@ -53,10 +53,12 @@ test "Peer resolution of extern function calls in @TypeOf" { |
| 53 | 53 | test "Extern function calls, dereferences and field access in @TypeOf" { |
| 54 | 54 | const Test = struct { |
| 55 | 55 | fn test_fn_1(a: c_long) @TypeOf(fopen("test", "r").*) { |
| 56 | _ = a; | |
| 56 | 57 | return .{ .dummy_field = 0 }; |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | fn test_fn_2(a: anytype) @TypeOf(fopen("test", "r").*.dummy_field) { |
| 61 | _ = a; | |
| 60 | 62 | return 255; |
| 61 | 63 | } |
| 62 | 64 |
test/behavior/bugs/4560.zig+4| ... | ... | @@ -25,6 +25,10 @@ pub fn StringHashMap(comptime V: type) type { |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | pub fn HashMap(comptime K: type, comptime V: type) type { |
| 28 | if (false) { | |
| 29 | K; | |
| 30 | V; | |
| 31 | } | |
| 28 | 32 | return struct { |
| 29 | 33 | size: usize, |
| 30 | 34 | max_distance_from_start_index: usize, |
test/behavior/bugs/529_other_file_2.zig+3-1| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | 1 | pub const A = extern struct { |
| 2 | 2 | field: c_int, |
| 3 | 3 | }; |
| 4 | export fn issue529(a: ?*A) void {} | |
| 4 | export fn issue529(a: ?*A) void { | |
| 5 | _ = a; | |
| 6 | } |
test/behavior/bugs/5487.zig+1| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | const io = @import("std").io; |
| 2 | 2 | |
| 3 | 3 | pub fn write(_: void, bytes: []const u8) !usize { |
| 4 | _ = bytes; | |
| 4 | 5 | return 0; |
| 5 | 6 | } |
| 6 | 7 | pub fn writer() io.Writer(void, @typeInfo(@typeInfo(@TypeOf(write)).Fn.return_type.?).ErrorUnion.error_set, write) { |
test/behavior/bugs/624.zig+1| ... | ... | @@ -12,6 +12,7 @@ const ListenerContext = struct { |
| 12 | 12 | const ContextAllocator = MemoryPool(TestContext); |
| 13 | 13 | |
| 14 | 14 | fn MemoryPool(comptime T: type) type { |
| 15 | _ = T; | |
| 15 | 16 | return struct { |
| 16 | 17 | n: usize, |
| 17 | 18 | }; |
test/behavior/bugs/679.zig+1| ... | ... | @@ -2,6 +2,7 @@ const std = @import("std"); |
| 2 | 2 | const expect = std.testing.expect; |
| 3 | 3 | |
| 4 | 4 | pub fn List(comptime T: type) type { |
| 5 | _ = T; | |
| 5 | 6 | return u32; |
| 6 | 7 | } |
| 7 | 8 |
test/behavior/bugs/7027.zig+3-1| ... | ... | @@ -9,7 +9,9 @@ const Foobar = struct { |
| 9 | 9 | } |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | fn foo(arg: anytype) void {} | |
| 12 | fn foo(arg: anytype) void { | |
| 13 | _ = arg; | |
| 14 | } | |
| 13 | 15 | |
| 14 | 16 | test "" { |
| 15 | 17 | comptime var foobar = Foobar.foo(); |
test/behavior/bugs/704.zig+3-1| ... | ... | @@ -1,5 +1,7 @@ |
| 1 | 1 | const xxx = struct { |
| 2 | pub fn bar(self: *xxx) void {} | |
| 2 | pub fn bar(self: *xxx) void { | |
| 3 | _ = self; | |
| 4 | } | |
| 3 | 5 | }; |
| 4 | 6 | test "bug 704" { |
| 5 | 7 | var x: xxx = undefined; |
test/behavior/bugs/7250.zig+3-1| ... | ... | @@ -3,7 +3,9 @@ const nrfx_uart_t = extern struct { |
| 3 | 3 | drv_inst_idx: u8, |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | pub fn nrfx_uart_rx(p_instance: [*c]const nrfx_uart_t) void {} | |
| 6 | pub fn nrfx_uart_rx(p_instance: [*c]const nrfx_uart_t) void { | |
| 7 | _ = p_instance; | |
| 8 | } | |
| 7 | 9 | |
| 8 | 10 | threadlocal var g_uart0 = nrfx_uart_t{ |
| 9 | 11 | .p_reg = 0, |
test/behavior/bugs/828.zig+2| ... | ... | @@ -4,6 +4,7 @@ const CountBy = struct { |
| 4 | 4 | const One = CountBy{ .a = 1 }; |
| 5 | 5 | |
| 6 | 6 | pub fn counter(self: *const CountBy) Counter { |
| 7 | _ = self; | |
| 7 | 8 | return Counter{ .i = 0 }; |
| 8 | 9 | } |
| 9 | 10 | }; |
| ... | ... | @@ -18,6 +19,7 @@ const Counter = struct { |
| 18 | 19 | }; |
| 19 | 20 | |
| 20 | 21 | fn constCount(comptime cb: *const CountBy, comptime unused: u32) void { |
| 22 | _ = unused; | |
| 21 | 23 | comptime { |
| 22 | 24 | var cnt = cb.counter(); |
| 23 | 25 | if (cnt.i != 0) @compileError("Counter instance reused!"); |
test/behavior/bugs/920.zig+2| ... | ... | @@ -46,6 +46,8 @@ fn norm_f_inv(y: f64) f64 { |
| 46 | 46 | return math.sqrt(-2.0 * math.ln(y)); |
| 47 | 47 | } |
| 48 | 48 | fn norm_zero_case(random: *Random, u: f64) f64 { |
| 49 | _ = random; | |
| 50 | _ = u; | |
| 49 | 51 | return 0.0; |
| 50 | 52 | } |
| 51 | 53 |
test/behavior/cast.zig+6-2| ... | ... | @@ -824,9 +824,13 @@ test "variable initialization uses result locations properly with regards to the |
| 824 | 824 | test "cast between [*c]T and ?[*:0]T on fn parameter" { |
| 825 | 825 | const S = struct { |
| 826 | 826 | const Handler = ?fn ([*c]const u8) callconv(.C) void; |
| 827 | fn addCallback(handler: Handler) void {} | |
| 827 | fn addCallback(handler: Handler) void { | |
| 828 | _ = handler; | |
| 829 | } | |
| 828 | 830 | |
| 829 | fn myCallback(cstr: ?[*:0]const u8) callconv(.C) void {} | |
| 831 | fn myCallback(cstr: ?[*:0]const u8) callconv(.C) void { | |
| 832 | _ = cstr; | |
| 833 | } | |
| 830 | 834 | |
| 831 | 835 | fn doTheTest() void { |
| 832 | 836 | addCallback(myCallback); |
test/behavior/error.zig+8-2| ... | ... | @@ -139,7 +139,10 @@ test "comptime test error for empty error set" { |
| 139 | 139 | const EmptyErrorSet = error{}; |
| 140 | 140 | |
| 141 | 141 | fn testComptimeTestErrorEmptySet(x: EmptyErrorSet!i32) !void { |
| 142 | if (x) |v| try expect(v == 1234) else |err| @compileError("bad"); | |
| 142 | if (x) |v| try expect(v == 1234) else |err| { | |
| 143 | _ = err; | |
| 144 | @compileError("bad"); | |
| 145 | } | |
| 143 | 146 | } |
| 144 | 147 | |
| 145 | 148 | test "syntax: optional operator in front of error union operator" { |
| ... | ... | @@ -394,6 +397,7 @@ test "function pointer with return type that is error union with payload which i |
| 394 | 397 | const Err = error{UnspecifiedErr}; |
| 395 | 398 | |
| 396 | 399 | fn bar(a: i32) anyerror!*Foo { |
| 400 | _ = a; | |
| 397 | 401 | return Err.UnspecifiedErr; |
| 398 | 402 | } |
| 399 | 403 | |
| ... | ... | @@ -448,7 +452,9 @@ test "error payload type is correctly resolved" { |
| 448 | 452 | |
| 449 | 453 | test "error union comptime caching" { |
| 450 | 454 | const S = struct { |
| 451 | fn foo(comptime arg: anytype) void {} | |
| 455 | fn foo(comptime arg: anytype) void { | |
| 456 | arg catch {}; | |
| 457 | } | |
| 452 | 458 | }; |
| 453 | 459 | |
| 454 | 460 | S.foo(@as(anyerror!void, {})); |
test/behavior/eval.zig+7-2| ... | ... | @@ -422,6 +422,7 @@ test { |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | pub fn TypeWithCompTimeSlice(comptime field_name: []const u8) type { |
| 425 | _ = field_name; | |
| 425 | 426 | return struct { |
| 426 | 427 | pub const Node = struct {}; |
| 427 | 428 | }; |
| ... | ... | @@ -698,7 +699,9 @@ test "refer to the type of a generic function" { |
| 698 | 699 | f(i32); |
| 699 | 700 | } |
| 700 | 701 | |
| 701 | fn doNothingWithType(comptime T: type) void {} | |
| 702 | fn doNothingWithType(comptime T: type) void { | |
| 703 | _ = T; | |
| 704 | } | |
| 702 | 705 | |
| 703 | 706 | test "zero extend from u0 to u1" { |
| 704 | 707 | var zero_u0: u0 = 0; |
| ... | ... | @@ -819,7 +822,9 @@ test "two comptime calls with array default initialized to undefined" { |
| 819 | 822 | result.getCpuArch(); |
| 820 | 823 | } |
| 821 | 824 | |
| 822 | pub fn getCpuArch(self: CrossTarget) void {} | |
| 825 | pub fn getCpuArch(self: CrossTarget) void { | |
| 826 | _ = self; | |
| 827 | } | |
| 823 | 828 | }; |
| 824 | 829 | |
| 825 | 830 | const DynamicLinker = struct { |
test/behavior/fn.zig+8-2| ... | ... | @@ -23,6 +23,7 @@ test "void parameters" { |
| 23 | 23 | try voidFun(1, void{}, 2, {}); |
| 24 | 24 | } |
| 25 | 25 | fn voidFun(a: i32, b: void, c: i32, d: void) !void { |
| 26 | _ = d; | |
| 26 | 27 | const v = b; |
| 27 | 28 | const vv: void = if (a == 1) v else {}; |
| 28 | 29 | try expect(a + c == 3); |
| ... | ... | @@ -57,7 +58,9 @@ test "call function with empty string" { |
| 57 | 58 | acceptsString(""); |
| 58 | 59 | } |
| 59 | 60 | |
| 60 | fn acceptsString(foo: []u8) void {} | |
| 61 | fn acceptsString(foo: []u8) void { | |
| 62 | _ = foo; | |
| 63 | } | |
| 61 | 64 | |
| 62 | 65 | fn @"weird function name"() i32 { |
| 63 | 66 | return 1234; |
| ... | ... | @@ -70,7 +73,9 @@ test "implicit cast function unreachable return" { |
| 70 | 73 | wantsFnWithVoid(fnWithUnreachable); |
| 71 | 74 | } |
| 72 | 75 | |
| 73 | fn wantsFnWithVoid(f: fn () void) void {} | |
| 76 | fn wantsFnWithVoid(f: fn () void) void { | |
| 77 | _ = f; | |
| 78 | } | |
| 74 | 79 | |
| 75 | 80 | fn fnWithUnreachable() noreturn { |
| 76 | 81 | unreachable; |
| ... | ... | @@ -162,6 +167,7 @@ const Point3 = struct { |
| 162 | 167 | y: i32, |
| 163 | 168 | |
| 164 | 169 | fn addPointCoords(self: Point3, comptime T: type) i32 { |
| 170 | _ = T; | |
| 165 | 171 | return self.x + self.y; |
| 166 | 172 | } |
| 167 | 173 | }; |
test/behavior/for.zig+11-3| ... | ... | @@ -29,10 +29,14 @@ test "for loop with pointer elem var" { |
| 29 | 29 | mangleString(target[0..]); |
| 30 | 30 | try expect(mem.eql(u8, &target, "bcdefgh")); |
| 31 | 31 | |
| 32 | for (source) |*c, i| | |
| 32 | for (source) |*c, i| { | |
| 33 | _ = i; | |
| 33 | 34 | try expect(@TypeOf(c) == *const u8); |
| 34 | for (target) |*c, i| | |
| 35 | } | |
| 36 | for (target) |*c, i| { | |
| 37 | _ = i; | |
| 35 | 38 | try expect(@TypeOf(c) == *u8); |
| 39 | } | |
| 36 | 40 | } |
| 37 | 41 | |
| 38 | 42 | fn mangleString(s: []u8) void { |
| ... | ... | @@ -53,6 +57,7 @@ test "basic for loop" { |
| 53 | 57 | buf_index += 1; |
| 54 | 58 | } |
| 55 | 59 | for (array) |item, index| { |
| 60 | _ = item; | |
| 56 | 61 | buffer[buf_index] = @intCast(u8, index); |
| 57 | 62 | buf_index += 1; |
| 58 | 63 | } |
| ... | ... | @@ -62,6 +67,7 @@ test "basic for loop" { |
| 62 | 67 | buf_index += 1; |
| 63 | 68 | } |
| 64 | 69 | for (array_ptr) |item, index| { |
| 70 | _ = item; | |
| 65 | 71 | buffer[buf_index] = @intCast(u8, index); |
| 66 | 72 | buf_index += 1; |
| 67 | 73 | } |
| ... | ... | @@ -70,7 +76,7 @@ test "basic for loop" { |
| 70 | 76 | buffer[buf_index] = item; |
| 71 | 77 | buf_index += 1; |
| 72 | 78 | } |
| 73 | for (unknown_size) |item, index| { | |
| 79 | for (unknown_size) |_, index| { | |
| 74 | 80 | buffer[buf_index] = @intCast(u8, index); |
| 75 | 81 | buf_index += 1; |
| 76 | 82 | } |
| ... | ... | @@ -118,6 +124,7 @@ test "2 break statements and an else" { |
| 118 | 124 | var buf: [10]u8 = undefined; |
| 119 | 125 | var ok = false; |
| 120 | 126 | ok = for (buf) |item| { |
| 127 | _ = item; | |
| 121 | 128 | if (f) break false; |
| 122 | 129 | if (t) break true; |
| 123 | 130 | } else false; |
| ... | ... | @@ -136,6 +143,7 @@ test "for with null and T peer types and inferred result location type" { |
| 136 | 143 | break item; |
| 137 | 144 | } |
| 138 | 145 | } else null) |v| { |
| 146 | _ = v; | |
| 139 | 147 | @panic("fail"); |
| 140 | 148 | } |
| 141 | 149 | } |
test/behavior/if.zig+1-1| ... | ... | @@ -45,7 +45,7 @@ var global_with_err: anyerror!u32 = error.SomeError; |
| 45 | 45 | test "unwrap mutable global var" { |
| 46 | 46 | if (global_with_val) |v| { |
| 47 | 47 | try expect(v == 0); |
| 48 | } else |e| { | |
| 48 | } else |_| { | |
| 49 | 49 | unreachable; |
| 50 | 50 | } |
| 51 | 51 | if (global_with_err) |_| { |
test/behavior/misc.zig+17-4| ... | ... | @@ -245,14 +245,18 @@ var some_mem: [100]u8 = undefined; |
| 245 | 245 | fn memAlloc(comptime T: type, n: usize) anyerror![]T { |
| 246 | 246 | return @ptrCast([*]T, &some_mem[0])[0..n]; |
| 247 | 247 | } |
| 248 | fn memFree(comptime T: type, memory: []T) void {} | |
| 248 | fn memFree(comptime T: type, memory: []T) void { | |
| 249 | _ = memory; | |
| 250 | } | |
| 249 | 251 | |
| 250 | 252 | test "cast undefined" { |
| 251 | 253 | const array: [100]u8 = undefined; |
| 252 | 254 | const slice = @as([]const u8, &array); |
| 253 | 255 | testCastUndefined(slice); |
| 254 | 256 | } |
| 255 | fn testCastUndefined(x: []const u8) void {} | |
| 257 | fn testCastUndefined(x: []const u8) void { | |
| 258 | _ = x; | |
| 259 | } | |
| 256 | 260 | |
| 257 | 261 | test "cast small unsigned to larger signed" { |
| 258 | 262 | try expect(castSmallUnsignedToLargerSigned1(200) == @as(i16, 200)); |
| ... | ... | @@ -452,6 +456,7 @@ test "@typeName" { |
| 452 | 456 | } |
| 453 | 457 | |
| 454 | 458 | fn TypeFromFn(comptime T: type) type { |
| 459 | _ = T; | |
| 455 | 460 | return struct {}; |
| 456 | 461 | } |
| 457 | 462 | |
| ... | ... | @@ -555,7 +560,12 @@ test "packed struct, enum, union parameters in extern function" { |
| 555 | 560 | }), &(PackedUnion{ .a = 1 })); |
| 556 | 561 | } |
| 557 | 562 | |
| 558 | export fn testPackedStuff(a: *const PackedStruct, b: *const PackedUnion) void {} | |
| 563 | export fn testPackedStuff(a: *const PackedStruct, b: *const PackedUnion) void { | |
| 564 | if (false) { | |
| 565 | a; | |
| 566 | b; | |
| 567 | } | |
| 568 | } | |
| 559 | 569 | |
| 560 | 570 | test "slicing zero length array" { |
| 561 | 571 | const s1 = ""[0..]; |
| ... | ... | @@ -584,6 +594,7 @@ test "self reference through fn ptr field" { |
| 584 | 594 | }; |
| 585 | 595 | |
| 586 | 596 | fn foo(a: A) u8 { |
| 597 | _ = a; | |
| 587 | 598 | return 12; |
| 588 | 599 | } |
| 589 | 600 | }; |
| ... | ... | @@ -753,7 +764,9 @@ test "extern variable with non-pointer opaque type" { |
| 753 | 764 | |
| 754 | 765 | test "lazy typeInfo value as generic parameter" { |
| 755 | 766 | const S = struct { |
| 756 | fn foo(args: anytype) void {} | |
| 767 | fn foo(args: anytype) void { | |
| 768 | _ = args; | |
| 769 | } | |
| 757 | 770 | }; |
| 758 | 771 | S.foo(@typeInfo(@TypeOf(.{}))); |
| 759 | 772 | } |
test/behavior/null.zig+1| ... | ... | @@ -130,6 +130,7 @@ var struct_with_optional: StructWithOptional = undefined; |
| 130 | 130 | test "unwrap optional which is field of global var" { |
| 131 | 131 | struct_with_optional.field = null; |
| 132 | 132 | if (struct_with_optional.field) |payload| { |
| 133 | _ = payload; | |
| 133 | 134 | unreachable; |
| 134 | 135 | } |
| 135 | 136 | struct_with_optional.field = 1234; |
test/behavior/optional.zig+1| ... | ... | @@ -161,6 +161,7 @@ test "self-referential struct through a slice of optional" { |
| 161 | 161 | test "assigning to an unwrapped optional field in an inline loop" { |
| 162 | 162 | comptime var maybe_pos_arg: ?comptime_int = null; |
| 163 | 163 | inline for ("ab") |x| { |
| 164 | _ = x; | |
| 164 | 165 | maybe_pos_arg = 0; |
| 165 | 166 | if (maybe_pos_arg.? != 0) { |
| 166 | 167 | @compileError("bad"); |
test/behavior/pointers.zig+5-1| ... | ... | @@ -179,6 +179,7 @@ test "assign null directly to C pointer and test null equality" { |
| 179 | 179 | try expect(!(x != null)); |
| 180 | 180 | try expect(!(null != x)); |
| 181 | 181 | if (x) |same_x| { |
| 182 | _ = same_x; | |
| 182 | 183 | @panic("fail"); |
| 183 | 184 | } |
| 184 | 185 | var otherx: i32 = undefined; |
| ... | ... | @@ -189,7 +190,10 @@ test "assign null directly to C pointer and test null equality" { |
| 189 | 190 | comptime try expect(null == y); |
| 190 | 191 | comptime try expect(!(y != null)); |
| 191 | 192 | comptime try expect(!(null != y)); |
| 192 | if (y) |same_y| @panic("fail"); | |
| 193 | if (y) |same_y| { | |
| 194 | _ = same_y; | |
| 195 | @panic("fail"); | |
| 196 | } | |
| 193 | 197 | const othery: i32 = undefined; |
| 194 | 198 | comptime try expect((y orelse &othery) == &othery); |
| 195 | 199 |
test/behavior/reflection.zig+5| ... | ... | @@ -15,6 +15,11 @@ test "reflection: function return type, var args, and param types" { |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | fn dummy(a: bool, b: i32, c: f32) i32 { |
| 18 | if (false) { | |
| 19 | a; | |
| 20 | b; | |
| 21 | c; | |
| 22 | } | |
| 18 | 23 | return 1234; |
| 19 | 24 | } |
| 20 | 25 |
test/behavior/struct.zig+5| ... | ... | @@ -182,6 +182,7 @@ test "empty struct method call" { |
| 182 | 182 | } |
| 183 | 183 | const EmptyStruct = struct { |
| 184 | 184 | fn method(es: *const EmptyStruct) i32 { |
| 185 | _ = es; | |
| 185 | 186 | return 1234; |
| 186 | 187 | } |
| 187 | 188 | }; |
| ... | ... | @@ -452,9 +453,11 @@ fn alloc(comptime T: type) []T { |
| 452 | 453 | test "call method with mutable reference to struct with no fields" { |
| 453 | 454 | const S = struct { |
| 454 | 455 | fn doC(s: *const @This()) bool { |
| 456 | _ = s; | |
| 455 | 457 | return true; |
| 456 | 458 | } |
| 457 | 459 | fn do(s: *@This()) bool { |
| 460 | _ = s; | |
| 458 | 461 | return true; |
| 459 | 462 | } |
| 460 | 463 | }; |
| ... | ... | @@ -625,11 +628,13 @@ test "for loop over pointers to struct, getting field from struct pointer" { |
| 625 | 628 | var ok = true; |
| 626 | 629 | |
| 627 | 630 | fn eql(a: []const u8) bool { |
| 631 | _ = a; | |
| 628 | 632 | return true; |
| 629 | 633 | } |
| 630 | 634 | |
| 631 | 635 | const ArrayList = struct { |
| 632 | 636 | fn toSlice(self: *ArrayList) []*Foo { |
| 637 | _ = self; | |
| 633 | 638 | return @as([*]*Foo, undefined)[0..0]; |
| 634 | 639 | } |
| 635 | 640 | }; |
test/behavior/switch.zig+13-3| ... | ... | @@ -386,6 +386,7 @@ test "switch with null and T peer types and inferred result location type" { |
| 386 | 386 | 0 => true, |
| 387 | 387 | else => null, |
| 388 | 388 | }) |v| { |
| 389 | _ = v; | |
| 389 | 390 | @panic("fail"); |
| 390 | 391 | } |
| 391 | 392 | } |
| ... | ... | @@ -411,12 +412,18 @@ test "switch prongs with cases with identical payload types" { |
| 411 | 412 | try expect(@TypeOf(e) == usize); |
| 412 | 413 | try expect(e == 8); |
| 413 | 414 | }, |
| 414 | .B => |e| @panic("fail"), | |
| 415 | .B => |e| { | |
| 416 | _ = e; | |
| 417 | @panic("fail"); | |
| 418 | }, | |
| 415 | 419 | } |
| 416 | 420 | } |
| 417 | 421 | fn doTheSwitch2(u: Union) !void { |
| 418 | 422 | switch (u) { |
| 419 | .A, .C => |e| @panic("fail"), | |
| 423 | .A, .C => |e| { | |
| 424 | _ = e; | |
| 425 | @panic("fail"); | |
| 426 | }, | |
| 420 | 427 | .B => |e| { |
| 421 | 428 | try expect(@TypeOf(e) == isize); |
| 422 | 429 | try expect(e == -8); |
| ... | ... | @@ -508,7 +515,10 @@ test "switch on error set with single else" { |
| 508 | 515 | fn doTheTest() !void { |
| 509 | 516 | var some: error{Foo} = error.Foo; |
| 510 | 517 | try expect(switch (some) { |
| 511 | else => |a| true, | |
| 518 | else => |a| blk: { | |
| 519 | a catch {}; | |
| 520 | break :blk true; | |
| 521 | }, | |
| 512 | 522 | }); |
| 513 | 523 | } |
| 514 | 524 | }; |
test/behavior/type.zig+7-1| ... | ... | @@ -431,6 +431,10 @@ test "Type.Fn" { |
| 431 | 431 | |
| 432 | 432 | const foo = struct { |
| 433 | 433 | fn func(a: usize, b: bool) align(4) callconv(.C) usize { |
| 434 | if (false) { | |
| 435 | a; | |
| 436 | b; | |
| 437 | } | |
| 434 | 438 | return 0; |
| 435 | 439 | } |
| 436 | 440 | }.func; |
| ... | ... | @@ -444,7 +448,9 @@ test "Type.BoundFn" { |
| 444 | 448 | if (builtin.target.cpu.arch == .wasm32 or builtin.target.cpu.arch == .wasm64) return error.SkipZigTest; |
| 445 | 449 | |
| 446 | 450 | const TestStruct = packed struct { |
| 447 | pub fn foo(self: *const @This()) align(4) callconv(.Unspecified) void {} | |
| 451 | pub fn foo(self: *const @This()) align(4) callconv(.Unspecified) void { | |
| 452 | _ = self; | |
| 453 | } | |
| 448 | 454 | }; |
| 449 | 455 | const test_instance: TestStruct = undefined; |
| 450 | 456 | try testing.expect(std.meta.eql( |
test/behavior/type_info.zig+7-2| ... | ... | @@ -277,7 +277,9 @@ const TestStruct = packed struct { |
| 277 | 277 | fieldC: *Self, |
| 278 | 278 | fieldD: u32 = 4, |
| 279 | 279 | |
| 280 | pub fn foo(self: *const Self) void {} | |
| 280 | pub fn foo(self: *const Self) void { | |
| 281 | _ = self; | |
| 282 | } | |
| 281 | 283 | const Self = @This(); |
| 282 | 284 | }; |
| 283 | 285 | |
| ... | ... | @@ -326,7 +328,9 @@ extern fn fooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize; |
| 326 | 328 | |
| 327 | 329 | test "typeInfo with comptime parameter in struct fn def" { |
| 328 | 330 | const S = struct { |
| 329 | pub fn func(comptime x: f32) void {} | |
| 331 | pub fn func(comptime x: f32) void { | |
| 332 | _ = x; | |
| 333 | } | |
| 330 | 334 | }; |
| 331 | 335 | comptime var info = @typeInfo(S); |
| 332 | 336 | _ = info; |
| ... | ... | @@ -369,6 +373,7 @@ test "type info: pass to function" { |
| 369 | 373 | } |
| 370 | 374 | |
| 371 | 375 | fn passTypeInfo(comptime info: TypeInfo) type { |
| 376 | _ = info; | |
| 372 | 377 | return void; |
| 373 | 378 | } |
| 374 | 379 |
test/behavior/underscore.zig+2| ... | ... | @@ -7,7 +7,9 @@ test "ignore lval with underscore" { |
| 7 | 7 | |
| 8 | 8 | test "ignore lval with underscore (for loop)" { |
| 9 | 9 | for ([_]void{}) |_, i| { |
| 10 | _ = i; | |
| 10 | 11 | for ([_]void{}) |_, j| { |
| 12 | _ = j; | |
| 11 | 13 | break; |
| 12 | 14 | } |
| 13 | 15 | break; |
test/behavior/union.zig+8-2| ... | ... | @@ -374,7 +374,9 @@ const Attribute = union(enum) { |
| 374 | 374 | B: u8, |
| 375 | 375 | }; |
| 376 | 376 | |
| 377 | fn setAttribute(attr: Attribute) void {} | |
| 377 | fn setAttribute(attr: Attribute) void { | |
| 378 | _ = attr; | |
| 379 | } | |
| 378 | 380 | |
| 379 | 381 | fn Setter(attr: Attribute) type { |
| 380 | 382 | return struct { |
| ... | ... | @@ -465,7 +467,9 @@ test "union no tag with struct member" { |
| 465 | 467 | const Struct = struct {}; |
| 466 | 468 | const Union = union { |
| 467 | 469 | s: Struct, |
| 468 | pub fn foo(self: *@This()) void {} | |
| 470 | pub fn foo(self: *@This()) void { | |
| 471 | _ = self; | |
| 472 | } | |
| 469 | 473 | }; |
| 470 | 474 | var u = Union{ .s = Struct{} }; |
| 471 | 475 | u.foo(); |
| ... | ... | @@ -703,6 +707,7 @@ test "method call on an empty union" { |
| 703 | 707 | X2: [0]u8, |
| 704 | 708 | |
| 705 | 709 | pub fn useIt(self: *@This()) bool { |
| 710 | _ = self; | |
| 706 | 711 | return true; |
| 707 | 712 | } |
| 708 | 713 | }; |
| ... | ... | @@ -771,6 +776,7 @@ test "@unionInit on union w/ tag but no fields" { |
| 771 | 776 | no_op: void, |
| 772 | 777 | |
| 773 | 778 | pub fn decode(buf: []const u8) Data { |
| 779 | _ = buf; | |
| 774 | 780 | return @unionInit(Data, "no_op", {}); |
| 775 | 781 | } |
| 776 | 782 | }; |
test/behavior/var_args.zig+3| ... | ... | @@ -48,6 +48,7 @@ test "runtime parameter before var args" { |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | fn extraFn(extra: u32, args: anytype) !usize { |
| 51 | _ = extra; | |
| 51 | 52 | if (args.len >= 1) { |
| 52 | 53 | try expect(args[0] == false); |
| 53 | 54 | } |
| ... | ... | @@ -63,9 +64,11 @@ const foos = [_]fn (anytype) bool{ |
| 63 | 64 | }; |
| 64 | 65 | |
| 65 | 66 | fn foo1(args: anytype) bool { |
| 67 | _ = args; | |
| 66 | 68 | return true; |
| 67 | 69 | } |
| 68 | 70 | fn foo2(args: anytype) bool { |
| 71 | _ = args; | |
| 69 | 72 | return false; |
| 70 | 73 | } |
| 71 | 74 |
test/behavior/while.zig+2-2| ... | ... | @@ -151,14 +151,14 @@ test "while on optional with else result follow break prong" { |
| 151 | 151 | test "while on error union with else result follow else prong" { |
| 152 | 152 | const result = while (returnError()) |value| { |
| 153 | 153 | break value; |
| 154 | } else |err| @as(i32, 2); | |
| 154 | } else |_| @as(i32, 2); | |
| 155 | 155 | try expect(result == 2); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | test "while on error union with else result follow break prong" { |
| 159 | 159 | const result = while (returnSuccess(10)) |value| { |
| 160 | 160 | break value; |
| 161 | } else |err| @as(i32, 2); | |
| 161 | } else |_| @as(i32, 2); | |
| 162 | 162 | try expect(result == 10); |
| 163 | 163 | } |
| 164 | 164 |
test/stage2/cbe.zig+10-6| ... | ... | @@ -823,31 +823,35 @@ pub fn addCases(ctx: *TestContext) !void { |
| 823 | 823 | \\ |
| 824 | 824 | ); |
| 825 | 825 | ctx.h("header with single param function", linux_x64, |
| 826 | \\export fn start(a: u8) void{} | |
| 826 | \\export fn start(a: u8) void{ | |
| 827 | \\ _ = a; | |
| 828 | \\} | |
| 827 | 829 | , |
| 828 | 830 | \\ZIG_EXTERN_C void start(uint8_t a0); |
| 829 | 831 | \\ |
| 830 | 832 | ); |
| 831 | 833 | ctx.h("header with multiple param function", linux_x64, |
| 832 | \\export fn start(a: u8, b: u8, c: u8) void{} | |
| 834 | \\export fn start(a: u8, b: u8, c: u8) void{ | |
| 835 | \\ _ = a; _ = b; _ = c; | |
| 836 | \\} | |
| 833 | 837 | , |
| 834 | 838 | \\ZIG_EXTERN_C void start(uint8_t a0, uint8_t a1, uint8_t a2); |
| 835 | 839 | \\ |
| 836 | 840 | ); |
| 837 | 841 | ctx.h("header with u32 param function", linux_x64, |
| 838 | \\export fn start(a: u32) void{} | |
| 842 | \\export fn start(a: u32) void{ _ = a; } | |
| 839 | 843 | , |
| 840 | 844 | \\ZIG_EXTERN_C void start(uint32_t a0); |
| 841 | 845 | \\ |
| 842 | 846 | ); |
| 843 | 847 | ctx.h("header with usize param function", linux_x64, |
| 844 | \\export fn start(a: usize) void{} | |
| 848 | \\export fn start(a: usize) void{ _ = a; } | |
| 845 | 849 | , |
| 846 | 850 | \\ZIG_EXTERN_C void start(uintptr_t a0); |
| 847 | 851 | \\ |
| 848 | 852 | ); |
| 849 | 853 | ctx.h("header with bool param function", linux_x64, |
| 850 | \\export fn start(a: bool) void{} | |
| 854 | \\export fn start(a: bool) void{_ = a;} | |
| 851 | 855 | , |
| 852 | 856 | \\ZIG_EXTERN_C void start(bool a0); |
| 853 | 857 | \\ |
| ... | ... | @@ -871,7 +875,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 871 | 875 | \\ |
| 872 | 876 | ); |
| 873 | 877 | ctx.h("header with multiple includes", linux_x64, |
| 874 | \\export fn start(a: u32, b: usize) void{} | |
| 878 | \\export fn start(a: u32, b: usize) void{ _ = a; _ = b; } | |
| 875 | 879 | , |
| 876 | 880 | \\ZIG_EXTERN_C void start(uint32_t a0, uintptr_t a1); |
| 877 | 881 | \\ |
test/stage2/test.zig+3-1| ... | ... | @@ -1392,7 +1392,9 @@ pub fn addCases(ctx: *TestContext) !void { |
| 1392 | 1392 | \\pub fn main() void { |
| 1393 | 1393 | \\ doNothing(0); |
| 1394 | 1394 | \\} |
| 1395 | \\fn doNothing(arg: u0) void {} | |
| 1395 | \\fn doNothing(arg: u0) void { | |
| 1396 | \\ _ = arg; | |
| 1397 | \\} | |
| 1396 | 1398 | , |
| 1397 | 1399 | "", |
| 1398 | 1400 | ); |
test/stage2/wasm.zig+2-1| ... | ... | @@ -64,7 +64,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 64 | 64 | \\ foo(10, 20); |
| 65 | 65 | \\ return 5; |
| 66 | 66 | \\} |
| 67 | \\fn foo(x: u32, y: u32) void {} | |
| 67 | \\fn foo(x: u32, y: u32) void { _ = x; _ = y; } | |
| 68 | 68 | , "5\n"); |
| 69 | 69 | } |
| 70 | 70 | |
| ... | ... | @@ -95,6 +95,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 95 | 95 | \\ return i; |
| 96 | 96 | \\} |
| 97 | 97 | \\fn foo(x: u32, y: u32) void { |
| 98 | \\ _ = y; | |
| 98 | 99 | \\ var i: u32 = 10; |
| 99 | 100 | \\ i = x; |
| 100 | 101 | \\} |
test/standalone/hello_world/hello_libc.zig+2| ... | ... | @@ -8,6 +8,8 @@ const c = @cImport({ |
| 8 | 8 | const msg = "Hello, world!\n"; |
| 9 | 9 | |
| 10 | 10 | pub export fn main(argc: c_int, argv: **u8) c_int { |
| 11 | _ = argv; | |
| 12 | _ = argc; | |
| 11 | 13 | if (c.printf(msg) != @intCast(c_int, c.strlen(msg))) return -1; |
| 12 | 14 | return 0; |
| 13 | 15 | } |
test/standalone/issue_339/test.zig+2| ... | ... | @@ -1,5 +1,7 @@ |
| 1 | 1 | const StackTrace = @import("std").builtin.StackTrace; |
| 2 | 2 | pub fn panic(msg: []const u8, stack_trace: ?*StackTrace) noreturn { |
| 3 | _ = msg; | |
| 4 | _ = stack_trace; | |
| 3 | 5 | @breakpoint(); |
| 4 | 6 | while (true) {} |
| 5 | 7 | } |
test/standalone/issue_8550/main.zig+3-1| ... | ... | @@ -1,6 +1,8 @@ |
| 1 | export fn main(r0: u32, r1: u32, atags: u32) callconv(.C) noreturn { | |
| 1 | export fn main() callconv(.C) noreturn { | |
| 2 | 2 | unreachable; // never gets run so it doesn't matter |
| 3 | 3 | } |
| 4 | 4 | pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace) noreturn { |
| 5 | _ = msg; | |
| 6 | _ = error_return_trace; | |
| 5 | 7 | while (true) {} |
| 6 | 8 | } |
test/tests.zig+2| ... | ... | @@ -417,6 +417,8 @@ pub fn addStandaloneTests(b: *build.Builder, test_filter: ?[]const u8, modes: [] |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | pub fn addCliTests(b: *build.Builder, test_filter: ?[]const u8, modes: []const Mode) *build.Step { |
| 420 | _ = test_filter; | |
| 421 | _ = modes; | |
| 420 | 422 | const step = b.step("test-cli", "Test the command line interface"); |
| 421 | 423 | |
| 422 | 424 | const exe = b.addExecutable("test-cli", "test/cli.zig"); |
tools/process_headers.zig+3| ... | ... | @@ -236,12 +236,14 @@ const DestTarget = struct { |
| 236 | 236 | |
| 237 | 237 | const HashContext = struct { |
| 238 | 238 | pub fn hash(self: @This(), a: DestTarget) u32 { |
| 239 | _ = self; | |
| 239 | 240 | return @enumToInt(a.arch) +% |
| 240 | 241 | (@enumToInt(a.os) *% @as(u32, 4202347608)) +% |
| 241 | 242 | (@enumToInt(a.abi) *% @as(u32, 4082223418)); |
| 242 | 243 | } |
| 243 | 244 | |
| 244 | 245 | pub fn eql(self: @This(), a: DestTarget, b: DestTarget) bool { |
| 246 | _ = self; | |
| 245 | 247 | return a.arch.eql(b.arch) and |
| 246 | 248 | a.os == b.os and |
| 247 | 249 | a.abi == b.abi; |
| ... | ... | @@ -256,6 +258,7 @@ const Contents = struct { |
| 256 | 258 | is_generic: bool, |
| 257 | 259 | |
| 258 | 260 | fn hitCountLessThan(context: void, lhs: *const Contents, rhs: *const Contents) bool { |
| 261 | _ = context; | |
| 259 | 262 | return lhs.hit_count < rhs.hit_count; |
| 260 | 263 | } |
| 261 | 264 | }; |
tools/update_clang_options.zig+3| ... | ... | @@ -585,6 +585,8 @@ const Syntax = union(enum) { |
| 585 | 585 | options: std.fmt.FormatOptions, |
| 586 | 586 | out_stream: anytype, |
| 587 | 587 | ) !void { |
| 588 | _ = fmt; | |
| 589 | _ = options; | |
| 588 | 590 | switch (self) { |
| 589 | 591 | .multi_arg => |n| return out_stream.print(".{{.{s}={}}}", .{ @tagName(self), n }), |
| 590 | 592 | else => return out_stream.print(".{s}", .{@tagName(self)}), |
| ... | ... | @@ -663,6 +665,7 @@ fn syntaxMatchesWithEql(syntax: Syntax) bool { |
| 663 | 665 | } |
| 664 | 666 | |
| 665 | 667 | fn objectLessThan(context: void, a: *json.ObjectMap, b: *json.ObjectMap) bool { |
| 668 | _ = context; | |
| 666 | 669 | // Priority is determined by exact matches first, followed by prefix matches in descending |
| 667 | 670 | // length, with key as a final tiebreaker. |
| 668 | 671 | const a_syntax = objSyntax(a); |
tools/update_cpu_features.zig+3| ... | ... | @@ -1227,14 +1227,17 @@ fn usageAndExit(file: fs.File, arg0: []const u8, code: u8) noreturn { |
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | fn featureLessThan(context: void, a: Feature, b: Feature) bool { |
| 1230 | _ = context; | |
| 1230 | 1231 | return std.ascii.lessThanIgnoreCase(a.zig_name, b.zig_name); |
| 1231 | 1232 | } |
| 1232 | 1233 | |
| 1233 | 1234 | fn cpuLessThan(context: void, a: Cpu, b: Cpu) bool { |
| 1235 | _ = context; | |
| 1234 | 1236 | return std.ascii.lessThanIgnoreCase(a.zig_name, b.zig_name); |
| 1235 | 1237 | } |
| 1236 | 1238 | |
| 1237 | 1239 | fn asciiLessThan(context: void, a: []const u8, b: []const u8) bool { |
| 1240 | _ = context; | |
| 1238 | 1241 | return std.ascii.lessThanIgnoreCase(a, b); |
| 1239 | 1242 | } |
| 1240 | 1243 |
tools/update_glibc.zig+5-3| ... | ... | @@ -155,7 +155,7 @@ pub fn main() !void { |
| 155 | 155 | } |
| 156 | 156 | const fn_set = &target_funcs_gop.value_ptr.list; |
| 157 | 157 | |
| 158 | for (lib_names) |lib_name, lib_name_index| { | |
| 158 | for (lib_names) |lib_name| { | |
| 159 | 159 | const lib_prefix = if (std.mem.eql(u8, lib_name, "ld")) "" else "lib"; |
| 160 | 160 | const basename = try fmt.allocPrint(allocator, "{s}{s}.abilist", .{ lib_prefix, lib_name }); |
| 161 | 161 | const abi_list_filename = blk: { |
| ... | ... | @@ -263,7 +263,7 @@ pub fn main() !void { |
| 263 | 263 | |
| 264 | 264 | // Now the mapping of version and function to integer index is complete. |
| 265 | 265 | // Here we create a mapping of function name to list of versions. |
| 266 | for (abi_lists) |*abi_list, abi_index| { | |
| 266 | for (abi_lists) |*abi_list| { | |
| 267 | 267 | const value = target_functions.getPtr(@ptrToInt(abi_list)).?; |
| 268 | 268 | const fn_vers_list = &value.fn_vers_list; |
| 269 | 269 | for (value.list.items) |*ver_fn| { |
| ... | ... | @@ -286,7 +286,7 @@ pub fn main() !void { |
| 286 | 286 | const abilist_txt = buffered.writer(); |
| 287 | 287 | |
| 288 | 288 | // first iterate over the abi lists |
| 289 | for (abi_lists) |*abi_list, abi_index| { | |
| 289 | for (abi_lists) |*abi_list| { | |
| 290 | 290 | const fn_vers_list = &target_functions.getPtr(@ptrToInt(abi_list)).?.fn_vers_list; |
| 291 | 291 | for (abi_list.targets) |target, it_i| { |
| 292 | 292 | if (it_i != 0) try abilist_txt.writeByte(' '); |
| ... | ... | @@ -312,10 +312,12 @@ pub fn main() !void { |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | pub fn strCmpLessThan(context: void, a: []const u8, b: []const u8) bool { |
| 315 | _ = context; | |
| 315 | 316 | return std.mem.order(u8, a, b) == .lt; |
| 316 | 317 | } |
| 317 | 318 | |
| 318 | 319 | pub fn versionLessThan(context: void, a: []const u8, b: []const u8) bool { |
| 320 | _ = context; | |
| 319 | 321 | const sep_chars = "GLIBC_."; |
| 320 | 322 | var a_tokens = std.mem.tokenize(a, sep_chars); |
| 321 | 323 | var b_tokens = std.mem.tokenize(b, sep_chars); |
tools/update_spirv_features.zig+1| ... | ... | @@ -37,6 +37,7 @@ const Version = struct { |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | fn lessThan(ctx: void, a: Version, b: Version) bool { |
| 40 | _ = ctx; | |
| 40 | 41 | return if (a.major == b.major) |
| 41 | 42 | a.minor < b.minor |
| 42 | 43 | else |