1*c87b03e5Sespie /* Language-specific hook definitions for C front end.
2*c87b03e5Sespie Copyright (C) 1991, 1995, 1997, 1998,
3*c87b03e5Sespie 1999, 2000, 2001 Free Software Foundation, Inc.
4*c87b03e5Sespie
5*c87b03e5Sespie This file is part of GCC.
6*c87b03e5Sespie
7*c87b03e5Sespie GCC is free software; you can redistribute it and/or modify it under
8*c87b03e5Sespie the terms of the GNU General Public License as published by the Free
9*c87b03e5Sespie Software Foundation; either version 2, or (at your option) any later
10*c87b03e5Sespie version.
11*c87b03e5Sespie
12*c87b03e5Sespie GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13*c87b03e5Sespie WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*c87b03e5Sespie FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15*c87b03e5Sespie for more details.
16*c87b03e5Sespie
17*c87b03e5Sespie You should have received a copy of the GNU General Public License
18*c87b03e5Sespie along with GCC; see the file COPYING. If not, write to the Free
19*c87b03e5Sespie Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20*c87b03e5Sespie 02111-1307, USA. */
21*c87b03e5Sespie
22*c87b03e5Sespie
23*c87b03e5Sespie #include "config.h"
24*c87b03e5Sespie #include "system.h"
25*c87b03e5Sespie #include "tree.h"
26*c87b03e5Sespie #include "c-tree.h"
27*c87b03e5Sespie #include "c-common.h"
28*c87b03e5Sespie #include "ggc.h"
29*c87b03e5Sespie #include "langhooks.h"
30*c87b03e5Sespie #include "langhooks-def.h"
31*c87b03e5Sespie
32*c87b03e5Sespie static void c_init_options PARAMS ((void));
33*c87b03e5Sespie
34*c87b03e5Sespie /* ### When changing hooks, consider if ObjC needs changing too!! ### */
35*c87b03e5Sespie
36*c87b03e5Sespie #undef LANG_HOOKS_NAME
37*c87b03e5Sespie #define LANG_HOOKS_NAME "GNU C"
38*c87b03e5Sespie #undef LANG_HOOKS_INIT
39*c87b03e5Sespie #define LANG_HOOKS_INIT c_objc_common_init
40*c87b03e5Sespie #undef LANG_HOOKS_FINISH
41*c87b03e5Sespie #define LANG_HOOKS_FINISH c_common_finish
42*c87b03e5Sespie #undef LANG_HOOKS_INIT_OPTIONS
43*c87b03e5Sespie #define LANG_HOOKS_INIT_OPTIONS c_init_options
44*c87b03e5Sespie #undef LANG_HOOKS_DECODE_OPTION
45*c87b03e5Sespie #define LANG_HOOKS_DECODE_OPTION c_common_decode_option
46*c87b03e5Sespie #undef LANG_HOOKS_POST_OPTIONS
47*c87b03e5Sespie #define LANG_HOOKS_POST_OPTIONS c_common_post_options
48*c87b03e5Sespie #undef LANG_HOOKS_GET_ALIAS_SET
49*c87b03e5Sespie #define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
50*c87b03e5Sespie #undef LANG_HOOKS_SAFE_FROM_P
51*c87b03e5Sespie #define LANG_HOOKS_SAFE_FROM_P c_safe_from_p
52*c87b03e5Sespie #undef LANG_HOOKS_EXPAND_EXPR
53*c87b03e5Sespie #define LANG_HOOKS_EXPAND_EXPR c_expand_expr
54*c87b03e5Sespie #undef LANG_HOOKS_MARK_ADDRESSABLE
55*c87b03e5Sespie #define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
56*c87b03e5Sespie #undef LANG_HOOKS_PARSE_FILE
57*c87b03e5Sespie #define LANG_HOOKS_PARSE_FILE c_common_parse_file
58*c87b03e5Sespie #undef LANG_HOOKS_TRUTHVALUE_CONVERSION
59*c87b03e5Sespie #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion
60*c87b03e5Sespie #undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES
61*c87b03e5Sespie #define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES c_insert_default_attributes
62*c87b03e5Sespie #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
63*c87b03e5Sespie #define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
64*c87b03e5Sespie #undef LANG_HOOKS_UNSAFE_FOR_REEVAL
65*c87b03e5Sespie #define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
66*c87b03e5Sespie #undef LANG_HOOKS_STATICP
67*c87b03e5Sespie #define LANG_HOOKS_STATICP c_staticp
68*c87b03e5Sespie #undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
69*c87b03e5Sespie #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL c_warn_unused_global_decl
70*c87b03e5Sespie #undef LANG_HOOKS_PRINT_IDENTIFIER
71*c87b03e5Sespie #define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
72*c87b03e5Sespie #undef LANG_HOOKS_FUNCTION_ENTER_NESTED
73*c87b03e5Sespie #define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
74*c87b03e5Sespie #undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
75*c87b03e5Sespie #define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context
76*c87b03e5Sespie #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
77*c87b03e5Sespie #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
78*c87b03e5Sespie
79*c87b03e5Sespie /* Attribute hooks. */
80*c87b03e5Sespie #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
81*c87b03e5Sespie #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE c_common_attribute_table
82*c87b03e5Sespie #undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
83*c87b03e5Sespie #define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE c_common_format_attribute_table
84*c87b03e5Sespie
85*c87b03e5Sespie #undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
86*c87b03e5Sespie #define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
87*c87b03e5Sespie c_cannot_inline_tree_fn
88*c87b03e5Sespie #undef LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS
89*c87b03e5Sespie #define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
90*c87b03e5Sespie c_disregard_inline_limits
91*c87b03e5Sespie #undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
92*c87b03e5Sespie #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
93*c87b03e5Sespie anon_aggr_type_p
94*c87b03e5Sespie #undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
95*c87b03e5Sespie #define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
96*c87b03e5Sespie c_convert_parm_for_inlining
97*c87b03e5Sespie #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
98*c87b03e5Sespie #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN c_dump_tree
99*c87b03e5Sespie
100*c87b03e5Sespie #undef LANG_HOOKS_TYPE_FOR_MODE
101*c87b03e5Sespie #define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
102*c87b03e5Sespie #undef LANG_HOOKS_TYPE_FOR_SIZE
103*c87b03e5Sespie #define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
104*c87b03e5Sespie #undef LANG_HOOKS_SIGNED_TYPE
105*c87b03e5Sespie #define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
106*c87b03e5Sespie #undef LANG_HOOKS_UNSIGNED_TYPE
107*c87b03e5Sespie #define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
108*c87b03e5Sespie #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
109*c87b03e5Sespie #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
110*c87b03e5Sespie #undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR
111*c87b03e5Sespie #define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error
112*c87b03e5Sespie #undef LANG_HOOKS_TYPE_PROMOTES_TO
113*c87b03e5Sespie #define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
114*c87b03e5Sespie
115*c87b03e5Sespie /* ### When changing hooks, consider if ObjC needs changing too!! ### */
116*c87b03e5Sespie
117*c87b03e5Sespie /* Each front end provides its own. */
118*c87b03e5Sespie const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
119*c87b03e5Sespie
120*c87b03e5Sespie /* Tree code classes. */
121*c87b03e5Sespie
122*c87b03e5Sespie #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
123*c87b03e5Sespie
124*c87b03e5Sespie const char tree_code_type[] = {
125*c87b03e5Sespie #include "tree.def"
126*c87b03e5Sespie 'x',
127*c87b03e5Sespie #include "c-common.def"
128*c87b03e5Sespie };
129*c87b03e5Sespie #undef DEFTREECODE
130*c87b03e5Sespie
131*c87b03e5Sespie /* Table indexed by tree code giving number of expression
132*c87b03e5Sespie operands beyond the fixed part of the node structure.
133*c87b03e5Sespie Not used for types or decls. */
134*c87b03e5Sespie
135*c87b03e5Sespie #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
136*c87b03e5Sespie
137*c87b03e5Sespie const unsigned char tree_code_length[] = {
138*c87b03e5Sespie #include "tree.def"
139*c87b03e5Sespie 0,
140*c87b03e5Sespie #include "c-common.def"
141*c87b03e5Sespie };
142*c87b03e5Sespie #undef DEFTREECODE
143*c87b03e5Sespie
144*c87b03e5Sespie /* Names of tree components.
145*c87b03e5Sespie Used for printing out the tree and error messages. */
146*c87b03e5Sespie #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
147*c87b03e5Sespie
148*c87b03e5Sespie const char *const tree_code_name[] = {
149*c87b03e5Sespie #include "tree.def"
150*c87b03e5Sespie "@@dummy",
151*c87b03e5Sespie #include "c-common.def"
152*c87b03e5Sespie };
153*c87b03e5Sespie #undef DEFTREECODE
154*c87b03e5Sespie
155*c87b03e5Sespie static void
c_init_options()156*c87b03e5Sespie c_init_options ()
157*c87b03e5Sespie {
158*c87b03e5Sespie c_common_init_options (clk_c);
159*c87b03e5Sespie }
160*c87b03e5Sespie
161*c87b03e5Sespie /* Used by c-lex.c, but only for objc. */
162*c87b03e5Sespie
163*c87b03e5Sespie tree
lookup_interface(arg)164*c87b03e5Sespie lookup_interface (arg)
165*c87b03e5Sespie tree arg ATTRIBUTE_UNUSED;
166*c87b03e5Sespie {
167*c87b03e5Sespie return 0;
168*c87b03e5Sespie }
169*c87b03e5Sespie
170*c87b03e5Sespie tree
is_class_name(arg)171*c87b03e5Sespie is_class_name (arg)
172*c87b03e5Sespie tree arg ATTRIBUTE_UNUSED;
173*c87b03e5Sespie {
174*c87b03e5Sespie return 0;
175*c87b03e5Sespie }
176*c87b03e5Sespie
177*c87b03e5Sespie tree
objc_is_id(arg)178*c87b03e5Sespie objc_is_id (arg)
179*c87b03e5Sespie tree arg ATTRIBUTE_UNUSED;
180*c87b03e5Sespie {
181*c87b03e5Sespie return 0;
182*c87b03e5Sespie }
183*c87b03e5Sespie
184*c87b03e5Sespie void
objc_check_decl(decl)185*c87b03e5Sespie objc_check_decl (decl)
186*c87b03e5Sespie tree decl ATTRIBUTE_UNUSED;
187*c87b03e5Sespie {
188*c87b03e5Sespie }
189*c87b03e5Sespie
190*c87b03e5Sespie int
objc_comptypes(lhs,rhs,reflexive)191*c87b03e5Sespie objc_comptypes (lhs, rhs, reflexive)
192*c87b03e5Sespie tree lhs ATTRIBUTE_UNUSED;
193*c87b03e5Sespie tree rhs ATTRIBUTE_UNUSED;
194*c87b03e5Sespie int reflexive ATTRIBUTE_UNUSED;
195*c87b03e5Sespie {
196*c87b03e5Sespie return -1;
197*c87b03e5Sespie }
198*c87b03e5Sespie
199*c87b03e5Sespie tree
objc_message_selector()200*c87b03e5Sespie objc_message_selector ()
201*c87b03e5Sespie {
202*c87b03e5Sespie return 0;
203*c87b03e5Sespie }
204*c87b03e5Sespie
205*c87b03e5Sespie /* Used by c-typeck.c (build_external_ref), but only for objc. */
206*c87b03e5Sespie
207*c87b03e5Sespie tree
lookup_objc_ivar(id)208*c87b03e5Sespie lookup_objc_ivar (id)
209*c87b03e5Sespie tree id ATTRIBUTE_UNUSED;
210*c87b03e5Sespie {
211*c87b03e5Sespie return 0;
212*c87b03e5Sespie }
213*c87b03e5Sespie
214*c87b03e5Sespie void
finish_file()215*c87b03e5Sespie finish_file ()
216*c87b03e5Sespie {
217*c87b03e5Sespie c_objc_common_finish_file ();
218*c87b03e5Sespie }
219*c87b03e5Sespie
220*c87b03e5Sespie #include "gtype-c.h"
221