OSDN Git Service

(finish_file): Pass new parm to start_function.
[pf3gnuchains/gcc-fork.git] / gcc / c-lang.c
1 /* Language-specific hook definitions for C front end.
2    Copyright (C) 1991, 1995 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, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20
21 #include "config.h"
22 #include "tree.h"
23 #include <stdio.h>
24 #include "input.h"
25
26 /* Each of the functions defined here
27    is an alternative to a function in objc-actions.c.  */
28    
29 int
30 lang_decode_option (p)
31      char *p;
32 {
33   return c_decode_option (p);
34 }
35
36 void
37 lang_init ()
38 {
39   /* the beginning of the file is a new line; check for # */
40   /* With luck, we discover the real source file's name from that
41      and put it in input_filename.  */
42   ungetc (check_newline (), finput);
43 }
44
45 void
46 lang_finish ()
47 {
48 }
49
50 char *
51 lang_identify ()
52 {
53   return "c";
54 }
55
56 void
57 print_lang_statistics ()
58 {
59 }
60
61 /* Used by c-lex.c, but only for objc.  */
62
63 tree
64 lookup_interface (arg)
65      tree arg;
66 {
67   return 0;
68 }
69
70 tree
71 is_class_name (arg)
72     tree arg;
73 {
74   return 0;
75 }
76
77 void
78 maybe_objc_check_decl (decl)
79      tree decl;
80 {
81 }
82
83 int
84 maybe_objc_comptypes (lhs, rhs, reflexive)
85      tree lhs, rhs;
86      int reflexive;
87 {
88   return -1;
89 }
90
91 tree
92 maybe_objc_method_name (decl)
93     tree decl;
94 {
95   return 0;
96 }
97
98 tree
99 maybe_building_objc_message_expr ()
100 {
101   return 0;
102 }
103
104 int
105 recognize_objc_keyword ()
106 {
107   return 0;
108 }
109
110 tree
111 build_objc_string (len, str)
112     int len;
113     char *str;
114 {
115   abort ();
116   return NULL_TREE;
117 }
118
119 void
120 GNU_xref_begin ()
121 {
122   fatal ("GCC does not yet support XREF");
123 }
124
125 void
126 GNU_xref_end ()
127 {
128   fatal ("GCC does not yet support XREF");
129 }
130
131 /* called at end of parsing, but before end-of-file processing.  */
132 void
133 finish_file ()
134 {
135   extern tree static_ctors, static_dtors;
136   extern tree get_file_function_name ();
137   extern tree build_function_call                 PROTO((tree, tree));
138   tree void_list_node = build_tree_list (NULL_TREE, void_type_node);
139 #ifndef ASM_OUTPUT_CONSTRUCTOR
140   if (static_ctors)
141     {
142       tree fnname = get_file_function_name ('I');
143       start_function (void_list_node,
144                       build_parse_node (CALL_EXPR, fnname, void_list_node,
145                                         NULL_TREE),
146                       NULL_TREE, 0);
147       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
148       store_parm_decls ();
149
150       for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
151         expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
152                                                NULL_TREE));
153
154       finish_function (0);
155
156       assemble_constructor (IDENTIFIER_POINTER (fnname));
157     }
158 #endif
159 #ifndef ASM_OUTPUT_DESTRUCTOR
160   if (static_dtors)
161     {
162       tree fnname = get_file_function_name ('D');
163       start_function (void_list_node,
164                       build_parse_node (CALL_EXPR, fnname, void_list_node,
165                                         NULL_TREE),
166                       NULL_TREE, 0);
167       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
168       store_parm_decls ();
169
170       for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
171         expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
172                                                NULL_TREE));
173
174       finish_function (0);
175
176       assemble_destructor (IDENTIFIER_POINTER (fnname));
177     }
178 #endif
179 }