diff options
| author | Ryan Liptak <squeek502@hotmail.com> | 2023-10-18 18:00:50 -0700 |
|---|---|---|
| committer | Ryan Liptak <squeek502@hotmail.com> | 2023-10-18 18:30:32 -0700 |
| commit | 81a61c8ecd7a970dc96a6068cf8587fd81ebd6e4 (patch) | |
| tree | 5f01df7d4b47a48bd25e505457a4fd0cf51d41b6 /src/resinator/preprocess.zig | |
| parent | 32bc077672cc3d7c468b4531c52d160ee12fb89f (diff) | |
| download | zig-81a61c8ecd7a970dc96a6068cf8587fd81ebd6e4.tar.gz zig-81a61c8ecd7a970dc96a6068cf8587fd81ebd6e4.zip | |
Sync resinator with upstream and fix INCLUDE env var handling
The INCLUDE variable being used during `.rc` preprocessing was an accidental regression in https://github.com/ziglang/zig/pull/17412.
Closes #17585.
resinator changes:
source_mapping: Protect against NUL bytes in #line filenames
lex: Avoid recalculating column on every tab stop within string literals
Proper error handling for failing to open cwd instead of `catch unreachable`
Use platform-specific delimiter for INCLUDE env var parsing
Diffstat (limited to 'src/resinator/preprocess.zig')
| -rw-r--r-- | src/resinator/preprocess.zig | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/resinator/preprocess.zig b/src/resinator/preprocess.zig index 9a214f1fad..981ef5bffc 100644 --- a/src/resinator/preprocess.zig +++ b/src/resinator/preprocess.zig @@ -1,7 +1,7 @@ const std = @import("std"); +const builtin = @import("builtin"); const Allocator = std.mem.Allocator; const cli = @import("cli.zig"); -const introspect = @import("../introspect.zig"); pub const IncludeArgs = struct { clang_target: ?[]const u8 = null, @@ -68,10 +68,15 @@ pub fn appendClangArgs(arena: Allocator, argv: *std.ArrayList([]const u8), optio } if (!options.ignore_include_env_var) { - const INCLUDE = (introspect.EnvVar.INCLUDE.get(arena) catch @panic("OOM")) orelse ""; + const INCLUDE = std.process.getEnvVarOwned(arena, "INCLUDE") catch ""; - // TODO: Should this be platform-specific? How does windres/llvm-rc handle this (if at all)? - var it = std.mem.tokenize(u8, INCLUDE, ";"); + // The only precedence here is llvm-rc which also uses the platform-specific + // delimiter. There's no precedence set by `rc.exe` since it's Windows-only. + const delimiter = switch (builtin.os.tag) { + .windows => ';', + else => ':', + }; + var it = std.mem.tokenizeScalar(u8, INCLUDE, delimiter); while (it.next()) |include_path| { try argv.append("-isystem"); try argv.append(include_path); |
