authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-01 19:22:03-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-01 19:22:03-05:00
log4af5c3867487b10bdfdb35fba79442f5cc860da1
treef81556784944dab181760082d8ac4f8ed33cc990
parent080316cd4f9a20fb4cf493ee071f672416b5864c
signature Commit is signed but in an unrecognized format.

fixes for self-hosted compiler


4 files changed, 13 insertions(+), 13 deletions(-)

lib/std/event/fs.zig+1-1
...@@ -695,7 +695,7 @@ pub fn readFile(allocator: *Allocator, file_path: []const u8, max_size: usize) !...@@ -695,7 +695,7 @@ pub fn readFile(allocator: *Allocator, file_path: []const u8, max_size: usize) !
695 try list.ensureCapacity(list.len + mem.page_size);695 try list.ensureCapacity(list.len + mem.page_size);
696 const buf = list.items[list.len..];696 const buf = list.items[list.len..];
697 const buf_array = [_][]u8{buf};697 const buf_array = [_][]u8{buf};
698 const amt = try preadv(allocator, fd, buf_array, list.len);698 const amt = try preadv(allocator, fd, &buf_array, list.len);
699 list.len += amt;699 list.len += amt;
700 if (list.len > max_size) {700 if (list.len > max_size) {
701 return error.FileTooBig;701 return error.FileTooBig;
src-self-hosted/compilation.zig+10-10
...@@ -148,13 +148,13 @@ pub const Compilation = struct {...@@ -148,13 +148,13 @@ pub const Compilation = struct {
148 is_static: bool,148 is_static: bool,
149 linker_rdynamic: bool = false,149 linker_rdynamic: bool = false,
150150
151 clang_argv: []const []const u8 = [_][]const u8{},151 clang_argv: []const []const u8 = &[_][]const u8{},
152 lib_dirs: []const []const u8 = [_][]const u8{},152 lib_dirs: []const []const u8 = &[_][]const u8{},
153 rpath_list: []const []const u8 = [_][]const u8{},153 rpath_list: []const []const u8 = &[_][]const u8{},
154 assembly_files: []const []const u8 = [_][]const u8{},154 assembly_files: []const []const u8 = &[_][]const u8{},
155155
156 /// paths that are explicitly provided by the user to link against156 /// paths that are explicitly provided by the user to link against
157 link_objects: []const []const u8 = [_][]const u8{},157 link_objects: []const []const u8 = &[_][]const u8{},
158158
159 /// functions that have their own objects that we need to link159 /// functions that have their own objects that we need to link
160 /// it uses an optional pointer so that tombstone removals are possible160 /// it uses an optional pointer so that tombstone removals are possible
...@@ -178,10 +178,10 @@ pub const Compilation = struct {...@@ -178,10 +178,10 @@ pub const Compilation = struct {
178 verbose_llvm_ir: bool = false,178 verbose_llvm_ir: bool = false,
179 verbose_link: bool = false,179 verbose_link: bool = false,
180180
181 darwin_frameworks: []const []const u8 = [_][]const u8{},181 darwin_frameworks: []const []const u8 = &[_][]const u8{},
182 darwin_version_min: DarwinVersionMin = .None,182 darwin_version_min: DarwinVersionMin = .None,
183183
184 test_filters: []const []const u8 = [_][]const u8{},184 test_filters: []const []const u8 = &[_][]const u8{},
185 test_name_prefix: ?[]const u8 = null,185 test_name_prefix: ?[]const u8 = null,
186186
187 emit_file_type: Emit = .Binary,187 emit_file_type: Emit = .Binary,
...@@ -1165,7 +1165,7 @@ pub const Compilation = struct {...@@ -1165,7 +1165,7 @@ pub const Compilation = struct {
1165 const file_name = try std.fmt.allocPrint(self.gpa(), "{}{}", file_prefix[0..], suffix);1165 const file_name = try std.fmt.allocPrint(self.gpa(), "{}{}", file_prefix[0..], suffix);
1166 defer self.gpa().free(file_name);1166 defer self.gpa().free(file_name);
11671167
1168 const full_path = try std.fs.path.join(self.gpa(), [_][]const u8{ tmp_dir, file_name[0..] });1168 const full_path = try std.fs.path.join(self.gpa(), &[_][]const u8{ tmp_dir, file_name[0..] });
1169 errdefer self.gpa().free(full_path);1169 errdefer self.gpa().free(full_path);
11701170
1171 return Buffer.fromOwnedSlice(self.gpa(), full_path);1171 return Buffer.fromOwnedSlice(self.gpa(), full_path);
...@@ -1186,7 +1186,7 @@ pub const Compilation = struct {...@@ -1186,7 +1186,7 @@ pub const Compilation = struct {
1186 const zig_dir_path = try getZigDir(self.gpa());1186 const zig_dir_path = try getZigDir(self.gpa());
1187 defer self.gpa().free(zig_dir_path);1187 defer self.gpa().free(zig_dir_path);
11881188
1189 const tmp_dir = try std.fs.path.join(self.arena(), [_][]const u8{ zig_dir_path, comp_dir_name[0..] });1189 const tmp_dir = try std.fs.path.join(self.arena(), &[_][]const u8{ zig_dir_path, comp_dir_name[0..] });
1190 try std.fs.makePath(self.gpa(), tmp_dir);1190 try std.fs.makePath(self.gpa(), tmp_dir);
1191 return tmp_dir;1191 return tmp_dir;
1192 }1192 }
...@@ -1208,7 +1208,7 @@ pub const Compilation = struct {...@@ -1208,7 +1208,7 @@ pub const Compilation = struct {
1208 }1208 }
12091209
1210 var result: [12]u8 = undefined;1210 var result: [12]u8 = undefined;
1211 b64_fs_encoder.encode(result[0..], rand_bytes);1211 b64_fs_encoder.encode(result[0..], &rand_bytes);
1212 return result;1212 return result;
1213 }1213 }
12141214
src-self-hosted/link.zig+1-1
...@@ -314,7 +314,7 @@ fn constructLinkerArgsElf(ctx: *Context) !void {...@@ -314,7 +314,7 @@ fn constructLinkerArgsElf(ctx: *Context) !void {
314}314}
315315
316fn addPathJoin(ctx: *Context, dirname: []const u8, basename: []const u8) !void {316fn addPathJoin(ctx: *Context, dirname: []const u8, basename: []const u8) !void {
317 const full_path = try std.fs.path.join(&ctx.arena.allocator, [_][]const u8{ dirname, basename });317 const full_path = try std.fs.path.join(&ctx.arena.allocator, &[_][]const u8{ dirname, basename });
318 const full_path_with_null = try std.cstr.addNullByte(&ctx.arena.allocator, full_path);318 const full_path_with_null = try std.cstr.addNullByte(&ctx.arena.allocator, full_path);
319 try ctx.args.append(@ptrCast([*:0]const u8, full_path_with_null.ptr));319 try ctx.args.append(@ptrCast([*:0]const u8, full_path_with_null.ptr));
320}320}
src-self-hosted/main.zig+1-1
...@@ -709,7 +709,7 @@ async fn fmtPath(fmt: *Fmt, file_path_ref: []const u8, check_mode: bool) FmtErro...@@ -709,7 +709,7 @@ async fn fmtPath(fmt: *Fmt, file_path_ref: []const u8, check_mode: bool) FmtErro
709 var it = dir.iterate();709 var it = dir.iterate();
710 while (try it.next()) |entry| {710 while (try it.next()) |entry| {
711 if (entry.kind == .Directory or mem.endsWith(u8, entry.name, ".zig")) {711 if (entry.kind == .Directory or mem.endsWith(u8, entry.name, ".zig")) {
712 const full_path = try fs.path.join(fmt.allocator, [_][]const u8{ file_path, entry.name });712 const full_path = try fs.path.join(fmt.allocator, &[_][]const u8{ file_path, entry.name });
713 @panic("TODO https://github.com/ziglang/zig/issues/3777");713 @panic("TODO https://github.com/ziglang/zig/issues/3777");
714 // try group.call(fmtPath, fmt, full_path, check_mode);714 // try group.call(fmtPath, fmt, full_path, check_mode);
715 }715 }