aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-04-26 08:55:56 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2013-04-26 08:55:56 +0200
commita2e836b2ac02b691a2085888d3a73d0296e93970 (patch)
tree51e30ba36c159ac77b30129857b8d14e386bd6bd /gcc/toplev.c
parente78e8a0b19f9becc90a0bcb4684fb83eae10533f (diff)
downloadgcc-a2e836b2ac02b691a2085888d3a73d0296e93970.zip
gcc-a2e836b2ac02b691a2085888d3a73d0296e93970.tar.gz
gcc-a2e836b2ac02b691a2085888d3a73d0296e93970.tar.bz2
Makefile.in (toplev.o): Depend on diagnostic-color.h.
* Makefile.in (toplev.o): Depend on diagnostic-color.h. * diagnostic-color.c (should_colorize): Remove _WIN32 version. (colorize_init): Add argument to _WIN32 version. * toplev.c: Include diagnostic-color.h. (process_options): Default to -fdiagnostics-color=auto if GCC_COLORS env var is in the environment. * common.opt (fdiagnostics-color=): Add Var and Init. * doc/invoke.texi (-fdiagnostics-color=): Document that if GCC_COLORS env var is in the environment, the default is auto rather than never. * lib/prune.exp: Add -fdiagnostics-color=never to TEST_ALWAYS_FLAGS. * lib/c-compat.exp (compat-use-alt-compiler, compat_setup_dfp): Handle -fdiagnostics-color=never option similarly to -fno-diagnostics-show-caret option. From-SVN: r198332
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index b85917d..d41283d 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -74,6 +74,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h"
#include "tree-ssa-alias.h"
#include "plugin.h"
+#include "diagnostic-color.h"
#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
#include "dbxout.h"
@@ -1209,6 +1210,13 @@ 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);
+
/* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also
sets the original filename if appropriate (e.g. foo.i -> foo.c)