[official-gcc.git] / gcc / java / parse.h
blob1e78e328ab88656e01eb6ca2f582ab4ee5f7c614
1 /* Language parser definitions for the GNU compiler for the Java(TM) language.
2 Copyright (C) 1997, 1998 Free Software Foundation, Inc.
3 Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
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)
10 any later version.
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.
22 Java and all Java-based marks are trademarks or registered trademarks
23 of Sun Microsystems, Inc. in the United States and other countries.
24 The Free Software Foundation is independent of Sun Microsystems, Inc. */
26 #ifndef JV_LANG_H
27 #define JV_LANG_H
29 #include "lex.h"
31 /* Extern global variable declarations */
32 extern int java_error_count;
33 extern struct obstack temporary_obstack;
34 extern struct obstack permanent_obstack;
35 extern int quiet_flag;
37 #ifndef JC1_LITE
38 /* Function extern to java/ */
39 extern int int_fits_type_p PROTO ((tree, tree));
40 extern tree stabilize_reference PROTO ((tree));
41 #endif
43 /* Macros for verbose debug info */
44 #ifdef VERBOSE_SKELETON
45 #define RULE( rule ) printf ( "jv_yacc:%d: rule %s\n", lineno, rule )
46 #else
47 #define RULE( rule )
48 #endif
50 #ifdef SOURCE_FRONTEND_DEBUG
51 #undef SOURCE_FRONTEND_DEBUG
52 #define SOURCE_FRONTEND_DEBUG(X) \
53 {if (!quiet_flag) {printf ("* "); printf X; putchar ('\n');} }
54 #else
55 #define SOURCE_FRONTEND_DEBUG(X)
56 #endif
58 /* Macro for error recovering */
59 #ifdef YYDEBUG
60 #define RECOVERED \
61 { if (!quiet_flag) {printf ("** Recovered\n");} }
62 #define DRECOVERED(s) \
63 { if (!quiet_flag) {printf ("** Recovered (%s)\n", #s);}}
64 #else
65 #define RECOVERED
66 #define DRECOVERED(s)
67 #endif
69 #define DRECOVER(s) {yyerrok; DRECOVERED(s)}
70 #define RECOVER {yyerrok; RECOVERED}
72 #define YYERROR_NOW ctxp->java_error_flag = 1
73 #define YYNOT_TWICE if (ctxp->prevent_ese != lineno)
75 /* Accepted modifiers */
76 #define CLASS_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT|ACC_FINAL
77 #define FIELD_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_FINAL| \
78 ACC_STATIC|ACC_TRANSIENT|ACC_VOLATILE
79 #define METHOD_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_ABSTRACT| \
80 ACC_STATIC|ACC_FINAL|ACC_SYNCHRONIZED|ACC_NATIVE
81 #define INTERFACE_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT
82 #define INTERFACE_METHOD_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT
83 #define INTERFACE_FIELD_MODIFIERS ACC_PUBLIC|ACC_STATIC|ACC_FINAL
85 /* Getting a modifier WFL */
86 #define MODIFIER_WFL(M) (ctxp->modifier_ctx [(M) - PUBLIC_TK])
88 /* Check on modifiers */
89 #define THIS_MODIFIER_ONLY(f, m, v, count, l) \
90 if ((f) & (m)) \
91 { \
92 tree node = ctxp->modifier_ctx [v]; \
93 if ((l) \
94 && ((EXPR_WFL_COLNO (node) > EXPR_WFL_COLNO (l)) \
95 || (EXPR_WFL_LINENO (node) > EXPR_WFL_LINENO (l)))) \
96 l = node; \
97 else if (!(l)) \
98 l = node; \
99 count++; \
102 #define ABSTRACT_CHECK(flag, v, cl, s) \
103 if ((flag) & (v)) \
104 parse_error_context (cl, s " method can't be abstract");
106 /* Misc. */
107 #define exit_java_complete_class() \
109 pop_obstacks (); \
110 return; \
113 #define CLASS_OR_INTERFACE(decl, s1, s2) \
114 (decl ? \
115 ((get_access_flags_from_decl (TYPE_NAME (TREE_TYPE (decl))) \
116 & ACC_INTERFACE) ? \
117 s2 : s1) : ((s1 [0]=='S'|| s1 [0]=='s') ? \
118 (s1 [0]=='S' ? "Supertype" : "supertype") : \
119 (s1 [0] > 'A' ? "Type" : "type")))
121 /* Pedantic warning on obsolete modifiers. Note: when cl is NULL,
122 flags was set artificially, such as for a interface method */
123 #define OBSOLETE_MODIFIER_WARNING(cl, flags, modifier, format, arg) \
125 if ((cl) && ((flags) & (modifier))) \
126 parse_warning_context (cl, \
127 "Discouraged redundant use of `%s' modifier " \
128 "in declaration of " format, \
129 java_accstring_lookup (modifier), arg); \
132 /* Quickly build a temporary pointer on hypothetical type NAME. */
133 #define BUILD_PTR_FROM_NAME(ptr, name) \
135 ptr = build (POINTER_TYPE, NULL_TREE); \
136 TYPE_NAME (ptr) = name; \
139 #define INCOMPLETE_TYPE_P(NODE) \
140 ((TREE_CODE (NODE) == TREE_LIST) \
141 && (TREE_CODE (TREE_PURPOSE (NODE)) == POINTER_TYPE) \
142 && (TREE_TYPE (TREE_PURPOSE (NODE)) == NULL_TREE))
144 /* Set the EMIT_LINE_NOTE flag of a EXPR_WLF to 1 if debug information
145 are requested. Works in the context of a parser rule. */
146 #define JAVA_MAYBE_GENERATE_DEBUG_INFO(node) \
147 (debug_info_level != DINFO_LEVEL_NONE ? \
148 EXPR_WFL_EMIT_LINE_NOTE (node) = 1, node : node)
150 /* Types classification, according to the JLS, section 4.2 */
151 #define JFLOAT_TYPE_P(TYPE) (TYPE && TREE_CODE ((TYPE)) == REAL_TYPE)
152 #define JINTEGRAL_TYPE_P(TYPE) ((TYPE) \
153 && (TREE_CODE ((TYPE)) == INTEGER_TYPE \
154 || TREE_CODE ((TYPE)) == CHAR_TYPE))
155 #define JNUMERIC_TYPE_P(TYPE) ((TYPE) \
156 && (JFLOAT_TYPE_P ((TYPE)) \
157 || JINTEGRAL_TYPE_P ((TYPE))))
158 #define JPRIMITIVE_TYPE_P(TYPE) ((TYPE) \
159 && (JNUMERIC_TYPE_P ((TYPE)) \
160 || TREE_CODE ((TYPE)) == BOOLEAN_TYPE))
162 /* Not defined in the LRM */
163 #define JSTRING_TYPE_P(TYPE) ((TYPE) \
164 && ((TYPE) == string_type_node || \
165 (TREE_CODE (TYPE) == POINTER_TYPE && \
166 TREE_TYPE (TYPE) == string_type_node)))
167 #define JSTRING_P(NODE) ((NODE) \
168 && (TREE_CODE (NODE) == STRING_CST \
169 || IS_CRAFTED_STRING_BUFFER_P (NODE) \
170 || JSTRING_TYPE_P (TREE_TYPE (NODE))))
172 #define JREFERENCE_TYPE_P(TYPE) ((TYPE) \
173 && (TREE_CODE (TYPE) == RECORD_TYPE \
174 || (TREE_CODE (TYPE) == POINTER_TYPE \
175 && TREE_CODE (TREE_TYPE (TYPE)) == \
176 RECORD_TYPE)))
178 /* Other predicate */
179 #define DECL_P(NODE) (NODE && (TREE_CODE (NODE) == PARM_DECL \
180 || TREE_CODE (NODE) == VAR_DECL \
181 || TREE_CODE (NODE) == FIELD_DECL))
183 #define TYPE_INTERFACE_P(TYPE) \
184 (CLASS_P (TYPE) && CLASS_INTERFACE (TYPE_NAME (TYPE)))
186 #define TYPE_CLASS_P(TYPE) (CLASS_P (TYPE) \
187 && !CLASS_INTERFACE (TYPE_NAME (TYPE)) \
188 && !TYPE_ARRAY_P (TYPE))
190 /* Standard error messages */
191 #define ERROR_CANT_CONVERT_TO_BOOLEAN(OPERATOR, NODE, TYPE) \
192 parse_error_context \
193 ((OPERATOR), "Incompatible type for `%s'. Can't convert `%s' to " \
194 "boolean", operator_string ((NODE)), lang_printable_name ((TYPE)))
196 #define ERROR_CANT_CONVERT_TO_NUMERIC(OPERATOR, NODE, TYPE) \
197 parse_error_context \
198 ((OPERATOR), "Incompatible type for `%s'. Can't convert `%s' to " \
199 "numeric type", operator_string ((NODE)), lang_printable_name ((TYPE)))
201 #define ERROR_CAST_NEEDED_TO_INTEGRAL(OPERATOR, NODE, TYPE) \
202 parse_error_context \
203 ((OPERATOR), (JPRIMITIVE_TYPE_P (TYPE) ? \
204 "Incompatible type for `%s'. Explicit cast needed to convert " \
205 "`%s' to integral" : "Incompatible type for `%s'. Can't convert " \
206 "`%s' to integral"), operator_string ((NODE)), \
207 lang_printable_name ((TYPE)))
209 #define ERROR_VARIABLE_NOT_INITIALIZED(WFL, V) \
210 parse_error_context \
211 ((WFL), "Variable `%s' may not have been initialized", \
212 IDENTIFIER_POINTER (V))
214 /* Definition for loop handling. This is Java's own definition of a
215 loop body. See parse.y for documentation. It's valid once you hold
216 a loop's body (LOOP_EXPR_BODY) */
218 /* The loop main block is the one hold the condition and the loop body */
219 #define LOOP_EXPR_BODY_MAIN_BLOCK(NODE) TREE_OPERAND (NODE, 0)
220 /* And then there is the loop update block */
221 #define LOOP_EXPR_BODY_UPDATE_BLOCK(NODE) TREE_OPERAND (NODE, 1)
223 /* Inside the loop main block, there is the loop condition and the
224 loop body. They may be reversed if the loop being described is a
225 do-while loop. NOTE: if you use a WFL around the EXIT_EXPR so you
226 can issue debug info for it, the EXIT_EXPR will be one operand
227 further. */
228 #define LOOP_EXPR_BODY_CONDITION_EXPR(NODE, R) \
229 TREE_OPERAND (LOOP_EXPR_BODY_MAIN_BLOCK (NODE), (R ? 1 : 0))
231 /* Here is the labeled block the loop real body is encapsulated in */
232 #define LOOP_EXPR_BODY_LABELED_BODY(NODE, R) \
233 TREE_OPERAND (LOOP_EXPR_BODY_MAIN_BLOCK (NODE), (R ? 0 : 1))
234 /* And here is the loop's real body */
235 #define LOOP_EXPR_BODY_BODY_EXPR(NODE, R) \
236 LABELED_BLOCK_BODY (LOOP_EXPR_BODY_LABELED_BODY(NODE, R))
238 /* Does a loop have a label ? */
239 #define LOOP_HAS_LABEL_P(LOOP) \
240 (ctxp->current_labeled_block \
241 && LABELED_BLOCK_BODY (ctxp->current_labeled_block) == (LOOP))
243 /* Same operation than the one performed above, but considering the
244 previous labeled block */
245 #define LOOP_HAS_LABEL_SKIP_P(LOOP) \
246 (ctxp->current_labeled_block \
247 && TREE_CHAIN (ctxp->current_labeled_block) \
248 && LABELED_BLOCK_BODY (TREE_CHAIN (ctxp->current_labeled_block)) == (LOOP))
250 #define PUSH_LABELED_BLOCK(B) \
252 TREE_CHAIN (B) = ctxp->current_labeled_block; \
253 ctxp->current_labeled_block = (B); \
255 #define POP_LABELED_BLOCK() \
256 ctxp->current_labeled_block = TREE_CHAIN (ctxp->current_labeled_block)
258 #define PUSH_LOOP(L) \
260 TREE_CHAIN (L) = ctxp->current_loop; \
261 ctxp->current_loop = (L); \
263 #define POP_LOOP() ctxp->current_loop = TREE_CHAIN (ctxp->current_loop)
265 /* Invocation modes, as returned by invocation_mode (). */
266 enum {
267 INVOKE_STATIC,
268 INVOKE_NONVIRTUAL,
269 INVOKE_SUPER,
270 INVOKE_INTERFACE,
271 INVOKE_VIRTUAL,
274 /* We need the resolution stuff only if we compile jc1 */
275 #ifndef JC1_LITE
277 /* Unresolved type identifiers handling. When we process the source
278 code, we blindly accept an unknown type identifier and try to
279 resolve it later. When an unknown type identifier is encountered
280 and used, we record in a struct jdep element what the incomplete
281 type is and what it should patch. Later, java_complete_class will
282 process all classes known to have unresolved type
283 dependencies. Within each of these classes, this routine will
284 process unresolved type dependencies (JDEP_TO_RESOLVE), patch what
285 needs to be patched in the dependent tree node (JDEP_GET_PATCH,
286 JDEP_APPLY_PATCH) and perform other actions dictated by the context
287 of the patch (JDEP_KIND). The ideas are: we patch only what needs
288 to be patched, and with java_complete_class called at the right
289 time, we will start processing incomplete function bodies tree
290 nodes with everything external to function's bodies already
291 completed, it makes things much simpler. */
293 enum jdep_code {
294 JDEP_NO_PATCH, /* Must be first */
295 JDEP_SUPER, /* Patch the type of one type
296 supertype. Requires some check
297 before it's done */
298 JDEP_FIELD, /* Patch the type of a class field */
300 /* JDEP_{METHOD,METHOD_RETURN,METHOD_END} to be kept in order */
301 JDEP_METHOD, /* Mark the beginning of the patching
302 of a method declaration, including
303 it's arguments */
304 JDEP_METHOD_RETURN, /* Mark the beginning of the patching
305 of a method declaration. Arguments
306 aren't patched, only the returned
307 type is */
308 JDEP_METHOD_END, /* Mark the end of the patching of a
309 method declaration. It indicates
310 that it's time to compute and
311 install a new signature */
313 JDEP_INTERFACE, /* Patch the type of a Class/interface
314 extension */
315 JDEP_VARIABLE, /* Patch the type of a variable declaration */
316 JDEP_PARM, /* Patch the type of a parm declaration */
317 JDEP_TYPE, /* Patch a random tree node type,
318 without the need for any specific
319 actions */
322 typedef struct _jdep {
323 #ifdef ONLY_INT_FIELDS
324 int kind : 8; /* Type of patch */
325 #else
326 enum jdep_code kind : 8;
327 #endif
329 int flag0 : 1; /* Some flags */
330 tree decl; /* Tied decl/or WFL */
331 tree solv; /* What to solve */
332 tree wfl; /* Where thing to resolve where found */
333 tree misc; /* Miscellaneous info (optional). */
334 tree *patch; /* Address of a location to patch */
335 struct _jdep *next; /* Linked list */
336 } jdep;
339 #define JDEP_DECL(J) ((J)->decl)
340 #define JDEP_DECL_WFL(J) ((J)->decl)
341 #define JDEP_KIND(J) ((J)->kind)
342 #define JDEP_SOLV(J) ((J)->solv)
343 #define JDEP_WFL(J) ((J)->wfl)
344 #define JDEP_MISC(J) ((J)->misc)
345 #define JDEP_CLASS(J) ((J)->class)
346 #define JDEP_APPLY_PATCH(J,P) (*(J)->patch = (P))
347 #define JDEP_GET_PATCH(J) ((J)->patch)
348 #define JDEP_CHAIN(J) ((J)->next)
349 #define JDEP_TO_RESOLVE(J) (TREE_PURPOSE ((J)->solv))
350 #define JDEP_RESOLVED_DECL(J) ((J)->solv ? TREE_PURPOSE ((J)->solv):NULL_TREE)
351 #define JDEP_RESOLVED(J, D) \
353 TREE_PURPOSE ((J)->solv) = D; \
354 TREE_VALUE ((J)->solv) = (J)->solv; \
356 #define JDEP_RESOLVED_P(J) (!(J)->solv || \
357 TREE_VALUE ((J)->solv) == (J)->solv)
359 typedef struct _jdeplist {
360 jdep *first;
361 jdep *last;
362 struct _jdeplist *next;
363 } jdeplist;
364 static jdeplist *reverse_jdep_list ();
366 #endif /* JC1_LITE */
368 #define CLASSD_FIRST(CD) ((CD)->first)
369 #define CLASSD_LAST(CD) ((CD)->last)
370 #define CLASSD_CHAIN(CD) ((CD)->next)
372 #define JDEP_INSERT(L,J) \
374 if (!(L)->first) \
375 (L)->last = (L)->first = (J); \
376 else \
378 JDEP_CHAIN ((L)->last) = (J); \
379 (L)->last = (J); \
383 /* Insert a DECL in the current block */
384 #define BLOCK_CHAIN_DECL(NODE) \
386 TREE_CHAIN ((NODE)) = \
387 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)); \
388 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) = (NODE); \
391 #define BLOCK_EXPR_DECLS(NODE) BLOCK_VARS(NODE)
392 #define BLOCK_EXPR_BODY(NODE) BLOCK_SUBBLOCKS(NODE)
393 #define BLOCK_EXPR_ORIGIN(NODE) BLOCK_ABSTRACT_ORIGIN(NODE)
395 /* Merge an other line to the source line number of a decl. Used to
396 remember function's end. */
397 #define DECL_SOURCE_LINE_MERGE(DECL,NO) DECL_SOURCE_LINE(DECL) |= (NO << 16)
399 /* Retrieve those two info separately. */
400 #define DECL_SOURCE_LINE_FIRST(DECL) (DECL_SOURCE_LINE(DECL) & 0x0000ffff)
401 #define DECL_SOURCE_LINE_LAST(DECL) (DECL_SOURCE_LINE(DECL) >> 16)
403 /* Build a WFL for expression nodes */
404 #define BUILD_EXPR_WFL(NODE, WFL) \
405 build_expr_wfl ((NODE), input_filename, EXPR_WFL_LINENO ((WFL)), \
406 EXPR_WFL_COLNO ((WFL)))
408 #define EXPR_WFL_QUALIFICATION(WFL) TREE_OPERAND ((WFL), 1)
409 #define QUAL_WFL(NODE) TREE_PURPOSE (NODE)
410 #define QUAL_RESOLUTION(NODE) TREE_VALUE (NODE)
411 #define QUAL_DECL_TYPE(NODE) \
412 (TREE_CODE (TREE_TYPE (NODE)) == POINTER_TYPE ? \
413 TREE_TYPE (TREE_TYPE (NODE)) : TREE_TYPE (NODE))
415 /* Handy macros for the walk operation */
416 #define COMPLETE_CHECK_OP(NODE, N) \
418 TREE_OPERAND ((NODE), (N)) = \
419 java_complete_tree (TREE_OPERAND ((NODE), (N))); \
420 if (TREE_OPERAND ((NODE), (N)) == error_mark_node) \
421 return error_mark_node; \
423 #define COMPLETE_CHECK_OP_0(NODE) COMPLETE_CHECK_OP(NODE, 0)
424 #define COMPLETE_CHECK_OP_1(NODE) COMPLETE_CHECK_OP(NODE, 1)
426 /* Building invocations: append(ARG) and StringBuffer(ARG) */
427 #define BUILD_APPEND(ARG) \
428 build_method_invocation (wfl_append, \
429 (ARG ? build_tree_list (NULL, (ARG)): NULL_TREE))
430 #define BUILD_STRING_BUFFER(ARG) \
431 build_new_invocation (wfl_string_buffer, \
432 (ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE))
434 /* Parser context data structure. */
435 struct parser_ctxt {
437 char *filename; /* Current filename */
438 FILE *finput; /* Current file input stream */
439 struct parser_ctxt *next;
441 struct java_line *p_line, *c_line; /* Previous and current line */
442 java_lc elc; /* Error's line column info */
443 unicode_t unget_utf8_value; /* An unget utf8 value */
444 int ccb_indent; /* Keep track of {} indent, lexer */
445 int first_ccb_indent1; /* First { at ident level 1 */
446 int last_ccb_indent1; /* Last } at ident level 1 */
447 int parser_ccb_indent; /* Keep track of {} indent, parser */
448 int osb_number; /* Keep track of ['s */
449 int minus_seen; /* Integral literal overflow */
450 int lineno; /* Current lineno */
451 int java_error_flag; /* Report error when true */
453 /* This section is defined only if we compile jc1 */
454 #ifndef JC1_LITE
455 tree modifier_ctx [11]; /* WFL of modifiers */
456 tree current_class; /* Current class */
457 tree current_function_decl; /* Current function decl, save/restore */
459 JCF *current_jcf; /* CU jcf */
461 int prevent_ese; /* Prevent expression statement error */
462 int class_err; /* Flag to report certain errors */
464 int formal_parameter_number; /* Number of parameters found */
465 int interface_number; /* # itfs declared to extend an itf def */
467 tree package; /* Defined package ID */
469 tree incomplete_class; /* List of non-complete classes */
470 tree current_parsed_class; /* Class currently parsed */
471 tree class_list; /* List of classes in a CU */
472 jdeplist *classd_list; /* Classe dependencies in a CU */
474 tree non_static_initialized; /* List of non static initialized fields */
475 tree static_initialized; /* List of static non final initialized */
477 tree import_list; /* List of import */
478 tree import_demand_list; /* List of import on demand */
480 tree current_loop; /* List of the currently nested loops */
481 tree current_labeled_block; /* List of currently nested
482 labeled blocks. */
484 int pending_block; /* Pending block to close */
485 #endif /* JC1_LITE */
488 /* Functions declarations */
489 #ifndef JC1_LITE
490 static char *java_accstring_lookup PROTO ((int));
491 static void parse_error PROTO ((char *));
492 static void classitf_redefinition_error PROTO ((char *,tree, tree, tree));
493 static void variable_redefinition_error PROTO ((tree, tree, tree, int));
494 static void check_modifiers PROTO ((char *, int, int));
495 static tree create_class PROTO ((int, tree, tree, tree));
496 static tree create_interface PROTO ((int, tree, tree));
497 static tree find_field PROTO ((tree, tree));
498 static tree lookup_field_wrapper PROTO ((tree, tree));
499 static int duplicate_declaration_error PROTO ((tree, tree, tree, tree));
500 static void register_fields PROTO ((int, tree, tree));
501 static tree parser_qualified_classname PROTO ((tree));
502 static int parser_check_super PROTO ((tree, tree, tree));
503 static int parser_check_super_interface PROTO ((tree, tree, tree));
504 static void check_modifiers_consistency PROTO ((int));
505 static tree lookup_cl PROTO ((tree));
506 static tree lookup_java_method2 PROTO ((tree, tree, int));
507 static tree method_header PROTO ((int, tree, tree, tree));
508 static tree method_declarator PROTO ((tree, tree));
509 static void parse_error_context VPROTO ((tree cl, char *msg, ...));
510 static void parse_warning_context VPROTO ((tree cl, char *msg, ...));
511 static tree parse_jdk1_1_error PROTO ((char *));
512 static void complete_class_report_errors PROTO ((jdep *));
513 static int process_imports PROTO ((void));
514 static void read_import_dir PROTO ((tree));
515 static int find_in_imports_on_demand PROTO ((tree));
516 static int find_in_imports PROTO ((tree));
517 static int check_pkg_class_access PROTO ((tree, tree));
518 static tree resolve_class PROTO ((tree, tree, tree));
519 static tree do_resolve_class PROTO ((tree, tree, tree));
520 static void declare_local_variables PROTO ((int, tree, tree));
521 static void source_start_java_method PROTO ((tree));
522 static void source_end_java_method PROTO ((void));
523 static void expand_start_java_method PROTO ((tree));
524 static tree find_name_in_single_imports PROTO ((tree));
525 static void check_abstract_method_header PROTO ((tree));
526 static tree lookup_java_interface_method2 PROTO ((tree, tree));
527 static tree resolve_expression_name PROTO ((tree));
528 static tree maybe_create_class_interface_decl PROTO ((tree, tree, tree));
529 static int check_class_interface_creation PROTO ((int, int, tree, tree, tree, tree));
530 static tree patch_method_invocation_stmt PROTO ((tree, tree, tree, int *));
531 static int breakdown_qualified PROTO ((tree *, tree *, tree));
532 static tree resolve_and_layout PROTO ((tree, tree));
533 static tree resolve_no_layout PROTO ((tree, tree));
534 static int identical_subpath_p PROTO ((tree, tree));
535 static int invocation_mode PROTO ((tree, int));
536 static tree find_applicable_accessible_methods_list PROTO ((tree, tree, tree));
537 static tree find_most_specific_methods_list PROTO ((tree));
538 static int argument_types_convertible PROTO ((tree, tree));
539 static tree patch_invoke PROTO ((tree, tree, tree, tree));
540 static tree lookup_method_invoke PROTO ((int, tree, tree, tree, tree));
541 static tree register_incomplete_type PROTO ((int, tree, tree, tree));
542 static tree obtain_incomplete_type PROTO ((tree));
543 static tree java_complete_tree PROTO ((tree));
544 static void java_complete_expand_method PROTO ((tree));
545 static int unresolved_type_p PROTO ((tree, tree *));
546 static void create_jdep_list PROTO ((struct parser_ctxt *));
547 static tree build_expr_block PROTO ((tree, tree));
548 static tree enter_block PROTO ((void));
549 static tree enter_a_block PROTO ((tree));
550 static tree exit_block PROTO ((void));
551 static tree lookup_name_in_blocks PROTO ((tree));
552 static void maybe_absorb_scoping_blocks PROTO ((void));
553 static tree build_method_invocation PROTO ((tree, tree));
554 static tree build_new_invocation PROTO ((tree, tree));
555 static tree build_assignment PROTO ((int, int, tree, tree));
556 static tree build_binop PROTO ((enum tree_code, int, tree, tree));
557 static tree patch_assignment PROTO ((tree, tree, tree ));
558 static tree patch_binop PROTO ((tree, tree, tree));
559 static tree build_unaryop PROTO ((int, int, tree));
560 static tree build_incdec PROTO ((int, int, tree, int));
561 static tree patch_unaryop PROTO ((tree, tree));
562 static tree build_cast PROTO ((int, tree, tree));
563 static tree patch_cast PROTO ((tree, tree, tree));
564 static int valid_ref_assignconv_cast_p PROTO ((tree, tree, int));
565 static int valid_builtin_assignconv_identity_widening_p PROTO ((tree, tree));
566 static int valid_cast_to_p PROTO ((tree, tree));
567 static int valid_method_invocation_conversion_p PROTO ((tree, tree));
568 static tree try_builtin_assignconv PROTO ((tree, tree, tree));
569 static tree try_reference_assignconv PROTO ((tree, tree));
570 static tree build_unresolved_array_type PROTO ((tree));
571 static tree build_array_ref PROTO ((int, tree, tree));
572 static tree patch_array_ref PROTO ((tree, tree, tree));
573 static tree make_qualified_name PROTO ((tree, tree, int));
574 static tree merge_qualified_name PROTO ((tree, tree));
575 static tree make_qualified_primary PROTO ((tree, tree, int));
576 static int resolve_qualified_expression_name PROTO ((tree, tree *, tree *, tree *));
577 static void qualify_ambiguous_name PROTO ((tree));
578 static void maybe_generate_clinit PROTO ((void));
579 static tree resolve_field_access PROTO ((tree, tree *, tree *));
580 static tree build_newarray_node PROTO ((tree, tree, int));
581 static tree patch_newarray PROTO ((tree));
582 static tree resolve_type_during_patch PROTO ((tree));
583 static int not_initialized_as_it_should_p PROTO ((tree));
584 static tree build_this PROTO ((int));
585 static tree build_return PROTO ((int, tree));
586 static tree patch_return PROTO ((tree));
587 static tree maybe_access_field PROTO ((tree, tree, tree));
588 static int complete_function_arguments PROTO ((tree));
589 static int check_for_static_method_reference PROTO ((tree, tree, tree, tree, tree));
590 static int not_accessible_p PROTO ((tree, tree, int));
591 static int class_in_current_package PROTO ((tree));
592 static tree build_if_else_statement PROTO ((int, tree, tree, tree));
593 static tree patch_if_else_statement PROTO ((tree));
594 static tree add_stmt_to_compound PROTO ((tree, tree, tree));
595 static tree add_stmt_to_block PROTO ((tree, tree, tree));
596 static tree patch_exit_expr PROTO ((tree));
597 static tree build_labeled_block PROTO ((int, tree, tree));
598 static tree generate_labeled_block PROTO (());
599 static tree complete_labeled_statement PROTO ((tree, tree));
600 static tree build_bc_statement PROTO ((int, int, tree));
601 static tree patch_bc_statement PROTO ((tree));
602 static tree patch_loop_statement PROTO ((tree));
603 static tree build_new_loop PROTO ((tree));
604 static tree build_loop_body PROTO ((int, tree, int));
605 static tree complete_loop_body PROTO ((int, tree, tree, int));
606 static tree build_debugable_stmt PROTO ((int, tree));
607 static tree complete_for_loop PROTO ((int, tree, tree, tree));
608 static tree patch_switch_statement PROTO ((tree));
609 static tree string_constant_concatenation PROTO ((tree, tree));
610 static tree build_string_concatenation PROTO ((tree, tree));
611 static tree patch_string_cst PROTO ((tree));
612 static tree patch_string PROTO ((tree));
613 static tree build_jump_to_finally PROTO ((tree, tree, tree, tree));
614 static tree build_try_statement PROTO ((int, tree, tree, tree));
615 static tree patch_try_statement PROTO ((tree));
617 void safe_layout_class PROTO ((tree));
618 void java_complete_class PROTO ((void));
619 void java_check_circular_reference PROTO ((void));
620 void java_check_final PROTO ((void));
621 void java_check_methods PROTO ((void));
622 void java_layout_classes PROTO ((void));
623 tree java_method_add_stmt PROTO ((tree, tree));
624 char *java_get_line_col PROTO ((char *, int, int));
625 void java_expand_switch PROTO ((tree));
626 tree java_get_catch_block PROTO ((tree, int));
627 #endif /* JC1_LITE */
629 /* Always in use, no matter what you compile */
631 void java_push_parser_context PROTO ((void));
632 void java_init_lex PROTO ((void));
633 int yyparse PROTO ((void));
634 int yylex ();
635 void yyerror PROTO ((char *));
637 #endif