From a2e836b2ac02b691a2085888d3a73d0296e93970 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 26 Apr 2013 08:55:56 +0200
Subject: 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
---
 gcc/toplev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'gcc/toplev.c')

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)
-- 
cgit v1.1