/* Language-independent diagnostic subroutines for the GNU Compiler Collection
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
This file is part of GCC.
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
+#include "version.h"
#include "tm_p.h"
#include "flags.h"
#include "input.h"
diagnostic_info *);
static void real_abort (void) ATTRIBUTE_NORETURN;
-extern int rtl_dump_and_exit;
-
/* A diagnostic_context surrogate for stderr. */
static diagnostic_context global_diagnostic_context;
diagnostic_context *global_dc = &global_diagnostic_context;
else if (p[0] == '%' && p[1] == 'J')
{
tree t = va_arg (*text->args_ptr, tree);
- *locus = TREE_LOCUS (t);
+ *locus = DECL_SOURCE_LOCATION (t);
text->format_spec = p + 2;
return true;
}
#undef DEFINE_DIAGNOSTIC_KIND
"must-not-happen"
};
- if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND)
- abort();
+ expanded_location s = expand_location (diagnostic->location);
+ if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND)
+ abort();
- return diagnostic->location.file
+ return s.file
? build_message_string ("%s:%d: %s",
- diagnostic->location.file,
- diagnostic->location.line,
+ s.file, s.line,
_(diagnostic_kind_text[diagnostic->kind]))
: build_message_string ("%s: %s", progname,
_(diagnostic_kind_text[diagnostic->kind]));
|| diagnostic_kind_count (context, DK_SORRY) > 0)
&& !context->abort_on_error)
{
+ expanded_location s = expand_location (diagnostic->location);
fnotice (stderr, "%s:%d: confused by earlier errors, bailing out\n",
- diagnostic->location.file, diagnostic->location.line);
+ s.file, s.line);
exit (FATAL_EXIT_CODE);
}
#endif
case DK_SORRY:
if (context->abort_on_error)
real_abort ();
+ if (flag_fatal_errors)
+ {
+ fnotice (stderr, "compilation terminated due to -Wfatal-errors.\n");
+ exit (FATAL_EXIT_CODE);
+ }
break;
case DK_ICE:
diagnostic_report_current_function (diagnostic_context *context)
{
diagnostic_report_current_module (context);
- (*lang_hooks.print_error_function) (context, input_filename);
+ lang_hooks.print_error_function (context, input_filename);
}
void
pp_needs_newline (context->printer) = false;
}
- if (input_file_stack && diagnostic_last_module_changed (context))
+ p = input_file_stack;
+ if (p && diagnostic_last_module_changed (context))
{
- p = input_file_stack;
+ expanded_location xloc = expand_location (p->location);
pp_verbatim (context->printer,
"In file included from %s:%d",
- p->location.file, p->location.line);
+ xloc.file, xloc.line);
while ((p = p->next) != NULL)
- pp_verbatim (context->printer,
- ",\n from %s:%d",
- p->location.file, p->location.line);
+ {
+ xloc = expand_location (p->location);
+ pp_verbatim (context->printer,
+ ",\n from %s:%d",
+ xloc.file, xloc.line);
+ }
pp_verbatim (context->printer, ":\n");
diagnostic_set_last_module (context);
}