summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-19 08:34:12 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-19 08:34:12 +0000
commit43b16ab5433bb25c10b8788dac59e75f08e536eb (patch)
tree9331a20317341603df1ee79ca669427c18893b17 /gcc/diagnostic.c
parent8f5e1611b8bb5f31af5aaeb457b59b4b36fad761 (diff)
downloadgcc-43b16ab5433bb25c10b8788dac59e75f08e536eb.tar.gz
2011-10-19 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 180173 using svnmerge. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@180177 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index d297cdda0ca..a8c0e669352 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -255,9 +255,9 @@ diagnostic_action_after_output (diagnostic_context *context,
}
void
-diagnostic_report_current_module (diagnostic_context *context)
+diagnostic_report_current_module (diagnostic_context *context, location_t where)
{
- const struct line_map *map;
+ const struct line_map *map = NULL;
if (pp_needs_newline (context->printer))
{
@@ -265,10 +265,13 @@ diagnostic_report_current_module (diagnostic_context *context)
pp_needs_newline (context->printer) = false;
}
- if (input_location <= BUILTINS_LOCATION)
+ if (where <= BUILTINS_LOCATION)
return;
- map = linemap_lookup (line_table, input_location);
+ linemap_resolve_location (line_table, where,
+ LRK_MACRO_DEFINITION_LOCATION,
+ &map);
+
if (map && diagnostic_last_module_changed (context, map))
{
diagnostic_set_last_module (context, map);
@@ -278,18 +281,18 @@ diagnostic_report_current_module (diagnostic_context *context)
if (context->show_column)
pp_verbatim (context->printer,
"In file included from %s:%d:%d",
- map->to_file,
+ LINEMAP_FILE (map),
LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map));
else
pp_verbatim (context->printer,
"In file included from %s:%d",
- map->to_file, LAST_SOURCE_LINE (map));
+ LINEMAP_FILE (map), LAST_SOURCE_LINE (map));
while (! MAIN_FILE_P (map))
{
map = INCLUDED_FROM (line_table, map);
pp_verbatim (context->printer,
",\n from %s:%d",
- map->to_file, LAST_SOURCE_LINE (map));
+ LINEMAP_FILE (map), LAST_SOURCE_LINE (map));
}
pp_verbatim (context->printer, ":");
pp_newline (context->printer);
@@ -301,7 +304,7 @@ void
default_diagnostic_starter (diagnostic_context *context,
diagnostic_info *diagnostic)
{
- diagnostic_report_current_module (context);
+ diagnostic_report_current_module (context, diagnostic->location);
pp_set_prefix (context->printer, diagnostic_build_prefix (context,
diagnostic));
}
@@ -459,7 +462,10 @@ diagnostic_report_diagnostic (diagnostic_context *context,
/* FIXME: Stupid search. Optimize later. */
for (i = context->n_classification_history - 1; i >= 0; i --)
{
- if (context->classification_history[i].location <= location)
+ if (linemap_location_before_p
+ (line_table,
+ context->classification_history[i].location,
+ location))
{
if (context->classification_history[i].kind == (int) DK_POP)
{