c-lang.c revision 50397
1/* Language-specific hook definitions for C front end.
2   Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
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
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, 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
34int
35lang_decode_option (argc, argv)
36     int argc;
37     char **argv;
38{
39  return c_decode_option (argc, argv);
40}
41
42void
43lang_init_options ()
44{
45}
46
47void
48lang_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
58void
59lang_finish ()
60{
61}
62
63char *
64lang_identify ()
65{
66  return "c";
67}
68
69void
70print_lang_statistics ()
71{
72}
73
74/* used by print-tree.c */
75
76void
77lang_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
86tree
87lookup_interface (arg)
88     tree arg ATTRIBUTE_UNUSED;
89{
90  return 0;
91}
92
93tree
94is_class_name (arg)
95    tree arg ATTRIBUTE_UNUSED;
96{
97  return 0;
98}
99
100void
101maybe_objc_check_decl (decl)
102     tree decl ATTRIBUTE_UNUSED;
103{
104}
105
106int
107maybe_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
115tree
116maybe_objc_method_name (decl)
117    tree decl ATTRIBUTE_UNUSED;
118{
119  return 0;
120}
121
122tree
123maybe_building_objc_message_expr ()
124{
125  return 0;
126}
127
128int
129recognize_objc_keyword ()
130{
131  return 0;
132}
133
134tree
135build_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
145void
146finish_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}
199