Commit a0ec07fdec

Jakub Konka <kubkon@jakubkonka.com>
2022-08-08 14:26:10
cc: add support for -M flag
1 parent 80c9d3f
src/clang_options_data.zig
@@ -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,
src/main.zig
@@ -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,
tools/update_clang_options.zig
@@ -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",