OSDN Git Service

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