commit 96e5f661bd34d98bba89bcb70c9db059aaf38641 (tree)
parent ceeb230c23e0665811956657157561170be54519
Author: Andrew Kelley <andrew@ziglang.org>
Date: Sun, 21 Nov 2021 17:07:18 -0700
zig cc: add -fcolor-diagnostics and -fcaret-diagnostics integration
Closes #6290
Diffstat:
3 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/src/clang_options_data.zig b/src/clang_options_data.zig
@@ -2569,12 +2569,26 @@ flagpd1("fcall-saved-x18"),
flagpd1("fcall-saved-x8"),
flagpd1("fcall-saved-x9"),
flagpd1("fcaller-saves"),
-flagpd1("fcaret-diagnostics"),
+.{
+ .name = "fcaret-diagnostics",
+ .syntax = .flag,
+ .zig_equivalent = .color_diagnostics,
+ .pd1 = true,
+ .pd2 = false,
+ .psl = false,
+},
sepd1("fcaret-diagnostics-max-lines"),
flagpd1("fcf-protection"),
flagpd1("fchar8_t"),
flagpd1("fcheck-array-temporaries"),
-flagpd1("fcolor-diagnostics"),
+.{
+ .name = "fcolor-diagnostics",
+ .syntax = .flag,
+ .zig_equivalent = .color_diagnostics,
+ .pd1 = true,
+ .pd2 = false,
+ .psl = false,
+},
flagpd1("fcommon"),
flagpd1("fcompatibility-qualified-id-block-type-checking"),
flagpd1("fcomplete-member-pointers"),
@@ -2937,10 +2951,24 @@ flagpd1("fno-bounds-check"),
flagpd1("fno-branch-count-reg"),
flagpd1("fno-builtin"),
flagpd1("fno-caller-saves"),
-flagpd1("fno-caret-diagnostics"),
+.{
+ .name = "fno-caret-diagnostics",
+ .syntax = .flag,
+ .zig_equivalent = .no_color_diagnostics,
+ .pd1 = true,
+ .pd2 = false,
+ .psl = false,
+},
flagpd1("fno-char8_t"),
flagpd1("fno-check-array-temporaries"),
-flagpd1("fno-color-diagnostics"),
+.{
+ .name = "fno-color-diagnostics",
+ .syntax = .flag,
+ .zig_equivalent = .no_color_diagnostics,
+ .pd1 = true,
+ .pd2 = false,
+ .psl = false,
+},
flagpd1("fno-common"),
flagpd1("fno-complete-member-pointers"),
flagpd1("fno-concept-satisfaction-caching"),
diff --git a/src/main.zig b/src/main.zig
@@ -1292,6 +1292,8 @@ fn buildOutputType(
.no_omit_frame_pointer => omit_frame_pointer = false,
.function_sections => function_sections = true,
.no_function_sections => function_sections = false,
+ .color_diagnostics => color = .on,
+ .no_color_diagnostics => color = .off,
.unwind_tables => want_unwind_tables = true,
.no_unwind_tables => want_unwind_tables = false,
.nostdlib => ensure_libc_on_non_freestanding = false,
@@ -3820,11 +3822,13 @@ pub const ClangArgIterator = struct {
no_red_zone,
omit_frame_pointer,
no_omit_frame_pointer,
+ function_sections,
+ no_function_sections,
+ color_diagnostics,
+ no_color_diagnostics,
strip,
exec_model,
emit_llvm,
- function_sections,
- no_function_sections,
};
const Args = struct {
diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig
@@ -317,6 +317,22 @@ const known_options = [_]KnownOpt{
.ident = "no_function_sections",
},
.{
+ .name = "fcolor-diagnostics",
+ .ident = "color_diagnostics",
+ },
+ .{
+ .name = "fno-color-diagnostics",
+ .ident = "no_color_diagnostics",
+ },
+ .{
+ .name = "fcaret-diagnostics",
+ .ident = "color_diagnostics",
+ },
+ .{
+ .name = "fno-caret-diagnostics",
+ .ident = "no_color_diagnostics",
+ },
+ .{
.name = "MD",
.ident = "dep_file",
},