From 4777f9bd4823ff630c79a5bb27d6f2501e6f9883 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 14 Nov 2014 07:30:27 +0000 Subject: * 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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@217540 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/config.in | 18 ++++++++++++------ gcc/configure | 41 +++++++++++++++++++++++++++++++++++++++-- gcc/configure.ac | 28 ++++++++++++++++++++++++++++ gcc/doc/invoke.texi | 6 ++++-- gcc/toplev.c | 28 ++++++++++++++++++++++------ 6 files changed, 116 insertions(+), 16 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b7b72dabccf..682f6fd1e33 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2014-11-14 Jakub Jelinek + + * 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. + 2014-11-13 Teresa Johnson PR tree-optimization/63841 diff --git a/gcc/config.in b/gcc/config.in index 9d1ad863b5f..6cfda75b0b3 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -57,6 +57,12 @@ #endif +/* The default for -fdiagnostics-color option */ +#ifndef USED_FOR_TARGET +#undef DIAGNOSTICS_COLOR_DEFAULT +#endif + + /* Define if you want assertions enabled. This is a cheap check. */ #ifndef USED_FOR_TARGET #undef ENABLE_ASSERT_CHECKING @@ -272,6 +278,12 @@ #endif +/* Define if your assembler supports .module. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_DOT_MODULE +#endif + + /* Define if your assembler supports DSPR1 mult. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_DSPR1_MULT @@ -484,12 +496,6 @@ #endif -/* Define if the assembler understands .module. */ -#ifndef USED_FOR_TARGET -#undef HAVE_AS_DOT_MODULE -#endif - - /* Define if your assembler supports the -no-mul-bug-abort option. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_NO_MUL_BUG_ABORT_OPTION diff --git a/gcc/configure b/gcc/configure index ebc314965a7..8e62ee7233f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -936,6 +936,7 @@ enable_plugin enable_host_shared enable_libquadmath_support with_linker_hash_style +with_diagnostics_color ' ac_precious_vars='build_alias host_alias @@ -1708,6 +1709,11 @@ Optional Packages: --with-system-zlib use installed libz --with-linker-hash-style={sysv,gnu,both} specify the linker hash style + --with-diagnostics-color={never,auto,auto-if-env,always} + specify the default of -fdiagnostics-color option + auto-if-env stands for -fdiagnostics-color=auto if + GCC_COLOR environment variable is present and + -fdiagnostics-color=never otherwise Some influential environment variables: CC C compiler command @@ -18140,7 +18146,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18143 "configure" +#line 18149 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18246,7 +18252,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18249 "configure" +#line 18255 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -28294,6 +28300,37 @@ _ACEOF fi +# Specify what should be the default of -fdiagnostics-color option. + +# Check whether --with-diagnostics-color was given. +if test "${with_diagnostics_color+set}" = set; then : + withval=$with_diagnostics_color; case x"$withval" in + xnever) + DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_NO + ;; + xauto) + DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO + ;; + xauto-if-env) + DIAGNOSTICS_COLOR_DEFAULT=-1 + ;; + xalways) + DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_YES + ;; + *) + as_fn_error "$withval is an invalid option to --with-diagnostics-color" "$LINENO" 5 + ;; + esac +else + DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO +fi + + +cat >>confdefs.h <<_ACEOF +#define DIAGNOSTICS_COLOR_DEFAULT $DIAGNOSTICS_COLOR_DEFAULT +_ACEOF + + # Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit # of jit/jit-playback.c. cat > gcc-driver-name.h < gcc-driver-name.h <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 -- cgit v1.2.3