/* 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.
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;
;
/* Extract the location information if any. */
- if (*p == '%' && *++p == 'H')
+ if (p[0] == '%' && p[1] == 'H')
{
*locus = *va_arg (*text->args_ptr, location_t *);
- text->format_spec = p + 1;
+ text->format_spec = p + 2;
+ return true;
+ }
+ else if (p[0] == '%' && p[1] == 'J')
+ {
+ tree t = va_arg (*text->args_ptr, tree);
+ *locus = DECL_SOURCE_LOCATION (t);
+ text->format_spec = p + 2;
return true;
}
}
}
-/* The default function to print out name of current function that caused
- an error. */
-void
-lhd_print_error_function (diagnostic_context *context, const char *file)
-{
- if (diagnostic_last_function_changed (context))
- {
- const char *old_prefix = context->printer->prefix;
- char *new_prefix = file ? build_message_string ("%s: ", file) : NULL;
-
- pp_set_prefix (context->printer, new_prefix);
-
- if (current_function_decl == NULL)
- pp_string (context->printer, _("At top level:"));
- else
- {
- if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
- pp_printf
- (context->printer, "In member function `%s':",
- (*lang_hooks.decl_printable_name) (current_function_decl, 2));
- else
- pp_printf
- (context->printer, "In function `%s':",
- (*lang_hooks.decl_printable_name) (current_function_decl, 2));
- }
- pp_newline (context->printer);
-
- diagnostic_set_last_function (context);
- pp_flush (context->printer);
- context->printer->prefix = old_prefix;
- free ((char*) new_prefix);
- }
-}
-
/* Prints out, if necessary, the name of the current function
that caused an error. Called from all error and warning functions.
We ignore the FILE parameter, as it cannot be relied upon. */
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
va_end (ap);
}
-/* Warn about a use of an identifier which was marked deprecated. */
-void
-warn_deprecated_use (tree node)
-{
- if (node == 0 || !warn_deprecated_decl)
- return;
-
- if (DECL_P (node))
- warning ("`%s' is deprecated (declared at %s:%d)",
- IDENTIFIER_POINTER (DECL_NAME (node)),
- DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
- else if (TYPE_P (node))
- {
- const char *what = NULL;
- tree decl = TYPE_STUB_DECL (node);
-
- if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
- what = IDENTIFIER_POINTER (TYPE_NAME (node));
- else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
- && DECL_NAME (TYPE_NAME (node)))
- what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
-
- if (what)
- {
- if (decl)
- warning ("`%s' is deprecated (declared at %s:%d)", what,
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
- else
- warning ("`%s' is deprecated", what);
- }
- else if (decl)
- warning ("type is deprecated (declared at %s:%d)",
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
- else
- warning ("type is deprecated");
- }
-}
-
/* Inform the user that an error occurred while trying to report some
other error. This indicates catastrophic internal inconsistencies,
so give up now. But do try to flush out the previous error.