OSDN Git Service

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