aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-04 23:59:35 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-04 23:59:35 +0000
commitaa47f95a1859cfbbd5b9cbd50df69bad873ca507 (patch)
tree5367afa1553141e677c4411189df8b007d01bd1c /gcc/diagnostic.c
parent8271b807e1fcab7b30b3d807b6d6c1c9caa0a26c (diff)
gcc/fortran/ChangeLog:
2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org> * error.c (gfc_diagnostic_build_locus_prefix): Use diagnostic_expand_location. gcc/ChangeLog: 2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org> * diagnostic.h (diagnostic_expand_location): New inline function. * diagnostic.c (diagnostic_build_prefix): Use it. (diagnostic_show_locus): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218409 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 07ce6020192..28ef81c5dad 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -260,6 +260,8 @@ diagnostic_build_prefix (diagnostic_context *context,
#undef DEFINE_DIAGNOSTIC_KIND
NULL
};
+ gcc_assert (diagnostic->kind < DK_LAST_DIAGNOSTIC_KIND);
+
const char *text = _(diagnostic_kind_text[diagnostic->kind]);
const char *text_cs = "", *text_ce = "";
const char *locus_cs, *locus_ce;
@@ -274,11 +276,7 @@ diagnostic_build_prefix (diagnostic_context *context,
locus_cs = colorize_start (pp_show_color (pp), "locus");
locus_ce = colorize_stop (pp_show_color (pp));
- expanded_location s = expand_location_to_spelling_point (diagnostic->location);
- if (diagnostic->override_column)
- s.column = diagnostic->override_column;
- gcc_assert (diagnostic->kind < DK_LAST_DIAGNOSTIC_KIND);
-
+ expanded_location s = diagnostic_expand_location (diagnostic);
return
(s.file == NULL
? build_message_string ("%s%s:%s %s%s%s", locus_cs, progname, locus_ce,
@@ -289,8 +287,8 @@ diagnostic_build_prefix (diagnostic_context *context,
: context->show_column
? build_message_string ("%s%s:%d:%d:%s %s%s%s", locus_cs, s.file, s.line,
s.column, locus_ce, text_cs, text, text_ce)
- : build_message_string ("%s%s:%d:%s %s%s%s", locus_cs, s.file, s.line, locus_ce,
- text_cs, text, text_ce));
+ : build_message_string ("%s%s:%d:%s %s%s%s", locus_cs, s.file, s.line,
+ locus_ce, text_cs, text, text_ce));
}
/* If LINE is longer than MAX_WIDTH, and COLUMN is not smaller than
@@ -337,9 +335,7 @@ diagnostic_show_locus (diagnostic_context * context,
return;
context->last_location = diagnostic->location;
- s = expand_location_to_spelling_point (diagnostic->location);
- if (diagnostic->override_column)
- s.column = diagnostic->override_column;
+ s = diagnostic_expand_location (diagnostic);
line = location_get_source_line (s, &line_width);
if (line == NULL || s.column > line_width)
return;