authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-21 17:07:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-21 17:07:18-07:00
log96e5f661bd34d98bba89bcb70c9db059aaf38641
treea33fe1d585b30e430175ae108c9e355d983cbc6b
parentceeb230c23e0665811956657157561170be54519

zig cc: add -fcolor-diagnostics and -fcaret-diagnostics integration

Closes #6290

3 files changed, 54 insertions(+), 6 deletions(-)

src/clang_options_data.zig+32-4
...@@ -2569,12 +2569,26 @@ flagpd1("fcall-saved-x18"),...@@ -2569,12 +2569,26 @@ flagpd1("fcall-saved-x18"),
2569flagpd1("fcall-saved-x8"),2569flagpd1("fcall-saved-x8"),
2570flagpd1("fcall-saved-x9"),2570flagpd1("fcall-saved-x9"),
2571flagpd1("fcaller-saves"),2571flagpd1("fcaller-saves"),
2572flagpd1("fcaret-diagnostics"),2572.{
2573 .name = "fcaret-diagnostics",
2574 .syntax = .flag,
2575 .zig_equivalent = .color_diagnostics,
2576 .pd1 = true,
2577 .pd2 = false,
2578 .psl = false,
2579},
2573sepd1("fcaret-diagnostics-max-lines"),2580sepd1("fcaret-diagnostics-max-lines"),
2574flagpd1("fcf-protection"),2581flagpd1("fcf-protection"),
2575flagpd1("fchar8_t"),2582flagpd1("fchar8_t"),
2576flagpd1("fcheck-array-temporaries"),2583flagpd1("fcheck-array-temporaries"),
2577flagpd1("fcolor-diagnostics"),2584.{
2585 .name = "fcolor-diagnostics",
2586 .syntax = .flag,
2587 .zig_equivalent = .color_diagnostics,
2588 .pd1 = true,
2589 .pd2 = false,
2590 .psl = false,
2591},
2578flagpd1("fcommon"),2592flagpd1("fcommon"),
2579flagpd1("fcompatibility-qualified-id-block-type-checking"),2593flagpd1("fcompatibility-qualified-id-block-type-checking"),
2580flagpd1("fcomplete-member-pointers"),2594flagpd1("fcomplete-member-pointers"),
...@@ -2937,10 +2951,24 @@ flagpd1("fno-bounds-check"),...@@ -2937,10 +2951,24 @@ flagpd1("fno-bounds-check"),
2937flagpd1("fno-branch-count-reg"),2951flagpd1("fno-branch-count-reg"),
2938flagpd1("fno-builtin"),2952flagpd1("fno-builtin"),
2939flagpd1("fno-caller-saves"),2953flagpd1("fno-caller-saves"),
2940flagpd1("fno-caret-diagnostics"),2954.{
2955 .name = "fno-caret-diagnostics",
2956 .syntax = .flag,
2957 .zig_equivalent = .no_color_diagnostics,
2958 .pd1 = true,
2959 .pd2 = false,
2960 .psl = false,
2961},
2941flagpd1("fno-char8_t"),2962flagpd1("fno-char8_t"),
2942flagpd1("fno-check-array-temporaries"),2963flagpd1("fno-check-array-temporaries"),
2943flagpd1("fno-color-diagnostics"),2964.{
2965 .name = "fno-color-diagnostics",
2966 .syntax = .flag,
2967 .zig_equivalent = .no_color_diagnostics,
2968 .pd1 = true,
2969 .pd2 = false,
2970 .psl = false,
2971},
2944flagpd1("fno-common"),2972flagpd1("fno-common"),
2945flagpd1("fno-complete-member-pointers"),2973flagpd1("fno-complete-member-pointers"),
2946flagpd1("fno-concept-satisfaction-caching"),2974flagpd1("fno-concept-satisfaction-caching"),
src/main.zig+6-2
...@@ -1292,6 +1292,8 @@ fn buildOutputType(...@@ -1292,6 +1292,8 @@ fn buildOutputType(
1292 .no_omit_frame_pointer => omit_frame_pointer = false,1292 .no_omit_frame_pointer => omit_frame_pointer = false,
1293 .function_sections => function_sections = true,1293 .function_sections => function_sections = true,
1294 .no_function_sections => function_sections = false,1294 .no_function_sections => function_sections = false,
1295 .color_diagnostics => color = .on,
1296 .no_color_diagnostics => color = .off,
1295 .unwind_tables => want_unwind_tables = true,1297 .unwind_tables => want_unwind_tables = true,
1296 .no_unwind_tables => want_unwind_tables = false,1298 .no_unwind_tables => want_unwind_tables = false,
1297 .nostdlib => ensure_libc_on_non_freestanding = false,1299 .nostdlib => ensure_libc_on_non_freestanding = false,
...@@ -3820,11 +3822,13 @@ pub const ClangArgIterator = struct {...@@ -3820,11 +3822,13 @@ pub const ClangArgIterator = struct {
3820 no_red_zone,3822 no_red_zone,
3821 omit_frame_pointer,3823 omit_frame_pointer,
3822 no_omit_frame_pointer,3824 no_omit_frame_pointer,
3825 function_sections,
3826 no_function_sections,
3827 color_diagnostics,
3828 no_color_diagnostics,
3823 strip,3829 strip,
3824 exec_model,3830 exec_model,
3825 emit_llvm,3831 emit_llvm,
3826 function_sections,
3827 no_function_sections,
3828 };3832 };
38293833
3830 const Args = struct {3834 const Args = struct {
tools/update_clang_options.zig+16
...@@ -316,6 +316,22 @@ const known_options = [_]KnownOpt{...@@ -316,6 +316,22 @@ const known_options = [_]KnownOpt{
316 .name = "fno-function-sections",316 .name = "fno-function-sections",
317 .ident = "no_function_sections",317 .ident = "no_function_sections",
318 },318 },
319 .{
320 .name = "fcolor-diagnostics",
321 .ident = "color_diagnostics",
322 },
323 .{
324 .name = "fno-color-diagnostics",
325 .ident = "no_color_diagnostics",
326 },
327 .{
328 .name = "fcaret-diagnostics",
329 .ident = "color_diagnostics",
330 },
331 .{
332 .name = "fno-caret-diagnostics",
333 .ident = "no_color_diagnostics",
334 },
319 .{335 .{
320 .name = "MD",336 .name = "MD",
321 .ident = "dep_file",337 .ident = "dep_file",