OSDN Git Service

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