]> gcc.gnu.org Git - gcc.git/blame - gcc/c-lang.c
reload.c: PROTO -> PARAMS.
[gcc.git] / gcc / c-lang.c
CommitLineData
c0f940ef 1/* Language-specific hook definitions for C front end.
6e090c76 2 Copyright (C) 1991, 1995, 97-99, 2000 Free Software Foundation, Inc.
c0f940ef
RS
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
940d9d63
RK
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
c0f940ef
RS
20
21
22#include "config.h"
670ee920 23#include "system.h"
c0f940ef 24#include "tree.h"
e2ecd91c 25#include "function.h"
c0f940ef 26#include "input.h"
d6f4ec51
KG
27#include "c-tree.h"
28#include "c-lex.h"
29#include "toplev.h"
cab634f2 30#include "output.h"
a8aa7975 31#include "flags.h"
1526a060 32#include "ggc.h"
c0f940ef 33
add7091b 34#if USE_CPPLIB
5d7da2c6 35#include "cpplib.h"
add7091b 36extern char *yy_cur;
5d7da2c6
DB
37extern cpp_reader parse_in;
38extern cpp_options parse_options;
add7091b
ZW
39#endif
40
c0f940ef
RS
41/* Each of the functions defined here
42 is an alternative to a function in objc-actions.c. */
43
44int
a0d85b75
DB
45lang_decode_option (argc, argv)
46 int argc;
47 char **argv;
c0f940ef 48{
a0d85b75 49 return c_decode_option (argc, argv);
c0f940ef
RS
50}
51
52void
b53beeb2
RH
53lang_init_options ()
54{
5d7da2c6
DB
55#if USE_CPPLIB
56 cpp_reader_init (&parse_in);
57 parse_in.opts = &parse_options;
58 cpp_options_init (&parse_options);
59#endif
a8aa7975
GM
60 /* Mark as "unspecified". */
61 flag_bounds_check = -1;
b53beeb2
RH
62}
63
64void
c0f940ef
RS
65lang_init ()
66{
a8aa7975
GM
67 /* If still "unspecified", make it match -fbounded-pointers. */
68 if (flag_bounds_check < 0)
69 flag_bounds_check = flag_bounded_pointers;
70
c0f940ef
RS
71 /* the beginning of the file is a new line; check for # */
72 /* With luck, we discover the real source file's name from that
73 and put it in input_filename. */
add7091b 74#if !USE_CPPLIB
c0f940ef 75 ungetc (check_newline (), finput);
add7091b
ZW
76#else
77 check_newline ();
78 yy_cur--;
79#endif
e2ecd91c
BS
80
81 save_lang_status = &push_c_function_context;
82 restore_lang_status = &pop_c_function_context;
1526a060
BS
83 mark_lang_status = &mark_c_function_context;
84
85 c_parse_init ();
c0f940ef
RS
86}
87
88void
89lang_finish ()
90{
91}
92
c9591059 93const char *
d0d4af87
MS
94lang_identify ()
95{
96 return "c";
97}
98
a604ca26
TW
99void
100print_lang_statistics ()
101{
102}
103
bc289659
ML
104/* used by print-tree.c */
105
106void
107lang_print_xnode (file, node, indent)
d6f4ec51
KG
108 FILE *file ATTRIBUTE_UNUSED;
109 tree node ATTRIBUTE_UNUSED;
110 int indent ATTRIBUTE_UNUSED;
bc289659
ML
111{
112}
113
c0f940ef 114/* Used by c-lex.c, but only for objc. */
a604ca26 115
c0f940ef
RS
116tree
117lookup_interface (arg)
d6f4ec51 118 tree arg ATTRIBUTE_UNUSED;
c0f940ef
RS
119{
120 return 0;
121}
122
a604ca26
TW
123tree
124is_class_name (arg)
d6f4ec51 125 tree arg ATTRIBUTE_UNUSED;
a604ca26
TW
126{
127 return 0;
128}
129
c0f940ef
RS
130void
131maybe_objc_check_decl (decl)
d6f4ec51 132 tree decl ATTRIBUTE_UNUSED;
c0f940ef
RS
133{
134}
135
136int
a604ca26 137maybe_objc_comptypes (lhs, rhs, reflexive)
d6f4ec51
KG
138 tree lhs ATTRIBUTE_UNUSED;
139 tree rhs ATTRIBUTE_UNUSED;
140 int reflexive ATTRIBUTE_UNUSED;
a604ca26 141{
a0825a7f 142 return -1;
a604ca26
TW
143}
144
145tree
146maybe_objc_method_name (decl)
d6f4ec51 147 tree decl ATTRIBUTE_UNUSED;
c0f940ef
RS
148{
149 return 0;
150}
151
152tree
153maybe_building_objc_message_expr ()
154{
155 return 0;
156}
157
158int
159recognize_objc_keyword ()
160{
161 return 0;
162}
163
a604ca26
TW
164tree
165build_objc_string (len, str)
d6f4ec51 166 int len ATTRIBUTE_UNUSED;
5d5993dd 167 const char *str ATTRIBUTE_UNUSED;
c0f940ef 168{
a604ca26
TW
169 abort ();
170 return NULL_TREE;
c0f940ef
RS
171}
172
0f41302f
MS
173/* Called at end of parsing, but before end-of-file processing. */
174
2c5f4139
JM
175void
176finish_file ()
177{
69d4ca36
RL
178#ifndef ASM_OUTPUT_CONSTRUCTOR
179 extern tree static_ctors;
180#endif
181#ifndef ASM_OUTPUT_DESTRUCTOR
182 extern tree static_dtors;
183#endif
6e090c76 184 extern tree build_function_call PARAMS ((tree, tree));
081f5e7e 185#if !defined(ASM_OUTPUT_CONSTRUCTOR) || !defined(ASM_OUTPUT_DESTRUCTOR)
9c1ce433 186 tree void_list_node_1 = build_tree_list (NULL_TREE, void_type_node);
081f5e7e 187#endif
2c5f4139
JM
188#ifndef ASM_OUTPUT_CONSTRUCTOR
189 if (static_ctors)
190 {
191 tree fnname = get_file_function_name ('I');
9c1ce433 192 start_function (void_list_node_1,
a89e95f9
RE
193 build_parse_node (CALL_EXPR, fnname,
194 tree_cons (NULL_TREE, NULL_TREE,
195 void_list_node_1),
2c5f4139 196 NULL_TREE),
79d101f8 197 NULL_TREE, NULL_TREE, 0);
2c5f4139
JM
198 fnname = DECL_ASSEMBLER_NAME (current_function_decl);
199 store_parm_decls ();
200
201 for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
202 expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
203 NULL_TREE));
204
205 finish_function (0);
206
207 assemble_constructor (IDENTIFIER_POINTER (fnname));
208 }
209#endif
210#ifndef ASM_OUTPUT_DESTRUCTOR
211 if (static_dtors)
212 {
213 tree fnname = get_file_function_name ('D');
9c1ce433 214 start_function (void_list_node_1,
a89e95f9
RE
215 build_parse_node (CALL_EXPR, fnname,
216 tree_cons (NULL_TREE, NULL_TREE,
217 void_list_node_1),
2c5f4139 218 NULL_TREE),
b7e043ad 219 NULL_TREE, NULL_TREE, 0);
2c5f4139
JM
220 fnname = DECL_ASSEMBLER_NAME (current_function_decl);
221 store_parm_decls ();
222
223 for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
224 expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
225 NULL_TREE));
226
227 finish_function (0);
228
229 assemble_destructor (IDENTIFIER_POINTER (fnname));
230 }
231#endif
232}
This page took 0.679894 seconds and 5 git commands to generate.