/* Language-independent diagnostic subroutines for the GNU Compiler Collection
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009, 2010 Free Software Foundation, Inc.
+ 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
This file is part of GCC.
/* -Werror was given. */
if (context->warning_as_error_requested)
pp_verbatim (context->printer,
- _("%s: all warnings being treated as errors\n"),
+ _("%s: all warnings being treated as errors"),
progname);
/* At least one -Werror= was given. */
else
pp_verbatim (context->printer,
- _("%s: some warnings being treated as errors\n"),
+ _("%s: some warnings being treated as errors"),
progname);
pp_flush (context->printer);
}
}
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))
{
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);
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);
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));
}
/* 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)
{