diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-04-02 21:15:36 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-04-02 21:15:36 -0400 |
| commit | f8cc6a191723d763fc7a8908f3e5beb4eff8317f (patch) | |
| tree | 0c551d4be6f9b3de844d74040fd39443ecb592c8 /tools | |
| parent | e7f555ca550cc73288adbdf4ec8d0e4abbc7a987 (diff) | |
| download | zig-f8cc6a191723d763fc7a8908f3e5beb4eff8317f.tar.gz zig-f8cc6a191723d763fc7a8908f3e5beb4eff8317f.zip | |
zig cc: fix ambiguity with -MT
In an MSVC context, `-MT` means
"Use static run-time"
and it is a flag with no parameter.
On POSIX it means
"Specify name of main file output in depfile"
and it is "joined or separate".
The former was interfering with the latter. Now, the MT flag is required
to be specified with a `/` to disambiguate: `/MT`.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/update_clang_options.zig | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig index dd46f72d4c..fd6edbdf2c 100644 --- a/tools/update_clang_options.zig +++ b/tools/update_clang_options.zig @@ -207,6 +207,34 @@ const known_options = [_]KnownOpt{ .ident = "dep_file", }, .{ + .name = "MT", + .ident = "dep_file", + }, + .{ + .name = "MG", + .ident = "dep_file", + }, + .{ + .name = "MJ", + .ident = "dep_file", + }, + .{ + .name = "MM", + .ident = "dep_file", + }, + .{ + .name = "MMD", + .ident = "dep_file", + }, + .{ + .name = "MP", + .ident = "dep_file", + }, + .{ + .name = "MQ", + .ident = "dep_file", + }, + .{ .name = "F", .ident = "framework_dir", }, @@ -336,7 +364,12 @@ pub fn main() anyerror!void { } const syntax = objSyntax(obj); - if (knownOption(name)) |ident| { + if (std.mem.eql(u8, name, "MT") and syntax == .flag) { + // `-MT foo` is ambiguous because there is also an -MT flag + // The canonical way to specify the flag is with `/MT` and so we make this + // the only way. + try stdout.print("flagpsl(\"{}\"),\n", .{name}); + } else if (knownOption(name)) |ident| { try stdout.print( \\.{{ \\ .name = "{}", @@ -350,6 +383,8 @@ pub fn main() anyerror!void { , .{ name, syntax, ident, pd1, pd2, pslash }); } else if (pd1 and !pd2 and !pslash and syntax == .flag) { try stdout.print("flagpd1(\"{}\"),\n", .{name}); + } else if (!pd1 and !pd2 and pslash and syntax == .flag) { + try stdout.print("flagpsl(\"{}\"),\n", .{name}); } else if (pd1 and !pd2 and !pslash and syntax == .joined) { try stdout.print("joinpd1(\"{}\"),\n", .{name}); } else if (pd1 and !pd2 and !pslash and syntax == .joined_or_separate) { |
