1 /* Various declarations for language-independent diagnostics
2    subroutines that are only for use in the compilers proper and not
3    the driver or other programs.
4    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
5    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 #ifndef GCC_TREE_DIAGNOSTIC_H
24 #define GCC_TREE_DIAGNOSTIC_H
25 
26 /* TREE_BLOCK if the diagnostic is to be reported in some inline
27    function inlined into other function, otherwise NULL.  */
28 #define diagnostic_abstract_origin(DI)		\
29   ((tree) diagnostic_info_auxiliary_data (DI))
30 
31 /* Function of last diagnostic message; more generally, function such
32    that if next diagnostic message is in it then we don't have to
33    mention the function name.  */
34 #define diagnostic_last_function(DC)			\
35   ((tree) diagnostic_context_auxiliary_data (DC))
36 
37 /* True if the last function in which a diagnostic was reported is
38    different from the current one.  */
39 #define diagnostic_last_function_changed(DC, DI)			\
40   (diagnostic_last_function (DC) != (diagnostic_abstract_origin (DI)	\
41 				     ? diagnostic_abstract_origin (DI)	\
42 				     : current_function_decl))
43 
44 /* Remember the current function as being the last one in which we report
45    a diagnostic.  */
46 #define diagnostic_set_last_function(DC, DI)		\
47   diagnostic_context_auxiliary_data (DC)		\
48     = (((DI) && diagnostic_abstract_origin (DI))	\
49        ? diagnostic_abstract_origin (DI)		\
50        : current_function_decl)
51 
52 void default_tree_diagnostic_starter (diagnostic_context *, diagnostic_info *);
53 extern void diagnostic_report_current_function (diagnostic_context *,
54 						diagnostic_info *);
55 void virt_loc_aware_diagnostic_finalizer (diagnostic_context *,
56 					  diagnostic_info *);
57 #endif /* ! GCC_TREE_DIAGNOSTIC_H */
58