OSDN Git Service

2010-04-09 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / tree-diagnostic.c
1 /* Language-independent diagnostic subroutines for the GNU Compiler
2    Collection that are only for use in the compilers proper and not
3    the driver or other programs.
4    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
5    2009, 2010 Free Software Foundation, Inc.
6
7 This file is part of GCC.
8
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 3, or (at your option) any later
12 version.
13
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3.  If not see
21 <http://www.gnu.org/licenses/>.  */
22
23 #include "config.h"
24 #include "system.h"
25 #include "coretypes.h"
26 #include "tree.h"
27 #include "diagnostic.h"
28 #include "tree-diagnostic.h"
29 #include "langhooks.h"
30 #include "langhooks-def.h"
31
32 /* Prints out, if necessary, the name of the current function
33    that caused an error.  Called from all error and warning functions.  */
34 void
35 diagnostic_report_current_function (diagnostic_context *context,
36                                     diagnostic_info *diagnostic)
37 {
38   diagnostic_report_current_module (context);
39   lang_hooks.print_error_function (context, input_filename, diagnostic);
40 }
41
42 void
43 default_tree_diagnostic_starter (diagnostic_context *context,
44                                  diagnostic_info *diagnostic)
45 {
46   diagnostic_report_current_function (context, diagnostic);
47   pp_set_prefix (context->printer, diagnostic_build_prefix (diagnostic));
48 }