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