cc: add support for -M flag

This commit is contained in:
Jakub Konka 2022-08-08 14:26:10 +02:00
parent 80c9d3f3b1
commit a0ec07fdec
3 changed files with 19 additions and 7 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",