diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2014-08-21 00:27:25 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2014-08-21 00:27:25 +0000 |
commit | fbecdc83824c4158ba7047226266719fb51bc412 (patch) | |
tree | 8e4a6ff9aef324beb077e82626a2a4e8f6c910e9 /gcc/diagnostic.c | |
parent | ecda22b23dea0a251b2a29caaab6424db472a297 (diff) | |
download | gcc-fbecdc83824c4158ba7047226266719fb51bc412.zip gcc-fbecdc83824c4158ba7047226266719fb51bc412.tar.gz gcc-fbecdc83824c4158ba7047226266719fb51bc412.tar.bz2 |
re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color)
gcc/ChangeLog:
2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/44054
* diagnostic.c: Set default caret.
(diagnostic_show_locus): Use it. Tell pretty-printer that a new
line is needed.
* diagnostic.h (struct diagnostic_context):
gcc/fortran/ChangeLog:
2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/44054
* error.c (gfc_diagnostic_build_locus_prefix): New function.
(gfc_diagnostic_starter): Follow Fortran FE diagnostics.
(gfc_diagnostic_finalizer): Do not call default finalizer.
From-SVN: r214251
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r-- | gcc/diagnostic.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 9e6bfe5..73666d6 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -131,6 +131,7 @@ diagnostic_initialize (diagnostic_context *context, int n_opts) context->classify_diagnostic[i] = DK_UNSPECIFIED; context->show_caret = false; diagnostic_set_caret_max_width (context, pp_line_cutoff (context->printer)); + context->caret_char = '^'; context->show_option_requested = false; context->abort_on_error = false; context->show_column = false; @@ -280,7 +281,7 @@ adjust_line (const char *line, int line_width, } /* Print the physical source line corresponding to the location of - this diagnostics, and a caret indicating the precise column. */ + this diagnostic, and a caret indicating the precise column. */ void diagnostic_show_locus (diagnostic_context * context, const diagnostic_info *diagnostic) @@ -328,9 +329,11 @@ diagnostic_show_locus (diagnostic_context * context, /* pp_printf does not implement %*c. */ size_t len = s.column + 3 + strlen (caret_cs) + strlen (caret_ce); buffer = XALLOCAVEC (char, len); - snprintf (buffer, len, "%s %*c%s", caret_cs, s.column, '^', caret_ce); + snprintf (buffer, len, "%s %*c%s", caret_cs, s.column, context->caret_char, + caret_ce); pp_string (context->printer, buffer); pp_set_prefix (context->printer, saved_prefix); + pp_needs_newline (context->printer) = true; } /* Functions at which to stop the backtrace print. It's not |