OSDN Git Service

Sat Aug 15 20:22:33 1998 H.J. Lu (hjl@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 #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 /* Called at end of parsing, but before end-of-file processing.  */
144
145 void
146 finish_file ()
147 {
148 #ifndef ASM_OUTPUT_CONSTRUCTOR
149   extern tree static_ctors;
150 #endif
151 #ifndef ASM_OUTPUT_DESTRUCTOR
152   extern tree static_dtors;
153 #endif
154   extern tree build_function_call                 PROTO((tree, tree));
155 #if !defined(ASM_OUTPUT_CONSTRUCTOR) || !defined(ASM_OUTPUT_DESTRUCTOR)
156   tree void_list_node = build_tree_list (NULL_TREE, void_type_node);
157 #endif
158 #ifndef ASM_OUTPUT_CONSTRUCTOR
159   if (static_ctors)
160     {
161       tree fnname = get_file_function_name ('I');
162       start_function (void_list_node,
163                       build_parse_node (CALL_EXPR, fnname, void_list_node,
164                                         NULL_TREE),
165                       NULL_TREE, NULL_TREE, 0);
166       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
167       store_parm_decls ();
168
169       for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
170         expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
171                                                NULL_TREE));
172
173       finish_function (0);
174
175       assemble_constructor (IDENTIFIER_POINTER (fnname));
176     }
177 #endif
178 #ifndef ASM_OUTPUT_DESTRUCTOR
179   if (static_dtors)
180     {
181       tree fnname = get_file_function_name ('D');
182       start_function (void_list_node,
183                       build_parse_node (CALL_EXPR, fnname, void_list_node,
184                                         NULL_TREE),
185                       NULL_TREE, NULL_TREE, 0);
186       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
187       store_parm_decls ();
188
189       for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
190         expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
191                                                NULL_TREE));
192
193       finish_function (0);
194
195       assemble_destructor (IDENTIFIER_POINTER (fnname));
196     }
197 #endif
198 }