| ... | @@ -14,6 +14,10 @@ pub fn main() !void { | ... | @@ -14,6 +14,10 @@ pub fn main() !void { |
| 14 | defer std.debug.assert(gpa.deinit() == .ok); | 14 | defer std.debug.assert(gpa.deinit() == .ok); |
| 15 | const allocator = gpa.allocator(); | 15 | const allocator = gpa.allocator(); |
| 16 | | 16 | |
| | 17 | var arena_state = std.heap.ArenaAllocator.init(allocator); |
| | 18 | defer arena_state.deinit(); |
| | 19 | const arena = arena_state.allocator(); |
| | 20 | |
| 17 | const stderr = std.io.getStdErr(); | 21 | const stderr = std.io.getStdErr(); |
| 18 | const stderr_config = std.io.tty.detectConfig(stderr); | 22 | const stderr_config = std.io.tty.detectConfig(stderr); |
| 19 | | 23 | |
| ... | @@ -101,6 +105,22 @@ pub fn main() !void { | ... | @@ -101,6 +105,22 @@ pub fn main() !void { |
| 101 | } | 105 | } |
| 102 | const maybe_dependencies_list: ?*std.ArrayList([]const u8) = if (options.depfile_path != null) &dependencies_list else null; | 106 | const maybe_dependencies_list: ?*std.ArrayList([]const u8) = if (options.depfile_path != null) &dependencies_list else null; |
| 103 | | 107 | |
| | 108 | const include_paths = getIncludePaths(arena, options.auto_includes, zig_lib_dir) catch |err| switch (err) { |
| | 109 | error.OutOfMemory => |e| return e, |
| | 110 | else => |e| { |
| | 111 | switch (e) { |
| | 112 | error.MsvcIncludesNotFound => { |
| | 113 | try error_handler.emitMessage(allocator, .err, "MSVC include paths could not be automatically detected", .{}); |
| | 114 | }, |
| | 115 | error.MingwIncludesNotFound => { |
| | 116 | try error_handler.emitMessage(allocator, .err, "MinGW include paths could not be automatically detected", .{}); |
| | 117 | }, |
| | 118 | } |
| | 119 | try error_handler.emitMessage(allocator, .note, "to disable auto includes, use the option /:auto-includes none", .{}); |
| | 120 | std.os.exit(1); |
| | 121 | }, |
| | 122 | }; |
| | 123 | |
| 104 | const full_input = full_input: { | 124 | const full_input = full_input: { |
| 105 | if (options.preprocess != .no) { | 125 | if (options.preprocess != .no) { |
| 106 | var preprocessed_buf = std.ArrayList(u8).init(allocator); | 126 | var preprocessed_buf = std.ArrayList(u8).init(allocator); |
| ... | @@ -112,22 +132,6 @@ pub fn main() !void { | ... | @@ -112,22 +132,6 @@ pub fn main() !void { |
| 112 | defer aro_arena_state.deinit(); | 132 | defer aro_arena_state.deinit(); |
| 113 | const aro_arena = aro_arena_state.allocator(); | 133 | const aro_arena = aro_arena_state.allocator(); |
| 114 | | 134 | |
| 115 | const include_paths = getIncludePaths(aro_arena, options.auto_includes, zig_lib_dir) catch |err| switch (err) { | | |
| 116 | error.OutOfMemory => |e| return e, | | |
| 117 | else => |e| { | | |
| 118 | switch (e) { | | |
| 119 | error.MsvcIncludesNotFound => { | | |
| 120 | try error_handler.emitMessage(allocator, .err, "MSVC include paths could not be automatically detected", .{}); | | |
| 121 | }, | | |
| 122 | error.MingwIncludesNotFound => { | | |
| 123 | try error_handler.emitMessage(allocator, .err, "MinGW include paths could not be automatically detected", .{}); | | |
| 124 | }, | | |
| 125 | } | | |
| 126 | try error_handler.emitMessage(allocator, .note, "to disable auto includes, use the option /:auto-includes none", .{}); | | |
| 127 | std.os.exit(1); | | |
| 128 | }, | | |
| 129 | }; | | |
| 130 | | | |
| 131 | var comp = aro.Compilation.init(aro_arena); | 135 | var comp = aro.Compilation.init(aro_arena); |
| 132 | defer comp.deinit(); | 136 | defer comp.deinit(); |
| 133 | | 137 | |
| ... | @@ -211,6 +215,7 @@ pub fn main() !void { | ... | @@ -211,6 +215,7 @@ pub fn main() !void { |
| 211 | .dependencies_list = maybe_dependencies_list, | 215 | .dependencies_list = maybe_dependencies_list, |
| 212 | .ignore_include_env_var = options.ignore_include_env_var, | 216 | .ignore_include_env_var = options.ignore_include_env_var, |
| 213 | .extra_include_paths = options.extra_include_paths.items, | 217 | .extra_include_paths = options.extra_include_paths.items, |
| | 218 | .system_include_paths = include_paths, |
| 214 | .default_language_id = options.default_language_id, | 219 | .default_language_id = options.default_language_id, |
| 215 | .default_code_page = options.default_code_page orelse .windows1252, | 220 | .default_code_page = options.default_code_page orelse .windows1252, |
| 216 | .verbose = options.verbose, | 221 | .verbose = options.verbose, |