OSDN Git Service

update
[pf3gnuchains/gcc-fork.git] / gcc / c-lang.c
1 /* Language-specific hook definitions for C front end.
2    Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
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.
10
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.
15
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.  */
20
21
22 #include "config.h"
23 #include "system.h"
24 #include "tree.h"
25 #include "input.h"
26 #include "c-tree.h"
27 #include "c-lex.h"
28 #include "toplev.h"
29
30 /* Each of the functions defined here
31    is an alternative to a function in objc-actions.c.  */
32    
33 int
34 lang_decode_option (p)
35      char *p;
36 {
37   return c_decode_option (p);
38 }
39
40 void
41 lang_init_options ()
42 {
43 }
44
45 void
46 lang_init ()
47 {
48 #if !USE_CPPLIB
49   /* the beginning of the file is a new line; check for # */
50   /* With luck, we discover the real source file's name from that
51      and put it in input_filename.  */
52   ungetc (check_newline (), finput);
53 #endif
54 }
55
56 void
57 lang_finish ()
58 {
59 }
60
61 char *
62 lang_identify ()
63 {
64   return "c";
65 }
66
67 void
68 print_lang_statistics ()
69 {
70 }
71
72 /* used by print-tree.c */
73
74 void
75 lang_print_xnode (file, node, indent)
76      FILE *file ATTRIBUTE_UNUSED;
77      tree node ATTRIBUTE_UNUSED;
78      int indent ATTRIBUTE_UNUSED;
79 {
80 }
81
82 /* Used by c-lex.c, but only for objc.  */
83
84 tree
85 lookup_interface (arg)
86      tree arg ATTRIBUTE_UNUSED;
87 {
88   return 0;
89 }
90
91 tree
92 is_class_name (arg)
93     tree arg ATTRIBUTE_UNUSED;
94 {
95   return 0;
96 }
97
98 void
99 maybe_objc_check_decl (decl)
100      tree decl ATTRIBUTE_UNUSED;
101 {
102 }
103
104 int
105 maybe_objc_comptypes (lhs, rhs, reflexive)
106      tree lhs ATTRIBUTE_UNUSED;
107      tree rhs ATTRIBUTE_UNUSED;
108      int reflexive ATTRIBUTE_UNUSED;
109 {
110   return -1;
111 }
112
113 tree
114 maybe_objc_method_name (decl)
115     tree decl ATTRIBUTE_UNUSED;
116 {
117   return 0;
118 }
119
120 tree
121 maybe_building_objc_message_expr ()
122 {
123   return 0;
124 }
125
126 int
127 recognize_objc_keyword ()
128 {
129   return 0;
130 }
131
132 tree
133 build_objc_string (len, str)
134     int len ATTRIBUTE_UNUSED;
135     char *str ATTRIBUTE_UNUSED;
136 {
137   abort ();
138   return NULL_TREE;
139 }
140
141 void
142 GNU_xref_begin ()
143 {
144   fatal ("GCC does not yet support XREF");
145 }
146
147 void
148 GNU_xref_end ()
149 {
150   fatal ("GCC does not yet support XREF");
151 }
152
153 /* Called at end of parsing, but before end-of-file processing.  */
154
155 void
156 finish_file ()
157 {
158 #ifndef ASM_OUTPUT_CONSTRUCTOR
159   extern tree static_ctors;
160 #endif
161 #ifndef ASM_OUTPUT_DESTRUCTOR
162   extern tree static_dtors;
163 #endif
164   extern tree build_function_call                 PROTO((tree, tree));
165 #if !defined(ASM_OUTPUT_CONSTRUCTOR) || !defined(ASM_OUTPUT_DESTRUCTOR)
166   tree void_list_node = build_tree_list (NULL_TREE, void_type_node);
167 #endif
168 #ifndef ASM_OUTPUT_CONSTRUCTOR
169   if (static_ctors)
170     {
171       tree fnname = get_file_function_name ('I');
172       start_function (void_list_node,
173                       build_parse_node (CALL_EXPR, fnname, void_list_node,
174                                         NULL_TREE),
175                       NULL_TREE, NULL_TREE, 0);
176       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
177       store_parm_decls ();
178
179       for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
180         expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
181                                                NULL_TREE));
182
183       finish_function (0);
184
185       assemble_constructor (IDENTIFIER_POINTER (fnname));
186     }
187 #endif
188 #ifndef ASM_OUTPUT_DESTRUCTOR
189   if (static_dtors)
190     {
191       tree fnname = get_file_function_name ('D');
192       start_function (void_list_node,
193                       build_parse_node (CALL_EXPR, fnname, void_list_node,
194                                         NULL_TREE),
195                       NULL_TREE, NULL_TREE, 0);
196       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
197       store_parm_decls ();
198
199       for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
200         expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
201                                                NULL_TREE));
202
203       finish_function (0);
204
205       assemble_destructor (IDENTIFIER_POINTER (fnname));
206     }
207 #endif
208 }