From 4b84d650e82e29bd3ff901a1e34b08435ee99871 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 12 Apr 2013 08:19:58 +0200 Subject: opts.c: Include diagnostic-color.h. * opts.c: Include diagnostic-color.h. (common_handle_option): Handle OPT_fdiagnostics_color_. * Makefile.in (OBJS-libcommon): Add diagnostic-color.o. (diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h. (diagnostic-color.o): New. * common.opt (fdiagnostics-color, fdiagnostics-color=): New options. (diagnostic_color_rule): New enum. * dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*. * langhooks.c (lhd_print_error_function): Add %r "locus" and %R around the location string. * diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros, either NULL, or color kind. * diagnostic-color.c: New file. * diagnostic-color.h: New file. * diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3 arguments. * doc/invoke.texi (-fdiagnostics-color): Document. * pretty-print.h (pp_show_color): Define. (struct pretty_print_info): Add show_color field. * diagnostic.c: Include diagnostic-color.h. (diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND macros. Colorize error:, warning: etc. strings and also the location string. (diagnostic_show_locus): Colorize the caret line. * pretty-print.c: Include diagnostic-color.h. (pp_base_format): Handle %r and %R format specifiers. Colorize strings inside of %< %> quotes or quoted through q format modifier. c-family/ * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format specifiers. cp/ * error.c (cp_print_error_function, print_instantiation_partial_context_line, maybe_print_constexpr_context): Colorize locus strings. From-SVN: r197841 --- gcc/common.opt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'gcc/common.opt') diff --git a/gcc/common.opt b/gcc/common.opt index 6b9b2e1..f0cb9e8 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1028,6 +1028,30 @@ fdiagnostics-show-caret Common Var(flag_diagnostics_show_caret) Init(1) Show the source line with a caret indicating the column +fdiagnostics-color +Common Alias(fdiagnostics-color=,always,never) +; + +fdiagnostics-color= +Common Joined RejectNegative Enum(diagnostic_color_rule) +-fdiagnostics-color=[never|always|auto] Colorize diagnostics + +; Required for these enum values. +SourceInclude +diagnostic-color.h + +Enum +Name(diagnostic_color_rule) Type(int) + +EnumValue +Enum(diagnostic_color_rule) String(never) Value(DIAGNOSTICS_COLOR_NO) + +EnumValue +Enum(diagnostic_color_rule) String(always) Value(DIAGNOSTICS_COLOR_YES) + +EnumValue +Enum(diagnostic_color_rule) String(auto) Value(DIAGNOSTICS_COLOR_AUTO) + fdiagnostics-show-option Common Var(flag_diagnostics_show_option) Init(1) Amend appropriate diagnostic messages with the command line option that controls them -- cgit v1.1