OSDN Git Service

* extend.texi (-fthis-is-variable): Undocument.
[pf3gnuchains/gcc-fork.git] / gcc / c-lang.c
1 /* Language-specific hook definitions for C front end.
2    Copyright (C) 1991, 1995, 1997, 1998,
3    1999, 2000 Free Software Foundation, Inc.
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
23 #include "config.h"
24 #include "system.h"
25 #include "tree.h"
26 #include "function.h"
27 #include "input.h"
28 #include "c-tree.h"
29 #include "c-lex.h"
30 #include "toplev.h"
31 #include "output.h"
32 #include "flags.h"
33 #include "ggc.h"
34
35 #if USE_CPPLIB
36 #include "cpplib.h"
37 extern char *yy_cur;
38 extern cpp_reader  parse_in;
39 extern cpp_options parse_options;
40 #endif
41
42 /* Each of the functions defined here
43    is an alternative to a function in objc-actions.c.  */
44    
45 int
46 lang_decode_option (argc, argv)
47      int argc;
48      char **argv;
49 {
50   return c_decode_option (argc, argv);
51 }
52
53 void
54 lang_init_options ()
55 {
56 #if USE_CPPLIB
57   cpp_reader_init (&parse_in);
58   parse_in.opts = &parse_options;
59   cpp_options_init (&parse_options);
60 #endif
61   /* Mark as "unspecified".  */
62   flag_bounds_check = -1;
63 }
64
65 void
66 lang_init ()
67 {
68   /* If still "unspecified", make it match -fbounded-pointers.  */
69   if (flag_bounds_check < 0)
70     flag_bounds_check = flag_bounded_pointers;
71
72   /* the beginning of the file is a new line; check for # */
73   /* With luck, we discover the real source file's name from that
74      and put it in input_filename.  */
75 #if !USE_CPPLIB
76   ungetc (check_newline (), finput);
77 #else
78   check_newline ();
79   yy_cur--;
80 #endif 
81
82   save_lang_status = &push_c_function_context;
83   restore_lang_status = &pop_c_function_context;
84   mark_lang_status = &mark_c_function_context;
85
86   c_parse_init ();
87 }
88
89 void
90 lang_finish ()
91 {
92 }
93
94 const char *
95 lang_identify ()
96 {
97   return "c";
98 }
99
100 void
101 print_lang_statistics ()
102 {
103 }
104
105 /* used by print-tree.c */
106
107 void
108 lang_print_xnode (file, node, indent)
109      FILE *file ATTRIBUTE_UNUSED;
110      tree node ATTRIBUTE_UNUSED;
111      int indent ATTRIBUTE_UNUSED;
112 {
113 }
114
115 /* Used by c-lex.c, but only for objc.  */
116
117 tree
118 lookup_interface (arg)
119      tree arg ATTRIBUTE_UNUSED;
120 {
121   return 0;
122 }
123
124 tree
125 is_class_name (arg)
126     tree arg ATTRIBUTE_UNUSED;
127 {
128   return 0;
129 }
130
131 void
132 maybe_objc_check_decl (decl)
133      tree decl ATTRIBUTE_UNUSED;
134 {
135 }
136
137 int
138 maybe_objc_comptypes (lhs, rhs, reflexive)
139      tree lhs ATTRIBUTE_UNUSED;
140      tree rhs ATTRIBUTE_UNUSED;
141      int reflexive ATTRIBUTE_UNUSED;
142 {
143   return -1;
144 }
145
146 tree
147 maybe_objc_method_name (decl)
148     tree decl ATTRIBUTE_UNUSED;
149 {
150   return 0;
151 }
152
153 tree
154 maybe_building_objc_message_expr ()
155 {
156   return 0;
157 }
158
159 int
160 recognize_objc_keyword ()
161 {
162   return 0;
163 }
164
165 tree
166 build_objc_string (len, str)
167     int len ATTRIBUTE_UNUSED;
168     const char *str ATTRIBUTE_UNUSED;
169 {
170   abort ();
171   return NULL_TREE;
172 }
173
174 /* Called at end of parsing, but before end-of-file processing.  */
175
176 void
177 finish_file ()
178 {
179 #ifndef ASM_OUTPUT_CONSTRUCTOR
180   extern tree static_ctors;
181 #endif
182 #ifndef ASM_OUTPUT_DESTRUCTOR
183   extern tree static_dtors;
184 #endif
185   extern tree build_function_call                 PARAMS ((tree, tree));
186 #if !defined(ASM_OUTPUT_CONSTRUCTOR) || !defined(ASM_OUTPUT_DESTRUCTOR)
187   tree void_list_node_1 = build_tree_list (NULL_TREE, void_type_node);
188 #endif
189 #ifndef ASM_OUTPUT_CONSTRUCTOR
190   if (static_ctors)
191     {
192       tree fnname = get_file_function_name ('I');
193       start_function (void_list_node_1,
194                       build_parse_node (CALL_EXPR, fnname, 
195                                         tree_cons (NULL_TREE, NULL_TREE, 
196                                                    void_list_node_1),
197                                         NULL_TREE),
198                       NULL_TREE, NULL_TREE);
199       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
200       store_parm_decls ();
201
202       for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
203         expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
204                                                NULL_TREE));
205
206       finish_function (0);
207
208       assemble_constructor (IDENTIFIER_POINTER (fnname));
209     }
210 #endif
211 #ifndef ASM_OUTPUT_DESTRUCTOR
212   if (static_dtors)
213     {
214       tree fnname = get_file_function_name ('D');
215       start_function (void_list_node_1,
216                       build_parse_node (CALL_EXPR, fnname, 
217                                         tree_cons (NULL_TREE, NULL_TREE,
218                                                    void_list_node_1),
219                                         NULL_TREE),
220                       NULL_TREE, NULL_TREE);
221       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
222       store_parm_decls ();
223
224       for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
225         expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
226                                                NULL_TREE));
227
228       finish_function (0);
229
230       assemble_destructor (IDENTIFIER_POINTER (fnname));
231     }
232 #endif
233 }