| ... | ... | @@ -14,6 +14,10 @@ pub fn main() !void { |
| 14 | 14 | defer std.debug.assert(gpa.deinit() == .ok); |
| 15 | 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 | 21 | const stderr = std.io.getStdErr(); |
| 18 | 22 | const stderr_config = std.io.tty.detectConfig(stderr); |
| 19 | 23 | |
| ... | ... | @@ -101,6 +105,22 @@ pub fn main() !void { |
| 101 | 105 | } |
| 102 | 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 | 124 | const full_input = full_input: { |
| 105 | 125 | if (options.preprocess != .no) { |
| 106 | 126 | var preprocessed_buf = std.ArrayList(u8).init(allocator); |
| ... | ... | @@ -112,22 +132,6 @@ pub fn main() !void { |
| 112 | 132 | defer aro_arena_state.deinit(); |
| 113 | 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 | 135 | var comp = aro.Compilation.init(aro_arena); |
| 132 | 136 | defer comp.deinit(); |
| 133 | 137 | |
| ... | ... | @@ -211,6 +215,7 @@ pub fn main() !void { |
| 211 | 215 | .dependencies_list = maybe_dependencies_list, |
| 212 | 216 | .ignore_include_env_var = options.ignore_include_env_var, |
| 213 | 217 | .extra_include_paths = options.extra_include_paths.items, |
| 218 | .system_include_paths = include_paths, |
| 214 | 219 | .default_language_id = options.default_language_id, |
| 215 | 220 | .default_code_page = options.default_code_page orelse .windows1252, |
| 216 | 221 | .verbose = options.verbose, |