Merge pull request #12369 from ziglang/zig-cc-m-flag

cc: add support for -M flag
This commit is contained in:
Andrew Kelley 2022-08-08 18:26:26 -07:00 committed by GitHub
commit 3afc4dff30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 14 deletions

View File

@ -33,7 +33,14 @@ flagpd1("H"),
.psl = false,
},
flagpd1("I-"),
flagpd1("M"),
.{
.name = "M",
.syntax = .flag,
.zig_equivalent = .dep_file_to_stdout,
.pd1 = true,
.pd2 = false,
.psl = false,
},
.{
.name = "MD",
.syntax = .flag,
@ -53,7 +60,7 @@ flagpd1("M"),
.{
.name = "MM",
.syntax = .flag,
.zig_equivalent = .dep_file_mm,
.zig_equivalent = .dep_file_to_stdout,
.pd1 = true,
.pd2 = false,
.psl = false,
@ -1983,7 +1990,7 @@ flagpsl("MT"),
.{
.name = "user-dependencies",
.syntax = .flag,
.zig_equivalent = .dep_file_mm,
.zig_equivalent = .dep_file_to_stdout,
.pd1 = false,
.pd2 = true,
.psl = false,

View File

@ -1657,7 +1657,8 @@ fn buildOutputType(
disable_c_depfile = true;
try clang_argv.appendSlice(it.other_args);
},
.dep_file_mm => { // -MM
.dep_file_to_stdout => { // -M, -MM
// "Like -MD, but also implies -E and writes to stdout by default"
// "Like -MMD, but also implies -E and writes to stdout by default"
c_out_mode = .preprocessor;
disable_c_depfile = true;
@ -4652,7 +4653,7 @@ pub const ClangArgIterator = struct {
lib_dir,
mcpu,
dep_file,
dep_file_mm,
dep_file_to_stdout,
framework_dir,
framework,
nostdlibinc,

View File

@ -386,11 +386,15 @@ const known_options = [_]KnownOpt{
},
.{
.name = "MM",
.ident = "dep_file_mm",
.ident = "dep_file_to_stdout",
},
.{
.name = "M",
.ident = "dep_file_to_stdout",
},
.{
.name = "user-dependencies",
.ident = "dep_file_mm",
.ident = "dep_file_to_stdout",
},
.{
.name = "MMD",
@ -497,7 +501,7 @@ const cpu_targets = struct {
pub const riscv = std.Target.riscv;
pub const sparc = std.Target.sparc;
pub const spirv = std.Target.spirv;
pub const systemz = std.Target.systemz;
pub const s390x = std.Target.s390x;
pub const ve = std.Target.ve;
pub const wasm = std.Target.wasm;
pub const x86 = std.Target.x86;
@ -647,9 +651,9 @@ pub fn main() anyerror!void {
\\ .name = "{s}",
\\ .syntax = {s},
\\ .zig_equivalent = .{s},
\\ .pd1 = {s},
\\ .pd2 = {s},
\\ .psl = {s},
\\ .pd1 = {},
\\ .pd2 = {},
\\ .psl = {},
\\}},
\\
, .{ name, final_syntax, ident, pd1, pd2, pslash });
@ -677,9 +681,9 @@ pub fn main() anyerror!void {
\\ .name = "{s}",
\\ .syntax = {s},
\\ .zig_equivalent = .other,
\\ .pd1 = {s},
\\ .pd2 = {s},
\\ .psl = {s},
\\ .pd1 = {},
\\ .pd2 = {},
\\ .psl = {},
\\}},
\\
, .{ name, syntax, pd1, pd2, pslash });