1 /* Language-specific hook definitions for C front end.
2 Copyright (C) 1991, 1995, 1997, 1998,
3 1999, 2000 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
29 #include "diagnostic.h"
38 static int c_tree_printer PARAMS ((output_buffer *));
42 extern cpp_reader parse_in;
45 /* Each of the functions defined here
46 is an alternative to a function in objc-actions.c. */
49 lang_decode_option (argc, argv)
53 return c_decode_option (argc, argv);
61 cpp_reader_init (&parse_in);
63 /* Mark as "unspecified". */
64 flag_bounds_check = -1;
70 /* If still "unspecified", make it match -fbounded-pointers. */
71 if (flag_bounds_check < 0)
72 flag_bounds_check = flag_bounded_pointers;
74 /* If still unspecified, make it match pedantic && -std=c99. */
75 if (mesg_implicit_function_declaration < 0)
77 if (pedantic && flag_isoc99)
78 mesg_implicit_function_declaration = flag_pedantic_errors ? 2 : 1;
80 mesg_implicit_function_declaration = 0;
83 /* the beginning of the file is a new line; check for # */
84 /* With luck, we discover the real source file's name from that
85 and put it in input_filename. */
87 ungetc (check_newline (), finput);
90 save_lang_status = &push_c_function_context;
91 restore_lang_status = &pop_c_function_context;
92 mark_lang_status = &mark_c_function_context;
93 lang_expand_expr = &c_expand_expr;
94 lang_safe_from_p = &c_safe_from_p;
95 lang_printer = &c_tree_printer;
96 lang_expand_decl_stmt = &c_expand_decl_stmt;
113 print_lang_statistics ()
117 /* used by print-tree.c */
120 lang_print_xnode (file, node, indent)
121 FILE *file ATTRIBUTE_UNUSED;
122 tree node ATTRIBUTE_UNUSED;
123 int indent ATTRIBUTE_UNUSED;
127 /* Used by c-lex.c, but only for objc. */
130 lookup_interface (arg)
131 tree arg ATTRIBUTE_UNUSED;
138 tree arg ATTRIBUTE_UNUSED;
144 maybe_objc_check_decl (decl)
145 tree decl ATTRIBUTE_UNUSED;
150 maybe_objc_comptypes (lhs, rhs, reflexive)
151 tree lhs ATTRIBUTE_UNUSED;
152 tree rhs ATTRIBUTE_UNUSED;
153 int reflexive ATTRIBUTE_UNUSED;
159 maybe_objc_method_name (decl)
160 tree decl ATTRIBUTE_UNUSED;
166 maybe_building_objc_message_expr ()
172 recognize_objc_keyword ()
177 /* Used by c-typeck.c (build_external_ref), but only for objc. */
180 lookup_objc_ivar (id)
181 tree id ATTRIBUTE_UNUSED;
186 /* Called at end of parsing, but before end-of-file processing. */
191 #ifndef ASM_OUTPUT_CONSTRUCTOR
192 extern tree static_ctors;
194 #ifndef ASM_OUTPUT_DESTRUCTOR
195 extern tree static_dtors;
197 extern tree build_function_call PARAMS ((tree, tree));
198 #if !defined(ASM_OUTPUT_CONSTRUCTOR) || !defined(ASM_OUTPUT_DESTRUCTOR)
199 tree void_list_node_1 = build_tree_list (NULL_TREE, void_type_node);
201 #ifndef ASM_OUTPUT_CONSTRUCTOR
204 tree fnname = get_file_function_name ('I');
205 start_function (void_list_node_1,
206 build_parse_node (CALL_EXPR, fnname,
207 tree_cons (NULL_TREE, NULL_TREE,
210 NULL_TREE, NULL_TREE);
211 fnname = DECL_ASSEMBLER_NAME (current_function_decl);
214 for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
215 expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
220 assemble_constructor (IDENTIFIER_POINTER (fnname));
223 #ifndef ASM_OUTPUT_DESTRUCTOR
226 tree fnname = get_file_function_name ('D');
227 start_function (void_list_node_1,
228 build_parse_node (CALL_EXPR, fnname,
229 tree_cons (NULL_TREE, NULL_TREE,
232 NULL_TREE, NULL_TREE);
233 fnname = DECL_ASSEMBLER_NAME (current_function_decl);
236 for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
237 expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
242 assemble_destructor (IDENTIFIER_POINTER (fnname));
247 /* Called during diagnostic message formatting process to print a
248 source-level entity onto BUFFER. The meaning of the format specifiers
251 %F: a function declaration,
254 These format specifiers form a subset of the format specifiers set used
255 by the C++ front-end.
256 Please notice when called, the `%' part was already skipped by the
257 diagnostic machinery. */
259 c_tree_printer (buffer)
260 output_buffer *buffer;
262 tree t = va_arg (output_buffer_format_args (buffer), tree);
264 switch (*output_buffer_text_cursor (buffer))
270 const char *n = DECL_NAME (t)
271 ? (*decl_printable_name) (t, 2)
273 output_add_string (buffer, n);