1 /* Language-specific hook definitions for CHILL front end.
2 Copyright (C) 1992, 93, 1994, 1998 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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)
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.
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. */
30 /* Type node for boolean types. */
32 tree boolean_type_node;
34 /* True if STRING(INDEX) yields a CHARS(1) (or BOOLS(1)) rather than
35 a CHAR (or BOOL). Also, makes CHARS(1) similar for CHAR,
36 and BOOLS(1) similar to BOOL. This is for compatibility
37 for the 1984 version of Z.200.*/
38 int flag_old_strings = 0;
40 /* This is set non-zero to force user input tokens to lower case.
41 This is non-standard. See Z.200, page 8. */
44 /* True if reserved and predefined words ('special' words in the Z.200
45 terminology) are in uppercase. Obviously, this had better not be
46 true if we're ignoring input case. */
49 /* The actual name of the input file, regardless of any #line directives */
50 char* chill_real_input_filename;
53 extern int maximum_field_alignment;
55 /* return 1 if the expression tree given has all
56 constant nodes as its leaves; return 0 otherwise. */
61 enum chill_tree_code code;
68 code = TREE_CODE (exp);
69 length = tree_code_length[(int) code];
71 /* constant leaf? return TRUE */
72 if (TREE_CODE_CLASS (code) == 'c')
75 /* recursively check next level down */
76 for (i = 0; i < length; i++)
77 if (! deep_const_expr (TREE_OPERAND (exp, i)))
87 if (TREE_CODE (exp) == INTEGER_CST)
89 if (TREE_CODE (exp) == CONST_DECL)
90 return const_expr (DECL_INITIAL (exp));
91 if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
92 && DECL_INITIAL (exp) != NULL_TREE
93 && TREE_READONLY (exp))
94 return DECL_INITIAL (exp);
95 if (deep_const_expr (exp))
97 if (TREE_CODE (exp) != ERROR_MARK)
98 error ("non-constant expression");
99 return error_mark_node;
102 /* Each of the functions defined here
103 is an alternative to a function in objc-actions.c. */
105 /* Used by c-lex.c, but only for objc. */
107 lookup_interface (arg)
108 tree arg ATTRIBUTE_UNUSED;
114 maybe_objc_comptypes (lhs, rhs)
115 tree lhs ATTRIBUTE_UNUSED, rhs ATTRIBUTE_UNUSED;
121 maybe_building_objc_message_expr ()
127 recognize_objc_keyword ()
137 /* used by print-tree.c */
140 lang_print_xnode (file, node, indent)
141 FILE *file ATTRIBUTE_UNUSED;
142 tree node ATTRIBUTE_UNUSED;
143 int indent ATTRIBUTE_UNUSED;
150 fatal ("GCC does not yet support XREF");
156 fatal ("GCC does not yet support XREF");
160 * process chill-specific compiler command-line options
163 lang_decode_option (argc, argv)
168 static int explicit_ignore_case = 0;
169 if (!strcmp(p, "-lang-chill"))
171 else if (!strcmp (p, "-fruntime-checking"))
176 else if (!strcmp (p, "-fno-runtime-checking"))
180 runtime_checking_flag = 0;
182 else if (!strcmp (p, "-flocal-loop-counter"))
183 flag_local_loop_counter = 1;
184 else if (!strcmp (p, "-fno-local-loop-counter"))
185 flag_local_loop_counter = 0;
186 else if (!strcmp (p, "-fold-strings"))
187 flag_old_strings = 1;
188 else if (!strcmp (p, "-fno-old-strings"))
189 flag_old_strings = 0;
190 else if (!strcmp (p, "-fignore-case"))
192 explicit_ignore_case = 1;
195 error ("Ignoring case upon input and");
196 error ("making special words uppercase wouldn't work.");
201 else if (!strcmp (p, "-fno-ignore-case"))
203 else if (!strcmp (p, "-fspecial_UC"))
205 if (explicit_ignore_case)
207 error ("Making special words uppercase and");
208 error (" ignoring case upon input wouldn't work.");
211 special_UC = 1, ignore_case = 0;
213 else if (!strcmp (p, "-fspecial_LC"))
215 else if (!strcmp (p, "-fpack"))
216 maximum_field_alignment = BITS_PER_UNIT;
217 else if (!strcmp (p, "-fno-pack"))
218 maximum_field_alignment = 0;
219 else if (!strcmp (p, "-fchill-grant-only"))
221 else if (!strcmp (p, "-fgrant-only"))
223 /* user has specified a seize-file path */
224 else if (p[0] == '-' && p[1] == 'I')
225 register_seize_path (&p[2]);
226 if (!strcmp(p, "-itu")) /* Force Z.200 semantics */
228 pedantic = 1; /* FIXME: new flag name? */
229 flag_local_loop_counter = 1;
232 return c_decode_option (argc, argv);
238 chill_print_error_function (file)
241 static tree last_error_function = NULL_TREE;
242 static struct module *last_error_module = NULL;
244 if (last_error_function == current_function_decl
245 && last_error_module == current_module)
248 last_error_function = current_function_decl;
249 last_error_module = current_module;
252 fprintf (stderr, "%s: ", file);
254 if (current_function_decl == global_function_decl
255 || current_function_decl == NULL_TREE)
257 if (current_module == NULL)
258 fprintf (stderr, "At top level:\n");
260 fprintf (stderr, "In module %s:\n",
261 IDENTIFIER_POINTER (current_module->name));
265 char *kind = "function";
266 char *name = (*decl_printable_name) (current_function_decl, 2);
267 fprintf (stderr, "In %s `%s':\n", kind, name);
271 /* Print an error message for invalid use of an incomplete type.
272 VALUE is the expression that was used (or 0 if that isn't known)
273 and TYPE is the type that was invalid. */
276 incomplete_type_error (value, type)
277 tree value ATTRIBUTE_UNUSED;
278 tree type ATTRIBUTE_UNUSED;
280 error ("internal error - use of undefined type");
286 extern void (*print_error_function) PROTO((char*));
288 chill_real_input_filename = input_filename;
290 /* the beginning of the file is a new line; check for # */
291 /* With luck, we discover the real source file's name from that
292 and put it in input_filename. */
294 ungetc (check_newline (), finput);
296 /* set default grant file */
297 set_default_grant_file ();
299 print_error_function = chill_print_error_function;