OSDN Git Service

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