Commit a2e836b2 by Jakub Jelinek Committed by Jakub Jelinek

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
parent e78e8a0b
2013-04-26 Jakub Jelinek <jakub@redhat.com> 2013-04-26 Jakub Jelinek <jakub@redhat.com>
* 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.
* diagnostic.h (file_name_as_prefix): Add context argument. * diagnostic.h (file_name_as_prefix): Add context argument.
* diagnostic.c (file_name_as_prefix): Likewise. Colorize * diagnostic.c (file_name_as_prefix): Likewise. Colorize
the string as locus. the string as locus.
......
...@@ -2716,7 +2716,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ ...@@ -2716,7 +2716,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(OPTS_H) params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \ $(OPTS_H) params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \
tree-ssa-alias.h $(PLUGIN_H) realmpfr.h tree-diagnostic.h \ tree-ssa-alias.h $(PLUGIN_H) realmpfr.h tree-diagnostic.h \
$(TREE_PRETTY_PRINT_H) opts-diagnostic.h $(COMMON_TARGET_H) \ $(TREE_PRETTY_PRINT_H) opts-diagnostic.h $(COMMON_TARGET_H) \
tsan.h tsan.h diagnostic-color.h
hwint.o : hwint.c $(CONFIG_H) $(SYSTEM_H) $(DIAGNOSTIC_CORE_H) hwint.o : hwint.c $(CONFIG_H) $(SYSTEM_H) $(DIAGNOSTIC_CORE_H)
......
...@@ -1033,7 +1033,7 @@ Common Alias(fdiagnostics-color=,always,never) ...@@ -1033,7 +1033,7 @@ Common Alias(fdiagnostics-color=,always,never)
; ;
fdiagnostics-color= fdiagnostics-color=
Common Joined RejectNegative Enum(diagnostic_color_rule) Common Joined RejectNegative Var(flag_diagnostics_show_color) Enum(diagnostic_color_rule) Init(DIAGNOSTICS_COLOR_NO)
-fdiagnostics-color=[never|always|auto] Colorize diagnostics -fdiagnostics-color=[never|always|auto] Colorize diagnostics
; Required for these enum values. ; Required for these enum values.
......
...@@ -264,14 +264,8 @@ parse_gcc_colors (void) ...@@ -264,14 +264,8 @@ parse_gcc_colors (void)
} }
#if defined(_WIN32) #if defined(_WIN32)
static bool
should_colorize (void)
{
return false;
}
bool bool
colorize_init (void) colorize_init (diagnostic_color_rule_t)
{ {
return false; return false;
} }
......
...@@ -2964,9 +2964,10 @@ a message which is too long to fit on a single line. ...@@ -2964,9 +2964,10 @@ a message which is too long to fit on a single line.
@cindex highlight, color, colour @cindex highlight, color, colour
@vindex GCC_COLORS @r{environment variable} @vindex GCC_COLORS @r{environment variable}
Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
or @samp{auto}. The default is @samp{never}, @samp{auto} means to use color or @samp{auto}. The default is @samp{never} if @env{GCC_COLORS} environment
only when the standard error is a terminal. The forms variable isn't present in the environment, and @samp{auto} otherwise.
@option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are @samp{auto} means to use color only when the standard error is a terminal.
The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
aliases for @option{-fdiagnostics-color=always} and aliases for @option{-fdiagnostics-color=always} and
@option{-fdiagnostics-color=never}, respectively. @option{-fdiagnostics-color=never}, respectively.
......
2013-04-26 Jakub Jelinek <jakub@redhat.com>
* 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.
2013-04-25 Jakub Jelinek <jakub@redhat.com> 2013-04-25 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/57003 PR rtl-optimization/57003
......
...@@ -34,7 +34,7 @@ load_lib target-supports.exp ...@@ -34,7 +34,7 @@ load_lib target-supports.exp
# #
proc compat-use-alt-compiler { } { proc compat-use-alt-compiler { } {
global GCC_UNDER_TEST ALT_CC_UNDER_TEST global GCC_UNDER_TEST ALT_CC_UNDER_TEST
global compat_same_alt compat_alt_caret global compat_same_alt compat_alt_caret compat_alt_color
global TEST_ALWAYS_FLAGS global TEST_ALWAYS_FLAGS
# We don't need to do this if the alternate compiler is actually # We don't need to do this if the alternate compiler is actually
...@@ -44,6 +44,9 @@ proc compat-use-alt-compiler { } { ...@@ -44,6 +44,9 @@ proc compat-use-alt-compiler { } {
if { $compat_alt_caret == 0 } then { if { $compat_alt_caret == 0 } then {
regsub -- "-fno-diagnostics-show-caret" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS regsub -- "-fno-diagnostics-show-caret" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS
} }
if { $compat_alt_color == 0 } then {
regsub -- "-fdiagnostics-color=never" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS
}
} }
} }
...@@ -70,9 +73,11 @@ proc compat_setup_dfp { } { ...@@ -70,9 +73,11 @@ proc compat_setup_dfp { } {
global compat_same_alt global compat_same_alt
global compat_have_dfp global compat_have_dfp
global compat_alt_caret global compat_alt_caret
global compat_alt_color
global TEST_ALWAYS_FLAGS compat_save_TEST_ALWAYS_FLAGS global TEST_ALWAYS_FLAGS compat_save_TEST_ALWAYS_FLAGS
set compat_alt_caret 0 set compat_alt_caret 0
set compat_alt_color 0
set compat_save_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS set compat_save_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2 verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2
...@@ -88,6 +93,10 @@ proc compat_setup_dfp { } { ...@@ -88,6 +93,10 @@ proc compat_setup_dfp { } {
int dummy; } "-fno-diagnostics-show-caret"] != 0 } { int dummy; } "-fno-diagnostics-show-caret"] != 0 } {
set compat_alt_caret 1 set compat_alt_caret 1
} }
if { [check_no_compiler_messages_nocache compat_alt_has_color object {
int dummy; } "-fdiagnostics-color=never"] != 0 } {
set compat_alt_color 1
}
compat-use-tst-compiler compat-use-tst-compiler
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
if ![info exists TEST_ALWAYS_FLAGS] { if ![info exists TEST_ALWAYS_FLAGS] {
set TEST_ALWAYS_FLAGS "" set TEST_ALWAYS_FLAGS ""
} }
set TEST_ALWAYS_FLAGS "-fno-diagnostics-show-caret $TEST_ALWAYS_FLAGS" set TEST_ALWAYS_FLAGS "-fno-diagnostics-show-caret -fdiagnostics-color=never $TEST_ALWAYS_FLAGS"
proc prune_gcc_output { text } { proc prune_gcc_output { text } {
#send_user "Before:$text\n" #send_user "Before:$text\n"
......
...@@ -74,6 +74,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -74,6 +74,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h" #include "gimple.h"
#include "tree-ssa-alias.h" #include "tree-ssa-alias.h"
#include "plugin.h" #include "plugin.h"
#include "diagnostic-color.h"
#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
#include "dbxout.h" #include "dbxout.h"
...@@ -1209,6 +1210,13 @@ process_options (void) ...@@ -1209,6 +1210,13 @@ process_options (void)
maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT; 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 /* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also initialization based on the command line options. This hook also
sets the original filename if appropriate (e.g. foo.i -> foo.c) sets the original filename if appropriate (e.g. foo.i -> foo.c)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment