PR c++/3637
[official-gcc.git] / gcc / langhooks.h
blob0402940a398ac589d34a9a566d2a492a49fc9991
1 /* The lang_hooks data structure.
2 Copyright 2001 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #ifndef GCC_LANG_HOOKS_H
22 #define GCC_LANG_HOOKS_H
24 /* A print hook for print_tree (). */
25 typedef void (*lang_print_tree_hook) PARAMS ((FILE *, tree, int indent));
27 /* The following hooks are documented in langhooks.c. Must not be
28 NULL. */
30 struct lang_hooks_for_tree_inlining
32 union tree_node *(*walk_subtrees) PARAMS ((union tree_node **, int *,
33 union tree_node *(*)
34 (union tree_node **,
35 int *, void *),
36 void *, void *));
37 int (*cannot_inline_tree_fn) PARAMS ((union tree_node **));
38 int (*disregard_inline_limits) PARAMS ((union tree_node *));
39 union tree_node *(*add_pending_fn_decls) PARAMS ((void *,
40 union tree_node *));
41 int (*tree_chain_matters_p) PARAMS ((union tree_node *));
42 int (*auto_var_in_fn_p) PARAMS ((union tree_node *, union tree_node *));
43 union tree_node *(*copy_res_decl_for_inlining) PARAMS ((union tree_node *,
44 union tree_node *,
45 union tree_node *,
46 void *, int *,
47 void *));
48 int (*anon_aggr_type_p) PARAMS ((union tree_node *));
51 /* Language-specific hooks. See langhooks-def.h for defaults. */
53 struct lang_hooks
55 /* String identifying the front end. e.g. "GNU C++". */
56 const char *name;
58 /* sizeof (struct lang_identifier), so make_node () creates
59 identifier nodes long enough for the language-specific slots. */
60 size_t identifier_size;
62 /* Called after options parsing, to initialize the front end. The
63 main input filename is passed, which may be NULL; the front end
64 should return the original filename (e.g. foo.i -> foo.c).
65 Return NULL to indicate a serious error of some sort; in that
66 case no compilation is performed, and the finish hook is called
67 immediately. */
68 const char * (*init) PARAMS ((const char *));
70 /* Called last, as a finalizer. */
71 void (*finish) PARAMS ((void));
73 /* Called immediately after parsing to clear the binding stack. */
74 void (*clear_binding_stack) PARAMS ((void));
76 /* Called to initialize options, before any calls to decode_option. */
77 void (*init_options) PARAMS ((void));
79 /* Function called with an option vector as argument, to decode a
80 single option (typically starting with -f or -W or +). It should
81 return the number of command-line arguments it uses if it handles
82 the option, or 0 and not complain if it does not recognise the
83 option. If this function returns a negative number, then its
84 absolute value is the number of command-line arguments used, but,
85 in addition, no language-independent option processing should be
86 done for this option. */
87 int (*decode_option) PARAMS ((int, char **));
89 /* Called when all command line options have been parsed. */
90 void (*post_options) PARAMS ((void));
92 /* Called to obtain the alias set to be used for an expression or type.
93 Returns -1 if the language does nothing special for it. */
94 HOST_WIDE_INT (*get_alias_set) PARAMS ((tree));
96 /* Nonzero if TYPE_READONLY and TREE_READONLY should always be honored. */
97 bool honor_readonly;
99 /* The front end can add its own statistics to -fmem-report with
100 this hook. It should output to stderr. */
101 void (*print_statistics) PARAMS ((void));
103 /* Called by print_tree when there is a tree of class 'x' that it
104 doesn't know how to display. */
105 lang_print_tree_hook print_xnode;
107 /* Called to print language-dependent parts of a class 'd', class
108 't', and IDENTIFIER_NODE nodes. */
109 lang_print_tree_hook print_decl;
110 lang_print_tree_hook print_type;
111 lang_print_tree_hook print_identifier;
113 /* Set yydebug for bison-based parsers, when -dy is given on the
114 command line. By default, if the parameter is non-zero, prints a
115 warning that the front end does not use such a parser. */
116 void (*set_yydebug) PARAMS ((int));
118 struct lang_hooks_for_tree_inlining tree_inlining;
120 /* Whenever you add entries here, make sure you adjust langhooks.h
121 and langhooks.c accordingly. */
124 /* Each front end provides its own. */
125 extern const struct lang_hooks lang_hooks;
127 #endif /* GCC_LANG_HOOKS_H */