OSDN Git Service

* c-common.h (c_common_parse_file): Update.
[pf3gnuchains/gcc-fork.git] / gcc / objc / objc-lang.c
1 /* Language-dependent hooks for Objective-C.
2    Copyright 2001 Free Software Foundation, Inc.
3    Contributed by Ziemowit Laski  <zlaski@apple.com>
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 #include "config.h"
23 #include "system.h"
24 #include "tree.h"
25 #include "c-tree.h"
26 #include "c-common.h"
27 #include "toplev.h"
28 #include "objc-act.h"
29 #include "langhooks.h"
30 #include "langhooks-def.h"
31
32 static void objc_init_options                   PARAMS ((void));
33 static void objc_post_options                   PARAMS ((void));
34
35 #undef LANG_HOOKS_NAME
36 #define LANG_HOOKS_NAME "GNU Objective-C"  
37 #undef LANG_HOOKS_INIT
38 #define LANG_HOOKS_INIT objc_init
39 #undef LANG_HOOKS_FINISH
40 #define LANG_HOOKS_FINISH c_common_finish
41 #undef LANG_HOOKS_INIT_OPTIONS
42 #define LANG_HOOKS_INIT_OPTIONS objc_init_options
43 #undef LANG_HOOKS_DECODE_OPTION
44 #define LANG_HOOKS_DECODE_OPTION objc_decode_option
45 #undef LANG_HOOKS_POST_OPTIONS
46 #define LANG_HOOKS_POST_OPTIONS objc_post_options
47 #undef LANG_HOOKS_PARSE_FILE
48 #define LANG_HOOKS_PARSE_FILE c_common_parse_file
49 #undef LANG_HOOKS_MARK_TREE
50 #define LANG_HOOKS_MARK_TREE c_mark_tree
51 #undef LANG_HOOKS_EXPAND_EXPR
52 #define LANG_HOOKS_EXPAND_EXPR c_expand_expr
53 #undef LANG_HOOKS_MARK_ADDRESSABLE
54 #define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
55 #undef LANG_HOOKS_TRUTHVALUE_CONVERSION
56 #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion
57 #undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES
58 #define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES c_insert_default_attributes
59 #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
60 #define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
61 #undef LANG_HOOKS_UNSAFE_FOR_REEVAL
62 #define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
63 #undef LANG_HOOKS_STATICP
64 #define LANG_HOOKS_STATICP c_staticp
65 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
66 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
67 #undef LANG_HOOKS_PRINT_IDENTIFIER
68 #define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
69 #undef LANG_HOOKS_DECL_PRINTABLE_NAME
70 #define LANG_HOOKS_DECL_PRINTABLE_NAME objc_printable_name
71 #undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
72 #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL c_warn_unused_global_decl
73
74 #undef LANG_HOOKS_FUNCTION_ENTER_NESTED
75 #define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
76 #undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
77 #define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context
78 #undef LANG_HOOKS_FUNCTION_MARK
79 #define LANG_HOOKS_FUNCTION_MARK c_mark_function_context
80
81 /* Attribute hooks.  */
82 #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
83 #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE c_common_attribute_table
84 #undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
85 #define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE c_common_format_attribute_table
86
87 /* Inlining hooks same as the C front end.  */
88 #undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
89 #define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
90   c_cannot_inline_tree_fn
91 #undef LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS
92 #define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
93   c_disregard_inline_limits
94 #undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
95 #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
96   anon_aggr_type_p
97 #undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
98 #define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
99   c_convert_parm_for_inlining
100
101 #undef LANG_HOOKS_TYPE_FOR_MODE
102 #define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
103 #undef LANG_HOOKS_TYPE_FOR_SIZE
104 #define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
105 #undef LANG_HOOKS_SIGNED_TYPE
106 #define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
107 #undef LANG_HOOKS_UNSIGNED_TYPE
108 #define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
109 #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
110 #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
111 #undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR
112 #define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error
113 #undef LANG_HOOKS_TYPE_PROMOTES_TO
114 #define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
115
116 /* Each front end provides its own hooks, for toplev.c.  */
117 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
118
119 /* Define the special tree codes that we use.  */
120
121 /* Table indexed by tree code giving a string containing a character
122    classifying the tree code.  */
123
124 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
125
126 const char tree_code_type[] = {
127 #include "tree.def"
128   'x',
129 #include "c-common.def"
130   'x',
131 #include "objc-tree.def"
132 };
133 #undef DEFTREECODE
134
135 /* Table indexed by tree code giving number of expression
136    operands beyond the fixed part of the node structure.
137    Not used for types or decls.  */
138
139 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
140
141 const unsigned char tree_code_length[] = {
142 #include "tree.def"
143   0,
144 #include "c-common.def"
145   0,
146 #include "objc-tree.def"
147 };
148 #undef DEFTREECODE
149
150 /* Names of tree components.
151    Used for printing out the tree and error messages.  */
152 #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
153
154 const char * const tree_code_name[] = {
155 #include "tree.def"
156   "@@dummy",
157 #include "c-common.def"
158   "@@dummy",
159 #include "objc-tree.def"
160 };
161 #undef DEFTREECODE
162
163 static void 
164 objc_init_options ()
165 {
166   c_common_init_options (clk_objective_c);
167
168
169 /* Post-switch processing.  */
170
171 static void
172 objc_post_options ()
173 {
174   c_common_post_options ();
175 }
176
177