authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-22 18:07:46-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-22 18:07:46-07:00
log507a8096d2f9624bafaf963c3e189a477ef6b7bf
treec21e3d54e1389fe44ecc7d5f230e792e26ab322d
parent7c453b91b85bab6800d24feb57c4f35b8ce48d57

std: fix compile errors caught by stage2 AstGen

* `comptime const` is redundant * don't use `extern enum`; specify a tag type. `extern enum` is only when you need tags to alias. But aliasing tags is a smell. I will be making a proposal shortly to remove `extern enum` from the language. * there is no such thing as `packed enum`. * instead of `catch |_|`, omit the capture entirely. * unused function definition with missing parameter name * using `try` outside of a function or test

40 files changed, 101 insertions(+), 103 deletions(-)

BRANCH_TODO+2
...@@ -32,6 +32,8 @@...@@ -32,6 +32,8 @@
32 compile error for a local shadowing a decl with Sema looking up the decl name.32 compile error for a local shadowing a decl with Sema looking up the decl name.
33 - this means LocalVal and LocalPtr should use the string table33 - this means LocalVal and LocalPtr should use the string table
3434
35 * sort compile errors before presenting them to eliminate nondeterministic error reporting
36
35 const container_name_hash: Scope.NameHash = if (found_pkg) |pkg|37 const container_name_hash: Scope.NameHash = if (found_pkg) |pkg|
36 pkg.namespace_hash38 pkg.namespace_hash
37 else39 else
lib/std/array_hash_map.zig+1-1
...@@ -1310,7 +1310,7 @@ test "reIndex" {...@@ -1310,7 +1310,7 @@ test "reIndex" {
1310}1310}
13111311
1312test "fromOwnedArrayList" {1312test "fromOwnedArrayList" {
1313 comptime const array_hash_map_type = AutoArrayHashMap(i32, i32);1313 const array_hash_map_type = AutoArrayHashMap(i32, i32);
1314 var al = std.ArrayListUnmanaged(array_hash_map_type.Entry){};1314 var al = std.ArrayListUnmanaged(array_hash_map_type.Entry){};
1315 const hash = getAutoHashFn(i32);1315 const hash = getAutoHashFn(i32);
13161316
lib/std/crypto/25519/edwards25519.zig+3-3
...@@ -238,7 +238,7 @@ pub const Edwards25519 = struct {...@@ -238,7 +238,7 @@ pub const Edwards25519 = struct {
238 pub fn mul(p: Edwards25519, s: [32]u8) Error!Edwards25519 {238 pub fn mul(p: Edwards25519, s: [32]u8) Error!Edwards25519 {
239 const pc = if (p.is_base) basePointPc else pc: {239 const pc = if (p.is_base) basePointPc else pc: {
240 const xpc = precompute(p, 15);240 const xpc = precompute(p, 15);
241 xpc[4].rejectIdentity() catch |_| return error.WeakPublicKey;241 xpc[4].rejectIdentity() catch return error.WeakPublicKey;
242 break :pc xpc;242 break :pc xpc;
243 };243 };
244 return pcMul16(pc, s, false);244 return pcMul16(pc, s, false);
...@@ -251,7 +251,7 @@ pub const Edwards25519 = struct {...@@ -251,7 +251,7 @@ pub const Edwards25519 = struct {
251 return pcMul16(basePointPc, s, true);251 return pcMul16(basePointPc, s, true);
252 } else {252 } else {
253 const pc = precompute(p, 8);253 const pc = precompute(p, 8);
254 pc[4].rejectIdentity() catch |_| return error.WeakPublicKey;254 pc[4].rejectIdentity() catch return error.WeakPublicKey;
255 return pcMul(pc, s, true);255 return pcMul(pc, s, true);
256 }256 }
257 }257 }
...@@ -266,7 +266,7 @@ pub const Edwards25519 = struct {...@@ -266,7 +266,7 @@ pub const Edwards25519 = struct {
266 pcs[i] = comptime precompute(Edwards25519.basePoint, 8);266 pcs[i] = comptime precompute(Edwards25519.basePoint, 8);
267 } else {267 } else {
268 pcs[i] = precompute(p, 8);268 pcs[i] = precompute(p, 8);
269 pcs[i][4].rejectIdentity() catch |_| return error.WeakPublicKey;269 pcs[i][4].rejectIdentity() catch return error.WeakPublicKey;
270 }270 }
271 }271 }
272 var es: [count][2 * 32]i8 = undefined;272 var es: [count][2 * 32]i8 = undefined;
lib/std/crypto/utils.zig+6-6
...@@ -16,9 +16,9 @@ pub fn timingSafeEql(comptime T: type, a: T, b: T) bool {...@@ -16,9 +16,9 @@ pub fn timingSafeEql(comptime T: type, a: T, b: T) bool {
16 for (a) |x, i| {16 for (a) |x, i| {
17 acc |= x ^ b[i];17 acc |= x ^ b[i];
18 }18 }
19 comptime const s = @typeInfo(C).Int.bits;19 const s = @typeInfo(C).Int.bits;
20 comptime const Cu = std.meta.Int(.unsigned, s);20 const Cu = std.meta.Int(.unsigned, s);
21 comptime const Cext = std.meta.Int(.unsigned, s + 1);21 const Cext = std.meta.Int(.unsigned, s + 1);
22 return @bitCast(bool, @truncate(u1, (@as(Cext, @bitCast(Cu, acc)) -% 1) >> s));22 return @bitCast(bool, @truncate(u1, (@as(Cext, @bitCast(Cu, acc)) -% 1) >> s));
23 },23 },
24 .Vector => |info| {24 .Vector => |info| {
...@@ -27,9 +27,9 @@ pub fn timingSafeEql(comptime T: type, a: T, b: T) bool {...@@ -27,9 +27,9 @@ pub fn timingSafeEql(comptime T: type, a: T, b: T) bool {
27 @compileError("Elements to be compared must be integers");27 @compileError("Elements to be compared must be integers");
28 }28 }
29 const acc = @reduce(.Or, a ^ b);29 const acc = @reduce(.Or, a ^ b);
30 comptime const s = @typeInfo(C).Int.bits;30 const s = @typeInfo(C).Int.bits;
31 comptime const Cu = std.meta.Int(.unsigned, s);31 const Cu = std.meta.Int(.unsigned, s);
32 comptime const Cext = std.meta.Int(.unsigned, s + 1);32 const Cext = std.meta.Int(.unsigned, s + 1);
33 return @bitCast(bool, @truncate(u1, (@as(Cext, @bitCast(Cu, acc)) -% 1) >> s));33 return @bitCast(bool, @truncate(u1, (@as(Cext, @bitCast(Cu, acc)) -% 1) >> s));
34 },34 },
35 else => {35 else => {
lib/std/elf.zig+2-2
...@@ -311,7 +311,7 @@ pub const VER_FLG_BASE = 0x1;...@@ -311,7 +311,7 @@ pub const VER_FLG_BASE = 0x1;
311pub const VER_FLG_WEAK = 0x2;311pub const VER_FLG_WEAK = 0x2;
312312
313/// File types313/// File types
314pub const ET = extern enum(u16) {314pub const ET = enum(u16) {
315 /// No file type315 /// No file type
316 NONE = 0,316 NONE = 0,
317317
...@@ -991,7 +991,7 @@ pub const Half = switch (@sizeOf(usize)) {...@@ -991,7 +991,7 @@ pub const Half = switch (@sizeOf(usize)) {
991/// See current registered ELF machine architectures at:991/// See current registered ELF machine architectures at:
992/// http://www.uxsglobal.com/developers/gabi/latest/ch4.eheader.html992/// http://www.uxsglobal.com/developers/gabi/latest/ch4.eheader.html
993/// The underscore prefix is because many of these start with numbers.993/// The underscore prefix is because many of these start with numbers.
994pub const EM = extern enum(u16) {994pub const EM = enum(u16) {
995 /// No machine995 /// No machine
996 _NONE = 0,996 _NONE = 0,
997997
lib/std/fmt.zig+14-14
...@@ -187,7 +187,7 @@ pub fn format(...@@ -187,7 +187,7 @@ pub fn format(
187187
188 comptime var i = 0;188 comptime var i = 0;
189 inline while (i < fmt.len) {189 inline while (i < fmt.len) {
190 comptime const start_index = i;190 const start_index = i;
191191
192 inline while (i < fmt.len) : (i += 1) {192 inline while (i < fmt.len) : (i += 1) {
193 switch (fmt[i]) {193 switch (fmt[i]) {
...@@ -226,10 +226,10 @@ pub fn format(...@@ -226,10 +226,10 @@ pub fn format(
226 comptime assert(fmt[i] == '{');226 comptime assert(fmt[i] == '{');
227 i += 1;227 i += 1;
228228
229 comptime const fmt_begin = i;229 const fmt_begin = i;
230 // Find the closing brace230 // Find the closing brace
231 inline while (i < fmt.len and fmt[i] != '}') : (i += 1) {}231 inline while (i < fmt.len and fmt[i] != '}') : (i += 1) {}
232 comptime const fmt_end = i;232 const fmt_end = i;
233233
234 if (i >= fmt.len) {234 if (i >= fmt.len) {
235 @compileError("Missing closing }");235 @compileError("Missing closing }");
...@@ -246,23 +246,23 @@ pub fn format(...@@ -246,23 +246,23 @@ pub fn format(
246 parser.pos = 0;246 parser.pos = 0;
247247
248 // Parse the positional argument number248 // Parse the positional argument number
249 comptime const opt_pos_arg = init: {249 const opt_pos_arg = comptime init: {
250 if (comptime parser.maybe('[')) {250 if (parser.maybe('[')) {
251 comptime const arg_name = parser.until(']');251 const arg_name = parser.until(']');
252252
253 if (!comptime parser.maybe(']')) {253 if (!parser.maybe(']')) {
254 @compileError("Expected closing ]");254 @compileError("Expected closing ]");
255 }255 }
256256
257 break :init comptime meta.fieldIndex(ArgsType, arg_name) orelse257 break :init meta.fieldIndex(ArgsType, arg_name) orelse
258 @compileError("No argument with name '" ++ arg_name ++ "'");258 @compileError("No argument with name '" ++ arg_name ++ "'");
259 } else {259 } else {
260 break :init comptime parser.number();260 break :init parser.number();
261 }261 }
262 };262 };
263263
264 // Parse the format specifier264 // Parse the format specifier
265 comptime const specifier_arg = comptime parser.until(':');265 const specifier_arg = comptime parser.until(':');
266266
267 // Skip the colon, if present267 // Skip the colon, if present
268 if (comptime parser.char()) |ch| {268 if (comptime parser.char()) |ch| {
...@@ -302,13 +302,13 @@ pub fn format(...@@ -302,13 +302,13 @@ pub fn format(
302 // Parse the width parameter302 // Parse the width parameter
303 options.width = init: {303 options.width = init: {
304 if (comptime parser.maybe('[')) {304 if (comptime parser.maybe('[')) {
305 comptime const arg_name = parser.until(']');305 const arg_name = parser.until(']');
306306
307 if (!comptime parser.maybe(']')) {307 if (!comptime parser.maybe(']')) {
308 @compileError("Expected closing ]");308 @compileError("Expected closing ]");
309 }309 }
310310
311 comptime const index = meta.fieldIndex(ArgsType, arg_name) orelse311 const index = meta.fieldIndex(ArgsType, arg_name) orelse
312 @compileError("No argument with name '" ++ arg_name ++ "'");312 @compileError("No argument with name '" ++ arg_name ++ "'");
313 const arg_index = comptime arg_state.nextArg(index);313 const arg_index = comptime arg_state.nextArg(index);
314314
...@@ -328,13 +328,13 @@ pub fn format(...@@ -328,13 +328,13 @@ pub fn format(
328 // Parse the precision parameter328 // Parse the precision parameter
329 options.precision = init: {329 options.precision = init: {
330 if (comptime parser.maybe('[')) {330 if (comptime parser.maybe('[')) {
331 comptime const arg_name = parser.until(']');331 const arg_name = parser.until(']');
332332
333 if (!comptime parser.maybe(']')) {333 if (!comptime parser.maybe(']')) {
334 @compileError("Expected closing ]");334 @compileError("Expected closing ]");
335 }335 }
336336
337 comptime const arg_i = meta.fieldIndex(ArgsType, arg_name) orelse337 const arg_i = meta.fieldIndex(ArgsType, arg_name) orelse
338 @compileError("No argument with name '" ++ arg_name ++ "'");338 @compileError("No argument with name '" ++ arg_name ++ "'");
339 const arg_to_use = comptime arg_state.nextArg(arg_i);339 const arg_to_use = comptime arg_state.nextArg(arg_i);
340340
lib/std/json.zig+2-2
...@@ -195,7 +195,7 @@ pub const StreamingParser = struct {...@@ -195,7 +195,7 @@ pub const StreamingParser = struct {
195 p.number_is_integer = undefined;195 p.number_is_integer = undefined;
196 }196 }
197197
198 pub const State = enum {198 pub const State = enum(u8) {
199 // These must be first with these explicit values as we rely on them for indexing the199 // These must be first with these explicit values as we rely on them for indexing the
200 // bit-stack directly and avoiding a branch.200 // bit-stack directly and avoiding a branch.
201 ObjectSeparator = 0,201 ObjectSeparator = 0,
...@@ -1765,7 +1765,7 @@ test "parse" {...@@ -1765,7 +1765,7 @@ test "parse" {
1765}1765}
17661766
1767test "parse into enum" {1767test "parse into enum" {
1768 const T = extern enum {1768 const T = enum(u32) {
1769 Foo = 42,1769 Foo = 42,
1770 Bar,1770 Bar,
1771 @"with\\escape",1771 @"with\\escape",
lib/std/macho.zig+5-5
...@@ -1314,13 +1314,13 @@ pub const BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM: u8 = 0x40;...@@ -1314,13 +1314,13 @@ pub const BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM: u8 = 0x40;
1314pub const BIND_OPCODE_SET_TYPE_IMM: u8 = 0x50;1314pub const BIND_OPCODE_SET_TYPE_IMM: u8 = 0x50;
1315pub const BIND_OPCODE_SET_ADDEND_SLEB: u8 = 0x60;1315pub const BIND_OPCODE_SET_ADDEND_SLEB: u8 = 0x60;
1316pub const BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB: u8 = 0x70;1316pub const BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB: u8 = 0x70;
1317pub const BIND_OPCODE_ADD_ADDR_ULEB: 0x80;1317pub const BIND_OPCODE_ADD_ADDR_ULEB: u8 = 0x80;
1318pub const BIND_OPCODE_DO_BIND: u8 = 0x90;1318pub const BIND_OPCODE_DO_BIND: u8 = 0x90;
1319pub const BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB: u8 = 0xa0;1319pub const BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB: u8 = 0xa0;
1320pub const BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED: u8 = 0xb0;1320pub const BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED: u8 = 0xb0;
1321pub const BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB: u8 = xc0;1321pub const BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB: u8 = 0xc0;
13221322
1323pub const reloc_type_x86_64 = packed enum(u4) {1323pub const reloc_type_x86_64 = enum(u4) {
1324 /// for absolute addresses1324 /// for absolute addresses
1325 X86_64_RELOC_UNSIGNED = 0,1325 X86_64_RELOC_UNSIGNED = 0,
13261326
...@@ -1352,9 +1352,9 @@ pub const reloc_type_x86_64 = packed enum(u4) {...@@ -1352,9 +1352,9 @@ pub const reloc_type_x86_64 = packed enum(u4) {
1352 X86_64_RELOC_TLV,1352 X86_64_RELOC_TLV,
1353};1353};
13541354
1355pub const reloc_type_arm64 = packed enum(u4) {1355pub const reloc_type_arm64 = enum(u4) {
1356 /// For pointers.1356 /// For pointers.
1357 ARM64_RELOC_UNSIGNED = 0,1357 ARM64_RELOC_UNSIGNED,
13581358
1359 /// Must be followed by a ARM64_RELOC_UNSIGNED.1359 /// Must be followed by a ARM64_RELOC_UNSIGNED.
1360 ARM64_RELOC_SUBTRACTOR,1360 ARM64_RELOC_SUBTRACTOR,
lib/std/mem.zig+1-1
...@@ -356,7 +356,7 @@ test "mem.zeroes" {...@@ -356,7 +356,7 @@ test "mem.zeroes" {
356/// If the field is present in the provided initial values, it will have that value instead.356/// If the field is present in the provided initial values, it will have that value instead.
357/// Structs are initialized recursively.357/// Structs are initialized recursively.
358pub fn zeroInit(comptime T: type, init: anytype) T {358pub fn zeroInit(comptime T: type, init: anytype) T {
359 comptime const Init = @TypeOf(init);359 const Init = @TypeOf(init);
360360
361 switch (@typeInfo(T)) {361 switch (@typeInfo(T)) {
362 .Struct => |struct_info| {362 .Struct => |struct_info| {
lib/std/meta.zig-4
...@@ -335,9 +335,6 @@ test "std.meta.containerLayout" {...@@ -335,9 +335,6 @@ test "std.meta.containerLayout" {
335 const E1 = enum {335 const E1 = enum {
336 A,336 A,
337 };337 };
338 const E2 = packed enum {
339 A,
340 };
341 const E3 = extern enum {338 const E3 = extern enum {
342 A,339 A,
343 };340 };
...@@ -355,7 +352,6 @@ test "std.meta.containerLayout" {...@@ -355,7 +352,6 @@ test "std.meta.containerLayout" {
355 };352 };
356353
357 testing.expect(containerLayout(E1) == .Auto);354 testing.expect(containerLayout(E1) == .Auto);
358 testing.expect(containerLayout(E2) == .Packed);
359 testing.expect(containerLayout(E3) == .Extern);355 testing.expect(containerLayout(E3) == .Extern);
360 testing.expect(containerLayout(S1) == .Auto);356 testing.expect(containerLayout(S1) == .Auto);
361 testing.expect(containerLayout(S2) == .Packed);357 testing.expect(containerLayout(S2) == .Packed);
lib/std/os/bits/darwin.zig+4-4
...@@ -1521,19 +1521,19 @@ pub const rusage = extern struct {...@@ -1521,19 +1521,19 @@ pub const rusage = extern struct {
1521 nivcsw: isize,1521 nivcsw: isize,
1522};1522};
15231523
1524pub const rlimit_resource = extern enum(c_int) {1524pub const rlimit_resource = enum(c_int) {
1525 CPU = 0,1525 CPU = 0,
1526 FSIZE = 1,1526 FSIZE = 1,
1527 DATA = 2,1527 DATA = 2,
1528 STACK = 3,1528 STACK = 3,
1529 CORE = 4,1529 CORE = 4,
1530 AS = 5,
1531 RSS = 5,1530 RSS = 5,
1532 MEMLOCK = 6,1531 MEMLOCK = 6,
1533 NPROC = 7,1532 NPROC = 7,
1534 NOFILE = 8,1533 NOFILE = 8,
1535
1536 _,1534 _,
1535
1536 pub const AS: rlimit_resource = .RSS;
1537};1537};
15381538
1539pub const rlim_t = u64;1539pub const rlim_t = u64;
...@@ -1669,7 +1669,7 @@ pub const TCSANOW = 0; // make change immediate...@@ -1669,7 +1669,7 @@ pub const TCSANOW = 0; // make change immediate
1669pub const TCSADRAIN = 1; // drain output, then change1669pub const TCSADRAIN = 1; // drain output, then change
1670pub const TCSAFLUSH = 2; // drain output, flush input1670pub const TCSAFLUSH = 2; // drain output, flush input
1671pub const TCSASOFT = 0x10; // flag - don't alter h.w. state1671pub const TCSASOFT = 0x10; // flag - don't alter h.w. state
1672pub const TCSA = extern enum(c_uint) {1672pub const TCSA = enum(c_uint) {
1673 NOW,1673 NOW,
1674 DRAIN,1674 DRAIN,
1675 FLUSH,1675 FLUSH,
lib/std/os/bits/dragonfly.zig+3-3
...@@ -734,7 +734,7 @@ pub const Flock = extern struct {...@@ -734,7 +734,7 @@ pub const Flock = extern struct {
734 l_whence: c_short,734 l_whence: c_short,
735};735};
736736
737pub const rlimit_resource = extern enum(c_int) {737pub const rlimit_resource = enum(c_int) {
738 CPU = 0,738 CPU = 0,
739 FSIZE = 1,739 FSIZE = 1,
740 DATA = 2,740 DATA = 2,
...@@ -745,11 +745,11 @@ pub const rlimit_resource = extern enum(c_int) {...@@ -745,11 +745,11 @@ pub const rlimit_resource = extern enum(c_int) {
745 NPROC = 7,745 NPROC = 7,
746 NOFILE = 8,746 NOFILE = 8,
747 SBSIZE = 9,747 SBSIZE = 9,
748 AS = 10,
749 VMEM = 10,748 VMEM = 10,
750 POSIXLOCKS = 11,749 POSIXLOCKS = 11,
751
752 _,750 _,
751
752 pub const AS: rlimit_resource = .VMEM;
753};753};
754754
755pub const rlim_t = i64;755pub const rlim_t = i64;
lib/std/os/bits/freebsd.zig+3-3
...@@ -1459,7 +1459,7 @@ pub const IPPROTO_RESERVED_253 = 253;...@@ -1459,7 +1459,7 @@ pub const IPPROTO_RESERVED_253 = 253;
1459/// Reserved1459/// Reserved
1460pub const IPPROTO_RESERVED_254 = 254;1460pub const IPPROTO_RESERVED_254 = 254;
14611461
1462pub const rlimit_resource = extern enum(c_int) {1462pub const rlimit_resource = enum(c_int) {
1463 CPU = 0,1463 CPU = 0,
1464 FSIZE = 1,1464 FSIZE = 1,
1465 DATA = 2,1465 DATA = 2,
...@@ -1471,13 +1471,13 @@ pub const rlimit_resource = extern enum(c_int) {...@@ -1471,13 +1471,13 @@ pub const rlimit_resource = extern enum(c_int) {
1471 NOFILE = 8,1471 NOFILE = 8,
1472 SBSIZE = 9,1472 SBSIZE = 9,
1473 VMEM = 10,1473 VMEM = 10,
1474 AS = 10,
1475 NPTS = 11,1474 NPTS = 11,
1476 SWAP = 12,1475 SWAP = 12,
1477 KQUEUES = 13,1476 KQUEUES = 13,
1478 UMTXP = 14,1477 UMTXP = 14,
1479
1480 _,1478 _,
1479
1480 pub const AS: rlimit_resource = .VMEM;
1481};1481};
14821482
1483pub const rlim_t = i64;1483pub const rlim_t = i64;
lib/std/os/bits/haiku.zig+4-4
...@@ -1401,7 +1401,7 @@ pub const IPPROTO_RESERVED_253 = 253;...@@ -1401,7 +1401,7 @@ pub const IPPROTO_RESERVED_253 = 253;
1401/// Reserved1401/// Reserved
1402pub const IPPROTO_RESERVED_254 = 254;1402pub const IPPROTO_RESERVED_254 = 254;
14031403
1404pub const rlimit_resource = extern enum(c_int) {1404pub const rlimit_resource = enum(c_int) {
1405 CPU = 0,1405 CPU = 0,
1406 FSIZE = 1,1406 FSIZE = 1,
1407 DATA = 2,1407 DATA = 2,
...@@ -1413,13 +1413,13 @@ pub const rlimit_resource = extern enum(c_int) {...@@ -1413,13 +1413,13 @@ pub const rlimit_resource = extern enum(c_int) {
1413 NOFILE = 8,1413 NOFILE = 8,
1414 SBSIZE = 9,1414 SBSIZE = 9,
1415 VMEM = 10,1415 VMEM = 10,
1416 AS = 10,
1417 NPTS = 11,1416 NPTS = 11,
1418 SWAP = 12,1417 SWAP = 12,
1419 KQUEUES = 13,1418 KQUEUES = 13,
1420 UMTXP = 14,1419 UMTXP = 14,
1421
1422 _,1420 _,
1421
1422 pub const AS: rlimit_resource = .VMEM;
1423};1423};
14241424
1425pub const rlim_t = i64;1425pub const rlim_t = i64;
...@@ -1442,7 +1442,7 @@ pub const SHUT_WR = 1;...@@ -1442,7 +1442,7 @@ pub const SHUT_WR = 1;
1442pub const SHUT_RDWR = 2;1442pub const SHUT_RDWR = 2;
14431443
1444// TODO fill out if needed1444// TODO fill out if needed
1445pub const directory_which = extern enum(c_int) {1445pub const directory_which = enum(c_int) {
1446 B_USER_SETTINGS_DIRECTORY = 0xbbe,1446 B_USER_SETTINGS_DIRECTORY = 0xbbe,
14471447
1448 _,1448 _,
lib/std/os/bits/linux.zig+8-8
...@@ -1487,7 +1487,7 @@ pub const io_uring_sqe = extern struct {...@@ -1487,7 +1487,7 @@ pub const io_uring_sqe = extern struct {
1487 __pad2: [2]u64,1487 __pad2: [2]u64,
1488};1488};
14891489
1490pub const IOSQE_BIT = extern enum(u8) {1490pub const IOSQE_BIT = enum(u8) {
1491 FIXED_FILE,1491 FIXED_FILE,
1492 IO_DRAIN,1492 IO_DRAIN,
1493 IO_LINK,1493 IO_LINK,
...@@ -1518,7 +1518,7 @@ pub const IOSQE_ASYNC = 1 << @enumToInt(IOSQE_BIT.ASYNC);...@@ -1518,7 +1518,7 @@ pub const IOSQE_ASYNC = 1 << @enumToInt(IOSQE_BIT.ASYNC);
1518/// select buffer from buf_group1518/// select buffer from buf_group
1519pub const IOSQE_BUFFER_SELECT = 1 << @enumToInt(IOSQE_BIT.BUFFER_SELECT);1519pub const IOSQE_BUFFER_SELECT = 1 << @enumToInt(IOSQE_BIT.BUFFER_SELECT);
15201520
1521pub const IORING_OP = extern enum(u8) {1521pub const IORING_OP = enum(u8) {
1522 NOP,1522 NOP,
1523 READV,1523 READV,
1524 WRITEV,1524 WRITEV,
...@@ -1587,7 +1587,7 @@ pub const IORING_ENTER_GETEVENTS = 1 << 0;...@@ -1587,7 +1587,7 @@ pub const IORING_ENTER_GETEVENTS = 1 << 0;
1587pub const IORING_ENTER_SQ_WAKEUP = 1 << 1;1587pub const IORING_ENTER_SQ_WAKEUP = 1 << 1;
15881588
1589// io_uring_register opcodes and arguments1589// io_uring_register opcodes and arguments
1590pub const IORING_REGISTER = extern enum(u8) {1590pub const IORING_REGISTER = enum(u8) {
1591 REGISTER_BUFFERS,1591 REGISTER_BUFFERS,
1592 UNREGISTER_BUFFERS,1592 UNREGISTER_BUFFERS,
1593 REGISTER_FILES,1593 REGISTER_FILES,
...@@ -1654,7 +1654,7 @@ pub const io_uring_restriction = extern struct {...@@ -1654,7 +1654,7 @@ pub const io_uring_restriction = extern struct {
1654};1654};
16551655
1656/// io_uring_restriction->opcode values1656/// io_uring_restriction->opcode values
1657pub const IORING_RESTRICTION = extern enum(u8) {1657pub const IORING_RESTRICTION = enum(u8) {
1658 /// Allow an io_uring_register(2) opcode1658 /// Allow an io_uring_register(2) opcode
1659 REGISTER_OP = 0,1659 REGISTER_OP = 0,
16601660
...@@ -1909,7 +1909,7 @@ pub const tcp_repair_window = extern struct {...@@ -1909,7 +1909,7 @@ pub const tcp_repair_window = extern struct {
1909 rcv_wup: u32,1909 rcv_wup: u32,
1910};1910};
19111911
1912pub const TcpRepairOption = extern enum {1912pub const TcpRepairOption = enum {
1913 TCP_NO_QUEUE,1913 TCP_NO_QUEUE,
1914 TCP_RECV_QUEUE,1914 TCP_RECV_QUEUE,
1915 TCP_SEND_QUEUE,1915 TCP_SEND_QUEUE,
...@@ -1917,7 +1917,7 @@ pub const TcpRepairOption = extern enum {...@@ -1917,7 +1917,7 @@ pub const TcpRepairOption = extern enum {
1917};1917};
19181918
1919/// why fastopen failed from client perspective1919/// why fastopen failed from client perspective
1920pub const tcp_fastopen_client_fail = extern enum {1920pub const tcp_fastopen_client_fail = enum {
1921 /// catch-all1921 /// catch-all
1922 TFO_STATUS_UNSPEC,1922 TFO_STATUS_UNSPEC,
1923 /// if not in TFO_CLIENT_NO_COOKIE mode1923 /// if not in TFO_CLIENT_NO_COOKIE mode
...@@ -2184,7 +2184,7 @@ pub const NOFLSH = 128;...@@ -2184,7 +2184,7 @@ pub const NOFLSH = 128;
2184pub const TOSTOP = 256;2184pub const TOSTOP = 256;
2185pub const IEXTEN = 32768;2185pub const IEXTEN = 32768;
21862186
2187pub const TCSA = extern enum(c_uint) {2187pub const TCSA = enum(c_uint) {
2188 NOW,2188 NOW,
2189 DRAIN,2189 DRAIN,
2190 FLUSH,2190 FLUSH,
...@@ -2235,7 +2235,7 @@ pub const ifreq = extern struct {...@@ -2235,7 +2235,7 @@ pub const ifreq = extern struct {
2235};2235};
22362236
2237// doc comments copied from musl2237// doc comments copied from musl
2238pub const rlimit_resource = extern enum(c_int) {2238pub const rlimit_resource = enum(c_int) {
2239 /// Per-process CPU limit, in seconds.2239 /// Per-process CPU limit, in seconds.
2240 CPU,2240 CPU,
22412241
lib/std/os/bits/linux/arm-eabi.zig+1-1
...@@ -15,7 +15,7 @@ const uid_t = linux.uid_t;...@@ -15,7 +15,7 @@ const uid_t = linux.uid_t;
15const gid_t = linux.gid_t;15const gid_t = linux.gid_t;
16const pid_t = linux.pid_t;16const pid_t = linux.pid_t;
1717
18pub const SYS = extern enum(usize) {18pub const SYS = enum(usize) {
19 restart_syscall = 0,19 restart_syscall = 0,
20 exit = 1,20 exit = 1,
21 fork = 2,21 fork = 2,
lib/std/os/bits/linux/arm64.zig+1-1
...@@ -16,7 +16,7 @@ const gid_t = linux.gid_t;...@@ -16,7 +16,7 @@ const gid_t = linux.gid_t;
16const pid_t = linux.pid_t;16const pid_t = linux.pid_t;
17const stack_t = linux.stack_t;17const stack_t = linux.stack_t;
18const sigset_t = linux.sigset_t;18const sigset_t = linux.sigset_t;
19pub const SYS = extern enum(usize) {19pub const SYS = enum(usize) {
20 io_setup = 0,20 io_setup = 0,
21 io_destroy = 1,21 io_destroy = 1,
22 io_submit = 2,22 io_submit = 2,
lib/std/os/bits/linux/i386.zig+1-1
...@@ -17,7 +17,7 @@ const pid_t = linux.pid_t;...@@ -17,7 +17,7 @@ const pid_t = linux.pid_t;
17const stack_t = linux.stack_t;17const stack_t = linux.stack_t;
18const sigset_t = linux.sigset_t;18const sigset_t = linux.sigset_t;
1919
20pub const SYS = extern enum(usize) {20pub const SYS = enum(usize) {
21 restart_syscall = 0,21 restart_syscall = 0,
22 exit = 1,22 exit = 1,
23 fork = 2,23 fork = 2,
lib/std/os/bits/linux/mips.zig+1-1
...@@ -12,7 +12,7 @@ const uid_t = linux.uid_t;...@@ -12,7 +12,7 @@ const uid_t = linux.uid_t;
12const gid_t = linux.gid_t;12const gid_t = linux.gid_t;
13const pid_t = linux.pid_t;13const pid_t = linux.pid_t;
1414
15pub const SYS = extern enum(usize) {15pub const SYS = enum(usize) {
16 pub const Linux = 4000;16 pub const Linux = 4000;
1717
18 syscall = Linux + 0,18 syscall = Linux + 0,
lib/std/os/bits/linux/netlink.zig+5-4
...@@ -126,7 +126,7 @@ pub const NLM_F_CAPPED = 0x100;...@@ -126,7 +126,7 @@ pub const NLM_F_CAPPED = 0x100;
126/// extended ACK TVLs were included126/// extended ACK TVLs were included
127pub const NLM_F_ACK_TLVS = 0x200;127pub const NLM_F_ACK_TLVS = 0x200;
128128
129pub const NetlinkMessageType = extern enum(u16) {129pub const NetlinkMessageType = enum(u16) {
130 /// < 0x10: reserved control messages130 /// < 0x10: reserved control messages
131 pub const MIN_TYPE = 0x10;131 pub const MIN_TYPE = 0x10;
132132
...@@ -287,7 +287,7 @@ pub const rtattr = extern struct {...@@ -287,7 +287,7 @@ pub const rtattr = extern struct {
287 pub const ALIGNTO = 4;287 pub const ALIGNTO = 4;
288};288};
289289
290pub const IFLA = extern enum(c_ushort) {290pub const IFLA = enum(c_ushort) {
291 UNSPEC,291 UNSPEC,
292 ADDRESS,292 ADDRESS,
293 BROADCAST,293 BROADCAST,
...@@ -351,8 +351,7 @@ pub const IFLA = extern enum(c_ushort) {...@@ -351,8 +351,7 @@ pub const IFLA = extern enum(c_ushort) {
351 EVENT,351 EVENT,
352352
353 NEW_NETNSID,353 NEW_NETNSID,
354 IF_NETNSID = 46,354 IF_NETNSID,
355 TARGET_NETNSID = 46, // new alias
356355
357 CARRIER_UP_COUNT,356 CARRIER_UP_COUNT,
358 CARRIER_DOWN_COUNT,357 CARRIER_DOWN_COUNT,
...@@ -361,6 +360,8 @@ pub const IFLA = extern enum(c_ushort) {...@@ -361,6 +360,8 @@ pub const IFLA = extern enum(c_ushort) {
361 MAX_MTU,360 MAX_MTU,
362361
363 _,362 _,
363
364 pub const TARGET_NETNSID: IFLA = .IF_NETNSID;
364};365};
365366
366pub const rtnl_link_ifmap = extern struct {367pub const rtnl_link_ifmap = extern struct {
lib/std/os/bits/linux/powerpc.zig+1-1
...@@ -14,7 +14,7 @@ const gid_t = linux.gid_t;...@@ -14,7 +14,7 @@ const gid_t = linux.gid_t;
14const pid_t = linux.pid_t;14const pid_t = linux.pid_t;
15const stack_t = linux.stack_t;15const stack_t = linux.stack_t;
16const sigset_t = linux.sigset_t;16const sigset_t = linux.sigset_t;
17pub const SYS = extern enum(usize) {17pub const SYS = enum(usize) {
18 restart_syscall = 0,18 restart_syscall = 0,
19 exit = 1,19 exit = 1,
20 fork = 2,20 fork = 2,
lib/std/os/bits/linux/powerpc64.zig+2-2
...@@ -14,7 +14,7 @@ const gid_t = linux.gid_t;...@@ -14,7 +14,7 @@ const gid_t = linux.gid_t;
14const pid_t = linux.pid_t;14const pid_t = linux.pid_t;
15const stack_t = linux.stack_t;15const stack_t = linux.stack_t;
16const sigset_t = linux.sigset_t;16const sigset_t = linux.sigset_t;
17pub const SYS = extern enum(usize) {17pub const SYS = enum(usize) {
18 restart_syscall = 0,18 restart_syscall = 0,
19 exit = 1,19 exit = 1,
20 fork = 2,20 fork = 2,
...@@ -295,7 +295,7 @@ pub const SYS = extern enum(usize) {...@@ -295,7 +295,7 @@ pub const SYS = extern enum(usize) {
295 mknodat = 288,295 mknodat = 288,
296 fchownat = 289,296 fchownat = 289,
297 futimesat = 290,297 futimesat = 290,
298 newfstatat = 291,298 fstatat = 291,
299 unlinkat = 292,299 unlinkat = 292,
300 renameat = 293,300 renameat = 293,
301 linkat = 294,301 linkat = 294,
lib/std/os/bits/linux/prctl.zig+1-1
...@@ -4,7 +4,7 @@...@@ -4,7 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
66
7pub const PR = extern enum(i32) {7pub const PR = enum(i32) {
8 SET_PDEATHSIG = 1,8 SET_PDEATHSIG = 1,
9 GET_PDEATHSIG = 2,9 GET_PDEATHSIG = 2,
1010
lib/std/os/bits/linux/riscv64.zig+1-1
...@@ -9,7 +9,7 @@ const uid_t = std.os.linux.uid_t;...@@ -9,7 +9,7 @@ const uid_t = std.os.linux.uid_t;
9const gid_t = std.os.linux.gid_t;9const gid_t = std.os.linux.gid_t;
10const pid_t = std.os.linux.pid_t;10const pid_t = std.os.linux.pid_t;
1111
12pub const SYS = extern enum(usize) {12pub const SYS = enum(usize) {
13 pub const arch_specific_syscall = 244;13 pub const arch_specific_syscall = 244;
1414
15 io_setup = 0,15 io_setup = 0,
lib/std/os/bits/linux/sparc64.zig+1-1
...@@ -12,7 +12,7 @@ const socklen_t = linux.socklen_t;...@@ -12,7 +12,7 @@ const socklen_t = linux.socklen_t;
12const iovec = linux.iovec;12const iovec = linux.iovec;
13const iovec_const = linux.iovec_const;13const iovec_const = linux.iovec_const;
1414
15pub const SYS = extern enum(usize) {15pub const SYS = enum(usize) {
16 restart_syscall = 0,16 restart_syscall = 0,
17 exit = 1,17 exit = 1,
18 fork = 2,18 fork = 2,
lib/std/os/bits/linux/x86_64.zig+1-2
...@@ -21,7 +21,7 @@ const iovec_const = linux.iovec_const;...@@ -21,7 +21,7 @@ const iovec_const = linux.iovec_const;
21pub const mode_t = usize;21pub const mode_t = usize;
22pub const time_t = isize;22pub const time_t = isize;
2323
24pub const SYS = extern enum(usize) {24pub const SYS = enum(usize) {
25 read = 0,25 read = 0,
26 write = 1,26 write = 1,
27 open = 2,27 open = 2,
...@@ -284,7 +284,6 @@ pub const SYS = extern enum(usize) {...@@ -284,7 +284,6 @@ pub const SYS = extern enum(usize) {
284 mknodat = 259,284 mknodat = 259,
285 fchownat = 260,285 fchownat = 260,
286 futimesat = 261,286 futimesat = 261,
287 newfstatat = 262,
288 fstatat = 262,287 fstatat = 262,
289 unlinkat = 263,288 unlinkat = 263,
290 renameat = 264,289 renameat = 264,
lib/std/os/bits/netbsd.zig+4-4
...@@ -60,7 +60,7 @@ pub const addrinfo = extern struct {...@@ -60,7 +60,7 @@ pub const addrinfo = extern struct {
60 next: ?*addrinfo,60 next: ?*addrinfo,
61};61};
6262
63pub const EAI = extern enum(c_int) {63pub const EAI = enum(c_int) {
64 /// address family for hostname not supported64 /// address family for hostname not supported
65 ADDRFAMILY = 1,65 ADDRFAMILY = 1,
6666
...@@ -1179,7 +1179,7 @@ pub const IPPROTO_PFSYNC = 240;...@@ -1179,7 +1179,7 @@ pub const IPPROTO_PFSYNC = 240;
1179/// raw IP packet1179/// raw IP packet
1180pub const IPPROTO_RAW = 255;1180pub const IPPROTO_RAW = 255;
11811181
1182pub const rlimit_resource = extern enum(c_int) {1182pub const rlimit_resource = enum(c_int) {
1183 CPU = 0,1183 CPU = 0,
1184 FSIZE = 1,1184 FSIZE = 1,
1185 DATA = 2,1185 DATA = 2,
...@@ -1190,11 +1190,11 @@ pub const rlimit_resource = extern enum(c_int) {...@@ -1190,11 +1190,11 @@ pub const rlimit_resource = extern enum(c_int) {
1190 NPROC = 7,1190 NPROC = 7,
1191 NOFILE = 8,1191 NOFILE = 8,
1192 SBSIZE = 9,1192 SBSIZE = 9,
1193 AS = 10,
1194 VMEM = 10,1193 VMEM = 10,
1195 NTHR = 11,1194 NTHR = 11,
1196
1197 _,1195 _,
1196
1197 pub const AS: rlimit_resource = .VMEM;
1198};1198};
11991199
1200pub const rlim_t = u64;1200pub const rlim_t = u64;
lib/std/os/bits/openbsd.zig+3-3
...@@ -76,7 +76,7 @@ pub const addrinfo = extern struct {...@@ -76,7 +76,7 @@ pub const addrinfo = extern struct {
76 next: ?*addrinfo,76 next: ?*addrinfo,
77};77};
7878
79pub const EAI = extern enum(c_int) {79pub const EAI = enum(c_int) {
80 /// address family for hostname not supported80 /// address family for hostname not supported
81 ADDRFAMILY = -9,81 ADDRFAMILY = -9,
8282
...@@ -805,7 +805,7 @@ comptime {...@@ -805,7 +805,7 @@ comptime {
805 if (@sizeOf(usize) == 4)805 if (@sizeOf(usize) == 4)
806 std.debug.assert(@sizeOf(siginfo_t) == 128)806 std.debug.assert(@sizeOf(siginfo_t) == 128)
807 else807 else
808 // Take into account the padding between errno and data fields.808 // Take into account the padding between errno and data fields.
809 std.debug.assert(@sizeOf(siginfo_t) == 136);809 std.debug.assert(@sizeOf(siginfo_t) == 136);
810}810}
811811
...@@ -1177,7 +1177,7 @@ pub const IPPROTO_PFSYNC = 240;...@@ -1177,7 +1177,7 @@ pub const IPPROTO_PFSYNC = 240;
1177/// raw IP packet1177/// raw IP packet
1178pub const IPPROTO_RAW = 255;1178pub const IPPROTO_RAW = 255;
11791179
1180pub const rlimit_resource = extern enum(c_int) {1180pub const rlimit_resource = enum(c_int) {
1181 CPU,1181 CPU,
1182 FSIZE,1182 FSIZE,
1183 DATA,1183 DATA,
lib/std/os/linux.zig-2
...@@ -1143,8 +1143,6 @@ pub fn lstat(pathname: [*:0]const u8, statbuf: *kernel_stat) usize {...@@ -1143,8 +1143,6 @@ pub fn lstat(pathname: [*:0]const u8, statbuf: *kernel_stat) usize {
1143pub fn fstatat(dirfd: i32, path: [*:0]const u8, stat_buf: *kernel_stat, flags: u32) usize {1143pub fn fstatat(dirfd: i32, path: [*:0]const u8, stat_buf: *kernel_stat, flags: u32) usize {
1144 if (@hasField(SYS, "fstatat64")) {1144 if (@hasField(SYS, "fstatat64")) {
1145 return syscall4(.fstatat64, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags);1145 return syscall4(.fstatat64, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags);
1146 } else if (@hasField(SYS, "newfstatat")) {
1147 return syscall4(.newfstatat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags);
1148 } else {1146 } else {
1149 return syscall4(.fstatat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags);1147 return syscall4(.fstatat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags);
1150 }1148 }
lib/std/os/uefi/status.zig+1-1
...@@ -5,7 +5,7 @@...@@ -5,7 +5,7 @@
5// and substantial portions of the software.5// and substantial portions of the software.
6const high_bit = 1 << @typeInfo(usize).Int.bits - 1;6const high_bit = 1 << @typeInfo(usize).Int.bits - 1;
77
8pub const Status = extern enum(usize) {8pub const Status = enum(usize) {
9 /// The operation completed successfully.9 /// The operation completed successfully.
10 Success = 0,10 Success = 0,
1111
lib/std/os/windows/bits.zig+3-3
...@@ -281,7 +281,7 @@ pub const IO_STATUS_BLOCK = extern struct {...@@ -281,7 +281,7 @@ pub const IO_STATUS_BLOCK = extern struct {
281 Information: ULONG_PTR,281 Information: ULONG_PTR,
282};282};
283283
284pub const FILE_INFORMATION_CLASS = extern enum {284pub const FILE_INFORMATION_CLASS = enum(c_int) {
285 FileDirectoryInformation = 1,285 FileDirectoryInformation = 1,
286 FileFullDirectoryInformation,286 FileFullDirectoryInformation,
287 FileBothDirectoryInformation,287 FileBothDirectoryInformation,
...@@ -901,7 +901,7 @@ pub const COINIT_APARTMENTTHREADED = COINIT.COINIT_APARTMENTTHREADED;...@@ -901,7 +901,7 @@ pub const COINIT_APARTMENTTHREADED = COINIT.COINIT_APARTMENTTHREADED;
901pub const COINIT_MULTITHREADED = COINIT.COINIT_MULTITHREADED;901pub const COINIT_MULTITHREADED = COINIT.COINIT_MULTITHREADED;
902pub const COINIT_DISABLE_OLE1DDE = COINIT.COINIT_DISABLE_OLE1DDE;902pub const COINIT_DISABLE_OLE1DDE = COINIT.COINIT_DISABLE_OLE1DDE;
903pub const COINIT_SPEED_OVER_MEMORY = COINIT.COINIT_SPEED_OVER_MEMORY;903pub const COINIT_SPEED_OVER_MEMORY = COINIT.COINIT_SPEED_OVER_MEMORY;
904pub const COINIT = extern enum {904pub const COINIT = enum(c_int) {
905 COINIT_APARTMENTTHREADED = 2,905 COINIT_APARTMENTTHREADED = 2,
906 COINIT_MULTITHREADED = 0,906 COINIT_MULTITHREADED = 0,
907 COINIT_DISABLE_OLE1DDE = 4,907 COINIT_DISABLE_OLE1DDE = 4,
...@@ -1623,7 +1623,7 @@ pub const SD_RECEIVE = 0;...@@ -1623,7 +1623,7 @@ pub const SD_RECEIVE = 0;
1623pub const SD_SEND = 1;1623pub const SD_SEND = 1;
1624pub const SD_BOTH = 2;1624pub const SD_BOTH = 2;
16251625
1626pub const OBJECT_INFORMATION_CLASS = extern enum {1626pub const OBJECT_INFORMATION_CLASS = enum(c_int) {
1627 ObjectBasicInformation = 0,1627 ObjectBasicInformation = 0,
1628 ObjectNameInformation = 1,1628 ObjectNameInformation = 1,
1629 ObjectTypeInformation = 2,1629 ObjectTypeInformation = 2,
lib/std/os/windows/ntstatus.zig+1-1
...@@ -4,7 +4,7 @@...@@ -4,7 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6// NTSTATUS codes from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55?6// NTSTATUS codes from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55?
7pub const NTSTATUS = extern enum(u32) {7pub const NTSTATUS = enum(u32) {
8 /// The operation completed successfully.8 /// The operation completed successfully.
9 SUCCESS = 0x00000000,9 SUCCESS = 0x00000000,
1010
lib/std/os/windows/win32error.zig+1-1
...@@ -4,7 +4,7 @@...@@ -4,7 +4,7 @@
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6// Codes are from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d6// Codes are from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d
7pub const Win32Error = extern enum(u16) {7pub const Win32Error = enum(u16) {
8 /// The operation completed successfully.8 /// The operation completed successfully.
9 SUCCESS = 0,9 SUCCESS = 0,
1010
lib/std/os/windows/ws2_32.zig+1-1
...@@ -256,7 +256,7 @@ pub const POLLHUP = 0x0002;...@@ -256,7 +256,7 @@ pub const POLLHUP = 0x0002;
256pub const POLLNVAL = 0x0004;256pub const POLLNVAL = 0x0004;
257257
258// https://docs.microsoft.com/en-au/windows/win32/winsock/windows-sockets-error-codes-2258// https://docs.microsoft.com/en-au/windows/win32/winsock/windows-sockets-error-codes-2
259pub const WinsockError = extern enum(u16) {259pub const WinsockError = enum(u16) {
260 /// Specified event object handle is invalid.260 /// Specified event object handle is invalid.
261 /// An application attempts to use an event object, but the specified handle is not valid.261 /// An application attempts to use an event object, but the specified handle is not valid.
262 WSA_INVALID_HANDLE = 6,262 WSA_INVALID_HANDLE = 6,
lib/std/pdb.zig+2-2
...@@ -115,7 +115,7 @@ pub const StreamType = enum(u16) {...@@ -115,7 +115,7 @@ pub const StreamType = enum(u16) {
115115
116/// Duplicate copy of SymbolRecordKind, but using the official CV names. Useful116/// Duplicate copy of SymbolRecordKind, but using the official CV names. Useful
117/// for reference purposes and when dealing with unknown record types.117/// for reference purposes and when dealing with unknown record types.
118pub const SymbolKind = packed enum(u16) {118pub const SymbolKind = enum(u16) {
119 S_COMPILE = 1,119 S_COMPILE = 1,
120 S_REGISTER_16t = 2,120 S_REGISTER_16t = 2,
121 S_CONSTANT_16t = 3,121 S_CONSTANT_16t = 3,
...@@ -426,7 +426,7 @@ pub const FileChecksumEntryHeader = packed struct {...@@ -426,7 +426,7 @@ pub const FileChecksumEntryHeader = packed struct {
426 ChecksumKind: u8,426 ChecksumKind: u8,
427};427};
428428
429pub const DebugSubsectionKind = packed enum(u32) {429pub const DebugSubsectionKind = enum(u32) {
430 None = 0,430 None = 0,
431 Symbols = 0xf1,431 Symbols = 0xf1,
432 Lines = 0xf2,432 Lines = 0xf2,
lib/std/valgrind.zig+4-4
...@@ -48,7 +48,7 @@ pub fn doClientRequest(default: usize, request: usize, a1: usize, a2: usize, a3:...@@ -48,7 +48,7 @@ pub fn doClientRequest(default: usize, request: usize, a1: usize, a2: usize, a3:
48 }48 }
49}49}
5050
51pub const ClientRequest = extern enum {51pub const ClientRequest = enum(u32) {
52 RunningOnValgrind = 4097,52 RunningOnValgrind = 4097,
53 DiscardTranslations = 4098,53 DiscardTranslations = 4098,
54 ClientCall0 = 4353,54 ClientCall0 = 4353,
...@@ -156,9 +156,9 @@ pub fn freeLikeBlock(addr: [*]u8, rzB: usize) void {...@@ -156,9 +156,9 @@ pub fn freeLikeBlock(addr: [*]u8, rzB: usize) void {
156}156}
157157
158/// Create a memory pool.158/// Create a memory pool.
159pub const MempoolFlags = extern enum {159pub const MempoolFlags = struct {
160 AutoFree = 1,160 pub const AutoFree = 1;
161 MetaPool = 2,161 pub const MetaPool = 2;
162};162};
163pub fn createMempool(pool: [*]u8, rzB: usize, is_zeroed: bool, flags: usize) void {163pub fn createMempool(pool: [*]u8, rzB: usize, is_zeroed: bool, flags: usize) void {
164 doClientRequestStmt(.CreateMempool, @ptrToInt(pool), rzB, @boolToInt(is_zeroed), flags, 0);164 doClientRequestStmt(.CreateMempool, @ptrToInt(pool), rzB, @boolToInt(is_zeroed), flags, 0);
lib/std/valgrind/callgrind.zig+1-1
...@@ -6,7 +6,7 @@...@@ -6,7 +6,7 @@
6const std = @import("../std.zig");6const std = @import("../std.zig");
7const valgrind = std.valgrind;7const valgrind = std.valgrind;
88
9pub const CallgrindClientRequest = extern enum {9pub const CallgrindClientRequest = enum(usize) {
10 DumpStats = valgrind.ToolBase("CT"),10 DumpStats = valgrind.ToolBase("CT"),
11 ZeroStats,11 ZeroStats,
12 ToggleCollect,12 ToggleCollect,
lib/std/valgrind/memcheck.zig+2-2
...@@ -7,7 +7,7 @@ const std = @import("../std.zig");...@@ -7,7 +7,7 @@ const std = @import("../std.zig");
7const testing = std.testing;7const testing = std.testing;
8const valgrind = std.valgrind;8const valgrind = std.valgrind;
99
10pub const MemCheckClientRequest = extern enum {10pub const MemCheckClientRequest = enum(usize) {
11 MakeMemNoAccess = valgrind.ToolBase("MC".*),11 MakeMemNoAccess = valgrind.ToolBase("MC".*),
12 MakeMemUndefined,12 MakeMemUndefined,
13 MakeMemDefined,13 MakeMemDefined,
...@@ -76,7 +76,7 @@ pub fn createBlock(qzz: []u8, desc: [*]u8) usize {...@@ -76,7 +76,7 @@ pub fn createBlock(qzz: []u8, desc: [*]u8) usize {
7676
77/// Discard a block-description-handle. Returns 1 for an77/// Discard a block-description-handle. Returns 1 for an
78/// invalid handle, 0 for a valid handle.78/// invalid handle, 0 for a valid handle.
79pub fn discard(blkindex) bool {79pub fn discard(blkindex: usize) bool {
80 return doMemCheckClientRequestExpr(0, // default return80 return doMemCheckClientRequestExpr(0, // default return
81 .Discard, 0, blkindex, 0, 0, 0) != 0;81 .Discard, 0, blkindex, 0, 0, 0) != 0;
82}82}
src/AstGen.zig+3-1
...@@ -2658,7 +2658,9 @@ fn fnDecl(...@@ -2658,7 +2658,9 @@ fn fnDecl(
2658 var i: usize = 0;2658 var i: usize = 0;
2659 var it = fn_proto.iterate(tree.*);2659 var it = fn_proto.iterate(tree.*);
2660 while (it.next()) |param| : (i += 1) {2660 while (it.next()) |param| : (i += 1) {
2661 const name_token = param.name_token.?;2661 const name_token = param.name_token orelse {
2662 return astgen.failNode(param.type_expr, "missing parameter name", .{});
2663 };
2662 const param_name = try astgen.identifierTokenString(name_token);2664 const param_name = try astgen.identifierTokenString(name_token);
2663 const sub_scope = try astgen.arena.create(Scope.LocalVal);2665 const sub_scope = try astgen.arena.create(Scope.LocalVal);
2664 sub_scope.* = .{2666 sub_scope.* = .{
src/Compilation.zig+1-1
...@@ -3220,7 +3220,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) Alloc...@@ -3220,7 +3220,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) Alloc
3220 \\const std = @import("std");3220 \\const std = @import("std");
3221 \\/// Zig version. When writing code that supports multiple versions of Zig, prefer3221 \\/// Zig version. When writing code that supports multiple versions of Zig, prefer
3222 \\/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.3222 \\/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
3223 \\pub const zig_version = try std.SemanticVersion.parse("{s}");3223 \\pub const zig_version = std.SemanticVersion.parse("{s}") catch unreachable;
3224 \\/// Temporary until self-hosted is feature complete.3224 \\/// Temporary until self-hosted is feature complete.
3225 \\pub const zig_is_stage2 = {};3225 \\pub const zig_is_stage2 = {};
3226 \\/// Temporary until self-hosted supports the `cpu.arch` value.3226 \\/// Temporary until self-hosted supports the `cpu.arch` value.