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