aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-11-14 08:30:27 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-11-14 08:30:27 +0100
commit899c78aee8e5bf75ade2364a586dcee039c25ede (patch)
treee7f3963d5df9a9efb868270660b28d10c7507bca /gcc/toplev.c
parent5004bd0026e9d57e17ff7c9f8e41a8c0f6e904c5 (diff)
downloadgcc-899c78aee8e5bf75ade2364a586dcee039c25ede.zip
gcc-899c78aee8e5bf75ade2364a586dcee039c25ede.tar.gz
gcc-899c78aee8e5bf75ade2364a586dcee039c25ede.tar.bz2
configure.ac (--with-diagnostics-color): New configure option, default to --with-diagnostics-color=auto.
* configure.ac (--with-diagnostics-color): New configure option, default to --with-diagnostics-color=auto. * toplev.c (process_options): Use DIAGNOSTICS_COLOR_DEFAULT to determine -fdiagnostics-color= option default. * doc/invoke.texi (-fdiagnostics-color=): Document new default. * configure: Regenerated. * config.in: Regenerated. From-SVN: r217540
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 80fb4ce..2ed76bc 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1267,12 +1267,28 @@ process_options (void)
maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT;
- /* Default to -fdiagnostics-color=auto if GCC_COLORS is in the environment,
- otherwise default to -fdiagnostics-color=never. */
- if (!global_options_set.x_flag_diagnostics_show_color
- && getenv ("GCC_COLORS"))
- pp_show_color (global_dc->printer)
- = colorize_init (DIAGNOSTICS_COLOR_AUTO);
+ /* If DIAGNOSTICS_COLOR_DEFAULT is -1, default to -fdiagnostics-color=auto
+ if GCC_COLORS is in the environment, otherwise default to
+ -fdiagnostics-color=never, for other values default to that
+ -fdiagnostics-color={never,auto,always}. */
+ if (!global_options_set.x_flag_diagnostics_show_color)
+ switch ((int) DIAGNOSTICS_COLOR_DEFAULT)
+ {
+ case -1:
+ if (!getenv ("GCC_COLORS"))
+ break;
+ /* FALLTHRU */
+ case DIAGNOSTICS_COLOR_AUTO:
+ pp_show_color (global_dc->printer)
+ = colorize_init (DIAGNOSTICS_COLOR_AUTO);
+ break;
+ case DIAGNOSTICS_COLOR_YES:
+ pp_show_color (global_dc->printer)
+ = colorize_init (DIAGNOSTICS_COLOR_YES);
+ break;
+ default:
+ break;
+ }
/* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also