authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-08 18:26:26-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-08-08 18:26:26-07:00
log3afc4dff302a85e2f13e0e43a2258d1b16dd4730
treebcbcbe379d55ccdaa87ec50c15a0d1afcf81bcdd
parent50b36e84fab023ec418eb794d6a5b4510ac6b984
parenta0ec07fdec9efb8364394ad12b4000a9072ed59f
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

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

cc: add support for -M flag

3 files changed, 26 insertions(+), 14 deletions(-)

src/clang_options_data.zig+10-3
......@@ -33,7 +33,14 @@ flagpd1("H"),
3333 .psl = false,
3434},
3535flagpd1("I-"),
36flagpd1("M"),
36.{
37 .name = "M",
38 .syntax = .flag,
39 .zig_equivalent = .dep_file_to_stdout,
40 .pd1 = true,
41 .pd2 = false,
42 .psl = false,
43},
3744.{
3845 .name = "MD",
3946 .syntax = .flag,
......@@ -53,7 +60,7 @@ flagpd1("M"),
5360.{
5461 .name = "MM",
5562 .syntax = .flag,
56 .zig_equivalent = .dep_file_mm,
63 .zig_equivalent = .dep_file_to_stdout,
5764 .pd1 = true,
5865 .pd2 = false,
5966 .psl = false,
......@@ -1983,7 +1990,7 @@ flagpsl("MT"),
19831990.{
19841991 .name = "user-dependencies",
19851992 .syntax = .flag,
1986 .zig_equivalent = .dep_file_mm,
1993 .zig_equivalent = .dep_file_to_stdout,
19871994 .pd1 = false,
19881995 .pd2 = true,
19891996 .psl = false,
src/main.zig+3-2
......@@ -1657,7 +1657,8 @@ fn buildOutputType(
16571657 disable_c_depfile = true;
16581658 try clang_argv.appendSlice(it.other_args);
16591659 },
1660 .dep_file_mm => { // -MM
1660 .dep_file_to_stdout => { // -M, -MM
1661 // "Like -MD, but also implies -E and writes to stdout by default"
16611662 // "Like -MMD, but also implies -E and writes to stdout by default"
16621663 c_out_mode = .preprocessor;
16631664 disable_c_depfile = true;
......@@ -4652,7 +4653,7 @@ pub const ClangArgIterator = struct {
46524653 lib_dir,
46534654 mcpu,
46544655 dep_file,
4655 dep_file_mm,
4656 dep_file_to_stdout,
46564657 framework_dir,
46574658 framework,
46584659 nostdlibinc,
tools/update_clang_options.zig+13-9
......@@ -386,11 +386,15 @@ const known_options = [_]KnownOpt{
386386 },
387387 .{
388388 .name = "MM",
389 .ident = "dep_file_mm",
389 .ident = "dep_file_to_stdout",
390 },
391 .{
392 .name = "M",
393 .ident = "dep_file_to_stdout",
390394 },
391395 .{
392396 .name = "user-dependencies",
393 .ident = "dep_file_mm",
397 .ident = "dep_file_to_stdout",
394398 },
395399 .{
396400 .name = "MMD",
......@@ -497,7 +501,7 @@ const cpu_targets = struct {
497501 pub const riscv = std.Target.riscv;
498502 pub const sparc = std.Target.sparc;
499503 pub const spirv = std.Target.spirv;
500 pub const systemz = std.Target.systemz;
504 pub const s390x = std.Target.s390x;
501505 pub const ve = std.Target.ve;
502506 pub const wasm = std.Target.wasm;
503507 pub const x86 = std.Target.x86;
......@@ -647,9 +651,9 @@ pub fn main() anyerror!void {
647651 \\ .name = "{s}",
648652 \\ .syntax = {s},
649653 \\ .zig_equivalent = .{s},
650 \\ .pd1 = {s},
651 \\ .pd2 = {s},
652 \\ .psl = {s},
654 \\ .pd1 = {},
655 \\ .pd2 = {},
656 \\ .psl = {},
653657 \\}},
654658 \\
655659 , .{ name, final_syntax, ident, pd1, pd2, pslash });
......@@ -677,9 +681,9 @@ pub fn main() anyerror!void {
677681 \\ .name = "{s}",
678682 \\ .syntax = {s},
679683 \\ .zig_equivalent = .other,
680 \\ .pd1 = {s},
681 \\ .pd2 = {s},
682 \\ .psl = {s},
684 \\ .pd1 = {},
685 \\ .pd2 = {},
686 \\ .psl = {},
683687 \\}},
684688 \\
685689 , .{ name, syntax, pd1, pd2, pslash });