GCC Middle and Back End API Reference
tree-diagnostic.h
Go to the documentation of this file.
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-2024 Free Software Foundation, Inc.
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
21
22#ifndef GCC_TREE_DIAGNOSTIC_H
23#define GCC_TREE_DIAGNOSTIC_H
24
25/* TREE_BLOCK if the diagnostic is to be reported in some inline
26 function inlined into other function, otherwise NULL. */
27#define diagnostic_abstract_origin(DI) \
28 ((tree) diagnostic_info_auxiliary_data (DI))
29
30/* Function of last diagnostic message; more generally, function such
31 that if next diagnostic message is in it then we don't have to
32 mention the function name. */
33#define diagnostic_last_function(DC) \
34 ((tree) diagnostic_context_auxiliary_data (DC))
35
36/* True if the last function in which a diagnostic was reported is
37 different from the current one. */
38#define diagnostic_last_function_changed(DC, DI) \
39 (diagnostic_last_function (DC) != (diagnostic_abstract_origin (DI) \
40 ? diagnostic_abstract_origin (DI) \
41 : current_function_decl))
42
43/* Remember the current function as being the last one in which we report
44 a diagnostic. */
45#define diagnostic_set_last_function(DC, DI) \
46 diagnostic_context_auxiliary_data (DC) \
47 = (((DI) && diagnostic_abstract_origin (DI)) \
48 ? diagnostic_abstract_origin (DI) \
49 : current_function_decl)
50
52 const diagnostic_info *);
53
55bool default_tree_printer (pretty_printer *, text_info *, const char *,
56 int, bool, bool, bool, bool *, pp_token_list &);
57
58/* A subclass of pretty_printer for writing "dump" functions.
59 Wires itself up to a FILE *, and colorizes if it's stderr and
60 the user requested colorization. */
61
63{
64public:
73 {
74 pp_flush (this);
75 }
76};
77
78#endif /* ! GCC_TREE_DIAGNOSTIC_H */
Definition diagnostic.h:458
pretty_printer * m_printer
Definition diagnostic.h:697
Definition pretty-print-format-impl.h:300
Definition pretty-print.h:241
void set_output_stream(FILE *outfile)
Definition pretty-print.h:274
friend bool & pp_show_color(pretty_printer *pp)
Definition pretty-print.h:435
friend printer_fn & pp_format_decoder(pretty_printer *pp)
Definition pretty-print.h:441
Definition tree-diagnostic.h:63
tree_dump_pretty_printer(FILE *outf)
Definition tree-diagnostic.h:65
~tree_dump_pretty_printer()
Definition tree-diagnostic.h:72
diagnostic_context * global_dc
Definition diagnostic-global-context.cc:34
void pp_flush(pretty_printer *pp)
Definition pretty-print.cc:2288
Definition diagnostic.h:141
Definition gengtype.h:377
Definition pretty-print.h:34
bool default_tree_printer(pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, pp_token_list &)
Definition tree-diagnostic.cc:57
void diagnostic_report_current_function(diagnostic_context *, const diagnostic_info *)
void tree_diagnostics_defaults(diagnostic_context *context)
Definition tree-diagnostic.cc:178