authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-22 19:32:57-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-22 19:32:57-07:00
log93d1c2d6d4092bd17dc27298294581b77fa68881
tree40332a8d4cecbfb70e4296a4d6b953dedc0fbd77
parent8dd737801355427c558876bbcb299926d47b8269

std: fix compile errors caught by stage2 AstGen

Follow-up from 507a8096d2f9624bafaf963c3e189a477ef6b7bf

17 files changed, 38 insertions(+), 36 deletions(-)

lib/std/c/darwin.zig+1-1
...@@ -121,7 +121,7 @@ pub const AI_NUMERICHOST = 0x00000004;...@@ -121,7 +121,7 @@ pub const AI_NUMERICHOST = 0x00000004;
121/// prevent service name resolution121/// prevent service name resolution
122pub const AI_NUMERICSERV = 0x00001000;122pub const AI_NUMERICSERV = 0x00001000;
123123
124pub const EAI = extern enum(c_int) {124pub const EAI = enum(c_int) {
125 /// address family for hostname not supported125 /// address family for hostname not supported
126 ADDRFAMILY = 1,126 ADDRFAMILY = 1,
127127
lib/std/c/freebsd.zig+1-1
...@@ -62,7 +62,7 @@ pub const sem_t = extern struct {...@@ -62,7 +62,7 @@ pub const sem_t = extern struct {
62 _padding: u32,62 _padding: u32,
63};63};
6464
65pub const EAI = extern enum(c_int) {65pub const EAI = enum(c_int) {
66 /// address family for hostname not supported66 /// address family for hostname not supported
67 ADDRFAMILY = 1,67 ADDRFAMILY = 1,
6868
lib/std/c/linux.zig+1-1
...@@ -39,7 +39,7 @@ pub const NI_NAMEREQD = 0x08;...@@ -39,7 +39,7 @@ pub const NI_NAMEREQD = 0x08;
39pub const NI_DGRAM = 0x10;39pub const NI_DGRAM = 0x10;
40pub const NI_NUMERICSCOPE = 0x100;40pub const NI_NUMERICSCOPE = 0x100;
4141
42pub const EAI = extern enum(c_int) {42pub const EAI = enum(c_int) {
43 BADFLAGS = -1,43 BADFLAGS = -1,
44 NONAME = -2,44 NONAME = -2,
45 AGAIN = -3,45 AGAIN = -3,
lib/std/crypto/25519/curve25519.zig+1-1
...@@ -98,7 +98,7 @@ pub const Curve25519 = struct {...@@ -98,7 +98,7 @@ pub const Curve25519 = struct {
98 /// key is a low-order point.98 /// key is a low-order point.
99 pub fn mul(p: Curve25519, s: [32]u8) Error!Curve25519 {99 pub fn mul(p: Curve25519, s: [32]u8) Error!Curve25519 {
100 const cofactor = [_]u8{8} ++ [_]u8{0} ** 31;100 const cofactor = [_]u8{8} ++ [_]u8{0} ** 31;
101 _ = ladder(p, cofactor, 4) catch |_| return error.WeakPublicKey;101 _ = ladder(p, cofactor, 4) catch return error.WeakPublicKey;
102 return try ladder(p, s, 256);102 return try ladder(p, s, 256);
103 }103 }
104104
lib/std/fmt.zig+1-1
...@@ -900,7 +900,7 @@ pub fn formatBuf(...@@ -900,7 +900,7 @@ pub fn formatBuf(
900) !void {900) !void {
901 if (options.width) |min_width| {901 if (options.width) |min_width| {
902 // In case of error assume the buffer content is ASCII-encoded902 // In case of error assume the buffer content is ASCII-encoded
903 const width = unicode.utf8CountCodepoints(buf) catch |_| buf.len;903 const width = unicode.utf8CountCodepoints(buf) catch buf.len;
904 const padding = if (width < min_width) min_width - width else 0;904 const padding = if (width < min_width) min_width - width else 0;
905905
906 if (padding == 0)906 if (padding == 0)
lib/std/os/linux/bpf.zig+4-4
...@@ -854,7 +854,7 @@ test "opcodes" {...@@ -854,7 +854,7 @@ test "opcodes" {
854 expect_opcode(0x95, Insn.exit());854 expect_opcode(0x95, Insn.exit());
855}855}
856856
857pub const Cmd = extern enum(usize) {857pub const Cmd = enum(usize) {
858 /// Create a map and return a file descriptor that refers to the map. The858 /// Create a map and return a file descriptor that refers to the map. The
859 /// close-on-exec file descriptor flag is automatically enabled for the new859 /// close-on-exec file descriptor flag is automatically enabled for the new
860 /// file descriptor.860 /// file descriptor.
...@@ -977,7 +977,7 @@ pub const Cmd = extern enum(usize) {...@@ -977,7 +977,7 @@ pub const Cmd = extern enum(usize) {
977 _,977 _,
978};978};
979979
980pub const MapType = extern enum(u32) {980pub const MapType = enum(u32) {
981 unspec,981 unspec,
982 hash,982 hash,
983 array,983 array,
...@@ -1044,7 +1044,7 @@ pub const MapType = extern enum(u32) {...@@ -1044,7 +1044,7 @@ pub const MapType = extern enum(u32) {
1044 _,1044 _,
1045};1045};
10461046
1047pub const ProgType = extern enum(u32) {1047pub const ProgType = enum(u32) {
1048 unspec,1048 unspec,
10491049
1050 /// context type: __sk_buff1050 /// context type: __sk_buff
...@@ -1139,7 +1139,7 @@ pub const ProgType = extern enum(u32) {...@@ -1139,7 +1139,7 @@ pub const ProgType = extern enum(u32) {
1139 _,1139 _,
1140};1140};
11411141
1142pub const AttachType = extern enum(u32) {1142pub const AttachType = enum(u32) {
1143 cgroup_inet_ingress,1143 cgroup_inet_ingress,
1144 cgroup_inet_egress,1144 cgroup_inet_egress,
1145 cgroup_inet_sock_create,1145 cgroup_inet_sock_create,
lib/std/os/uefi/protocols/device_path_protocol.zig+7-7
...@@ -90,7 +90,7 @@ pub const DevicePath = union(DevicePathType) {...@@ -90,7 +90,7 @@ pub const DevicePath = union(DevicePathType) {
90 End: EndDevicePath,90 End: EndDevicePath,
91};91};
9292
93pub const DevicePathType = extern enum(u8) {93pub const DevicePathType = enum(u8) {
94 Hardware = 0x01,94 Hardware = 0x01,
95 Acpi = 0x02,95 Acpi = 0x02,
96 Messaging = 0x03,96 Messaging = 0x03,
...@@ -108,7 +108,7 @@ pub const HardwareDevicePath = union(Subtype) {...@@ -108,7 +108,7 @@ pub const HardwareDevicePath = union(Subtype) {
108 Controller: *const ControllerDevicePath,108 Controller: *const ControllerDevicePath,
109 Bmc: *const BmcDevicePath,109 Bmc: *const BmcDevicePath,
110110
111 pub const Subtype = extern enum(u8) {111 pub const Subtype = enum(u8) {
112 Pci = 1,112 Pci = 1,
113 PcCard = 2,113 PcCard = 2,
114 MemoryMapped = 3,114 MemoryMapped = 3,
...@@ -167,7 +167,7 @@ pub const AcpiDevicePath = union(Subtype) {...@@ -167,7 +167,7 @@ pub const AcpiDevicePath = union(Subtype) {
167 Adr: void, // TODO167 Adr: void, // TODO
168 Nvdimm: void, // TODO168 Nvdimm: void, // TODO
169169
170 pub const Subtype = extern enum(u8) {170 pub const Subtype = enum(u8) {
171 Acpi = 1,171 Acpi = 1,
172 ExpandedAcpi = 2,172 ExpandedAcpi = 2,
173 Adr = 3,173 Adr = 3,
...@@ -196,7 +196,7 @@ pub const MessagingDevicePath = union(Subtype) {...@@ -196,7 +196,7 @@ pub const MessagingDevicePath = union(Subtype) {
196 Uart: void, // TODO196 Uart: void, // TODO
197 Vendor: void, // TODO197 Vendor: void, // TODO
198198
199 pub const Subtype = extern enum(u8) {199 pub const Subtype = enum(u8) {
200 Atapi = 1,200 Atapi = 1,
201 Scsi = 2,201 Scsi = 2,
202 FibreChannel = 3,202 FibreChannel = 3,
...@@ -230,7 +230,7 @@ pub const MediaDevicePath = union(Subtype) {...@@ -230,7 +230,7 @@ pub const MediaDevicePath = union(Subtype) {
230 RelativeOffsetRange: *const RelativeOffsetRangeDevicePath,230 RelativeOffsetRange: *const RelativeOffsetRangeDevicePath,
231 RamDisk: *const RamDiskDevicePath,231 RamDisk: *const RamDiskDevicePath,
232232
233 pub const Subtype = extern enum(u8) {233 pub const Subtype = enum(u8) {
234 HardDrive = 1,234 HardDrive = 1,
235 Cdrom = 2,235 Cdrom = 2,
236 Vendor = 3,236 Vendor = 3,
...@@ -316,7 +316,7 @@ pub const MediaDevicePath = union(Subtype) {...@@ -316,7 +316,7 @@ pub const MediaDevicePath = union(Subtype) {
316pub const BiosBootSpecificationDevicePath = union(Subtype) {316pub const BiosBootSpecificationDevicePath = union(Subtype) {
317 BBS101: *const BBS101DevicePath,317 BBS101: *const BBS101DevicePath,
318318
319 pub const Subtype = extern enum(u8) {319 pub const Subtype = enum(u8) {
320 BBS101 = 1,320 BBS101 = 1,
321 _,321 _,
322 };322 };
...@@ -338,7 +338,7 @@ pub const EndDevicePath = union(Subtype) {...@@ -338,7 +338,7 @@ pub const EndDevicePath = union(Subtype) {
338 EndEntire: *const EndEntireDevicePath,338 EndEntire: *const EndEntireDevicePath,
339 EndThisInstance: *const EndThisInstanceDevicePath,339 EndThisInstance: *const EndThisInstanceDevicePath,
340340
341 pub const Subtype = extern enum(u8) {341 pub const Subtype = enum(u8) {
342 EndEntire = 0xff,342 EndEntire = 0xff,
343 EndThisInstance = 0x01,343 EndThisInstance = 0x01,
344 _,344 _,
lib/std/os/uefi/protocols/graphics_output_protocol.zig+2-2
...@@ -57,7 +57,7 @@ pub const GraphicsOutputModeInformation = extern struct {...@@ -57,7 +57,7 @@ pub const GraphicsOutputModeInformation = extern struct {
57 pixels_per_scan_line: u32 = undefined,57 pixels_per_scan_line: u32 = undefined,
58};58};
5959
60pub const GraphicsPixelFormat = extern enum(u32) {60pub const GraphicsPixelFormat = enum(u32) {
61 PixelRedGreenBlueReserved8BitPerColor,61 PixelRedGreenBlueReserved8BitPerColor,
62 PixelBlueGreenRedReserved8BitPerColor,62 PixelBlueGreenRedReserved8BitPerColor,
63 PixelBitMask,63 PixelBitMask,
...@@ -79,7 +79,7 @@ pub const GraphicsOutputBltPixel = extern struct {...@@ -79,7 +79,7 @@ pub const GraphicsOutputBltPixel = extern struct {
79 reserved: u8 = undefined,79 reserved: u8 = undefined,
80};80};
8181
82pub const GraphicsOutputBltOperation = extern enum(u32) {82pub const GraphicsOutputBltOperation = enum(u32) {
83 BltVideoFill,83 BltVideoFill,
84 BltVideoToBltBuffer,84 BltVideoToBltBuffer,
85 BltBufferToVideo,85 BltBufferToVideo,
lib/std/os/uefi/protocols/hii_popup_protocol.zig+3-3
...@@ -28,20 +28,20 @@ pub const HIIPopupProtocol = extern struct {...@@ -28,20 +28,20 @@ pub const HIIPopupProtocol = extern struct {
28 };28 };
29};29};
3030
31pub const HIIPopupStyle = extern enum(u32) {31pub const HIIPopupStyle = enum(u32) {
32 Info,32 Info,
33 Warning,33 Warning,
34 Error,34 Error,
35};35};
3636
37pub const HIIPopupType = extern enum(u32) {37pub const HIIPopupType = enum(u32) {
38 Ok,38 Ok,
39 Cancel,39 Cancel,
40 YesNo,40 YesNo,
41 YesNoCancel,41 YesNoCancel,
42};42};
4343
44pub const HIIPopupSelection = extern enum(u32) {44pub const HIIPopupSelection = enum(u32) {
45 Ok,45 Ok,
46 Cancel,46 Cancel,
47 Yes,47 Yes,
lib/std/os/uefi/protocols/ip6_config_protocol.zig+1-1
...@@ -40,7 +40,7 @@ pub const Ip6ConfigProtocol = extern struct {...@@ -40,7 +40,7 @@ pub const Ip6ConfigProtocol = extern struct {
40 };40 };
41};41};
4242
43pub const Ip6ConfigDataType = extern enum(u32) {43pub const Ip6ConfigDataType = enum(u32) {
44 InterfaceInfo,44 InterfaceInfo,
45 AltInterfaceId,45 AltInterfaceId,
46 Policy,46 Policy,
lib/std/os/uefi/protocols/ip6_protocol.zig+1-1
...@@ -123,7 +123,7 @@ pub const Ip6RouteTable = extern struct {...@@ -123,7 +123,7 @@ pub const Ip6RouteTable = extern struct {
123 prefix_length: u8,123 prefix_length: u8,
124};124};
125125
126pub const Ip6NeighborState = extern enum(u32) {126pub const Ip6NeighborState = enum(u32) {
127 Incomplete,127 Incomplete,
128 Reachable,128 Reachable,
129 Stale,129 Stale,
lib/std/os/uefi/protocols/simple_network_protocol.zig+1-1
...@@ -134,7 +134,7 @@ pub const SimpleNetworkReceiveFilter = packed struct {...@@ -134,7 +134,7 @@ pub const SimpleNetworkReceiveFilter = packed struct {
134 _pad: u27 = undefined,134 _pad: u27 = undefined,
135};135};
136136
137pub const SimpleNetworkState = extern enum(u32) {137pub const SimpleNetworkState = enum(u32) {
138 Stopped,138 Stopped,
139 Started,139 Started,
140 Initialized,140 Initialized,
lib/std/os/uefi/tables/boot_services.zig+4-4
...@@ -156,13 +156,13 @@ pub const BootServices = extern struct {...@@ -156,13 +156,13 @@ pub const BootServices = extern struct {
156 pub const tpl_high_level: usize = 31;156 pub const tpl_high_level: usize = 31;
157};157};
158158
159pub const TimerDelay = extern enum(u32) {159pub const TimerDelay = enum(u32) {
160 TimerCancel,160 TimerCancel,
161 TimerPeriodic,161 TimerPeriodic,
162 TimerRelative,162 TimerRelative,
163};163};
164164
165pub const MemoryType = extern enum(u32) {165pub const MemoryType = enum(u32) {
166 ReservedMemoryType,166 ReservedMemoryType,
167 LoaderCode,167 LoaderCode,
168 LoaderData,168 LoaderData,
...@@ -206,7 +206,7 @@ pub const MemoryDescriptor = extern struct {...@@ -206,7 +206,7 @@ pub const MemoryDescriptor = extern struct {
206 },206 },
207};207};
208208
209pub const LocateSearchType = extern enum(u32) {209pub const LocateSearchType = enum(u32) {
210 AllHandles,210 AllHandles,
211 ByRegisterNotify,211 ByRegisterNotify,
212 ByProtocol,212 ByProtocol,
...@@ -229,7 +229,7 @@ pub const ProtocolInformationEntry = extern struct {...@@ -229,7 +229,7 @@ pub const ProtocolInformationEntry = extern struct {
229 open_count: u32,229 open_count: u32,
230};230};
231231
232pub const AllocateType = extern enum(u32) {232pub const AllocateType = enum(u32) {
233 AllocateAnyPages,233 AllocateAnyPages,
234 AllocateMaxAddress,234 AllocateMaxAddress,
235 AllocateAddress,235 AllocateAddress,
lib/std/os/uefi/tables/runtime_services.zig+1-1
...@@ -51,7 +51,7 @@ pub const RuntimeServices = extern struct {...@@ -51,7 +51,7 @@ pub const RuntimeServices = extern struct {
51 pub const signature: u64 = 0x56524553544e5552;51 pub const signature: u64 = 0x56524553544e5552;
52};52};
5353
54pub const ResetType = extern enum(u32) {54pub const ResetType = enum(u32) {
55 ResetCold,55 ResetCold,
56 ResetWarm,56 ResetWarm,
57 ResetShutdown,57 ResetShutdown,
lib/std/special/compiler_rt/compareXf2.zig+7-5
...@@ -10,18 +10,20 @@...@@ -10,18 +10,20 @@
10const std = @import("std");10const std = @import("std");
11const builtin = @import("builtin");11const builtin = @import("builtin");
1212
13const LE = extern enum(i32) {13const LE = enum(i32) {
14 Less = -1,14 Less = -1,
15 Equal = 0,15 Equal = 0,
16 Greater = 1,16 Greater = 1,
17 Unordered = 1,17
18 const Unordered: LE = .Greater;
18};19};
1920
20const GE = extern enum(i32) {21const GE = enum(i32) {
21 Less = -1,22 Less = -1,
22 Equal = 0,23 Equal = 0,
23 Greater = 1,24 Greater = 1,
24 Unordered = -1,25
26 const Unordered: GE = .Less;
25};27};
2628
27pub fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT {29pub fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT {
...@@ -43,7 +45,7 @@ pub fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT {...@@ -43,7 +45,7 @@ pub fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT {
43 const bAbs = @bitCast(rep_t, bInt) & absMask;45 const bAbs = @bitCast(rep_t, bInt) & absMask;
4446
45 // If either a or b is NaN, they are unordered.47 // If either a or b is NaN, they are unordered.
46 if (aAbs > infRep or bAbs > infRep) return .Unordered;48 if (aAbs > infRep or bAbs > infRep) return RT.Unordered;
4749
48 // If a and b are both zeros, they are equal.50 // If a and b are both zeros, they are equal.
49 if ((aAbs | bAbs) == 0) return .Equal;51 if ((aAbs | bAbs) == 0) return .Equal;
lib/std/special/compiler_rt/sparc.zig+1-1
...@@ -11,7 +11,7 @@ const builtin = @import("builtin");...@@ -11,7 +11,7 @@ const builtin = @import("builtin");
1111
12// The SPARC Architecture Manual, Version 9:12// The SPARC Architecture Manual, Version 9:
13// A.13 Floating-Point Compare13// A.13 Floating-Point Compare
14const FCMP = extern enum(i32) {14const FCMP = enum(i32) {
15 Equal = 0,15 Equal = 0,
16 Less = 1,16 Less = 1,
17 Greater = 2,17 Greater = 2,
src/BuiltinFn.zig+1-1
...@@ -506,7 +506,7 @@ pub const list = list: {...@@ -506,7 +506,7 @@ pub const list = list: {
506 "@intToFloat",506 "@intToFloat",
507 .{507 .{
508 .tag = .int_to_float,508 .tag = .int_to_float,
509 .param_count = 1,509 .param_count = 2,
510 },510 },
511 },511 },
512 .{512 .{