authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-12 12:56:01-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-12 12:56:01-04:00
logc1793d61061a112dc3d58c33ac0d3a1ebc8fb35e
treeda9b4839ee1c8bcc4d5c6dcd3423f955cfce2e5d
parented5a6d74ad980474ed46732828c7f8363dd5b80d
signature Commit is signed but in an unrecognized format.

zig fmt on the standard library


25 files changed, 141 insertions(+), 214 deletions(-)

std/ascii.zig+11-11
......@@ -29,7 +29,7 @@ const combinedTable = init: {
2929 const mem = std.mem;
3030
3131 const alpha = []u1{
32 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
32 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
3333 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3434 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3535 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
......@@ -41,7 +41,7 @@ const combinedTable = init: {
4141 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
4242 };
4343 const lower = []u1{
44 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
44 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
4545 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4646 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4747 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
......@@ -53,7 +53,7 @@ const combinedTable = init: {
5353 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
5454 };
5555 const upper = []u1{
56 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
56 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
5757 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5858 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5959 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
......@@ -65,7 +65,7 @@ const combinedTable = init: {
6565 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6666 };
6767 const digit = []u1{
68 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
68 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
6969 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
7070 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
7171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
......@@ -77,7 +77,7 @@ const combinedTable = init: {
7777 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
7878 };
7979 const hex = []u1{
80 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
80 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
8181 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8383 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
......@@ -89,7 +89,7 @@ const combinedTable = init: {
8989 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9090 };
9191 const space = []u1{
92 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
92 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
9393 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0,
9494 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9595 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
......@@ -101,7 +101,7 @@ const combinedTable = init: {
101101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
102102 };
103103 const punct = []u1{
104 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
104 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
105105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
107107 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
......@@ -113,7 +113,7 @@ const combinedTable = init: {
113113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
114114 };
115115 const graph = []u1{
116 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
116 // 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9,10,11,12,13,14,15
117117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
118118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
119119 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
......@@ -129,7 +129,7 @@ const combinedTable = init: {
129129 inline while (i < 128) : (i += 1) {
130130 table[i] =
131131 u8(alpha[i]) << @enumToInt(tIndex.Alpha) |
132 u8(hex[i]) << @enumToInt(tIndex.Hex) |
132 u8(hex[i]) << @enumToInt(tIndex.Hex) |
133133 u8(space[i]) << @enumToInt(tIndex.Space) |
134134 u8(digit[i]) << @enumToInt(tIndex.Digit) |
135135 u8(lower[i]) << @enumToInt(tIndex.Lower) |
......@@ -146,8 +146,8 @@ fn inTable(c: u8, t: tIndex) bool {
146146}
147147
148148pub fn isAlNum(c: u8) bool {
149 return (combinedTable[c] & ((u8(1) << @enumToInt(tIndex.Alpha)) |
150 u8(1) << @enumToInt(tIndex.Digit))) != 0;
149 return (combinedTable[c] & ((u8(1) << @enumToInt(tIndex.Alpha)) |
150 u8(1) << @enumToInt(tIndex.Digit))) != 0;
151151}
152152
153153pub fn isAlpha(c: u8) bool {
std/c/freebsd.zig+12
......@@ -44,16 +44,22 @@ pub const pthread_attr_t = extern struct {
4444pub const msghdr = extern struct {
4545 /// optional address
4646 msg_name: ?*sockaddr,
47
4748 /// size of address
4849 msg_namelen: socklen_t,
50
4951 /// scatter/gather array
5052 msg_iov: [*]iovec,
53
5154 /// # elements in msg_iov
5255 msg_iovlen: i32,
56
5357 /// ancillary data
5458 msg_control: ?*c_void,
59
5560 /// ancillary data buffer len
5661 msg_controllen: socklen_t,
62
5763 /// flags on received message
5864 msg_flags: i32,
5965};
......@@ -61,16 +67,22 @@ pub const msghdr = extern struct {
6167pub const msghdr_const = extern struct {
6268 /// optional address
6369 msg_name: ?*const sockaddr,
70
6471 /// size of address
6572 msg_namelen: socklen_t,
73
6674 /// scatter/gather array
6775 msg_iov: [*]iovec_const,
76
6877 /// # elements in msg_iov
6978 msg_iovlen: i32,
79
7080 /// ancillary data
7181 msg_control: ?*c_void,
82
7283 /// ancillary data buffer len
7384 msg_controllen: socklen_t,
85
7486 /// flags on received message
7587 msg_flags: i32,
7688};
std/c/netbsd.zig+12
......@@ -44,16 +44,22 @@ pub const pthread_attr_t = extern struct {
4444pub const msghdr = extern struct {
4545 /// optional address
4646 msg_name: ?*sockaddr,
47
4748 /// size of address
4849 msg_namelen: socklen_t,
50
4951 /// scatter/gather array
5052 msg_iov: [*]iovec,
53
5154 /// # elements in msg_iov
5255 msg_iovlen: i32,
56
5357 /// ancillary data
5458 msg_control: ?*c_void,
59
5560 /// ancillary data buffer len
5661 msg_controllen: socklen_t,
62
5763 /// flags on received message
5864 msg_flags: i32,
5965};
......@@ -61,16 +67,22 @@ pub const msghdr = extern struct {
6167pub const msghdr_const = extern struct {
6268 /// optional address
6369 msg_name: ?*const sockaddr,
70
6471 /// size of address
6572 msg_namelen: socklen_t,
73
6674 /// scatter/gather array
6775 msg_iov: [*]iovec_const,
76
6877 /// # elements in msg_iov
6978 msg_iovlen: i32,
79
7080 /// ancillary data
7181 msg_control: ?*c_void,
82
7283 /// ancillary data buffer len
7384 msg_controllen: socklen_t,
85
7486 /// flags on received message
7587 msg_flags: i32,
7688};
std/crypto/chacha20.zig+2-2
......@@ -206,8 +206,8 @@ test "crypto.chacha20 test vector sunscreen" {
206206 const input = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.";
207207 var result: [114]u8 = undefined;
208208 const key = []u8{
209 0, 1, 2, 3, 4, 5, 6, 7,
210 8, 9, 10, 11, 12, 13, 14, 15,
209 0, 1, 2, 3, 4, 5, 6, 7,
210 8, 9, 10, 11, 12, 13, 14, 15,
211211 16, 17, 18, 19, 20, 21, 22, 23,
212212 24, 25, 26, 27, 28, 29, 30, 31,
213213 };
std/dynamic_library.zig+4-4
......@@ -71,12 +71,12 @@ pub fn linkmap_iterator(phdrs: []elf.Phdr) !LinkMap.Iterator {
7171 for (phdrs) |*phdr| {
7272 if (phdr.p_type == elf.PT_DYNAMIC) {
7373 const ptr = @intToPtr([*]elf.Dyn, va_offset + phdr.p_vaddr);
74 break :init ptr[0..phdr.p_memsz / @sizeOf(elf.Dyn)];
74 break :init ptr[0 .. phdr.p_memsz / @sizeOf(elf.Dyn)];
7575 }
7676 }
7777 // No PT_DYNAMIC means this is either a statically-linked program or a
7878 // badly corrupted one
79 return LinkMap.Iterator{.current = null};
79 return LinkMap.Iterator{ .current = null };
8080 };
8181
8282 const link_map_ptr = init: {
......@@ -93,13 +93,13 @@ pub fn linkmap_iterator(phdrs: []elf.Phdr) !LinkMap.Iterator {
9393 // second slot
9494 break :init @intToPtr(?*LinkMap, got_table[1]);
9595 },
96 else => { }
96 else => {},
9797 }
9898 }
9999 return error.InvalidExe;
100100 };
101101
102 return LinkMap.Iterator{.current = link_map_ptr};
102 return LinkMap.Iterator{ .current = link_map_ptr };
103103}
104104
105105pub const LinuxDynLib = struct {
std/event/locked.zig+1-1
......@@ -34,7 +34,7 @@ pub fn Locked(comptime T: type) type {
3434
3535 pub async fn acquire(self: *Self) HeldLock {
3636 return HeldLock{
37 // TODO guaranteed allocation elision
37 // TODO guaranteed allocation elision
3838 .held = await (async self.lock.acquire() catch unreachable),
3939 .value = &self.private_data,
4040 };
std/fmt.zig+2-2
......@@ -183,7 +183,7 @@ pub fn formatType(
183183 }
184184 try output(context, @memberName(T, field_i));
185185 try output(context, " = ");
186 try formatType(@field(value, @memberName(T, field_i)), "", context, Errors, output, max_depth-1);
186 try formatType(@field(value, @memberName(T, field_i)), "", context, Errors, output, max_depth - 1);
187187 }
188188 try output(context, " }");
189189 },
......@@ -198,7 +198,7 @@ pub fn formatType(
198198 try output(context, " = ");
199199 inline for (info.fields) |u_field| {
200200 if (@enumToInt(UnionTagType(value)) == u_field.enum_field.?.value) {
201 try formatType(@field(value, u_field.name), "", context, Errors, output, max_depth-1);
201 try formatType(@field(value, u_field.name), "", context, Errors, output, max_depth - 1);
202202 }
203203 }
204204 try output(context, " }");
std/hash_map.zig+3-3
......@@ -155,7 +155,7 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn (key: K) u3
155155 /// capacity is greater than the current capacity.
156156 /// New capacity must be a power of two.
157157 fn ensureCapacityExact(self: *Self, new_capacity: usize) !void {
158 const is_power_of_two = new_capacity & (new_capacity-1) == 0;
158 const is_power_of_two = new_capacity & (new_capacity - 1) == 0;
159159 assert(is_power_of_two);
160160
161161 if (new_capacity <= self.entries.len) {
......@@ -474,9 +474,9 @@ test "ensure capacity" {
474474 try map.ensureCapacity(20);
475475 const initialCapacity = map.entries.len;
476476 testing.expect(initialCapacity >= 20);
477 var i : i32 = 0;
477 var i: i32 = 0;
478478 while (i < 20) : (i += 1) {
479 testing.expect(map.putAssumeCapacity(i, i+10) == null);
479 testing.expect(map.putAssumeCapacity(i, i + 10) == null);
480480 }
481481 // shouldn't resize from putAssumeCapacity
482482 testing.expect(initialCapacity == map.entries.len);
std/os/linux/tls.zig+8-10
......@@ -86,8 +86,7 @@ const tls_dtv_offset = switch (builtin.arch) {
8686};
8787
8888// Per-thread storage for Zig's use
89const CustomData = packed struct {
90};
89const CustomData = packed struct {};
9190
9291// Dynamic Thread Vector
9392const DTV = packed struct {
......@@ -109,14 +108,14 @@ pub var tls_image: ?TLSImage = null;
109108pub fn setThreadPointer(addr: usize) void {
110109 switch (builtin.arch) {
111110 .x86_64 => {
112 const rc = std.os.linux.syscall2(std.os.linux.SYS_arch_prctl,
113 std.os.linux.ARCH_SET_FS, addr);
111 const rc = std.os.linux.syscall2(std.os.linux.SYS_arch_prctl, std.os.linux.ARCH_SET_FS, addr);
114112 assert(rc == 0);
115113 },
116114 .aarch64 => {
117115 asm volatile (
118116 \\ msr tpidr_el0, %[addr]
119 : : [addr] "r" (addr)
117 :
118 : [addr] "r" (addr)
120119 );
121120 },
122121 else => @compileError("Unsupported architecture"),
......@@ -137,7 +136,7 @@ pub fn initTLS() void {
137136 switch (auxv[i].a_type) {
138137 elf.AT_PHENT => at_phent = auxv[i].a_un.a_val,
139138 elf.AT_PHNUM => at_phnum = auxv[i].a_un.a_val,
140 elf.AT_PHDR => at_phdr = auxv[i].a_un.a_val,
139 elf.AT_PHDR => at_phdr = auxv[i].a_un.a_val,
141140 else => continue,
142141 }
143142 }
......@@ -151,7 +150,7 @@ pub fn initTLS() void {
151150 for (phdrs) |*phdr| {
152151 switch (phdr.p_type) {
153152 elf.PT_PHDR => img_base = at_phdr - phdr.p_vaddr,
154 elf.PT_TLS => tls_phdr = phdr,
153 elf.PT_TLS => tls_phdr = phdr,
155154 else => continue,
156155 }
157156 }
......@@ -194,7 +193,7 @@ pub fn initTLS() void {
194193 dtv_offset = l;
195194 l += @sizeOf(DTV);
196195 break :blk l;
197 }
196 },
198197 };
199198
200199 tls_image = TLSImage{
......@@ -238,8 +237,7 @@ pub fn allocateTLS(size: usize) usize {
238237 return @ptrToInt(&main_thread_tls_buffer);
239238 }
240239
241 const addr = posix.mmap(null, size, posix.PROT_READ | posix.PROT_WRITE,
242 posix.MAP_PRIVATE | posix.MAP_ANONYMOUS, -1, 0);
240 const addr = posix.mmap(null, size, posix.PROT_READ | posix.PROT_WRITE, posix.MAP_PRIVATE | posix.MAP_ANONYMOUS, -1, 0);
243241
244242 if (posix.getErrno(addr) != 0) @panic("out of memory");
245243
std/os/windows/shell32.zig-1
......@@ -1,4 +1,3 @@
11use @import("../windows.zig");
22
33pub extern "shell32" stdcallcc fn SHGetKnownFolderPath(rfid: *const KNOWNFOLDERID, dwFlags: DWORD, hToken: ?HANDLE, ppszPath: *[*]WCHAR) HRESULT;
4
std/special/compiler_rt.zig+16-4
......@@ -338,7 +338,10 @@ extern fn __umoddi3(a: u64, b: u64) u64 {
338338 return r;
339339}
340340
341extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct{q: u32, r: u32} {
341extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct {
342 q: u32,
343 r: u32,
344} {
342345 @setRuntimeSafety(is_test);
343346
344347 var result: @typeOf(__aeabi_uidivmod).ReturnType = undefined;
......@@ -346,7 +349,10 @@ extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct{q: u32, r: u32} {
346349 return result;
347350}
348351
349extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct{q: u64, r: u64} {
352extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct {
353 q: u64,
354 r: u64,
355} {
350356 @setRuntimeSafety(is_test);
351357
352358 var result: @typeOf(__aeabi_uldivmod).ReturnType = undefined;
......@@ -354,7 +360,10 @@ extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct{q: u64, r: u64} {
354360 return result;
355361}
356362
357extern fn __aeabi_idivmod(n: i32, d: i32) extern struct{q: i32, r: i32} {
363extern fn __aeabi_idivmod(n: i32, d: i32) extern struct {
364 q: i32,
365 r: i32,
366} {
358367 @setRuntimeSafety(is_test);
359368
360369 var result: @typeOf(__aeabi_idivmod).ReturnType = undefined;
......@@ -362,7 +371,10 @@ extern fn __aeabi_idivmod(n: i32, d: i32) extern struct{q: i32, r: i32} {
362371 return result;
363372}
364373
365extern fn __aeabi_ldivmod(n: i64, d: i64) extern struct{q: i64, r:i64} {
374extern fn __aeabi_ldivmod(n: i64, d: i64) extern struct {
375 q: i64,
376 r: i64,
377} {
366378 @setRuntimeSafety(is_test);
367379
368380 var result: @typeOf(__aeabi_ldivmod).ReturnType = undefined;
std/special/compiler_rt/ashrti3_test.zig+1-1
......@@ -4,7 +4,7 @@ const testing = @import("std").testing;
44fn test__ashrti3(a: i128, b: i32, expected: i128) void {
55 const x = __ashrti3(a, b);
66 // @import("std").debug.warn("got 0x{x}\nexp 0x{x}\n", @truncate(u64,
7// @bitCast(u128, x) >> 64), @truncate(u64, @bitCast(u128, expected)) >> 64);
7 // @bitCast(u128, x) >> 64), @truncate(u64, @bitCast(u128, expected)) >> 64);
88 testing.expect(x == expected);
99}
1010
std/special/compiler_rt/fixdfdi_test.zig-1
......@@ -12,7 +12,6 @@ fn test__fixdfdi(a: f64, expected: i64) void {
1212
1313test "fixdfdi" {
1414 //warn("\n");
15
1615 test__fixdfdi(-math.f64_max, math.minInt(i64));
1716
1817 test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
std/special/compiler_rt/fixdfsi_test.zig+4-5
......@@ -12,7 +12,6 @@ fn test__fixdfsi(a: f64, expected: i32) void {
1212
1313test "fixdfsi" {
1414 //warn("\n");
15
1615 test__fixdfsi(-math.f64_max, math.minInt(i32));
1716
1817 test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
......@@ -22,10 +21,10 @@ test "fixdfsi" {
2221 test__fixdfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000);
2322 test__fixdfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000);
2423
25 test__fixdfsi(-0x1.0000000000001p+63, -0x80000000);
26 test__fixdfsi(-0x1.0000000000000p+63, -0x80000000);
27 test__fixdfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000);
28 test__fixdfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000);
24 test__fixdfsi(-0x1.0000000000001p+63, -0x80000000);
25 test__fixdfsi(-0x1.0000000000000p+63, -0x80000000);
26 test__fixdfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000);
27 test__fixdfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000);
2928
3029 test__fixdfsi(-0x1.FFFFFEp+62, -0x80000000);
3130 test__fixdfsi(-0x1.FFFFFCp+62, -0x80000000);
std/special/compiler_rt/fixdfti_test.zig-1
......@@ -12,7 +12,6 @@ fn test__fixdfti(a: f64, expected: i128) void {
1212
1313test "fixdfti" {
1414 //warn("\n");
15
1615 test__fixdfti(-math.f64_max, math.minInt(i128));
1716
1817 test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
std/special/compiler_rt/fixint_test.zig+7-7
......@@ -82,7 +82,7 @@ test "fixint.i32" {
8282 test__fixint(f64, i32, -math.inf_f64, math.minInt(i32));
8383 test__fixint(f64, i32, -math.f64_max, math.minInt(i32));
8484 test__fixint(f64, i32, f64(math.minInt(i32)), math.minInt(i32));
85 test__fixint(f64, i32, f64(math.minInt(i32))+1, math.minInt(i32)+1);
85 test__fixint(f64, i32, f64(math.minInt(i32)) + 1, math.minInt(i32) + 1);
8686 test__fixint(f64, i32, -2.0, -2);
8787 test__fixint(f64, i32, -1.9, -1);
8888 test__fixint(f64, i32, -1.1, -1);
......@@ -96,7 +96,7 @@ test "fixint.i32" {
9696 test__fixint(f64, i32, 0.1, 0);
9797 test__fixint(f64, i32, 0.9, 0);
9898 test__fixint(f64, i32, 1.0, 1);
99 test__fixint(f64, i32, f64(math.maxInt(i32))-1, math.maxInt(i32)-1);
99 test__fixint(f64, i32, f64(math.maxInt(i32)) - 1, math.maxInt(i32) - 1);
100100 test__fixint(f64, i32, f64(math.maxInt(i32)), math.maxInt(i32));
101101 test__fixint(f64, i32, math.f64_max, math.maxInt(i32));
102102 test__fixint(f64, i32, math.inf_f64, math.maxInt(i32));
......@@ -106,8 +106,8 @@ test "fixint.i64" {
106106 test__fixint(f64, i64, -math.inf_f64, math.minInt(i64));
107107 test__fixint(f64, i64, -math.f64_max, math.minInt(i64));
108108 test__fixint(f64, i64, f64(math.minInt(i64)), math.minInt(i64));
109 test__fixint(f64, i64, f64(math.minInt(i64))+1, math.minInt(i64));
110 test__fixint(f64, i64, f64(math.minInt(i64)/2), math.minInt(i64)/2);
109 test__fixint(f64, i64, f64(math.minInt(i64)) + 1, math.minInt(i64));
110 test__fixint(f64, i64, f64(math.minInt(i64) / 2), math.minInt(i64) / 2);
111111 test__fixint(f64, i64, -2.0, -2);
112112 test__fixint(f64, i64, -1.9, -1);
113113 test__fixint(f64, i64, -1.1, -1);
......@@ -121,7 +121,7 @@ test "fixint.i64" {
121121 test__fixint(f64, i64, 0.1, 0);
122122 test__fixint(f64, i64, 0.9, 0);
123123 test__fixint(f64, i64, 1.0, 1);
124 test__fixint(f64, i64, f64(math.maxInt(i64))-1, math.maxInt(i64));
124 test__fixint(f64, i64, f64(math.maxInt(i64)) - 1, math.maxInt(i64));
125125 test__fixint(f64, i64, f64(math.maxInt(i64)), math.maxInt(i64));
126126 test__fixint(f64, i64, math.f64_max, math.maxInt(i64));
127127 test__fixint(f64, i64, math.inf_f64, math.maxInt(i64));
......@@ -131,7 +131,7 @@ test "fixint.i128" {
131131 test__fixint(f64, i128, -math.inf_f64, math.minInt(i128));
132132 test__fixint(f64, i128, -math.f64_max, math.minInt(i128));
133133 test__fixint(f64, i128, f64(math.minInt(i128)), math.minInt(i128));
134 test__fixint(f64, i128, f64(math.minInt(i128))+1, math.minInt(i128));
134 test__fixint(f64, i128, f64(math.minInt(i128)) + 1, math.minInt(i128));
135135 test__fixint(f64, i128, -2.0, -2);
136136 test__fixint(f64, i128, -1.9, -1);
137137 test__fixint(f64, i128, -1.1, -1);
......@@ -145,7 +145,7 @@ test "fixint.i128" {
145145 test__fixint(f64, i128, 0.1, 0);
146146 test__fixint(f64, i128, 0.9, 0);
147147 test__fixint(f64, i128, 1.0, 1);
148 test__fixint(f64, i128, f64(math.maxInt(i128))-1, math.maxInt(i128));
148 test__fixint(f64, i128, f64(math.maxInt(i128)) - 1, math.maxInt(i128));
149149 test__fixint(f64, i128, f64(math.maxInt(i128)), math.maxInt(i128));
150150 test__fixint(f64, i128, math.f64_max, math.maxInt(i128));
151151 test__fixint(f64, i128, math.inf_f64, math.maxInt(i128));
std/special/compiler_rt/fixsfdi_test.zig-1
......@@ -12,7 +12,6 @@ fn test__fixsfdi(a: f32, expected: i64) void {
1212
1313test "fixsfdi" {
1414 //warn("\n");
15
1615 test__fixsfdi(-math.f32_max, math.minInt(i64));
1716
1817 test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
std/special/compiler_rt/fixsfsi_test.zig+4-5
......@@ -12,7 +12,6 @@ fn test__fixsfsi(a: f32, expected: i32) void {
1212
1313test "fixsfsi" {
1414 //warn("\n");
15
1615 test__fixsfsi(-math.f32_max, math.minInt(i32));
1716
1817 test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
......@@ -22,10 +21,10 @@ test "fixsfsi" {
2221 test__fixsfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000);
2322 test__fixsfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000);
2423
25 test__fixsfsi(-0x1.0000000000001p+63, -0x80000000);
26 test__fixsfsi(-0x1.0000000000000p+63, -0x80000000);
27 test__fixsfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000);
28 test__fixsfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000);
24 test__fixsfsi(-0x1.0000000000001p+63, -0x80000000);
25 test__fixsfsi(-0x1.0000000000000p+63, -0x80000000);
26 test__fixsfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000);
27 test__fixsfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000);
2928
3029 test__fixsfsi(-0x1.FFFFFEp+62, -0x80000000);
3130 test__fixsfsi(-0x1.FFFFFCp+62, -0x80000000);
std/special/compiler_rt/fixsfti_test.zig+1-2
......@@ -12,7 +12,6 @@ fn test__fixsfti(a: f32, expected: i128) void {
1212
1313test "fixsfti" {
1414 //warn("\n");
15
1615 test__fixsfti(-math.f32_max, math.minInt(i128));
1716
1817 test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
......@@ -30,7 +29,7 @@ test "fixsfti" {
3029 test__fixsfti(-0x1.FFFFFFFFFFFFFp+62, -0x8000000000000000);
3130 test__fixsfti(-0x1.FFFFFFFFFFFFEp+62, -0x8000000000000000);
3231
33 test__fixsfti(-0x1.FFFFFFp+62, -0x8000000000000000);
32 test__fixsfti(-0x1.FFFFFFp+62, -0x8000000000000000);
3433 test__fixsfti(-0x1.FFFFFEp+62, -0x7fffff8000000000);
3534 test__fixsfti(-0x1.FFFFFCp+62, -0x7fffff0000000000);
3635
std/special/compiler_rt/fixtfdi_test.zig+4-5
......@@ -12,7 +12,6 @@ fn test__fixtfdi(a: f128, expected: i64) void {
1212
1313test "fixtfdi" {
1414 //warn("\n");
15
1615 test__fixtfdi(-math.f128_max, math.minInt(i64));
1716
1817 test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
......@@ -22,10 +21,10 @@ test "fixtfdi" {
2221 test__fixtfdi(-0x1.FFFFFFFFFFFFFp+126, -0x8000000000000000);
2322 test__fixtfdi(-0x1.FFFFFFFFFFFFEp+126, -0x8000000000000000);
2423
25 test__fixtfdi(-0x1.0000000000001p+63, -0x8000000000000000);
26 test__fixtfdi(-0x1.0000000000000p+63, -0x8000000000000000);
27 test__fixtfdi(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00);
28 test__fixtfdi(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800);
24 test__fixtfdi(-0x1.0000000000001p+63, -0x8000000000000000);
25 test__fixtfdi(-0x1.0000000000000p+63, -0x8000000000000000);
26 test__fixtfdi(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00);
27 test__fixtfdi(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800);
2928
3029 test__fixtfdi(-0x1.FFFFFEp+62, -0x7FFFFF8000000000);
3130 test__fixtfdi(-0x1.FFFFFCp+62, -0x7FFFFF0000000000);
std/special/compiler_rt/fixtfsi_test.zig+4-5
......@@ -12,7 +12,6 @@ fn test__fixtfsi(a: f128, expected: i32) void {
1212
1313test "fixtfsi" {
1414 //warn("\n");
15
1615 test__fixtfsi(-math.f128_max, math.minInt(i32));
1716
1817 test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
......@@ -22,10 +21,10 @@ test "fixtfsi" {
2221 test__fixtfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000);
2322 test__fixtfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000);
2423
25 test__fixtfsi(-0x1.0000000000001p+63, -0x80000000);
26 test__fixtfsi(-0x1.0000000000000p+63, -0x80000000);
27 test__fixtfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000);
28 test__fixtfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000);
24 test__fixtfsi(-0x1.0000000000001p+63, -0x80000000);
25 test__fixtfsi(-0x1.0000000000000p+63, -0x80000000);
26 test__fixtfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000);
27 test__fixtfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000);
2928
3029 test__fixtfsi(-0x1.FFFFFEp+62, -0x80000000);
3130 test__fixtfsi(-0x1.FFFFFCp+62, -0x80000000);
std/special/compiler_rt/fixtfti_test.zig-1
......@@ -12,7 +12,6 @@ fn test__fixtfti(a: f128, expected: i128) void {
1212
1313test "fixtfti" {
1414 //warn("\n");
15
1615 test__fixtfti(-math.f128_max, math.minInt(i128));
1716
1817 test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
std/special/compiler_rt/stack_probe.zig+5-5
......@@ -51,7 +51,7 @@ pub nakedcc fn zig_probe_stack() void {
5151 \\ ret
5252 );
5353 },
54 else => { }
54 else => {},
5555 }
5656
5757 unreachable;
......@@ -103,7 +103,7 @@ fn win_probe_stack_only() void {
103103 \\ ret
104104 );
105105 },
106 else => { }
106 else => {},
107107 }
108108
109109 unreachable;
......@@ -159,9 +159,9 @@ fn win_probe_stack_adjust_sp() void {
159159 \\ push (%%eax)
160160 \\ sub %%esp,%%eax
161161 \\ ret
162 );
162 );
163163 },
164 else => { },
164 else => {},
165165 }
166166
167167 unreachable;
......@@ -189,7 +189,7 @@ pub nakedcc fn __chkstk() void {
189189 switch (builtin.arch) {
190190 .i386 => @inlineCall(win_probe_stack_adjust_sp),
191191 .x86_64 => @inlineCall(win_probe_stack_only),
192 else => unreachable
192 else => unreachable,
193193 }
194194}
195195pub nakedcc fn ___chkstk() void {
std/valgrind.zig+40-136
......@@ -1,11 +1,7 @@
11const builtin = @import("builtin");
22const math = @import("index.zig").math;
33
4
5pub fn doClientRequest(default: usize, request: usize,
6 a1: usize, a2: usize, a3: usize, a4: usize, a5: usize
7 ) usize
8{
4pub fn doClientRequest(default: usize, request: usize, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize {
95 if (!builtin.valgrind_support) {
106 return default;
117 }
......@@ -16,8 +12,8 @@ pub fn doClientRequest(default: usize, request: usize,
1612 \\ roll $3, %%edi ; roll $13, %%edi
1713 \\ roll $29, %%edi ; roll $19, %%edi
1814 \\ xchgl %%ebx,%%ebx
19 : [_] "={edx}" (-> usize)
20 : [_] "{eax}" (&[]usize{request, a1, a2, a3, a4, a5}),
15 : [_] "={edx}" (-> usize)
16 : [_] "{eax}" (&[]usize{ request, a1, a2, a3, a4, a5 }),
2117 [_] "0" (default)
2218 : "cc", "memory"
2319 );
......@@ -27,8 +23,8 @@ pub fn doClientRequest(default: usize, request: usize,
2723 \\ rolq $3, %%rdi ; rolq $13, %%rdi
2824 \\ rolq $61, %%rdi ; rolq $51, %%rdi
2925 \\ xchgq %%rbx,%%rbx
30 : [_] "={rdx}" (-> usize)
31 : [_] "{rax}" (&[]usize{request, a1, a2, a3, a4, a5}),
26 : [_] "={rdx}" (-> usize)
27 : [_] "{rax}" (&[]usize{ request, a1, a2, a3, a4, a5 }),
3228 [_] "0" (default)
3329 : "cc", "memory"
3430 );
......@@ -42,11 +38,10 @@ pub fn doClientRequest(default: usize, request: usize,
4238 // mips64
4339 else => {
4440 return default;
45 }
41 },
4642 }
4743}
4844
49
5045pub const ClientRequest = extern enum {
5146 RunningOnValgrind = 4097,
5247 DiscardTranslations = 4098,
......@@ -81,59 +76,39 @@ pub const ClientRequest = extern enum {
8176 InnerThreads = 6402,
8277};
8378pub fn ToolBase(base: [2]u8) u32 {
84 return (u32(base[0]&0xff) << 24) | (u32(base[1]&0xff) << 16);
79 return (u32(base[0] & 0xff) << 24) | (u32(base[1] & 0xff) << 16);
8580}
8681pub fn IsTool(base: [2]u8, code: usize) bool {
8782 return ToolBase(base) == (code & 0xffff0000);
8883}
8984
90fn doClientRequestExpr(default: usize, request: ClientRequest,
91 a1: usize, a2: usize, a3: usize, a4: usize, a5: usize
92 ) usize
93{
94 return doClientRequest(
95 default,
96 @intCast(usize, @enumToInt(request)),
97 a1, a2, a3, a4, a5);
85fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize {
86 return doClientRequest(default, @intCast(usize, @enumToInt(request)), a1, a2, a3, a4, a5);
9887}
9988
100fn doClientRequestStmt(request: ClientRequest,
101 a1: usize, a2: usize, a3: usize, a4: usize, a5: usize
102 ) void
103{
89fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void {
10490 _ = doClientRequestExpr(0, request, a1, a2, a3, a4, a5);
10591}
10692
107
108
10993/// Returns the number of Valgrinds this code is running under. That
11094/// is, 0 if running natively, 1 if running under Valgrind, 2 if
11195/// running under Valgrind which is running under another Valgrind,
11296/// etc.
11397pub fn runningOnValgrind() usize {
114 return doClientRequestExpr(0,
115 ClientRequest.RunningOnValgrind,
116 0, 0, 0, 0, 0);
98 return doClientRequestExpr(0, ClientRequest.RunningOnValgrind, 0, 0, 0, 0, 0);
11799}
118100
119
120101/// Discard translation of code in the slice qzz. Useful if you are debugging
121102/// a JITter or some such, since it provides a way to make sure valgrind will
122103/// retranslate the invalidated area. Returns no value.
123104pub fn discardTranslations(qzz: []const u8) void {
124 doClientRequestStmt(ClientRequest.DiscardTranslations,
125 @ptrToInt(qzz.ptr), qzz.len,
126 0, 0, 0);
105 doClientRequestStmt(ClientRequest.DiscardTranslations, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0);
127106}
128107
129
130108pub fn innerThreads(qzz: [*]u8) void {
131 doClientRequestStmt(ClientRequest.InnerThreads,
132 qzz,
133 0, 0, 0, 0);
109 doClientRequestStmt(ClientRequest.InnerThreads, qzz, 0, 0, 0, 0);
134110}
135111
136
137112//pub fn printf(format: [*]const u8, args: ...) usize {
138113// return doClientRequestExpr(0,
139114// ClientRequest.PrintfValistByRef,
......@@ -141,7 +116,6 @@ pub fn innerThreads(qzz: [*]u8) void {
141116// 0, 0, 0);
142117//}
143118
144
145119//pub fn printfBacktrace(format: [*]const u8, args: ...) usize {
146120// return doClientRequestExpr(0,
147121// ClientRequest.PrintfBacktraceValistByRef,
......@@ -149,161 +123,105 @@ pub fn innerThreads(qzz: [*]u8) void {
149123// 0, 0, 0);
150124//}
151125
152
153pub fn nonSIMDCall0(func: fn(usize) usize) usize {
154 return doClientRequestExpr(0,
155 ClientRequest.ClientCall0,
156 @ptrToInt(func),
157 0, 0, 0, 0);
126pub fn nonSIMDCall0(func: fn (usize) usize) usize {
127 return doClientRequestExpr(0, ClientRequest.ClientCall0, @ptrToInt(func), 0, 0, 0, 0);
158128}
159129
160pub fn nonSIMDCall1(func: fn(usize, usize) usize, a1: usize) usize {
161 return doClientRequestExpr(0,
162 ClientRequest.ClientCall1,
163 @ptrToInt(func), a1,
164 0, 0, 0);
130pub fn nonSIMDCall1(func: fn (usize, usize) usize, a1: usize) usize {
131 return doClientRequestExpr(0, ClientRequest.ClientCall1, @ptrToInt(func), a1, 0, 0, 0);
165132}
166133
167pub fn nonSIMDCall2(func: fn(usize, usize, usize) usize,
168 a1: usize, a2: usize) usize
169{
170 return doClientRequestExpr(0,
171 ClientRequest.ClientCall2,
172 @ptrToInt(func), a1, a2,
173 0, 0);
134pub fn nonSIMDCall2(func: fn (usize, usize, usize) usize, a1: usize, a2: usize) usize {
135 return doClientRequestExpr(0, ClientRequest.ClientCall2, @ptrToInt(func), a1, a2, 0, 0);
174136}
175137
176pub fn nonSIMDCall3(func: fn(usize, usize, usize, usize) usize,
177 a1: usize, a2: usize, a3: usize) usize
178{
179 return doClientRequestExpr(0,
180 ClientRequest.ClientCall3,
181 @ptrToInt(func), a1, a2, a3,
182 0);
138pub fn nonSIMDCall3(func: fn (usize, usize, usize, usize) usize, a1: usize, a2: usize, a3: usize) usize {
139 return doClientRequestExpr(0, ClientRequest.ClientCall3, @ptrToInt(func), a1, a2, a3, 0);
183140}
184141
185
186142/// Counts the number of errors that have been recorded by a tool. Nb:
187143/// the tool must record the errors with VG_(maybe_record_error)() or
188144/// VG_(unique_error)() for them to be counted.
189145pub fn countErrors() usize {
190146 return doClientRequestExpr(0, // default return
191 ClientRequest.CountErrors,
192 0, 0, 0, 0, 0);
147 ClientRequest.CountErrors, 0, 0, 0, 0, 0);
193148}
194149
195
196150pub fn mallocLikeBlock(mem: []u8, rzB: usize, is_zeroed: bool) void {
197 doClientRequestStmt(ClientRequest.MalloclikeBlock,
198 @ptrToInt(mem.ptr), mem.len, rzB, @boolToInt(is_zeroed),
199 0);
151 doClientRequestStmt(ClientRequest.MalloclikeBlock, @ptrToInt(mem.ptr), mem.len, rzB, @boolToInt(is_zeroed), 0);
200152}
201153
202
203154pub fn resizeInPlaceBlock(oldmem: []u8, newsize: usize, rzB: usize) void {
204 doClientRequestStmt(ClientRequest.ResizeinplaceBlock,
205 @ptrToInt(oldmem.ptr), oldmem.len, newsize, rzB,
206 0);
155 doClientRequestStmt(ClientRequest.ResizeinplaceBlock, @ptrToInt(oldmem.ptr), oldmem.len, newsize, rzB, 0);
207156}
208157
209
210158pub fn freeLikeBlock(addr: [*]u8, rzB: usize) void {
211 doClientRequestStmt(ClientRequest.FreelikeBlock,
212 @ptrToInt(addr), rzB,
213 0, 0, 0);
159 doClientRequestStmt(ClientRequest.FreelikeBlock, @ptrToInt(addr), rzB, 0, 0, 0);
214160}
215161
216
217162/// Create a memory pool.
218163pub const MempoolFlags = extern enum {
219164 AutoFree = 1,
220165 MetaPool = 2,
221166};
222167pub fn createMempool(pool: [*]u8, rzB: usize, is_zeroed: bool, flags: usize) void {
223 doClientRequestStmt(ClientRequest.CreateMempool,
224 @ptrToInt(pool), rzB, @boolToInt(is_zeroed), flags,
225 0);
168 doClientRequestStmt(ClientRequest.CreateMempool, @ptrToInt(pool), rzB, @boolToInt(is_zeroed), flags, 0);
226169}
227170
228171/// Destroy a memory pool.
229172pub fn destroyMempool(pool: [*]u8) void {
230 doClientRequestStmt(ClientRequest.DestroyMempool,
231 pool,
232 0, 0, 0, 0);
173 doClientRequestStmt(ClientRequest.DestroyMempool, pool, 0, 0, 0, 0);
233174}
234175
235
236176/// Associate a piece of memory with a memory pool.
237177pub fn mempoolAlloc(pool: [*]u8, mem: []u8) void {
238 doClientRequestStmt(ClientRequest.MempoolAlloc,
239 @ptrToInt(pool), @ptrToInt(mem.ptr), mem.len,
240 0, 0);
178 doClientRequestStmt(ClientRequest.MempoolAlloc, @ptrToInt(pool), @ptrToInt(mem.ptr), mem.len, 0, 0);
241179}
242180
243181/// Disassociate a piece of memory from a memory pool.
244182pub fn mempoolFree(pool: [*]u8, addr: [*]u8) void {
245 doClientRequestStmt(ClientRequest.MempoolFree,
246 @ptrToInt(pool), @ptrToInt(addr),
247 0, 0, 0);
183 doClientRequestStmt(ClientRequest.MempoolFree, @ptrToInt(pool), @ptrToInt(addr), 0, 0, 0);
248184}
249185
250186/// Disassociate any pieces outside a particular range.
251187pub fn mempoolTrim(pool: [*]u8, mem: []u8) void {
252 doClientRequestStmt(ClientRequest.MempoolTrim,
253 @ptrToInt(pool), @ptrToInt(mem.ptr), mem.len,
254 0, 0);
188 doClientRequestStmt(ClientRequest.MempoolTrim, @ptrToInt(pool), @ptrToInt(mem.ptr), mem.len, 0, 0);
255189}
256190
257191/// Resize and/or move a piece associated with a memory pool.
258192pub fn moveMempool(poolA: [*]u8, poolB: [*]u8) void {
259 doClientRequestStmt(ClientRequest.MoveMempool,
260 @ptrToInt(poolA), @ptrToInt(poolB),
261 0, 0, 0);
193 doClientRequestStmt(ClientRequest.MoveMempool, @ptrToInt(poolA), @ptrToInt(poolB), 0, 0, 0);
262194}
263195
264196/// Resize and/or move a piece associated with a memory pool.
265197pub fn mempoolChange(pool: [*]u8, addrA: [*]u8, mem: []u8) void {
266 doClientRequestStmt(ClientRequest.MempoolChange,
267 @ptrToInt(pool), @ptrToInt(addrA), @ptrToInt(mem.ptr), mem.len,
268 0);
198 doClientRequestStmt(ClientRequest.MempoolChange, @ptrToInt(pool), @ptrToInt(addrA), @ptrToInt(mem.ptr), mem.len, 0);
269199}
270200
271201/// Return if a mempool exists.
272202pub fn mempoolExists(pool: [*]u8) bool {
273 return doClientRequestExpr(0,
274 ClientRequest.MempoolExists,
275 @ptrToInt(pool),
276 0, 0, 0, 0) != 0;
203 return doClientRequestExpr(0, ClientRequest.MempoolExists, @ptrToInt(pool), 0, 0, 0, 0) != 0;
277204}
278205
279
280206/// Mark a piece of memory as being a stack. Returns a stack id.
281207/// start is the lowest addressable stack byte, end is the highest
282208/// addressable stack byte.
283209pub fn stackRegister(stack: []u8) usize {
284 return doClientRequestExpr(0,
285 ClientRequest.StackRegister,
286 @ptrToInt(stack.ptr), @ptrToInt(stack.ptr) + stack.len,
287 0, 0, 0);
210 return doClientRequestExpr(0, ClientRequest.StackRegister, @ptrToInt(stack.ptr), @ptrToInt(stack.ptr) + stack.len, 0, 0, 0);
288211}
289212
290213/// Unmark the piece of memory associated with a stack id as being a stack.
291214pub fn stackDeregister(id: usize) void {
292 doClientRequestStmt(ClientRequest.StackDeregister,
293 id,
294 0, 0, 0, 0);
215 doClientRequestStmt(ClientRequest.StackDeregister, id, 0, 0, 0, 0);
295216}
296217
297218/// Change the start and end address of the stack id.
298219/// start is the new lowest addressable stack byte, end is the new highest
299220/// addressable stack byte.
300221pub fn stackChange(id: usize, newstack: []u8) void {
301 doClientRequestStmt(ClientRequest.StackChange,
302 id, @ptrToInt(newstack.ptr), @ptrToInt(newstack.ptr) + newstack.len,
303 0, 0);
222 doClientRequestStmt(ClientRequest.StackChange, id, @ptrToInt(newstack.ptr), @ptrToInt(newstack.ptr) + newstack.len, 0, 0);
304223}
305224
306
307225// Load PDB debug info for Wine PE image_map.
308226// pub fn loadPdbDebuginfo(fd, ptr, total_size, delta) void {
309227// doClientRequestStmt(ClientRequest.LoadPdbDebuginfo,
......@@ -311,19 +229,14 @@ pub fn stackChange(id: usize, newstack: []u8) void {
311229// 0);
312230// }
313231
314
315232/// Map a code address to a source file name and line number. buf64
316233/// must point to a 64-byte buffer in the caller's address space. The
317234/// result will be dumped in there and is guaranteed to be zero
318235/// terminated. If no info is found, the first byte is set to zero.
319236pub fn mapIpToSrcloc(addr: *const u8, buf64: [64]u8) usize {
320 return doClientRequestExpr(0,
321 ClientRequest.MapIpToSrcloc,
322 @ptrToInt(addr), @ptrToInt(&buf64[0]),
323 0, 0, 0);
237 return doClientRequestExpr(0, ClientRequest.MapIpToSrcloc, @ptrToInt(addr), @ptrToInt(&buf64[0]), 0, 0, 0);
324238}
325239
326
327240/// Disable error reporting for this thread. Behaves in a stack like
328241/// way, so you can safely call this multiple times provided that
329242/// enableErrorReporting() is called the same number of times
......@@ -333,31 +246,22 @@ pub fn mapIpToSrcloc(addr: *const u8, buf64: [64]u8) usize {
333246/// reporting. Child threads do not inherit this setting from their
334247/// parents -- they are always created with reporting enabled.
335248pub fn disableErrorReporting() void {
336 doClientRequestStmt(ClientRequest.ChangeErrDisablement,
337 1,
338 0, 0, 0, 0);
249 doClientRequestStmt(ClientRequest.ChangeErrDisablement, 1, 0, 0, 0, 0);
339250}
340251
341252/// Re-enable error reporting, (see disableErrorReporting())
342253pub fn enableErrorReporting() void {
343 doClientRequestStmt(ClientRequest.ChangeErrDisablement,
344 math.maxInt(usize),
345 0, 0, 0, 0);
254 doClientRequestStmt(ClientRequest.ChangeErrDisablement, math.maxInt(usize), 0, 0, 0, 0);
346255}
347256
348
349257/// Execute a monitor command from the client program.
350258/// If a connection is opened with GDB, the output will be sent
351259/// according to the output mode set for vgdb.
352260/// If no connection is opened, output will go to the log output.
353261/// Returns 1 if command not recognised, 0 otherwise.
354262pub fn monitorCommand(command: [*]u8) bool {
355 return doClientRequestExpr(0,
356 ClientRequest.GdbMonitorCommand,
357 @ptrToInt(command.ptr),
358 0, 0, 0, 0) != 0;
263 return doClientRequestExpr(0, ClientRequest.GdbMonitorCommand, @ptrToInt(command.ptr), 0, 0, 0, 0) != 0;
359264}
360265
361
362266pub const memcheck = @import("memcheck.zig");
363267pub const callgrind = @import("callgrind.zig");
std/zig.zig-1
......@@ -13,4 +13,3 @@ test "std.zig tests" {
1313 _ = @import("zig/tokenizer.zig");
1414 _ = @import("zig/parse_string_literal.zig");
1515}
16