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;
121121/// prevent service name resolution
122122pub const AI_NUMERICSERV = 0x00001000;
123123
124pub const EAI = extern enum(c_int) {
124pub const EAI = enum(c_int) {
125125 /// address family for hostname not supported
126126 ADDRFAMILY = 1,
127127
lib/std/c/freebsd.zig+1-1
......@@ -62,7 +62,7 @@ pub const sem_t = extern struct {
6262 _padding: u32,
6363};
6464
65pub const EAI = extern enum(c_int) {
65pub const EAI = enum(c_int) {
6666 /// address family for hostname not supported
6767 ADDRFAMILY = 1,
6868
lib/std/c/linux.zig+1-1
......@@ -39,7 +39,7 @@ pub const NI_NAMEREQD = 0x08;
3939pub const NI_DGRAM = 0x10;
4040pub const NI_NUMERICSCOPE = 0x100;
4141
42pub const EAI = extern enum(c_int) {
42pub const EAI = enum(c_int) {
4343 BADFLAGS = -1,
4444 NONAME = -2,
4545 AGAIN = -3,
lib/std/crypto/25519/curve25519.zig+1-1
......@@ -98,7 +98,7 @@ pub const Curve25519 = struct {
9898 /// key is a low-order point.
9999 pub fn mul(p: Curve25519, s: [32]u8) Error!Curve25519 {
100100 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;
102102 return try ladder(p, s, 256);
103103 }
104104
lib/std/fmt.zig+1-1
......@@ -900,7 +900,7 @@ pub fn formatBuf(
900900) !void {
901901 if (options.width) |min_width| {
902902 // 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;
904904 const padding = if (width < min_width) min_width - width else 0;
905905
906906 if (padding == 0)
lib/std/os/linux/bpf.zig+4-4
......@@ -854,7 +854,7 @@ test "opcodes" {
854854 expect_opcode(0x95, Insn.exit());
855855}
856856
857pub const Cmd = extern enum(usize) {
857pub const Cmd = enum(usize) {
858858 /// Create a map and return a file descriptor that refers to the map. The
859859 /// close-on-exec file descriptor flag is automatically enabled for the new
860860 /// file descriptor.
......@@ -977,7 +977,7 @@ pub const Cmd = extern enum(usize) {
977977 _,
978978};
979979
980pub const MapType = extern enum(u32) {
980pub const MapType = enum(u32) {
981981 unspec,
982982 hash,
983983 array,
......@@ -1044,7 +1044,7 @@ pub const MapType = extern enum(u32) {
10441044 _,
10451045};
10461046
1047pub const ProgType = extern enum(u32) {
1047pub const ProgType = enum(u32) {
10481048 unspec,
10491049
10501050 /// context type: __sk_buff
......@@ -1139,7 +1139,7 @@ pub const ProgType = extern enum(u32) {
11391139 _,
11401140};
11411141
1142pub const AttachType = extern enum(u32) {
1142pub const AttachType = enum(u32) {
11431143 cgroup_inet_ingress,
11441144 cgroup_inet_egress,
11451145 cgroup_inet_sock_create,
lib/std/os/uefi/protocols/device_path_protocol.zig+7-7
......@@ -90,7 +90,7 @@ pub const DevicePath = union(DevicePathType) {
9090 End: EndDevicePath,
9191};
9292
93pub const DevicePathType = extern enum(u8) {
93pub const DevicePathType = enum(u8) {
9494 Hardware = 0x01,
9595 Acpi = 0x02,
9696 Messaging = 0x03,
......@@ -108,7 +108,7 @@ pub const HardwareDevicePath = union(Subtype) {
108108 Controller: *const ControllerDevicePath,
109109 Bmc: *const BmcDevicePath,
110110
111 pub const Subtype = extern enum(u8) {
111 pub const Subtype = enum(u8) {
112112 Pci = 1,
113113 PcCard = 2,
114114 MemoryMapped = 3,
......@@ -167,7 +167,7 @@ pub const AcpiDevicePath = union(Subtype) {
167167 Adr: void, // TODO
168168 Nvdimm: void, // TODO
169169
170 pub const Subtype = extern enum(u8) {
170 pub const Subtype = enum(u8) {
171171 Acpi = 1,
172172 ExpandedAcpi = 2,
173173 Adr = 3,
......@@ -196,7 +196,7 @@ pub const MessagingDevicePath = union(Subtype) {
196196 Uart: void, // TODO
197197 Vendor: void, // TODO
198198
199 pub const Subtype = extern enum(u8) {
199 pub const Subtype = enum(u8) {
200200 Atapi = 1,
201201 Scsi = 2,
202202 FibreChannel = 3,
......@@ -230,7 +230,7 @@ pub const MediaDevicePath = union(Subtype) {
230230 RelativeOffsetRange: *const RelativeOffsetRangeDevicePath,
231231 RamDisk: *const RamDiskDevicePath,
232232
233 pub const Subtype = extern enum(u8) {
233 pub const Subtype = enum(u8) {
234234 HardDrive = 1,
235235 Cdrom = 2,
236236 Vendor = 3,
......@@ -316,7 +316,7 @@ pub const MediaDevicePath = union(Subtype) {
316316pub const BiosBootSpecificationDevicePath = union(Subtype) {
317317 BBS101: *const BBS101DevicePath,
318318
319 pub const Subtype = extern enum(u8) {
319 pub const Subtype = enum(u8) {
320320 BBS101 = 1,
321321 _,
322322 };
......@@ -338,7 +338,7 @@ pub const EndDevicePath = union(Subtype) {
338338 EndEntire: *const EndEntireDevicePath,
339339 EndThisInstance: *const EndThisInstanceDevicePath,
340340
341 pub const Subtype = extern enum(u8) {
341 pub const Subtype = enum(u8) {
342342 EndEntire = 0xff,
343343 EndThisInstance = 0x01,
344344 _,
lib/std/os/uefi/protocols/graphics_output_protocol.zig+2-2
......@@ -57,7 +57,7 @@ pub const GraphicsOutputModeInformation = extern struct {
5757 pixels_per_scan_line: u32 = undefined,
5858};
5959
60pub const GraphicsPixelFormat = extern enum(u32) {
60pub const GraphicsPixelFormat = enum(u32) {
6161 PixelRedGreenBlueReserved8BitPerColor,
6262 PixelBlueGreenRedReserved8BitPerColor,
6363 PixelBitMask,
......@@ -79,7 +79,7 @@ pub const GraphicsOutputBltPixel = extern struct {
7979 reserved: u8 = undefined,
8080};
8181
82pub const GraphicsOutputBltOperation = extern enum(u32) {
82pub const GraphicsOutputBltOperation = enum(u32) {
8383 BltVideoFill,
8484 BltVideoToBltBuffer,
8585 BltBufferToVideo,
lib/std/os/uefi/protocols/hii_popup_protocol.zig+3-3
......@@ -28,20 +28,20 @@ pub const HIIPopupProtocol = extern struct {
2828 };
2929};
3030
31pub const HIIPopupStyle = extern enum(u32) {
31pub const HIIPopupStyle = enum(u32) {
3232 Info,
3333 Warning,
3434 Error,
3535};
3636
37pub const HIIPopupType = extern enum(u32) {
37pub const HIIPopupType = enum(u32) {
3838 Ok,
3939 Cancel,
4040 YesNo,
4141 YesNoCancel,
4242};
4343
44pub const HIIPopupSelection = extern enum(u32) {
44pub const HIIPopupSelection = enum(u32) {
4545 Ok,
4646 Cancel,
4747 Yes,
lib/std/os/uefi/protocols/ip6_config_protocol.zig+1-1
......@@ -40,7 +40,7 @@ pub const Ip6ConfigProtocol = extern struct {
4040 };
4141};
4242
43pub const Ip6ConfigDataType = extern enum(u32) {
43pub const Ip6ConfigDataType = enum(u32) {
4444 InterfaceInfo,
4545 AltInterfaceId,
4646 Policy,
lib/std/os/uefi/protocols/ip6_protocol.zig+1-1
......@@ -123,7 +123,7 @@ pub const Ip6RouteTable = extern struct {
123123 prefix_length: u8,
124124};
125125
126pub const Ip6NeighborState = extern enum(u32) {
126pub const Ip6NeighborState = enum(u32) {
127127 Incomplete,
128128 Reachable,
129129 Stale,
lib/std/os/uefi/protocols/simple_network_protocol.zig+1-1
......@@ -134,7 +134,7 @@ pub const SimpleNetworkReceiveFilter = packed struct {
134134 _pad: u27 = undefined,
135135};
136136
137pub const SimpleNetworkState = extern enum(u32) {
137pub const SimpleNetworkState = enum(u32) {
138138 Stopped,
139139 Started,
140140 Initialized,
lib/std/os/uefi/tables/boot_services.zig+4-4
......@@ -156,13 +156,13 @@ pub const BootServices = extern struct {
156156 pub const tpl_high_level: usize = 31;
157157};
158158
159pub const TimerDelay = extern enum(u32) {
159pub const TimerDelay = enum(u32) {
160160 TimerCancel,
161161 TimerPeriodic,
162162 TimerRelative,
163163};
164164
165pub const MemoryType = extern enum(u32) {
165pub const MemoryType = enum(u32) {
166166 ReservedMemoryType,
167167 LoaderCode,
168168 LoaderData,
......@@ -206,7 +206,7 @@ pub const MemoryDescriptor = extern struct {
206206 },
207207};
208208
209pub const LocateSearchType = extern enum(u32) {
209pub const LocateSearchType = enum(u32) {
210210 AllHandles,
211211 ByRegisterNotify,
212212 ByProtocol,
......@@ -229,7 +229,7 @@ pub const ProtocolInformationEntry = extern struct {
229229 open_count: u32,
230230};
231231
232pub const AllocateType = extern enum(u32) {
232pub const AllocateType = enum(u32) {
233233 AllocateAnyPages,
234234 AllocateMaxAddress,
235235 AllocateAddress,
lib/std/os/uefi/tables/runtime_services.zig+1-1
......@@ -51,7 +51,7 @@ pub const RuntimeServices = extern struct {
5151 pub const signature: u64 = 0x56524553544e5552;
5252};
5353
54pub const ResetType = extern enum(u32) {
54pub const ResetType = enum(u32) {
5555 ResetCold,
5656 ResetWarm,
5757 ResetShutdown,
lib/std/special/compiler_rt/compareXf2.zig+7-5
......@@ -10,18 +10,20 @@
1010const std = @import("std");
1111const builtin = @import("builtin");
1212
13const LE = extern enum(i32) {
13const LE = enum(i32) {
1414 Less = -1,
1515 Equal = 0,
1616 Greater = 1,
17 Unordered = 1,
17
18 const Unordered: LE = .Greater;
1819};
1920
20const GE = extern enum(i32) {
21const GE = enum(i32) {
2122 Less = -1,
2223 Equal = 0,
2324 Greater = 1,
24 Unordered = -1,
25
26 const Unordered: GE = .Less;
2527};
2628
2729pub 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 {
4345 const bAbs = @bitCast(rep_t, bInt) & absMask;
4446
4547 // 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
4850 // If a and b are both zeros, they are equal.
4951 if ((aAbs | bAbs) == 0) return .Equal;
lib/std/special/compiler_rt/sparc.zig+1-1
......@@ -11,7 +11,7 @@ const builtin = @import("builtin");
1111
1212// The SPARC Architecture Manual, Version 9:
1313// A.13 Floating-Point Compare
14const FCMP = extern enum(i32) {
14const FCMP = enum(i32) {
1515 Equal = 0,
1616 Less = 1,
1717 Greater = 2,
src/BuiltinFn.zig+1-1
......@@ -506,7 +506,7 @@ pub const list = list: {
506506 "@intToFloat",
507507 .{
508508 .tag = .int_to_float,
509 .param_count = 1,
509 .param_count = 2,
510510 },
511511 },
512512 .{