3 # DP: J*va patch set for gcc-2.95.2
4 # DP: taken from http://waitaki.otago.ac.nz/~bryce/gcj/
6 # DP: This patch consists of new J*va features and fixes extracted
7 # DP: from cvs and back-ported to gcc-2.95.2. It allows compilation of the
8 # DP: latest libgcj snapshots and cvs tree without the problems of the
9 # DP: current unstable cvs gcc tree (last update 1999-10-31).
11 if [ $# -eq 3 -a "$2" = '-d' ]; then
13 elif [ $# -ne 1 ]; then
14 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
18 -patch) patch $pdir -f --no-backup-if-mismatch -p1 < $0;;
19 -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p1 < $0;;
21 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
26 Only in gcc-2.95.2/: build
27 diff -u -r gcc-2.95.2-orig/gcc/java/ChangeLog gcc-2.95.2/gcc/java/ChangeLog
28 --- gcc-2.95.2-orig/gcc/java/ChangeLog Mon Oct 25 19:59:13 1999
29 +++ gcc-2.95.2/gcc/java/ChangeLog Sun Oct 31 19:09:00 1999
31 +Fri Oct 29 14:35:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
33 + * class.c (add_method_1): Set DECL_INLINE to 1 for private, static
36 +Fri Oct 29 14:23:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
38 + * parse.y (expression_statement:): Call function to report
39 + improper invocation of a constructor.
40 + (parse_ctor_invocation_error): New function.
42 +1999-10-04 Tom Tromey <tromey@cygnus.com>
44 + * lex.h (BUILD_OPERATOR2): Return ASSIGN_ANY_TK in `lite' case as
45 + well. Fixes Java PR gcj/59.
46 + * parse-scan.y (yyerror): Report errors.
48 +Thu Oct 21 01:27:31 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
50 + * parse.y (resolve_qualified_expression_name): Handle MODIFY_EXPR.
51 + (qualify_ambiguous_name): Likewise.
53 +1999-10-21 Tom Tromey <tromey@cygnus.com>
55 + * jvgenmain.c (main): _Jv_Compiler_Properties now an extern; set
56 + in generated `main'.
58 +Tue Oct 12 22:28:10 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
60 + * jcf-write.c (RELOCATION_VALUE_1): Fixed integer value from 0 to 1.
62 +1999-10-07 Anthony Green <green@cygnus.com>
64 + * jcf-write.c (generate_classfile): Use UNSAFE_PUTx in cases
65 + where CHECK_PUT may fail for valid reasons.
67 + * jcf-write.c (UNSAFE_PUT1, UNSAFE_PUT2, UNSAFE_PUT3,
68 + UNSAFE_PUTN): New macros.
70 +Tue Sep 14 16:24:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
72 + * jcf-write.c: (RELOCATION_VALUE_0): New macro.
73 + (RELOCATION_VALUE_1): Likewise.
74 + (emit_iinc, emit_reloc, push_constant1, push_constant2,
75 + push_in_const, push_long_const): Prototyped.
76 + (push_constant1): Argument `index' is of type HOST_WIDE_INT.
77 + (push_constant2): Likewise.
78 + (push_int_const): Cast find_constant1's integer arguments to `jword'.
79 + (find_constant_wide): Cast find_constant2's integer arguments to
81 + (find_constant_index): Cast find_constant2's and find_constant2's
82 + integer arguments to `jword'.
83 + (emit_pop): Argument `value' is of type HOST_WIDE_INT.
84 + (emit_switch_reloc): Use RELOCATION_VALUE_0.
85 + (emit_if): Use RELOCATION_VALUE_1.
86 + (emit_goto): Likewise.
87 + (emit_jsr): Likewise.
88 + (generate_bytecode_insns): Use RELOCATION_VALUE_0. Cast second
89 + argument to push_long_const to HOST_WIDE_INT.
91 +Thu Sep 16 15:42:39 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
93 + * parse.y (java_method_add_stmt): Test against GET_CURRENT_BLOCK
96 +Sat Sep 11 16:46:44 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
98 + * parse.y (find_applicable_accessible_methods_list): Search
99 + abstract classes as interfaces.
101 +Thu Sep 9 17:33:28 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
103 + * class.c (finish_class): We're now outside a valid method
104 + declaration. Tell the rest of gcc so.
106 +1999-09-07 Tom Tromey <tromey@cygnus.com>
108 + * gjavah.c (add_class_decl): Generate include for gcj/array.h, not
110 + (decode_signature_piece): Don't emit "::" in JArray<>.
111 + (print_namelet): Only print trailing `;' when printing a class.
113 +1999-09-03 Tom Tromey <tromey@cygnus.com>
115 + * parse.y (strip_out_static_field_access_decl): Return operand if
116 + it satisfies JDECL_P.
118 +1999-09-02 Tom Tromey <tromey@cygnus.com>
120 + * gjavah.c (decode_signature_piece): Emit "::" in JArray<>.
121 + Handle nested arrays, like `[[I'.
123 +1999-08-26 Tom Tromey <tromey@cygnus.com>
125 + * gjavah.c (print_cxx_classname): Print "::" before qualified
128 +1999-10-19 Tom Tromey <tromey@cygnus.com>
130 + * jcf-parse.c (parse_source_file): Call jcf_dependency_add_file.
131 + From Mike Moreton <mike@pillim.demon.co.uk>.
133 +1999-09-23 Tom Tromey <tromey@cygnus.com>
135 + * jvspec.c (lang_specific_driver): Don't read spec file if
136 + -fsyntax-only given.
138 +1999-09-22 Tom Tromey <tromey@cygnus.com>
140 + * lang-specs.h: Added `%(jc1)' to the jc1 spec.
142 +1999-08-25 Tom Tromey <tromey@cygnus.com>
144 + * jvspec.c (lang_specific_driver): Correctly handle --help again.
146 +1999-10-14 Tom Tromey <tromey@cygnus.com>
148 + * jvgenmain.c (usage): New function.
149 + (main): Use it. Also, handle `-D' options.
150 + * jvspec.c (lang_specific_driver): Recognize -D.
151 + (jvgenmain_spec): Added `%{D*}' to jvgenmain invocation.
153 +Thu Aug 26 09:10:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
155 + * parse.y (lookup_cl): Changed leading comment. Now does its best
156 + to set the column number.
157 + (qualify_ambiguous_name): Take WFL wrappers into account.
159 +Wed Aug 25 15:37:15 1999 Gregg Townsend <gmt@cs.arizona.edu>
161 + * verify.c (verify_jvm_instructions): Don't check instruction
162 + validity beyond end of method.
164 +Sun Aug 22 11:07:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
166 + * parse.y (check_method_redefinition): Changed leading comment.
167 + (check_abstract_method_definitions): New function.
168 + (java_check_abstract_method_definitions): New function.
169 + (java_check_regular_methods): Call it.
170 + (verify_constructor_super): Fixed indentation.
171 + (lookup_method_invoke): Likewise.
173 +Thu Aug 19 10:26:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
175 + * parse.y (method_header): Return a null pointer if the current
176 + class node is null.
177 + (finish_method_declaration): Return if the current function decl
179 + (source_start_java_method): Likewise.
180 + (java_method_add_stmt): Likewise.
182 +Wed Aug 18 13:17:15 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
184 + * class.c (emit_register_class): Removed unnecessary call to
186 + * parse.y (labeled_block_contains_loop_p): Removed unused local
189 +Tue Aug 17 22:51:44 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
191 + * parse.y (java_refold): Added prototype.
193 +Tue Aug 17 21:48:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
195 + * parse.y (BINOP_COMPOUND_CANDIDATES): New macro.
196 + (java_stabilize_reference): Removed unnecessary `else'.
197 + (java_complete_lhs): Set flag to remember boolean. Call
198 + java_refold. Added comments.
199 + (java_decl_equiv): New function.
200 + (binop_compound_p): Likewise.
201 + (java_refold): Likewise.
202 + (patch_unaryop): Striped static field access assigned to decl and
203 + op. Changed promotion scheme for ++/-- operators.
204 + (search_loop): New function.
205 + (labeled_block_contains_loop_p): Likewise.
206 + (patch_loop_statement): Call labeled_block_contains_loop_p. Added
208 + (patch_bc_statement): Call search_loop. Fixed comment.
210 +1999-08-15 Anthony Green <green@cygnus.com>
212 + * expr.c (java_lang_expand_expr): Mark static array data as
215 +1999-07-25 Anthony Green <green@cygnus.com>
217 + * gjavah.c (print_stub): New function.
218 + (METHOD_IS_NATIVE): New macro.
219 + (print_mangled_classname): Make static.
220 + (HANDLE_END_FIELD): Don't emit fields during stub generation.
221 + (process_file): Perform stub generation.
222 + (HANDLE_METHOD): Don't emit class decls during stub
224 + (HANDLE_END_METHOD): Take into account stub generation.
225 + (print_method_info): Handle stub generation.
226 + (print_stub): New function.
227 + (print_cxx_classname): Make signature consistant with others.
228 + (help): Describe -stubs option.
229 + (main): Create stub file.
230 + (version): Use version.c.
231 + (print_full_cxx_name): New function.
232 + (print_c_decl): Use print_full_cxx_name.
234 +Thu Jul 22 12:41:12 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
236 + * check-init.c (check_init): Handle MAX_EXPR.
238 +1999-07-15 Andrew Haley <aph@cygnus.com>
240 + * lang.c (flag_use_divide_subroutine): New variable.
241 + * typeck.c: (convert_ieee_real_to_integer): Bounds check
242 + fp-to-integer conversion.
243 + (convert): Call convert_ieee_real_to_integer when flag_fast_math
246 + * expr.c (build_java_soft_divmod): New function.
247 + (build_java_binop): Call build_java_soft_divmod if
248 + flag_use_divide_subroutine is set.
249 + * decl.c: soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
250 + soft_lrem_node: new builtin functions.
251 + (init_decl_processing) Initialize the new builtins.
252 + * java-tree.h soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
253 + soft_lrem_node: new builtin functions.
254 + (build_java_soft_divmod): New function.
255 + * parse.y: Call build_java_soft_divmod if
256 + flag_use_divide_subroutine is set.
257 + * parse.c: Rebuilt.
259 + * jvspec.c (lang_specific_driver): Always allow an extra arg (for
260 + a --specs= arg) even if not linking.
261 + * lang-options.h (DEFINE_LANG_NAME ("Java")): Add
262 + -fuse-divide-subroutine
264 +Tue Jul 20 13:20:05 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
266 + * parse.y (resolve_and_layout): Check methods only once.
267 + (resolve_qualified_expression_name): Verify thrown exceptions
269 + (check_thrown_exceptions): Reject exceptions thrown in
270 + initializer. Error message tuned.
272 +1999-07-14 Andrew Haley <aph@cygnus.com>
274 + * expr.c (expand_expr): Do not return the last statement in a
275 + block as the block's value.
277 +Sat Jul 3 22:26:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
279 + * expr.c (force_evaluation_order): Save the COMPOUND_EXPR'ed
280 + CALL_EXPR, to avoid order of evaluation changes.
282 +Fri Jul 2 17:44:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
284 + * parse.y (qualify_ambiguous_name): Do not use
285 + IDENTIFIER_LOCAL_VALUE when name is a STRING_CST.
287 +Thu Jul 1 23:31:16 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
289 + * check-init.c (check_init): Handle MAX_EXPR.
290 + * expr.c (force_evaluation_order): Force method call arguments to
291 + be evaluated in left-to-right order.
292 + * parse.y (qualify_ambiguous_name): Loop again to qualify
293 + NEW_ARRAY_EXPR properly.
295 +Wed Jun 30 17:27:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
297 + * parse.y (patch_invoke): Resolve unresolved invoked method
299 + (qualify_ambiguous_name): STRING_CST to qualify expression for
300 + type name resolution.
302 +1999-06-24 Andrew Haley <aph@cygnus.com>
304 + * java/class.c (finish_class): Whenever a deferred method is
305 + output, rescan the list of methods to see if a new candidate for
306 + output can be found.
309 +======================================================================
314 Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com)
316 * gcc-2.95.2 Released.
317 diff -u -r gcc-2.95.2-orig/gcc/java/check-init.c gcc-2.95.2/gcc/java/check-init.c
318 --- gcc-2.95.2-orig/gcc/java/check-init.c Sat May 15 01:44:08 1999
319 +++ gcc-2.95.2/gcc/java/check-init.c Sun Oct 31 12:32:14 1999
328 check_init (TREE_OPERAND (exp, 0), before);
329 diff -u -r gcc-2.95.2-orig/gcc/java/class.c gcc-2.95.2/gcc/java/class.c
330 --- gcc-2.95.2-orig/gcc/java/class.c Fri Jun 25 15:27:08 1999
331 +++ gcc-2.95.2/gcc/java/class.c Sun Oct 31 19:08:09 1999
332 @@ -425,10 +425,13 @@
334 if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1;
335 if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1;
336 - if (access_flags & ACC_PRIVATE) METHOD_PRIVATE (fndecl) = 1;
337 + if (access_flags & ACC_PRIVATE)
338 + METHOD_PRIVATE (fndecl) = DECL_INLINE (fndecl) = 1;
339 if (access_flags & ACC_NATIVE) METHOD_NATIVE (fndecl) = 1;
340 - if (access_flags & ACC_STATIC) METHOD_STATIC (fndecl) = 1;
341 - if (access_flags & ACC_FINAL) METHOD_FINAL (fndecl) = 1;
342 + if (access_flags & ACC_STATIC)
343 + METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1;
344 + if (access_flags & ACC_FINAL)
345 + METHOD_FINAL (fndecl) = DECL_INLINE (fndecl) = 1;
346 if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1;
347 if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1;
348 if (access_flags & ACC_TRANSIENT) METHOD_TRANSIENT (fndecl) = 1;
349 @@ -1200,10 +1203,10 @@
353 + tree type_methods = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
355 - /* Emit deferred inline methods. */
356 - for ( method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
357 - method != NULL_TREE; method = TREE_CHAIN (method))
358 + /* Emit deferred inline methods. */
359 + for (method = type_methods; method != NULL_TREE; )
361 if (! TREE_ASM_WRITTEN (method) && DECL_SAVED_INSNS (method) != 0)
363 @@ -1215,10 +1218,16 @@
364 temporary_allocation ();
365 output_inline_function (method);
366 permanent_allocation (1);
367 + /* Scan the list again to see if there are any earlier
368 + methods to emit. */
369 + method = type_methods;
373 + method = TREE_CHAIN (method);
376 + current_function_decl = NULL_TREE;
377 make_class_data (current_class);
379 rest_of_decl_compilation (TYPE_NAME (current_class), (char*) 0, 1, 0);
380 @@ -1721,7 +1730,6 @@
385 init_decl = build_decl (FUNCTION_DECL, init_name, init_type);
386 DECL_ASSEMBLER_NAME (init_decl) = init_name;
387 TREE_STATIC (init_decl) = 1;
388 Only in gcc-2.95.2/gcc/java: class.c.orig
389 diff -u -r gcc-2.95.2-orig/gcc/java/decl.c gcc-2.95.2/gcc/java/decl.c
390 --- gcc-2.95.2-orig/gcc/java/decl.c Sat Jun 5 20:18:17 1999
391 +++ gcc-2.95.2/gcc/java/decl.c Sat Oct 30 19:53:18 1999
393 tree soft_lookupinterfacemethod_node;
395 tree soft_exceptioninfo_call_node;
396 +tree soft_idiv_node;
397 +tree soft_irem_node;
398 +tree soft_ldiv_node;
399 +tree soft_lrem_node;
402 /* Build (and pushdecl) a "promoted type" for all standard
403 types shorter than int. */
405 BUILT_IN_FMOD, "fmodf");
409 + = builtin_function ("_Jv_divI",
410 + build_function_type (int_type_node, t),
411 + NOT_BUILT_IN, NULL_PTR);
414 + = builtin_function ("_Jv_remI",
415 + build_function_type (int_type_node, t),
416 + NOT_BUILT_IN, NULL_PTR);
419 + = builtin_function ("_Jv_divJ",
420 + build_function_type (long_type_node, t),
421 + NOT_BUILT_IN, NULL_PTR);
424 + = builtin_function ("_Jv_remJ",
425 + build_function_type (long_type_node, t),
426 + NOT_BUILT_IN, NULL_PTR);
428 init_class_processing ();
431 Only in gcc-2.95.2/gcc/java: decl.c.orig
432 diff -u -r gcc-2.95.2-orig/gcc/java/expr.c gcc-2.95.2/gcc/java/expr.c
433 --- gcc-2.95.2-orig/gcc/java/expr.c Sat Jun 5 20:18:19 1999
434 +++ gcc-2.95.2/gcc/java/expr.c Sun Oct 31 13:00:28 1999
435 @@ -1052,6 +1052,53 @@
436 expand_assignment (local_var, res, 0, 0);
441 +build_java_soft_divmod (op, type, op1, op2)
443 + tree type, op1, op2;
446 + tree arg1 = convert (type, op1);
447 + tree arg2 = convert (type, op2);
449 + if (type == int_type_node)
453 + case TRUNC_DIV_EXPR:
454 + call = soft_idiv_node;
456 + case TRUNC_MOD_EXPR:
457 + call = soft_irem_node;
461 + else if (type == long_type_node)
465 + case TRUNC_DIV_EXPR:
466 + call = soft_ldiv_node;
468 + case TRUNC_MOD_EXPR:
469 + call = soft_lrem_node;
475 + fatal ("Internal compiler error in build_java_soft_divmod");
477 + call = build (CALL_EXPR, type,
478 + build_address_of (call),
479 + tree_cons (NULL_TREE, arg1,
480 + build_tree_list (NULL_TREE, arg2)),
487 build_java_binop (op, type, arg1, arg2)
489 @@ -1100,10 +1147,11 @@
491 return fold (build (COND_EXPR, int_type_node,
492 ifexp1, integer_negative_one_node, second_compare));
496 + case TRUNC_DIV_EXPR:
498 - if (TREE_CODE (type) == REAL_TYPE)
499 + if (TREE_CODE (type) == REAL_TYPE
500 + && op == TRUNC_MOD_EXPR)
503 if (type != double_type_node)
504 @@ -1120,6 +1168,12 @@
505 call = convert (type, call);
509 + if (TREE_CODE (type) == INTEGER_TYPE
510 + && flag_use_divide_subroutine
511 + && ! flag_syntax_only)
512 + return build_java_soft_divmod (op, type, arg1, arg2);
517 @@ -1881,6 +1935,7 @@
518 DECL_INITIAL (init_decl) = init;
519 DECL_IGNORED_P (init_decl) = 1;
520 TREE_READONLY (init_decl) = 1;
521 + TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1;
522 make_decl_rtl (init_decl, NULL, 1);
525 @@ -1895,7 +1950,6 @@
528 tree body = BLOCK_EXPR_BODY (exp);
529 - struct rtx_def *to_return;
530 pushlevel (2); /* 2 and above */
531 expand_start_bindings (0);
532 local = BLOCK_EXPR_DECLS (exp);
533 @@ -1913,10 +1967,11 @@
535 body = TREE_OPERAND (body, 1);
537 - to_return = expand_expr (body, target, tmode, modifier);
538 + expand_expr (body, const0_rtx, VOIDmode, 0);
541 expand_end_bindings (getdecls (), 1, 0);
547 @@ -2578,6 +2633,10 @@
549 We fix this by using save_expr. This forces the sub-operand to be
550 copied into a fresh virtual register,
552 + For method invocation, we modify the arguments so that a
553 + left-to-right order evaluation is performed. Saved expressions
554 + will, in CALL_EXPR order, be reused when the call will be expanded.
558 @@ -2593,19 +2652,30 @@
560 else if (TREE_CODE (node) == CALL_EXPR || TREE_CODE (node) == NEW_CLASS_EXPR)
562 - tree last_side_effecting_arg = NULL_TREE;
563 - tree arg = TREE_OPERAND (node, 1);
564 - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg))
567 + if (!TREE_OPERAND (node, 1))
570 + /* This reverses the evaluation order. This is a desired effect. */
571 + for (cmp = NULL_TREE, arg = TREE_OPERAND (node, 1);
572 + arg; arg = TREE_CHAIN (arg))
574 - if (TREE_SIDE_EFFECTS (TREE_VALUE (arg)))
575 - last_side_effecting_arg = arg;
576 + tree saved = save_expr (TREE_VALUE (arg));
577 + cmp = (cmp == NULL_TREE ? saved :
578 + build (COMPOUND_EXPR, void_type_node, cmp, saved));
579 + TREE_VALUE (arg) = saved;
581 - arg = TREE_OPERAND (node, 1);
582 - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg))
584 + if (cmp && TREE_CODE (cmp) == COMPOUND_EXPR)
585 + TREE_SIDE_EFFECTS (cmp) = 1;
589 - if (arg == last_side_effecting_arg)
591 - TREE_VALUE (arg) = save_expr (TREE_VALUE (arg));
592 + cmp = save_expr (build (COMPOUND_EXPR, TREE_TYPE (node), cmp, node));
593 + CAN_COMPLETE_NORMALLY (cmp) = CAN_COMPLETE_NORMALLY (node);
594 + TREE_SIDE_EFFECTS (cmp) = 1;
599 Only in gcc-2.95.2/gcc/java: expr.c.orig
600 Only in gcc-2.95.2/gcc/java: expr.c.rej
601 diff -u -r gcc-2.95.2-orig/gcc/java/gjavah.c gcc-2.95.2/gcc/java/gjavah.c
602 --- gcc-2.95.2-orig/gcc/java/gjavah.c Fri May 14 00:05:02 1999
603 +++ gcc-2.95.2/gcc/java/gjavah.c Sat Oct 30 15:06:45 1999
605 #include "java-tree.h"
606 #include "java-opcodes.h"
608 +#include "version.c"
610 /* The output file. */
614 #define METHOD_IS_FINAL(Class, Method) \
615 (((Class) & ACC_FINAL) || ((Method) & (ACC_FINAL | ACC_PRIVATE)))
617 +/* Pass this macro the flags for a method. It will return true if the
618 + method is native. */
619 +#define METHOD_IS_NATIVE(Method) \
620 + ((Method) & ACC_NATIVE)
622 /* We keep a linked list of all method names we have seen. This lets
623 us determine if a method name and a field name are in conflict. */
625 @@ -100,11 +107,15 @@
626 /* List of method names we've seen. */
627 static struct method_name *method_name_list;
629 -static void print_field_info PROTO ((FILE *, JCF*, int, int, JCF_u2));
630 -static void print_method_info PROTO ((FILE *, JCF*, int, int, JCF_u2));
631 +static void print_field_info PROTO ((FILE*, JCF*, int, int, JCF_u2));
632 +static void print_mangled_classname PROTO ((FILE*, JCF*, const char*, int));
633 +static int print_cxx_classname PROTO ((FILE*, const char*, JCF*, int));
634 +static void print_method_info PROTO ((FILE*, JCF*, int, int, JCF_u2));
635 static void print_c_decl PROTO ((FILE*, JCF*, int, int, int, const char *));
636 -static void decompile_method PROTO ((FILE *, JCF *, int));
637 -static void add_class_decl PROTO ((FILE *, JCF *, JCF_u2));
638 +static void print_stub PROTO ((FILE*, JCF*, int, int, int, const char *));
639 +static void print_full_cxx_name PROTO ((FILE*, JCF*, int, int, int, const char *));
640 +static void decompile_method PROTO ((FILE*, JCF*, int));
641 +static void add_class_decl PROTO ((FILE*, JCF*, JCF_u2));
643 static int java_float_finite PROTO ((jfloat));
644 static int java_double_finite PROTO ((jdouble));
645 @@ -130,13 +141,13 @@
646 #define HANDLE_END_FIELD() \
650 + if (out && ! stubs) \
651 print_field_info (out, jcf, current_field_name, \
652 current_field_signature, \
653 current_field_flags); \
656 - add_class_decl (out, jcf, current_field_signature);
657 + if (! stubs) add_class_decl (out, jcf, current_field_signature);
659 #define HANDLE_CONSTANTVALUE(VALUEINDEX) current_field_value = (VALUEINDEX)
661 @@ -151,14 +162,14 @@
662 print_method_info (out, jcf, NAME, SIGNATURE, ACCESS_FLAGS); \
665 - add_class_decl (out, jcf, SIGNATURE);
666 + if (! stubs) add_class_decl (out, jcf, SIGNATURE);
668 #define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
669 if (out && method_declared) decompile_method (out, jcf, CODE_LENGTH);
671 static int decompiled = 0;
672 #define HANDLE_END_METHOD() \
673 - if (out && method_printed) fputs (decompiled ? "\n" : ";\n", out);
674 + if (out && method_printed) fputs (decompiled || stubs ? "\n" : ";\n", out);
676 #include "jcf-reader.c"
678 @@ -562,24 +573,36 @@
682 - method_printed = 1;
683 - generate_access (stream, flags);
686 - if ((flags & ACC_STATIC))
687 - fputs ("static ", out);
688 - else if (! METHOD_IS_FINAL (jcf->access_flags, flags))
691 - /* Don't print `virtual' if we have a constructor. */
693 - fputs ("virtual ", out);
695 - print_c_decl (out, jcf, name_index, sig_index, is_init, override);
696 + method_printed = 1;
698 - if ((flags & ACC_ABSTRACT))
699 - fputs (" = 0", out);
700 + generate_access (stream, flags);
703 + if ((flags & ACC_STATIC))
704 + fputs ("static ", out);
705 + else if (! METHOD_IS_FINAL (jcf->access_flags, flags))
707 + /* Don't print `virtual' if we have a constructor. */
709 + fputs ("virtual ", out);
711 + print_c_decl (out, jcf, name_index, sig_index, is_init, override);
713 + if ((flags & ACC_ABSTRACT))
714 + fputs (" = 0", out);
716 + method_declared = 1;
719 - method_declared = 1;
721 + if (METHOD_IS_NATIVE(flags))
723 + method_printed = 1;
724 + print_stub (out, jcf, name_index, sig_index, is_init, override);
729 /* Try to decompile a method body. Right now we just try to handle a
730 @@ -653,10 +676,13 @@
734 + int array_depth = 0;
736 switch (signature[0])
739 + /* More spaghetti. */
741 for (signature++; (signature < limit
743 && *signature <= '9'); signature++)
744 @@ -671,13 +697,17 @@
745 case 'S': ctype = "jshortArray"; goto printit;
746 case 'J': ctype = "jlongArray"; goto printit;
747 case 'Z': ctype = "jbooleanArray"; goto printit;
748 - case '[': ctype = "jobjectArray"; goto printit;
750 + /* We have a nested array. */
752 + fputs ("JArray<", stream);
756 - /* We have to generate a reference to JArray here,
757 - so that our output matches what the compiler
759 + /* We have to generate a reference to JArray here, so that
760 + our output matches what the compiler does. */
762 - fputs ("JArray<", stream);
763 + fputs ("JArray<", stream);
764 while (signature < limit && *signature != ';')
766 int ch = UTF8_GET (signature, limit);
768 case 'Z': ctype = "jboolean"; goto printit;
769 case 'V': ctype = "void"; goto printit;
771 + /* Print a leading "::" so we look in the right namespace. */
772 + fputs ("::", stream);
774 while (*signature && *signature != ';')
780 + while (array_depth-- > 0)
781 + fputs ("> *", stream);
786 @@ -791,40 +826,121 @@
787 /* Now print the name of the thing. */
791 - fputs (name_override, stream);
792 - else if (name_index)
794 - /* Declare constructors specially. */
796 - print_base_classname (stream, jcf, jcf->this_class);
798 - print_name (stream, jcf, name_index);
800 + print_full_cxx_name (stream, jcf, name_index,
801 + signature_index, is_init, name_override);
806 +// Print the unqualified method name followed by the signature.
808 +DEFUN(print_full_cxx_name, (stream, jcf, name_index, signature_index, is_init, name_override),
809 + FILE* stream AND JCF* jcf
810 + AND int name_index AND int signature_index AND int is_init
811 + AND const char *name_override)
813 + int length = JPOOL_UTF_LENGTH (jcf, signature_index);
814 + unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
815 + register unsigned char *str = str0;
816 + unsigned char *limit = str + length;
817 + int need_space = 0;
818 + int is_method = str[0] == '(';
819 + unsigned char *next;
822 + fputs (name_override, stream);
823 + else if (name_index)
825 + /* Declare constructors specially. */
827 + print_base_classname (stream, jcf, jcf->this_class);
829 + print_name (stream, jcf, name_index);
834 + /* Have a method or a constructor. Print signature pieces
836 + fputs (" (", stream);
838 + while (str < limit && *str != ')')
840 - /* Have a method or a constructor. Print signature pieces
842 - fputs (" (", stream);
844 - while (str < limit && *str != ')')
845 + next = decode_signature_piece (stream, str, limit, &need_space);
848 - next = decode_signature_piece (stream, str, limit, &need_space);
851 - fprintf (stderr, "unparseable signature: `%s'\n", str0);
855 + fprintf (stderr, "unparseable signature: `%s'\n", str0);
860 + if (next < limit && *next != ')')
861 + fputs (", ", stream);
865 + fputs (")", stream);
870 +DEFUN(print_stub, (stream, jcf, name_index, signature_index, is_init,
872 + FILE* stream AND JCF* jcf
873 + AND int name_index AND int signature_index
874 + AND int is_init AND const char *name_override)
876 + if (JPOOL_TAG (jcf, signature_index) != CONSTANT_Utf8)
878 + fprintf (stream, "<not a UTF8 constant>");
883 + int length = JPOOL_UTF_LENGTH (jcf, signature_index);
884 + unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
885 + register unsigned char *str = str0;
886 + unsigned char *limit = str + length;
887 + int need_space = 0;
888 + int is_method = str[0] == '(';
889 + unsigned char *next;
891 - if (next < limit && *next != ')')
892 - fputs (", ", stream);
894 + /* If printing a method, skip to the return signature and print
895 + that first. However, there is no return value if this is a
897 + if (is_method && ! is_init)
899 + while (str < limit)
907 - fputs (")", stream);
908 + /* If printing a field or an ordinary method, then print the
909 + "return value" now. */
910 + if (! is_method || ! is_init)
912 + next = decode_signature_piece (stream, str, limit, &need_space);
915 + fprintf (stderr, "unparseable signature: `%s'\n", str0);
921 + /* Now print the name of the thing. */
922 + print_cxx_classname (stream, "\n", jcf, jcf->this_class);
923 + fputs ("::", stream);
924 + print_full_cxx_name (stream, jcf, name_index,
925 + signature_index, is_init, name_override);
926 + fputs ("\n{\n JvFail (\"", stream);
927 + print_cxx_classname (stream, "", jcf, jcf->this_class);
928 + fputs ("::", stream);
929 + print_full_cxx_name (stream, jcf, name_index,
930 + signature_index, is_init, name_override);
931 + fputs (" not implemented\");\n}\n\n", stream);
937 print_cxx_classname (stream, prefix, jcf, index)
940 + const char *prefix;
947 fputs (prefix, stream);
949 + /* Print a leading "::" so we look in the right namespace. */
950 + fputs ("::", stream);
954 c = UTF8_GET (s, limit);
955 @@ -1071,7 +1191,10 @@
957 for (i = 0; i < depth; ++i)
959 - fputs ("};\n", out);
960 + fputs ("}\n", out);
961 + /* Only print a `;' when printing a class. C++ is evil. */
962 + if (name->is_class)
967 @@ -1103,7 +1226,7 @@
968 /* If we see an array, then we include the array header. */
971 - print_include (out, "java-array", -1);
972 + print_include (out, "gcj/array", -1);
976 @@ -1204,30 +1327,49 @@
977 jcf_parse_class (jcf);
979 if (written_class_count++ == 0 && out)
980 - fputs ("// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-\n\n",
983 + fputs ("// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-\n\n",
987 + fputs ("// This file was created by `gcjh -stubs'. It is -*- c++ -*-.
989 +// This file is intended to give you a head start on implementing native
990 +// methods using CNI.
991 +// Be aware: running `gcjh -stubs' once more for this class may overwrite any
992 +// edits you have made to this file.\n\n", out);
997 - print_mangled_classname (out, jcf, "#ifndef __", jcf->this_class);
998 - fprintf (out, "__\n");
1000 - print_mangled_classname (out, jcf, "#define __", jcf->this_class);
1001 - fprintf (out, "__\n\n");
1003 - /* We do this to ensure that inline methods won't be `outlined'
1004 - by g++. This works as long as method and fields are not
1005 - added by the user. */
1006 - fprintf (out, "#pragma interface\n");
1009 - if (jcf->super_class && out)
1012 - unsigned char *supername = super_class_name (jcf, &super_length);
1014 - fputs ("\n", out);
1015 - print_include (out, supername, super_length);
1018 + print_mangled_classname (out, jcf, "#ifndef __", jcf->this_class);
1019 + fprintf (out, "__\n");
1021 + print_mangled_classname (out, jcf, "#define __", jcf->this_class);
1022 + fprintf (out, "__\n\n");
1024 + /* We do this to ensure that inline methods won't be `outlined'
1025 + by g++. This works as long as method and fields are not
1026 + added by the user. */
1027 + fprintf (out, "#pragma interface\n");
1029 + if (jcf->super_class)
1032 + unsigned char *supername = super_class_name (jcf, &super_length);
1034 + fputs ("\n", out);
1035 + print_include (out, supername, super_length);
1040 + /* Strip off the ".class" portion of the name when printing
1041 + the include file name. */
1042 + print_include (out, jcf->classname, strlen (jcf->classname) - 6);
1046 /* We want to parse the methods first. But we need to find where
1047 @@ -1246,31 +1388,37 @@
1051 - print_class_decls (out, jcf, jcf->this_class);
1054 + print_class_decls (out, jcf, jcf->this_class);
1056 for (i = 0; i < prepend_count; ++i)
1057 fprintf (out, "%s\n", prepend_specs[i]);
1058 if (prepend_count > 0)
1062 - if (out && ! print_cxx_classname (out, "class ", jcf, jcf->this_class))
1064 - fprintf (stderr, "class is of array type\n");
1068 - if (out && jcf->super_class)
1070 - if (! print_cxx_classname (out, " : public ", jcf, jcf->super_class))
1074 - fprintf (stderr, "base class is of array type\n");
1077 + if (! print_cxx_classname (out, "class ", jcf, jcf->this_class))
1079 + fprintf (stderr, "class is of array type\n");
1083 + if (jcf->super_class)
1085 + if (! print_cxx_classname (out, " : public ",
1086 + jcf, jcf->super_class))
1088 + fprintf (stderr, "base class is of array type\n");
1094 + fputs ("\n{\n", out);
1098 - fputs ("\n{\n", out);
1100 /* Now go back for second pass over methods and fields. */
1101 JCF_SEEK (jcf, method_start);
1102 @@ -1297,15 +1445,20 @@
1103 for (i = 0; i < add_count; ++i)
1104 fprintf (out, " %s\n", add_specs[i]);
1106 - fputs ("};\n", out);
1108 + fputs ("};\n", out);
1110 if (append_count > 0)
1112 for (i = 0; i < append_count; ++i)
1113 fprintf (out, "%s\n", append_specs[i]);
1115 - print_mangled_classname (out, jcf, "\n#endif /* __", jcf->this_class);
1116 - fprintf (out, "__ */\n");
1119 + print_mangled_classname (out, jcf,
1120 + "\n#endif /* __", jcf->this_class);
1121 + fprintf (out, "__ */\n");
1126 @@ -1327,6 +1480,7 @@
1127 printf (" -d DIRECTORY Set output directory name\n");
1128 printf (" --help Print this help, then exit\n");
1129 printf (" -o FILE Set output file name\n");
1130 + printf (" -stubs Generate a C++ implementation stub file\n");
1131 printf (" -td DIRECTORY Set temporary directory name\n");
1132 printf (" -v, --verbose Print extra information while running\n");
1133 printf (" --version Print version number, then exit\n");
1134 @@ -1346,8 +1500,8 @@
1137 /* FIXME: use version.c? */
1138 - printf ("gcjh (GNU gcc) 0.0\n\n");
1139 - printf ("Copyright (C) 1998 Free Software Foundation, Inc.\n");
1140 + printf ("gcjh (%s)\n\n", version_string);
1141 + printf ("Copyright (C) 1998, 1999 Free Software Foundation, Inc.\n");
1142 printf ("This is free software; see the source for copying conditions. There is NO\n");
1143 printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
1145 @@ -1548,7 +1702,7 @@
1147 int dir_len = strlen (output_directory);
1148 int i, classname_length = strlen (classname);
1149 - current_output_file = (char*) ALLOC (dir_len + classname_length + 4);
1150 + current_output_file = (char*) ALLOC (dir_len + classname_length + 5);
1151 strcpy (current_output_file, output_directory);
1152 if (dir_len > 0 && output_directory[dir_len-1] != '/')
1153 current_output_file[dir_len++] = '/';
1154 @@ -1574,7 +1728,8 @@
1155 jcf_dependency_set_dep_file (current_output_file);
1158 - strcpy (current_output_file + dir_len, ".h");
1159 + strcpy (current_output_file + dir_len,
1160 + stubs ? ".cc" : ".h");
1161 jcf_dependency_set_target (current_output_file);
1162 if (! suppress_output)
1164 @@ -1601,10 +1756,9 @@
1168 - * Do whatever the javah -stubs flag does.
1170 * Emit "structure forward declarations" when needed.
1172 * Generate C headers, like javah
1176 Only in gcc-2.95.2/gcc/java: gjavah.c.orig
1177 Only in gcc-2.95.2/gcc/java: gjavah.c.rej
1178 diff -u -r gcc-2.95.2-orig/gcc/java/java-tree.h gcc-2.95.2/gcc/java/java-tree.h
1179 --- gcc-2.95.2-orig/gcc/java/java-tree.h Fri May 14 02:33:28 1999
1180 +++ gcc-2.95.2/gcc/java/java-tree.h Sat Oct 30 19:45:50 1999
1182 extern int flag_not_overriding;
1183 extern int flag_static_local_jdk1_1;
1185 +/* When non zero, call a library routine to do integer divisions. */
1186 +extern int flag_use_divide_subroutine;
1188 /* The Java .class file that provides main_class; the main input file. */
1189 extern struct JCF *current_jcf;
1191 @@ -283,6 +286,10 @@
1192 extern tree soft_lookupinterfacemethod_node;
1193 extern tree soft_fmod_node;
1194 extern tree soft_exceptioninfo_call_node;
1195 +extern tree soft_idiv_node;
1196 +extern tree soft_irem_node;
1197 +extern tree soft_ldiv_node;
1198 +extern tree soft_lrem_node;
1200 extern tree access_flags_type_node;
1203 extern tree build_field_ref PROTO ((tree, tree, tree));
1204 extern void pushdecl_force_head PROTO ((tree));
1205 extern tree build_java_binop PROTO ((enum tree_code, tree, tree, tree));
1206 +extern tree build_java_soft_divmod PROTO ((enum tree_code, tree, tree, tree));
1207 extern tree binary_numeric_promotion PROTO ((tree, tree, tree *, tree *));
1208 extern tree build_java_arrayaccess PROTO ((tree, tree, tree));
1209 extern tree build_newarray PROTO ((int, tree));
1210 Only in gcc-2.95.2/gcc/java: java-tree.h.orig
1211 diff -u -r gcc-2.95.2-orig/gcc/java/jcf-parse.c gcc-2.95.2/gcc/java/jcf-parse.c
1212 --- gcc-2.95.2-orig/gcc/java/jcf-parse.c Thu Apr 22 01:49:42 1999
1213 +++ gcc-2.95.2/gcc/java/jcf-parse.c Sat Oct 30 14:02:11 1999
1215 /* Mark the file as parsed */
1216 HAS_BEEN_ALREADY_PARSED_P (file) = 1;
1218 + jcf_dependency_add_file (input_filename, 0);
1220 lang_init_source (1); /* Error msgs have no method prototypes */
1222 java_init_lex (); /* Initialize the parser */
1223 diff -u -r gcc-2.95.2-orig/gcc/java/jcf-write.c gcc-2.95.2/gcc/java/jcf-write.c
1224 --- gcc-2.95.2-orig/gcc/java/jcf-write.c Sun Mar 21 18:09:14 1999
1225 +++ gcc-2.95.2/gcc/java/jcf-write.c Sun Oct 31 18:54:12 1999
1227 struct jcf_block *label;
1230 +#define RELOCATION_VALUE_0 ((HOST_WIDE_INT)0)
1231 +#define RELOCATION_VALUE_1 ((HOST_WIDE_INT)1)
1233 /* State for single catch clause. */
1236 @@ -299,8 +302,14 @@
1237 static void init_jcf_method PROTO ((struct jcf_partial *, tree));
1238 static void release_jcf_state PROTO ((struct jcf_partial *));
1239 static struct chunk * generate_classfile PROTO ((tree, struct jcf_partial *));
1240 +static void emit_iinc PROTO ((tree, HOST_WIDE_INT, struct jcf_partial *));
1241 +static void emit_reloc PROTO ((HOST_WIDE_INT, int, struct jcf_block *,
1242 + struct jcf_partial *));
1243 +static void push_constant1 PROTO ((HOST_WIDE_INT, struct jcf_partial *));
1244 +static void push_constant2 PROTO ((HOST_WIDE_INT, struct jcf_partial *));
1247 +static void push_long_const PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1248 + struct jcf_partial *));
1249 /* Utility macros for appending (big-endian) data to a buffer.
1250 We assume a local variable 'ptr' points into where we want to
1251 write next, and we assume enoygh space has been allocated. */
1252 @@ -326,7 +335,13 @@
1253 #define PUT4(X) (PUT2((X) >> 16), PUT2((X) & 0xFFFF))
1254 #define PUTN(P, N) (CHECK_PUT(ptr, state, N), memcpy(ptr, P, N), ptr += (N))
1257 +/* There are some cases below where CHECK_PUT is guaranteed to fail.
1258 + Use the following macros in those specific cases. */
1259 +#define UNSAFE_PUT1(X) (*ptr++ = (X))
1260 +#define UNSAFE_PUT2(X) (UNSAFE_PUT1((X) >> 8), UNSAFE_PUT1((X) & 0xFF))
1261 +#define UNSAFE_PUT4(X) (UNSAFE_PUT2((X) >> 16), UNSAFE_PUT2((X) & 0xFFFF))
1262 +#define UNSAFE_PUTN(P, N) (memcpy(ptr, P, N), ptr += (N))
1264 /* Allocate a new chunk on obstack WORK, and link it in after LAST.
1265 Set the data and size fields to DATA and SIZE, respectively.
1266 However, if DATA is NULL and SIZE>0, allocate a buffer as well. */
1270 push_constant1 (index, state)
1272 + HOST_WIDE_INT index;
1273 struct jcf_partial *state;
1279 push_constant2 (index, state)
1281 + HOST_WIDE_INT index;
1282 struct jcf_partial *state;
1289 - i = find_constant1 (&state->cpool, CONSTANT_Integer, i & 0xFFFFFFFF);
1290 + i = find_constant1 (&state->cpool, CONSTANT_Integer,
1291 + (jword)(i & 0xFFFFFFFF));
1292 push_constant1 (i, state);
1296 HOST_WIDE_INT w1, w2;
1297 lshift_double (lo, hi, -32, 64, &w1, &w2, 1);
1298 return find_constant2 (&state->cpool, CONSTANT_Long,
1299 - w1 & 0xFFFFFFFF, lo & 0xFFFFFFFF);
1300 + (jword)(w1 & 0xFFFFFFFF), (jword)(lo & 0xFFFFFFFF));
1303 /* Find or allocate a constant pool entry for the given VALUE.
1306 if (TYPE_PRECISION (TREE_TYPE (value)) <= 32)
1307 return find_constant1 (&state->cpool, CONSTANT_Integer,
1308 - TREE_INT_CST_LOW (value) & 0xFFFFFFFF);
1309 + (jword)(TREE_INT_CST_LOW (value) & 0xFFFFFFFF));
1311 return find_constant_wide (TREE_INT_CST_LOW (value),
1312 TREE_INT_CST_HIGH (value), state);
1313 @@ -756,14 +772,17 @@
1314 if (TYPE_PRECISION (TREE_TYPE (value)) == 32)
1316 words[0] = etarsingle (TREE_REAL_CST (value)) & 0xFFFFFFFF;
1317 - return find_constant1 (&state->cpool, CONSTANT_Float, words[0]);
1318 + return find_constant1 (&state->cpool, CONSTANT_Float,
1323 etardouble (TREE_REAL_CST (value), words);
1324 return find_constant2 (&state->cpool, CONSTANT_Double,
1325 - words[1-FLOAT_WORDS_BIG_ENDIAN] & 0xFFFFFFFF,
1326 - words[FLOAT_WORDS_BIG_ENDIAN] & 0xFFFFFFFF);
1327 + (jword)(words[1-FLOAT_WORDS_BIG_ENDIAN] &
1329 + (jword)(words[FLOAT_WORDS_BIG_ENDIAN] &
1333 else if (TREE_CODE (value) == STRING_CST)
1336 emit_iinc (var, value, state)
1339 + HOST_WIDE_INT value;
1340 struct jcf_partial *state;
1342 int slot = DECL_LOCAL_INDEX (var);
1343 @@ -1012,7 +1031,7 @@
1344 struct jcf_block *label;
1345 struct jcf_partial *state;
1347 - emit_reloc (0, BLOCK_START_RELOC, label, state);
1348 + emit_reloc (RELOCATION_VALUE_0, BLOCK_START_RELOC, label, state);
1351 /* Similar to emit_switch_reloc,
1352 @@ -1041,8 +1060,8 @@
1353 struct jcf_partial *state;
1356 - // value is 1 byte from reloc back to start of instruction.
1357 - emit_reloc (1, - inv_opcode, target, state);
1358 + /* value is 1 byte from reloc back to start of instruction. */
1359 + emit_reloc (RELOCATION_VALUE_1, - inv_opcode, target, state);
1363 @@ -1051,8 +1070,8 @@
1364 struct jcf_partial *state;
1367 - // Value is 1 byte from reloc back to start of instruction.
1368 - emit_reloc (1, OPCODE_goto_w, target, state);
1369 + /* Value is 1 byte from reloc back to start of instruction. */
1370 + emit_reloc (RELOCATION_VALUE_1, OPCODE_goto_w, target, state);
1374 @@ -1061,8 +1080,8 @@
1375 struct jcf_partial *state;
1378 - // Value is 1 byte from reloc back to start of instruction.
1379 - emit_reloc (1, OPCODE_jsr_w, target, state);
1380 + /* Value is 1 byte from reloc back to start of instruction. */
1381 + emit_reloc (RELOCATION_VALUE_1, OPCODE_jsr_w, target, state);
1384 /* Generate code to evaluate EXP. If the result is true,
1385 @@ -1690,7 +1709,8 @@
1387 RESERVE (13 + 4 * (sw_state.max_case - sw_state.min_case + 1));
1388 OP1 (OPCODE_tableswitch);
1389 - emit_reloc (0, SWITCH_ALIGN_RELOC, NULL, state);
1390 + emit_reloc (RELOCATION_VALUE_0,
1391 + SWITCH_ALIGN_RELOC, NULL, state);
1392 emit_switch_reloc (sw_state.default_label, state);
1393 OP4 (sw_state.min_case);
1394 OP4 (sw_state.max_case);
1395 @@ -1713,7 +1733,8 @@
1396 { /* Use lookupswitch. */
1397 RESERVE(9 + 8 * sw_state.num_cases);
1398 OP1 (OPCODE_lookupswitch);
1399 - emit_reloc (0, SWITCH_ALIGN_RELOC, NULL, state);
1400 + emit_reloc (RELOCATION_VALUE_0,
1401 + SWITCH_ALIGN_RELOC, NULL, state);
1402 emit_switch_reloc (sw_state.default_label, state);
1403 OP4 (sw_state.num_cases);
1404 for (i = 0; i < sw_state.num_cases; i++)
1405 @@ -1886,7 +1907,7 @@
1407 push_int_const (value, state);
1409 - push_long_const (value, value >= 0 ? 0 : -1, state);
1410 + push_long_const (value, (HOST_WIDE_INT)(value >= 0 ? 0 : -1), state);
1412 emit_binop (OPCODE_iadd + adjust_typed_op (type, 3), type, state);
1413 if (target != IGNORE_TARGET && ! post_op)
1414 @@ -2775,7 +2796,7 @@
1418 - ptr = fields_count_ptr; PUT2 (fields_count);
1419 + ptr = fields_count_ptr; UNSAFE_PUT2 (fields_count);
1421 ptr = methods_count_ptr = append_chunk (NULL, 2, state);
1423 @@ -2841,10 +2862,10 @@
1424 code_attributes_count++;
1425 i += 8 + 10 * state->lvar_count;
1427 - PUT4 (i); /* attribute_length */
1428 - PUT2 (state->code_SP_max); /* max_stack */
1429 - PUT2 (localvar_max); /* max_locals */
1430 - PUT4 (state->code_length);
1431 + UNSAFE_PUT4 (i); /* attribute_length */
1432 + UNSAFE_PUT2 (state->code_SP_max); /* max_stack */
1433 + UNSAFE_PUT2 (localvar_max); /* max_locals */
1434 + UNSAFE_PUT4 (state->code_length);
1436 /* Emit the exception table. */
1437 ptr = append_chunk (NULL, 2 + 8 * state->num_handlers, state);
1438 @@ -2934,7 +2955,7 @@
1440 current_function_decl = save_function;
1442 - ptr = methods_count_ptr; PUT2 (methods_count);
1443 + ptr = methods_count_ptr; UNSAFE_PUT2 (methods_count);
1445 source_file = DECL_SOURCE_FILE (TYPE_NAME (clas));
1446 for (ptr = source_file; ; ptr++)
1447 Only in gcc-2.95.2/gcc/java: jcf-write.c.orig
1448 Only in gcc-2.95.2/gcc/java: jcf-write.c.rej
1449 diff -u -r gcc-2.95.2-orig/gcc/java/jvgenmain.c gcc-2.95.2/gcc/java/jvgenmain.c
1450 --- gcc-2.95.2-orig/gcc/java/jvgenmain.c Wed Aug 11 17:08:32 1999
1451 +++ gcc-2.95.2/gcc/java/jvgenmain.c Sat Oct 30 14:02:48 1999
1453 /* Program to generate "main" a Java(TM) class containing a main method.
1454 - Copyright (C) 1998 Free Software Foundation, Inc.
1455 + Copyright (C) 1998, 1999 Free Software Foundation, Inc.
1457 This file is part of GNU CC.
1460 (void (*) ()) OBSTACK_CHUNK_FREE);
1464 +usage (const char *name)
1466 + fprintf (stderr, "Usage: %s [OPTIONS]... CLASSNAME [OUTFILE]\n", name);
1471 main (int argc, const char **argv)
1473 const char *classname;
1475 char *mangled_classname;
1478 - if (argc < 2 || argc > 3)
1481 + for (i = 1; i < argc; ++i)
1483 - fprintf (stderr, "Usage: %s CLASSNAME [OUTFILE]\n", argv[0]);
1485 + if (! strncmp (argv[i], "-D", 2))
1487 + /* Handled later. */
1493 + if (i < argc - 2 || i == argc)
1497 classname = argv[1];
1499 gcc_obstack_init (&name_obstack);
1500 @@ -99,23 +117,46 @@
1501 obstack_1grow (&name_obstack, '\0');
1502 mangled_classname = obstack_finish (&name_obstack);
1504 - if (argc > 2 && strcmp (argv[2], "-") != 0)
1505 + if (i < argc - 1 && strcmp (argv[i + 1], "-") != 0)
1507 - const char *outfile = argv[2];
1508 + const char *outfile = argv[i + 1];
1509 stream = fopen (outfile, "w");
1512 fprintf (stderr, "%s: Cannot open output file: %s\n",
1521 + /* At this point every element of ARGV from 1 to LAST_ARG is a `-D'
1522 + option. Process them appropriately. */
1523 + fprintf (stream, "extern const char **_Jv_Compiler_Properties;\n");
1524 + fprintf (stream, "static const char *props[] =\n{\n");
1525 + for (i = 1; i < last_arg; ++i)
1528 + fprintf (stream, " \"");
1529 + for (p = &argv[i][2]; *p; ++p)
1531 + if (! isascii (*p))
1532 + fprintf (stream, "\\%o", *p);
1533 + else if (*p == '\\' || *p == '"')
1534 + fprintf (stream, "\\%c", *p);
1536 + putc (*p, stream);
1538 + fprintf (stream, "\",\n");
1540 + fprintf (stream, " 0\n};\n\n");
1542 fprintf (stream, "extern struct Class %s%s;\n",
1543 class_mangling_prefix, mangled_classname);
1544 fprintf (stream, "int main (int argc, const char **argv)\n");
1545 fprintf (stream, "{\n");
1546 + fprintf (stream, " _Jv_Compiler_Properties = props;\n");
1547 fprintf (stream, " JvRunMain (&%s%s, argc, argv);\n",
1548 class_mangling_prefix, mangled_classname);
1549 fprintf (stream, "}\n");
1552 fprintf (stderr, "%s: Failed to close output file %s\n",
1559 Only in gcc-2.95.2/gcc/java: jvgenmain.c.orig
1560 diff -u -r gcc-2.95.2-orig/gcc/java/jvspec.c gcc-2.95.2/gcc/java/jvspec.c
1561 --- gcc-2.95.2-orig/gcc/java/jvspec.c Sun Oct 17 10:18:28 1999
1562 +++ gcc-2.95.2/gcc/java/jvspec.c Sat Oct 30 20:09:50 1999
1564 #define COMBINE_INPUTS 0
1566 char jvgenmain_spec[] =
1567 - "jvgenmain %i %{!pipe:%umain.i} |\n\
1568 + "jvgenmain %{D*} %i %{!pipe:%umain.i} |\n\
1569 cc1 %{!pipe:%Umain.i} %1 \
1570 %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\
1576 + /* Saw a `-D' option. */
1579 /* An array used to flag each argument that needs a bit set for
1580 LANGSPEC, MATHLIB, WITHLIBC, or GCLIB. */
1583 /* Non-zero if linking is supposed to happen. */
1586 + /* Non-zero if we want to find the spec file. */
1587 + int want_spec_file = 1;
1589 /* The argument we use to specify the spec file. */
1590 char *spec_file = NULL;
1595 else if (strcmp (argv[i], "-fhelp") == 0)
1597 + want_spec_file = 0;
1598 else if (strcmp (argv[i], "-v") == 0)
1600 saw_verbose_flag = 1;
1602 else if (strcmp (argv[i], "-C") == 0)
1605 + want_spec_file = 0;
1613 + else if (argv[i][1] == 'D')
1615 else if (argv[i][1] == 'g')
1617 else if (argv[i][1] == 'O')
1619 else if (strcmp (argv[i], "-fsyntax-only") == 0
1620 || strcmp (argv[i], "--syntax-only") == 0)
1622 + want_spec_file = 0;
1628 (*fn) ("argument to `%s' missing\n", quote);
1630 + if (saw_D && ! main_class_name)
1631 + fatal ("can't specify `-D' without `--main'\n");
1633 num_args = argc + added;
1638 if (saw_g + saw_O == 0)
1643 arglist = (char **) xmalloc ((num_args + 1) * sizeof (char *));
1645 for (i = 0, j = 0; i < argc; i++, j++)
1650 - if (will_link && spec_file == NULL && strncmp (argv[i], "-L", 2) == 0)
1651 + if (spec_file == NULL && strncmp (argv[i], "-L", 2) == 0)
1652 spec_file = find_spec_file (argv[i] + 2);
1654 if (strncmp (argv[i], "-fmain=", 7) == 0)
1655 @@ -453,10 +465,10 @@
1656 if (saw_g + saw_O == 0)
1657 arglist[j++] = "-g1";
1659 - /* Read the specs file corresponding to libgcj, but only if linking.
1660 + /* Read the specs file corresponding to libgcj.
1661 If we didn't find the spec file on the -L path, then we hope it
1662 is somewhere in the standard install areas. */
1664 + if (want_spec_file)
1665 arglist[j++] = spec_file == NULL ? "-specs=libgcj.spec" : spec_file;
1668 Only in gcc-2.95.2/gcc/java: jvspec.c.orig
1669 Only in gcc-2.95.2/gcc/java: jvspec.c.rej
1670 diff -u -r gcc-2.95.2-orig/gcc/java/lang-options.h gcc-2.95.2/gcc/java/lang-options.h
1671 --- gcc-2.95.2-orig/gcc/java/lang-options.h Tue May 11 20:50:13 1999
1672 +++ gcc-2.95.2/gcc/java/lang-options.h Sat Oct 30 19:45:50 1999
1674 { "-fCLASSPATH", "Set class path" },
1675 { "-I", "Add directory to class path" },
1676 { "-foutput-class-dir", "Directory where class files should be written" },
1677 + { "-fuse-divide-subroutine", "" },
1678 + { "-fno-use-divide-subroutine", "Use built-in instructions for division" },
1679 { "-Wredundant-modifiers",
1680 "Warn if modifiers are specified when not necessary"},
1681 - { "-Wunsupported-jdk11", "Warn if `final' local variables are specified"},
1682 + { "-Wunsupported-jdk11", "Warn if `final' local variables are specified"},
1683 Only in gcc-2.95.2/gcc/java: lang-options.h.orig
1684 diff -u -r gcc-2.95.2-orig/gcc/java/lang-specs.h gcc-2.95.2/gcc/java/lang-specs.h
1685 --- gcc-2.95.2-orig/gcc/java/lang-specs.h Mon Feb 1 06:46:51 1999
1686 +++ gcc-2.95.2/gcc/java/lang-specs.h Sat Oct 30 20:07:34 1999
1688 {".zip", {"@java"} },
1689 {".jar", {"@java"} },
1691 - {"%{!E:jc1 %i %1 %{!Q:-quiet} %{d*} %{m*} %{a}\
1692 + {"%{!E:jc1 %i %1 %(jc1) %{!Q:-quiet} %{d*} %{m*} %{a}\
1693 %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
1694 %{traditional} %{v:-version} %{pg:-p} %{p}\
1695 %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\
1696 Only in gcc-2.95.2/gcc/java: lang-specs.h.orig
1697 Only in gcc-2.95.2/gcc/java: lang-specs.h.rej
1698 diff -u -r gcc-2.95.2-orig/gcc/java/lang.c gcc-2.95.2/gcc/java/lang.c
1699 --- gcc-2.95.2-orig/gcc/java/lang.c Sat May 15 01:44:09 1999
1700 +++ gcc-2.95.2/gcc/java/lang.c Sat Oct 30 19:45:50 1999
1702 /* When non zero, warns that final local are treated as non final. */
1703 int flag_static_local_jdk1_1 = 0;
1705 +/* When non zero, call a library routine to do integer divisions. */
1706 +int flag_use_divide_subroutine = 1;
1708 /* From gcc/flags.h, and indicates if exceptions are turned on or not. */
1710 extern int flag_new_exceptions;
1712 {"assume-compiled", &flag_assume_compiled, 1},
1713 {"emit-class-file", &flag_emit_class_files, 1},
1714 {"emit-class-files", &flag_emit_class_files, 1},
1715 + {"use-divide-subroutine", &flag_use_divide_subroutine, 1},
1719 Only in gcc-2.95.2/gcc/java: lang.c.orig
1720 diff -u -r gcc-2.95.2-orig/gcc/java/lex.h gcc-2.95.2/gcc/java/lex.h
1721 --- gcc-2.95.2-orig/gcc/java/lex.h Thu May 13 04:52:35 1999
1722 +++ gcc-2.95.2/gcc/java/lex.h Sun Oct 31 18:48:35 1999
1724 #define SET_MODIFIER_CTX(TOKEN) java_lval->value = (TOKEN)
1725 #define GET_TYPE_PRECISION(NODE) 4
1726 #define BUILD_OPERATOR(TOKEN) return TOKEN
1727 -#define BUILD_OPERATOR2(TOKEN) return TOKEN
1728 +#define BUILD_OPERATOR2(TOKEN) return ASSIGN_ANY_TK
1729 #define SET_LVAL_NODE(NODE)
1730 #define SET_LVAL_NODE_TYPE(NODE, TYPE)
1731 #define BUILD_ID_WFL(EXP) (EXP)
1732 diff -u -r gcc-2.95.2-orig/gcc/java/parse-scan.c gcc-2.95.2/gcc/java/parse-scan.c
1733 --- gcc-2.95.2-orig/gcc/java/parse-scan.c Mon Oct 25 21:02:09 1999
1734 +++ gcc-2.95.2/gcc/java/parse-scan.c Sun Oct 31 19:10:26 1999
1737 /* A Bison parser, made from ./parse-scan.y
1738 - by GNU Bison version 1.25
1740 + by GNU Bison version 1.28 */
1742 #define YYBISON 1 /* Identify Bison output. */
1744 -#define PLUS_TK 258
1745 -#define MINUS_TK 259
1746 -#define MULT_TK 260
1755 -#define BOOL_AND_TK 269
1756 -#define BOOL_OR_TK 270
1763 -#define PLUS_ASSIGN_TK 277
1764 -#define MINUS_ASSIGN_TK 278
1765 -#define MULT_ASSIGN_TK 279
1766 -#define DIV_ASSIGN_TK 280
1767 -#define REM_ASSIGN_TK 281
1768 -#define LS_ASSIGN_TK 282
1769 -#define SRS_ASSIGN_TK 283
1770 -#define ZRS_ASSIGN_TK 284
1771 -#define AND_ASSIGN_TK 285
1772 -#define XOR_ASSIGN_TK 286
1773 -#define OR_ASSIGN_TK 287
1774 -#define PUBLIC_TK 288
1775 -#define PRIVATE_TK 289
1776 -#define PROTECTED_TK 290
1777 -#define STATIC_TK 291
1778 -#define FINAL_TK 292
1779 -#define SYNCHRONIZED_TK 293
1780 -#define VOLATILE_TK 294
1781 -#define TRANSIENT_TK 295
1782 -#define NATIVE_TK 296
1784 -#define ABSTRACT_TK 298
1785 -#define MODIFIER_TK 299
1786 -#define DECR_TK 300
1787 -#define INCR_TK 301
1788 -#define DEFAULT_TK 302
1790 -#define THROW_TK 304
1791 -#define BOOLEAN_TK 305
1793 -#define IMPLEMENTS_TK 307
1794 -#define THROWS_TK 308
1795 -#define BREAK_TK 309
1796 -#define IMPORT_TK 310
1797 -#define ELSE_TK 311
1798 -#define INSTANCEOF_TK 312
1799 -#define RETURN_TK 313
1800 -#define VOID_TK 314
1801 -#define CATCH_TK 315
1802 -#define INTERFACE_TK 316
1803 -#define CASE_TK 317
1804 -#define EXTENDS_TK 318
1805 -#define FINALLY_TK 319
1806 -#define SUPER_TK 320
1807 -#define WHILE_TK 321
1808 -#define CLASS_TK 322
1809 -#define SWITCH_TK 323
1810 -#define CONST_TK 324
1814 -#define CONTINUE_TK 328
1815 -#define GOTO_TK 329
1816 -#define PACKAGE_TK 330
1817 -#define THIS_TK 331
1818 -#define BYTE_TK 332
1819 -#define SHORT_TK 333
1821 -#define LONG_TK 335
1822 -#define CHAR_TK 336
1823 -#define INTEGRAL_TK 337
1824 -#define FLOAT_TK 338
1825 -#define DOUBLE_TK 339
1828 -#define REL_QM_TK 342
1829 -#define REL_CL_TK 343
1832 -#define ASSIGN_ANY_TK 346
1833 -#define ASSIGN_TK 347
1843 -#define STRING_LIT_TK 357
1844 -#define CHAR_LIT_TK 358
1845 -#define INT_LIT_TK 359
1846 -#define FP_LIT_TK 360
1847 -#define TRUE_TK 361
1848 -#define FALSE_TK 362
1849 -#define BOOL_LIT_TK 363
1850 -#define NULL_TK 364
1851 +#define PLUS_TK 257
1852 +#define MINUS_TK 258
1853 +#define MULT_TK 259
1862 +#define BOOL_AND_TK 268
1863 +#define BOOL_OR_TK 269
1870 +#define PLUS_ASSIGN_TK 276
1871 +#define MINUS_ASSIGN_TK 277
1872 +#define MULT_ASSIGN_TK 278
1873 +#define DIV_ASSIGN_TK 279
1874 +#define REM_ASSIGN_TK 280
1875 +#define LS_ASSIGN_TK 281
1876 +#define SRS_ASSIGN_TK 282
1877 +#define ZRS_ASSIGN_TK 283
1878 +#define AND_ASSIGN_TK 284
1879 +#define XOR_ASSIGN_TK 285
1880 +#define OR_ASSIGN_TK 286
1881 +#define PUBLIC_TK 287
1882 +#define PRIVATE_TK 288
1883 +#define PROTECTED_TK 289
1884 +#define STATIC_TK 290
1885 +#define FINAL_TK 291
1886 +#define SYNCHRONIZED_TK 292
1887 +#define VOLATILE_TK 293
1888 +#define TRANSIENT_TK 294
1889 +#define NATIVE_TK 295
1891 +#define ABSTRACT_TK 297
1892 +#define MODIFIER_TK 298
1893 +#define DECR_TK 299
1894 +#define INCR_TK 300
1895 +#define DEFAULT_TK 301
1897 +#define THROW_TK 303
1898 +#define BOOLEAN_TK 304
1900 +#define IMPLEMENTS_TK 306
1901 +#define THROWS_TK 307
1902 +#define BREAK_TK 308
1903 +#define IMPORT_TK 309
1904 +#define ELSE_TK 310
1905 +#define INSTANCEOF_TK 311
1906 +#define RETURN_TK 312
1907 +#define VOID_TK 313
1908 +#define CATCH_TK 314
1909 +#define INTERFACE_TK 315
1910 +#define CASE_TK 316
1911 +#define EXTENDS_TK 317
1912 +#define FINALLY_TK 318
1913 +#define SUPER_TK 319
1914 +#define WHILE_TK 320
1915 +#define CLASS_TK 321
1916 +#define SWITCH_TK 322
1917 +#define CONST_TK 323
1921 +#define CONTINUE_TK 327
1922 +#define GOTO_TK 328
1923 +#define PACKAGE_TK 329
1924 +#define THIS_TK 330
1925 +#define BYTE_TK 331
1926 +#define SHORT_TK 332
1928 +#define LONG_TK 334
1929 +#define CHAR_TK 335
1930 +#define INTEGRAL_TK 336
1931 +#define FLOAT_TK 337
1932 +#define DOUBLE_TK 338
1935 +#define REL_QM_TK 341
1936 +#define REL_CL_TK 342
1939 +#define ASSIGN_ANY_TK 345
1940 +#define ASSIGN_TK 346
1950 +#define STRING_LIT_TK 356
1951 +#define CHAR_LIT_TK 357
1952 +#define INT_LIT_TK 358
1953 +#define FP_LIT_TK 359
1954 +#define TRUE_TK 360
1955 +#define FALSE_TK 361
1956 +#define BOOL_LIT_TK 362
1957 +#define NULL_TK 363
1959 #line 37 "./parse-scan.y"
1962 #define YYFLAG -32768
1963 #define YYNTBASE 110
1965 -#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 253)
1966 +#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 253)
1968 static const char yytranslate[] = { 0,
1969 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1970 @@ -228,18 +227,18 @@
1971 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1972 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1973 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1974 - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
1975 - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1976 - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1977 - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1978 - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
1979 - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
1980 - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
1981 - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
1982 - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1983 - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
1984 - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1985 - 106, 107, 108, 109
1986 + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1987 + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1988 + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1989 + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1990 + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1991 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1992 + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1993 + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1994 + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1995 + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1996 + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
2001 @@ -1375,7 +1374,8 @@
2004 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2005 -#line 3 "/usr/cygnus/gnupro-98r2/share/bison.simple"
2006 +#line 3 "/usr/lib/bison.simple"
2007 +/* This file comes from bison-1.28. */
2009 /* Skeleton output parser for bison,
2010 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2011 @@ -1392,46 +1392,66 @@
2013 You should have received a copy of the GNU General Public License
2014 along with this program; if not, write to the Free Software
2015 - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
2016 + Foundation, Inc., 59 Temple Place - Suite 330,
2017 + Boston, MA 02111-1307, USA. */
2019 /* As a special exception, when this file is copied by Bison into a
2020 Bison output file, you may use that output file without restriction.
2021 This special exception was added by the Free Software Foundation
2022 in version 1.24 of Bison. */
2025 +/* This is the parser code that is written into each bison parser
2026 + when the %semantic_parser declaration is not specified in the grammar.
2027 + It was written by Richard Stallman by simplifying the hairy parser
2028 + used when %semantic_parser is specified. */
2030 +#ifndef YYSTACK_USE_ALLOCA
2032 +#define YYSTACK_USE_ALLOCA
2033 +#else /* alloca not defined */
2035 +#define YYSTACK_USE_ALLOCA
2036 #define alloca __builtin_alloca
2037 #else /* not GNU C. */
2038 -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
2039 +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2040 +#define YYSTACK_USE_ALLOCA
2042 #else /* not sparc */
2043 -#if defined (MSDOS) && !defined (__TURBOC__)
2044 +/* We think this test detects Watcom and Microsoft C. */
2045 +/* This used to test MSDOS, but that is a bad idea
2046 + since that symbol is in the user namespace. */
2047 +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2048 +#if 0 /* No need for malloc.h, which pollutes the namespace;
2049 + instead, just don't use alloca. */
2052 #else /* not MSDOS, or __TURBOC__ */
2054 -#include <malloc.h>
2055 +/* I don't know what this was needed for, but it pollutes the namespace.
2056 + So I turned it off. rms, 2 May 1997. */
2057 +/* #include <malloc.h> */
2059 -#else /* not MSDOS, __TURBOC__, or _AIX */
2063 -void *alloca (unsigned int);
2065 -#else /* not __cplusplus */
2067 -#endif /* not __cplusplus */
2068 +#define YYSTACK_USE_ALLOCA
2069 +#else /* not MSDOS, or __TURBOC__, or _AIX */
2071 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2072 + and on HPUX 10. Eventually we can turn this on. */
2073 +#define YYSTACK_USE_ALLOCA
2074 +#define alloca __builtin_alloca
2077 #endif /* not _AIX */
2078 #endif /* not MSDOS, or __TURBOC__ */
2079 -#endif /* not sparc. */
2080 -#endif /* not GNU C. */
2081 -#endif /* alloca not defined. */
2082 +#endif /* not sparc */
2083 +#endif /* not GNU C */
2084 +#endif /* alloca not defined */
2085 +#endif /* YYSTACK_USE_ALLOCA not defined */
2087 -/* This is the parser code that is written into each bison parser
2088 - when the %semantic_parser declaration is not specified in the grammar.
2089 - It was written by Richard Stallman by simplifying the hairy parser
2090 - used when %semantic_parser is specified. */
2091 +#ifdef YYSTACK_USE_ALLOCA
2092 +#define YYSTACK_ALLOC alloca
2094 +#define YYSTACK_ALLOC malloc
2097 /* Note: there must be only one dollar sign in this file.
2098 It is replaced by the list of actions, each action
2099 @@ -1441,8 +1461,8 @@
2100 #define yyclearin (yychar = YYEMPTY)
2103 -#define YYACCEPT return(0)
2104 -#define YYABORT return(1)
2105 +#define YYACCEPT goto yyacceptlab
2106 +#define YYABORT goto yyabortlab
2107 #define YYERROR goto yyerrlab1
2108 /* Like YYERROR except do call yyerror.
2109 This remains here temporarily to ease the
2110 @@ -1523,12 +1543,12 @@
2112 #define YYMAXDEPTH 10000
2115 -/* Prevent warning if -Wstrict-prototypes. */
2117 -int yyparse (void);
2120 +/* Define __yy_memcpy. Note that the size argument
2121 + should be passed with type unsigned int, because that is what the non-GCC
2122 + definitions require. With GCC, __builtin_memcpy takes an arg
2123 + of type size_t, but it can handle unsigned int. */
2125 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2126 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2127 #else /* not GNU C or C++ */
2128 @@ -1540,7 +1560,7 @@
2129 __yy_memcpy (to, from, count)
2133 + unsigned int count;
2135 register char *f = from;
2136 register char *t = to;
2137 @@ -1555,10 +1575,10 @@
2138 /* This is the most reliable way to avoid incompatibilities
2139 in available built-in functions on various systems. */
2141 -__yy_memcpy (char *to, char *from, int count)
2142 +__yy_memcpy (char *to, char *from, unsigned int count)
2144 - register char *f = from;
2145 register char *t = to;
2146 + register char *f = from;
2147 register int i = count;
2150 @@ -1568,7 +1588,7 @@
2154 -#line 196 "/usr/cygnus/gnupro-98r2/share/bison.simple"
2155 +#line 217 "/usr/lib/bison.simple"
2157 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2158 into yyparse. The argument should have type void *.
2159 @@ -1589,6 +1609,15 @@
2160 #define YYPARSE_PARAM_DECL
2161 #endif /* not YYPARSE_PARAM */
2163 +/* Prevent warning if -Wstrict-prototypes. */
2165 +#ifdef YYPARSE_PARAM
2166 +int yyparse (void *);
2168 +int yyparse (void);
2173 yyparse(YYPARSE_PARAM_ARG)
2175 @@ -1617,6 +1646,7 @@
2178 int yystacksize = YYINITDEPTH;
2179 + int yyfree_stacks = 0;
2183 @@ -1701,18 +1731,32 @@
2184 if (yystacksize >= YYMAXDEPTH)
2186 yyerror("parser stack overflow");
2187 + if (yyfree_stacks)
2191 +#ifdef YYLSP_NEEDED
2198 if (yystacksize > YYMAXDEPTH)
2199 yystacksize = YYMAXDEPTH;
2200 - yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
2201 - __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
2202 - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
2203 - __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
2204 +#ifndef YYSTACK_USE_ALLOCA
2205 + yyfree_stacks = 1;
2207 + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2208 + __yy_memcpy ((char *)yyss, (char *)yyss1,
2209 + size * (unsigned int) sizeof (*yyssp));
2210 + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2211 + __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2212 + size * (unsigned int) sizeof (*yyvsp));
2214 - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
2215 - __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
2216 + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2217 + __yy_memcpy ((char *)yyls, (char *)yyls1,
2218 + size * (unsigned int) sizeof (*yylsp));
2220 #endif /* no yyoverflow */
2222 @@ -2156,7 +2200,7 @@
2225 /* the action file gets copied in in place of this dollarsign */
2226 -#line 498 "/usr/cygnus/gnupro-98r2/share/bison.simple"
2227 +#line 543 "/usr/lib/bison.simple"
2231 @@ -2351,6 +2395,30 @@
2237 + /* YYACCEPT comes here. */
2238 + if (yyfree_stacks)
2242 +#ifdef YYLSP_NEEDED
2249 + /* YYABORT comes here. */
2250 + if (yyfree_stacks)
2254 +#ifdef YYLSP_NEEDED
2260 #line 1105 "./parse-scan.y"
2262 @@ -2434,6 +2502,8 @@
2264 char *msg ATTRIBUTE_UNUSED;
2266 + fprintf (stderr, "%s: %d: %s\n", input_filename, lineno, msg);
2271 diff -u -r gcc-2.95.2-orig/gcc/java/parse-scan.y gcc-2.95.2/gcc/java/parse-scan.y
2272 --- gcc-2.95.2-orig/gcc/java/parse-scan.y Tue May 4 04:59:16 1999
2273 +++ gcc-2.95.2/gcc/java/parse-scan.y Sun Oct 31 18:48:35 1999
2274 @@ -1183,6 +1183,8 @@
2276 char *msg ATTRIBUTE_UNUSED;
2278 + fprintf (stderr, "%s: %d: %s\n", input_filename, lineno, msg);
2283 Only in gcc-2.95.2/gcc/java: parse-scan.y.orig
2284 diff -u -r gcc-2.95.2-orig/gcc/java/parse.c gcc-2.95.2/gcc/java/parse.c
2285 --- gcc-2.95.2-orig/gcc/java/parse.c Mon Oct 25 21:02:09 1999
2286 +++ gcc-2.95.2/gcc/java/parse.c Sun Oct 31 21:39:17 1999
2289 /* A Bison parser, made from ./parse.y
2290 - by GNU Bison version 1.27
2292 + by GNU Bison version 1.28 */
2294 #define YYBISON 1 /* Identify Bison output. */
2297 static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...))
2299 static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list));
2300 +static void parse_ctor_invocation_error PROTO ((void));
2301 static tree parse_jdk1_1_error PROTO ((char *));
2302 static void complete_class_report_errors PROTO ((jdep *));
2303 static int process_imports PROTO ((void));
2305 static tree strip_out_static_field_access_decl PROTO ((tree));
2306 static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *));
2307 static void static_ref_err PROTO ((tree, tree, tree));
2308 +static tree java_refold PROTO ((tree));
2310 /* Number of error found so far. */
2311 int java_error_count;
2312 @@ -350,6 +351,10 @@
2313 binop_lookup [((VALUE) - PLUS_TK)% \
2314 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
2316 +/* This is the end index for binary operators that can also be used
2317 + in compound assignements. */
2318 +#define BINOP_COMPOUND_CANDIDATES 11
2320 /* Fake WFL used to report error message. It is initialized once if
2321 needed and reused with it's location information is overriden. */
2322 tree wfl_operator = NULL_TREE;
2324 static tree current_static_block = NULL_TREE;
2327 -#line 304 "./parse.y"
2328 +#line 310 "./parse.y"
2336 -#line 314 "./parse.y"
2337 +#line 320 "./parse.y"
2341 @@ -684,57 +689,57 @@
2344 static const short yyrline[] = { 0,
2345 - 458, 464, 466, 467, 468, 469, 470, 474, 476, 479,
2346 - 481, 482, 485, 487, 490, 494, 498, 502, 508, 510,
2347 - 512, 514, 519, 521, 524, 528, 533, 538, 540, 541,
2348 - 542, 543, 544, 545, 546, 549, 554, 560, 562, 565,
2349 - 568, 570, 574, 576, 579, 606, 608, 612, 625, 627,
2350 - 631, 638, 643, 645, 655, 660, 675, 679, 682, 685,
2351 - 688, 690, 692, 697, 701, 703, 705, 707, 711, 713,
2352 - 715, 722, 728, 733, 737, 746, 756, 758, 761, 763,
2353 - 764, 765, 769, 771, 773, 774, 776, 781, 784, 794,
2354 - 797, 799, 803, 806, 813, 819, 827, 829, 831, 833,
2355 - 835, 839, 841, 845, 852, 853, 857, 860, 862, 864,
2356 - 866, 868, 870, 872, 874, 881, 884, 886, 895, 897,
2357 - 901, 906, 911, 915, 920, 925, 927, 934, 936, 938,
2358 - 942, 945, 947, 951, 953, 954, 959, 965, 972, 980,
2359 - 987, 990, 993, 997, 1000, 1004, 1013, 1015, 1017, 1021,
2360 - 1023, 1026, 1033, 1041, 1043, 1047, 1054, 1064, 1068, 1071,
2361 - 1074, 1077, 1080, 1083, 1086, 1089, 1091, 1095, 1101, 1106,
2362 - 1108, 1112, 1115, 1119, 1121, 1124, 1126, 1127, 1129, 1133,
2363 - 1137, 1143, 1148, 1151, 1153, 1157, 1163, 1167, 1172, 1181,
2364 - 1185, 1190, 1202, 1204, 1207, 1209, 1211, 1215, 1219, 1222,
2365 - 1226, 1228, 1229, 1230, 1231, 1232, 1236, 1238, 1239, 1240,
2366 - 1241, 1245, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254,
2367 - 1255, 1256, 1259, 1264, 1275, 1278, 1282, 1289, 1299, 1305,
2368 - 1311, 1317, 1319, 1325, 1327, 1333, 1335, 1337, 1339, 1341,
2369 - 1345, 1347, 1348, 1349, 1350, 1351, 1352, 1355, 1361, 1363,
2370 - 1365, 1369, 1374, 1379, 1385, 1395, 1401, 1403, 1405, 1412,
2371 - 1415, 1417, 1419, 1423, 1425, 1428, 1432, 1434, 1437, 1444,
2372 - 1450, 1452, 1454, 1458, 1466, 1469, 1471, 1473, 1477, 1482,
2373 - 1491, 1496, 1499, 1506, 1508, 1510, 1514, 1517, 1526, 1533,
2374 - 1535, 1539, 1552, 1554, 1560, 1566, 1570, 1572, 1576, 1579,
2375 - 1581, 1585, 1588, 1590, 1592, 1596, 1599, 1601, 1603, 1607,
2376 - 1610, 1612, 1614, 1618, 1624, 1626, 1630, 1637, 1639, 1641,
2377 - 1643, 1647, 1655, 1658, 1660, 1665, 1669, 1671, 1678, 1686,
2378 - 1703, 1705, 1707, 1711, 1714, 1719, 1721, 1724, 1726, 1728,
2379 - 1730, 1731, 1732, 1733, 1737, 1739, 1741, 1746, 1748, 1750,
2380 - 1752, 1754, 1758, 1761, 1766, 1768, 1773, 1774, 1775, 1776,
2381 - 1777, 1779, 1781, 1783, 1785, 1787, 1791, 1793, 1796, 1802,
2382 - 1807, 1811, 1814, 1816, 1818, 1822, 1824, 1826, 1828, 1832,
2383 - 1835, 1839, 1845, 1847, 1855, 1882, 1884, 1888, 1893, 1900,
2384 - 1904, 1907, 1909, 1920, 1931, 1936, 1945, 1947, 1951, 1954,
2385 - 1956, 1961, 1966, 1971, 1978, 1980, 1981, 1982, 1985, 1990,
2386 - 1995, 1997, 1998, 2000, 2002, 2003, 2005, 2009, 2012, 2016,
2387 - 2019, 2023, 2025, 2027, 2029, 2030, 2032, 2036, 2045, 2047,
2388 - 2049, 2062, 2064, 2070, 2072, 2074, 2078, 2080, 2085, 2090,
2389 - 2095, 2097, 2099, 2103, 2105, 2110, 2115, 2117, 2121, 2123,
2390 - 2128, 2133, 2138, 2140, 2142, 2146, 2148, 2153, 2158, 2163,
2391 - 2168, 2170, 2172, 2174, 2176, 2178, 2182, 2184, 2189, 2194,
2392 - 2196, 2200, 2202, 2207, 2211, 2213, 2218, 2222, 2224, 2229,
2393 - 2233, 2235, 2240, 2244, 2246, 2251, 2255, 2257, 2262, 2268,
2394 - 2270, 2274, 2276, 2279, 2282, 2290, 2292, 2293, 2296, 2298,
2396 + 464, 470, 472, 473, 474, 475, 476, 480, 482, 485,
2397 + 487, 488, 491, 493, 496, 500, 504, 508, 514, 516,
2398 + 518, 520, 525, 527, 530, 534, 539, 544, 546, 547,
2399 + 548, 549, 550, 551, 552, 555, 560, 566, 568, 571,
2400 + 574, 576, 580, 582, 585, 612, 614, 618, 631, 633,
2401 + 637, 644, 649, 651, 661, 666, 681, 685, 688, 691,
2402 + 694, 696, 698, 703, 707, 709, 711, 713, 717, 719,
2403 + 721, 728, 734, 739, 743, 752, 762, 764, 767, 769,
2404 + 770, 771, 775, 777, 779, 780, 782, 787, 790, 800,
2405 + 803, 805, 809, 812, 819, 825, 833, 835, 837, 839,
2406 + 841, 845, 847, 851, 858, 859, 863, 866, 868, 870,
2407 + 872, 874, 876, 878, 880, 887, 890, 892, 901, 903,
2408 + 907, 912, 917, 921, 926, 931, 933, 940, 942, 944,
2409 + 948, 951, 953, 957, 959, 960, 965, 971, 978, 986,
2410 + 993, 996, 999, 1003, 1006, 1010, 1019, 1021, 1023, 1027,
2411 + 1029, 1032, 1039, 1047, 1049, 1053, 1060, 1070, 1074, 1077,
2412 + 1080, 1083, 1086, 1089, 1092, 1095, 1097, 1101, 1107, 1112,
2413 + 1114, 1118, 1121, 1125, 1127, 1130, 1132, 1133, 1135, 1139,
2414 + 1143, 1149, 1154, 1157, 1159, 1163, 1169, 1173, 1178, 1187,
2415 + 1191, 1196, 1208, 1210, 1213, 1215, 1217, 1221, 1225, 1228,
2416 + 1232, 1234, 1235, 1236, 1237, 1238, 1242, 1244, 1245, 1246,
2417 + 1247, 1251, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260,
2418 + 1261, 1262, 1265, 1270, 1281, 1284, 1288, 1295, 1305, 1311,
2419 + 1317, 1323, 1325, 1330, 1332, 1337, 1339, 1341, 1343, 1345,
2420 + 1349, 1351, 1352, 1353, 1354, 1355, 1356, 1359, 1365, 1367,
2421 + 1369, 1373, 1378, 1383, 1389, 1399, 1405, 1407, 1409, 1416,
2422 + 1419, 1421, 1423, 1427, 1429, 1432, 1436, 1438, 1441, 1448,
2423 + 1454, 1456, 1458, 1462, 1470, 1473, 1475, 1477, 1481, 1486,
2424 + 1495, 1500, 1503, 1510, 1512, 1514, 1518, 1521, 1530, 1537,
2425 + 1539, 1543, 1556, 1558, 1564, 1570, 1574, 1576, 1580, 1583,
2426 + 1585, 1589, 1592, 1594, 1596, 1600, 1603, 1605, 1607, 1611,
2427 + 1614, 1616, 1618, 1622, 1628, 1630, 1634, 1641, 1643, 1645,
2428 + 1647, 1651, 1659, 1662, 1664, 1669, 1673, 1675, 1682, 1690,
2429 + 1707, 1709, 1711, 1715, 1718, 1723, 1725, 1728, 1730, 1732,
2430 + 1734, 1735, 1736, 1737, 1741, 1743, 1745, 1750, 1752, 1754,
2431 + 1756, 1758, 1762, 1765, 1770, 1772, 1777, 1778, 1779, 1780,
2432 + 1781, 1783, 1785, 1787, 1789, 1791, 1795, 1797, 1800, 1806,
2433 + 1811, 1815, 1818, 1820, 1822, 1826, 1828, 1830, 1832, 1836,
2434 + 1839, 1843, 1849, 1851, 1859, 1886, 1888, 1892, 1897, 1904,
2435 + 1908, 1911, 1913, 1924, 1935, 1940, 1949, 1951, 1955, 1958,
2436 + 1960, 1965, 1970, 1975, 1982, 1984, 1985, 1986, 1989, 1994,
2437 + 1999, 2001, 2002, 2004, 2006, 2007, 2009, 2013, 2016, 2020,
2438 + 2023, 2027, 2029, 2031, 2033, 2034, 2036, 2040, 2049, 2051,
2439 + 2053, 2066, 2068, 2074, 2076, 2078, 2082, 2084, 2089, 2094,
2440 + 2099, 2101, 2103, 2107, 2109, 2114, 2119, 2121, 2125, 2127,
2441 + 2132, 2137, 2142, 2144, 2146, 2150, 2152, 2157, 2162, 2167,
2442 + 2172, 2174, 2176, 2178, 2180, 2182, 2186, 2188, 2193, 2198,
2443 + 2200, 2204, 2206, 2211, 2215, 2217, 2222, 2226, 2228, 2233,
2444 + 2237, 2239, 2244, 2248, 2250, 2255, 2259, 2261, 2266, 2272,
2445 + 2274, 2278, 2280, 2283, 2286, 2294, 2296, 2297, 2300, 2302,
2450 @@ -2213,7 +2218,7 @@
2452 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2453 #line 3 "/usr/lib/bison.simple"
2454 -/* This file comes from bison-1.27. */
2455 +/* This file comes from bison-1.28. */
2457 /* Skeleton output parser for bison,
2458 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2459 @@ -2426,7 +2431,7 @@
2463 -#line 216 "/usr/lib/bison.simple"
2464 +#line 217 "/usr/lib/bison.simple"
2466 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2467 into yyparse. The argument should have type void *.
2468 @@ -2755,66 +2760,66 @@
2472 -#line 460 "./parse.y"
2473 +#line 466 "./parse.y"
2477 -#line 504 "./parse.y"
2478 +#line 510 "./parse.y"
2480 yyval.node = build_java_array_type (yyvsp[-2].node, -1);
2481 CLASS_LOADED_P (yyval.node) = 1;
2485 -#line 509 "./parse.y"
2486 +#line 515 "./parse.y"
2487 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2490 -#line 511 "./parse.y"
2491 +#line 517 "./parse.y"
2492 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2495 -#line 513 "./parse.y"
2496 +#line 519 "./parse.y"
2497 {RULE ("']' expected"); RECOVER;;
2500 -#line 515 "./parse.y"
2501 +#line 521 "./parse.y"
2502 {RULE ("']' expected"); RECOVER;;
2505 -#line 530 "./parse.y"
2506 +#line 536 "./parse.y"
2507 { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
2510 -#line 539 "./parse.y"
2511 +#line 545 "./parse.y"
2512 {yyval.node = NULL;;
2515 -#line 551 "./parse.y"
2516 +#line 557 "./parse.y"
2522 -#line 555 "./parse.y"
2523 +#line 561 "./parse.y"
2529 -#line 567 "./parse.y"
2530 +#line 573 "./parse.y"
2531 { ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ;
2534 -#line 569 "./parse.y"
2535 +#line 575 "./parse.y"
2536 {yyerror ("Missing name"); RECOVER;;
2539 -#line 571 "./parse.y"
2540 +#line 577 "./parse.y"
2541 {yyerror ("';' expected"); RECOVER;;
2544 -#line 581 "./parse.y"
2545 +#line 587 "./parse.y"
2547 tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name;
2548 int i = IDENTIFIER_LENGTH (name)-1;
2549 @@ -2842,15 +2847,15 @@
2553 -#line 607 "./parse.y"
2554 +#line 613 "./parse.y"
2555 {yyerror ("Missing name"); RECOVER;;
2558 -#line 609 "./parse.y"
2559 +#line 615 "./parse.y"
2560 {yyerror ("';' expected"); RECOVER;;
2563 -#line 614 "./parse.y"
2564 +#line 620 "./parse.y"
2566 tree name = EXPR_WFL_NODE (yyvsp[-3].node);
2567 /* Don't import java.lang.* twice. */
2568 @@ -2864,15 +2869,15 @@
2572 -#line 626 "./parse.y"
2573 +#line 632 "./parse.y"
2574 {yyerror ("'*' expected"); RECOVER;;
2577 -#line 628 "./parse.y"
2578 +#line 634 "./parse.y"
2579 {yyerror ("';' expected"); RECOVER;;
2582 -#line 633 "./parse.y"
2583 +#line 639 "./parse.y"
2585 maybe_generate_finit ();
2586 maybe_generate_clinit ();
2587 @@ -2880,31 +2885,31 @@
2591 -#line 639 "./parse.y"
2592 +#line 645 "./parse.y"
2594 maybe_generate_clinit ();
2595 yyval.node = yyvsp[0].node;
2599 -#line 644 "./parse.y"
2600 +#line 650 "./parse.y"
2601 { yyval.node = NULL; ;
2604 -#line 646 "./parse.y"
2605 +#line 652 "./parse.y"
2608 yyerror ("Class or interface declaration expected");
2612 -#line 657 "./parse.y"
2613 +#line 663 "./parse.y"
2615 yyval.value = (1 << yyvsp[0].value);
2619 -#line 661 "./parse.y"
2620 +#line 667 "./parse.y"
2622 int acc = (1 << yyvsp[0].value);
2623 if (yyval.value & acc)
2624 @@ -2918,95 +2923,95 @@
2628 -#line 677 "./parse.y"
2629 +#line 683 "./parse.y"
2630 { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2633 -#line 679 "./parse.y"
2634 +#line 685 "./parse.y"
2636 yyval.node = yyvsp[0].node;
2640 -#line 683 "./parse.y"
2641 +#line 689 "./parse.y"
2642 { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2645 -#line 685 "./parse.y"
2646 +#line 691 "./parse.y"
2648 yyval.node = yyvsp[0].node;
2652 -#line 689 "./parse.y"
2653 +#line 695 "./parse.y"
2654 {yyerror ("Missing class name"); RECOVER;;
2657 -#line 691 "./parse.y"
2658 +#line 697 "./parse.y"
2659 {yyerror ("Missing class name"); RECOVER;;
2662 -#line 693 "./parse.y"
2663 +#line 699 "./parse.y"
2665 if (!ctxp->class_err) yyerror ("'{' expected");
2670 -#line 698 "./parse.y"
2671 +#line 704 "./parse.y"
2672 {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;;
2675 -#line 702 "./parse.y"
2676 +#line 708 "./parse.y"
2677 { yyval.node = NULL; ;
2680 -#line 704 "./parse.y"
2681 +#line 710 "./parse.y"
2682 { yyval.node = yyvsp[0].node; ;
2685 -#line 706 "./parse.y"
2686 +#line 712 "./parse.y"
2687 {yyerror ("'{' expected"); ctxp->class_err=1;;
2690 -#line 708 "./parse.y"
2691 +#line 714 "./parse.y"
2692 {yyerror ("Missing super class name"); ctxp->class_err=1;;
2695 -#line 712 "./parse.y"
2696 +#line 718 "./parse.y"
2697 { yyval.node = NULL_TREE; ;
2700 -#line 714 "./parse.y"
2701 +#line 720 "./parse.y"
2702 { yyval.node = yyvsp[0].node; ;
2705 -#line 716 "./parse.y"
2706 +#line 722 "./parse.y"
2709 yyerror ("Missing interface name");
2713 -#line 724 "./parse.y"
2714 +#line 730 "./parse.y"
2716 ctxp->interface_number = 1;
2717 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
2721 -#line 729 "./parse.y"
2722 +#line 735 "./parse.y"
2724 ctxp->interface_number++;
2725 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
2729 -#line 734 "./parse.y"
2730 +#line 740 "./parse.y"
2731 {yyerror ("Missing interface name"); RECOVER;;
2734 -#line 739 "./parse.y"
2735 +#line 745 "./parse.y"
2737 /* Store the location of the `}' when doing xrefs */
2739 @@ -3016,7 +3021,7 @@
2743 -#line 747 "./parse.y"
2744 +#line 753 "./parse.y"
2746 /* Store the location of the `}' when doing xrefs */
2748 @@ -3026,27 +3031,27 @@
2752 -#line 766 "./parse.y"
2753 +#line 772 "./parse.y"
2754 { yyval.node = parse_jdk1_1_error ("instance initializer"); ;
2757 -#line 772 "./parse.y"
2758 +#line 778 "./parse.y"
2759 { yyval.node = yyvsp[-1].node; ;
2762 -#line 775 "./parse.y"
2763 +#line 781 "./parse.y"
2764 { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ;
2767 -#line 777 "./parse.y"
2768 +#line 783 "./parse.y"
2769 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
2772 -#line 783 "./parse.y"
2773 +#line 789 "./parse.y"
2774 { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ;
2777 -#line 785 "./parse.y"
2778 +#line 791 "./parse.y"
2781 ("Illegal modifier `%s' for field declaration",
2782 @@ -3056,19 +3061,19 @@
2786 -#line 798 "./parse.y"
2787 +#line 804 "./parse.y"
2788 { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ;
2791 -#line 800 "./parse.y"
2792 +#line 806 "./parse.y"
2793 {yyerror ("Missing term"); RECOVER;;
2796 -#line 805 "./parse.y"
2797 +#line 811 "./parse.y"
2798 { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ;
2801 -#line 807 "./parse.y"
2802 +#line 813 "./parse.y"
2804 if (java_error_count)
2805 yyvsp[0].node = NULL_TREE;
2806 @@ -3077,7 +3082,7 @@
2810 -#line 814 "./parse.y"
2811 +#line 820 "./parse.y"
2813 yyerror ("Missing variable initializer");
2814 yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
2815 @@ -3085,7 +3090,7 @@
2819 -#line 820 "./parse.y"
2820 +#line 826 "./parse.y"
2822 yyerror ("';' expected");
2823 yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
2824 @@ -3093,85 +3098,85 @@
2828 -#line 830 "./parse.y"
2829 +#line 836 "./parse.y"
2830 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2833 -#line 832 "./parse.y"
2834 +#line 838 "./parse.y"
2835 {yyerror ("Invalid declaration"); DRECOVER(vdi);;
2838 -#line 834 "./parse.y"
2839 +#line 840 "./parse.y"
2840 {yyerror ("']' expected"); DRECOVER(vdi);;
2843 -#line 836 "./parse.y"
2844 +#line 842 "./parse.y"
2845 {yyerror ("Unbalanced ']'"); DRECOVER(vdi);;
2848 -#line 847 "./parse.y"
2849 +#line 853 "./parse.y"
2851 current_function_decl = yyvsp[0].node;
2852 source_start_java_method (current_function_decl);
2856 -#line 852 "./parse.y"
2857 +#line 858 "./parse.y"
2858 { finish_method_declaration (yyvsp[0].node); ;
2861 -#line 854 "./parse.y"
2862 +#line 860 "./parse.y"
2863 {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;
2866 -#line 859 "./parse.y"
2867 +#line 865 "./parse.y"
2868 { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2871 -#line 861 "./parse.y"
2872 +#line 867 "./parse.y"
2873 { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
2876 -#line 863 "./parse.y"
2877 +#line 869 "./parse.y"
2878 { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2881 -#line 865 "./parse.y"
2882 +#line 871 "./parse.y"
2883 { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
2886 -#line 867 "./parse.y"
2887 +#line 873 "./parse.y"
2891 -#line 869 "./parse.y"
2892 +#line 875 "./parse.y"
2896 -#line 871 "./parse.y"
2897 +#line 877 "./parse.y"
2898 {yyerror ("Identifier expected"); RECOVER;;
2901 -#line 873 "./parse.y"
2902 +#line 879 "./parse.y"
2903 {yyerror ("Identifier expected"); RECOVER;;
2906 -#line 875 "./parse.y"
2907 +#line 881 "./parse.y"
2909 yyerror ("Invalid method declaration, return type required");
2914 -#line 883 "./parse.y"
2915 +#line 889 "./parse.y"
2916 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
2919 -#line 885 "./parse.y"
2920 +#line 891 "./parse.y"
2921 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
2924 -#line 887 "./parse.y"
2925 +#line 893 "./parse.y"
2927 EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location;
2928 TREE_PURPOSE (yyvsp[-2].node) =
2929 @@ -3182,150 +3187,150 @@
2933 -#line 896 "./parse.y"
2934 +#line 902 "./parse.y"
2935 {yyerror ("')' expected"); DRECOVER(method_declarator);;
2938 -#line 898 "./parse.y"
2939 +#line 904 "./parse.y"
2940 {yyerror ("']' expected"); RECOVER;;
2943 -#line 903 "./parse.y"
2944 +#line 909 "./parse.y"
2946 ctxp->formal_parameter_number = 1;
2950 -#line 907 "./parse.y"
2951 +#line 913 "./parse.y"
2953 ctxp->formal_parameter_number += 1;
2954 yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
2958 -#line 912 "./parse.y"
2959 +#line 918 "./parse.y"
2960 {yyerror ("Missing formal parameter term"); RECOVER;;
2963 -#line 917 "./parse.y"
2964 +#line 923 "./parse.y"
2966 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
2970 -#line 921 "./parse.y"
2971 +#line 927 "./parse.y"
2973 parse_jdk1_1_error ("final parameters");
2974 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
2978 -#line 926 "./parse.y"
2979 +#line 932 "./parse.y"
2980 {yyerror ("Missing identifier"); RECOVER;;
2983 -#line 928 "./parse.y"
2984 +#line 934 "./parse.y"
2986 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value));
2987 yyerror ("Missing identifier"); RECOVER;
2991 -#line 935 "./parse.y"
2992 +#line 941 "./parse.y"
2993 { yyval.node = NULL_TREE; ;
2996 -#line 937 "./parse.y"
2997 +#line 943 "./parse.y"
2998 { yyval.node = yyvsp[0].node; ;
3001 -#line 939 "./parse.y"
3002 +#line 945 "./parse.y"
3003 {yyerror ("Missing class type term"); RECOVER;;
3006 -#line 944 "./parse.y"
3007 +#line 950 "./parse.y"
3008 { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ;
3011 -#line 946 "./parse.y"
3012 +#line 952 "./parse.y"
3013 { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ;
3016 -#line 948 "./parse.y"
3017 +#line 954 "./parse.y"
3018 {yyerror ("Missing class type term"); RECOVER;;
3021 -#line 955 "./parse.y"
3022 +#line 961 "./parse.y"
3023 { yyval.node = NULL_TREE; ;
3026 -#line 961 "./parse.y"
3027 +#line 967 "./parse.y"
3029 TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized;
3030 ctxp->static_initialized = yyvsp[0].node;
3034 -#line 966 "./parse.y"
3035 +#line 972 "./parse.y"
3037 TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized;
3038 ctxp->static_initialized = yyvsp[-1].node;
3042 -#line 974 "./parse.y"
3043 +#line 980 "./parse.y"
3045 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
3049 -#line 982 "./parse.y"
3050 +#line 988 "./parse.y"
3052 current_function_decl = yyvsp[0].node;
3053 source_start_java_method (current_function_decl);
3057 -#line 987 "./parse.y"
3058 +#line 993 "./parse.y"
3059 { finish_method_declaration (yyvsp[0].node); ;
3062 -#line 992 "./parse.y"
3063 +#line 998 "./parse.y"
3064 { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3067 -#line 994 "./parse.y"
3068 +#line 1000 "./parse.y"
3069 { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3072 -#line 999 "./parse.y"
3073 +#line 1005 "./parse.y"
3074 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3077 -#line 1001 "./parse.y"
3078 +#line 1007 "./parse.y"
3079 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3082 -#line 1009 "./parse.y"
3083 +#line 1015 "./parse.y"
3085 BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node;
3086 yyval.node = yyvsp[0].node;
3090 -#line 1014 "./parse.y"
3091 +#line 1020 "./parse.y"
3092 { yyval.node = yyvsp[0].node; ;
3095 -#line 1016 "./parse.y"
3096 +#line 1022 "./parse.y"
3097 { yyval.node = yyvsp[0].node; ;
3100 -#line 1018 "./parse.y"
3101 +#line 1024 "./parse.y"
3102 { yyval.node = yyvsp[0].node; ;
3105 -#line 1028 "./parse.y"
3106 +#line 1034 "./parse.y"
3108 yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE);
3109 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node);
3110 @@ -3333,7 +3338,7 @@
3114 -#line 1034 "./parse.y"
3115 +#line 1040 "./parse.y"
3117 yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node);
3118 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node);
3119 @@ -3341,15 +3346,15 @@
3123 -#line 1042 "./parse.y"
3124 +#line 1048 "./parse.y"
3125 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3128 -#line 1044 "./parse.y"
3129 +#line 1050 "./parse.y"
3130 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3133 -#line 1049 "./parse.y"
3134 +#line 1055 "./parse.y"
3136 tree wfl = build_wfl_node (this_identifier_node);
3137 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3138 @@ -3357,7 +3362,7 @@
3142 -#line 1055 "./parse.y"
3143 +#line 1061 "./parse.y"
3145 tree wfl = build_wfl_node (super_identifier_node);
3146 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3147 @@ -3365,133 +3370,133 @@
3151 -#line 1066 "./parse.y"
3152 +#line 1072 "./parse.y"
3153 { create_interface (0, yyvsp[0].node, NULL_TREE); ;
3156 -#line 1068 "./parse.y"
3157 +#line 1074 "./parse.y"
3159 yyval.node = yyvsp[0].node;
3163 -#line 1072 "./parse.y"
3164 +#line 1078 "./parse.y"
3165 { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ;
3168 -#line 1074 "./parse.y"
3169 +#line 1080 "./parse.y"
3171 yyval.node = yyvsp[0].node;
3175 -#line 1078 "./parse.y"
3176 +#line 1084 "./parse.y"
3177 { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ;
3180 -#line 1080 "./parse.y"
3181 +#line 1086 "./parse.y"
3183 yyval.node = yyvsp[0].node;
3187 -#line 1084 "./parse.y"
3188 +#line 1090 "./parse.y"
3189 { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ;
3192 -#line 1086 "./parse.y"
3193 +#line 1092 "./parse.y"
3195 yyval.node = yyvsp[0].node;
3199 -#line 1090 "./parse.y"
3200 +#line 1096 "./parse.y"
3201 {yyerror ("'{' expected"); RECOVER;;
3204 -#line 1092 "./parse.y"
3205 +#line 1098 "./parse.y"
3206 {yyerror ("'{' expected"); RECOVER;;
3209 -#line 1097 "./parse.y"
3210 +#line 1103 "./parse.y"
3212 ctxp->interface_number = 1;
3213 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3217 -#line 1102 "./parse.y"
3218 +#line 1108 "./parse.y"
3220 ctxp->interface_number++;
3221 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3225 -#line 1107 "./parse.y"
3226 +#line 1113 "./parse.y"
3227 {yyerror ("Invalid interface type"); RECOVER;;
3230 -#line 1109 "./parse.y"
3231 +#line 1115 "./parse.y"
3232 {yyerror ("Missing term"); RECOVER;;
3235 -#line 1114 "./parse.y"
3236 +#line 1120 "./parse.y"
3237 { yyval.node = NULL_TREE; ;
3240 -#line 1116 "./parse.y"
3241 +#line 1122 "./parse.y"
3242 { yyval.node = NULL_TREE; ;
3245 -#line 1128 "./parse.y"
3246 +#line 1134 "./parse.y"
3247 { yyval.node = parse_jdk1_1_error ("inner class declaration"); ;
3250 -#line 1130 "./parse.y"
3251 +#line 1136 "./parse.y"
3252 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
3255 -#line 1139 "./parse.y"
3256 +#line 1145 "./parse.y"
3258 check_abstract_method_header (yyvsp[-1].node);
3259 current_function_decl = NULL_TREE; /* FIXME ? */
3263 -#line 1144 "./parse.y"
3264 +#line 1150 "./parse.y"
3265 {yyerror ("';' expected"); RECOVER;;
3268 -#line 1150 "./parse.y"
3269 +#line 1156 "./parse.y"
3270 { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ;
3273 -#line 1152 "./parse.y"
3274 +#line 1158 "./parse.y"
3275 { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3278 -#line 1154 "./parse.y"
3279 +#line 1160 "./parse.y"
3280 { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ;
3283 -#line 1159 "./parse.y"
3284 +#line 1165 "./parse.y"
3286 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node),
3287 yyvsp[0].node, NULL_TREE);
3291 -#line 1164 "./parse.y"
3292 +#line 1170 "./parse.y"
3294 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node);
3298 -#line 1168 "./parse.y"
3299 +#line 1174 "./parse.y"
3300 {yyerror ("Missing term"); RECOVER;;
3303 -#line 1174 "./parse.y"
3304 +#line 1180 "./parse.y"
3306 /* Store the location of the `}' when doing xrefs */
3307 if (current_function_decl && flag_emit_xref)
3308 @@ -3501,15 +3506,15 @@
3312 -#line 1182 "./parse.y"
3313 +#line 1188 "./parse.y"
3314 { yyval.node = yyvsp[0].node; ;
3317 -#line 1187 "./parse.y"
3318 +#line 1193 "./parse.y"
3322 -#line 1192 "./parse.y"
3323 +#line 1198 "./parse.y"
3325 maybe_absorb_scoping_blocks ();
3326 /* Store the location of the `}' when doing xrefs */
3327 @@ -3520,35 +3525,35 @@
3331 -#line 1210 "./parse.y"
3332 +#line 1216 "./parse.y"
3333 { java_method_add_stmt (current_function_decl, yyvsp[0].node); ;
3336 -#line 1212 "./parse.y"
3337 +#line 1218 "./parse.y"
3338 { parse_jdk1_1_error ("inner class declaration"); ;
3341 -#line 1221 "./parse.y"
3342 +#line 1227 "./parse.y"
3343 { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ;
3346 -#line 1223 "./parse.y"
3347 +#line 1229 "./parse.y"
3348 { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ;
3351 -#line 1233 "./parse.y"
3352 +#line 1239 "./parse.y"
3353 { yyval.node = exit_block (); ;
3356 -#line 1242 "./parse.y"
3357 +#line 1248 "./parse.y"
3358 { yyval.node = exit_block (); ;
3361 -#line 1261 "./parse.y"
3362 +#line 1267 "./parse.y"
3363 { yyval.node = empty_stmt_node; ;
3366 -#line 1266 "./parse.y"
3367 +#line 1272 "./parse.y"
3369 yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node),
3370 EXPR_WFL_NODE (yyvsp[-1].node));
3371 @@ -3558,19 +3563,19 @@
3375 -#line 1277 "./parse.y"
3376 +#line 1283 "./parse.y"
3377 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3380 -#line 1279 "./parse.y"
3381 +#line 1285 "./parse.y"
3382 {yyerror ("':' expected"); RECOVER;;
3385 -#line 1284 "./parse.y"
3386 +#line 1290 "./parse.y"
3387 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3390 -#line 1291 "./parse.y"
3391 +#line 1297 "./parse.y"
3393 /* We have a statement. Generate a WFL around it so
3395 @@ -3581,7 +3586,7 @@
3399 -#line 1300 "./parse.y"
3400 +#line 1306 "./parse.y"
3402 if (ctxp->prevent_ese != lineno)
3403 yyerror ("Invalid expression statement");
3404 @@ -3589,7 +3594,7 @@
3408 -#line 1306 "./parse.y"
3409 +#line 1312 "./parse.y"
3411 if (ctxp->prevent_ese != lineno)
3412 yyerror ("Invalid expression statement");
3413 @@ -3597,7 +3602,7 @@
3417 -#line 1312 "./parse.y"
3418 +#line 1318 "./parse.y"
3420 if (ctxp->prevent_ese != lineno)
3421 yyerror ("Invalid expression statement");
3422 @@ -3605,84 +3610,82 @@
3426 -#line 1318 "./parse.y"
3427 +#line 1324 "./parse.y"
3428 {yyerror ("')' expected"); RECOVER;;
3431 -#line 1320 "./parse.y"
3432 +#line 1326 "./parse.y"
3434 - yyerror ("Constructor invocation must be first "
3435 - "thing in a constructor");
3436 + parse_ctor_invocation_error ();
3441 -#line 1326 "./parse.y"
3442 +#line 1331 "./parse.y"
3443 {yyerror ("')' expected"); RECOVER;;
3446 -#line 1328 "./parse.y"
3447 +#line 1333 "./parse.y"
3449 - yyerror ("Constructor invocation must be first "
3450 - "thing in a constructor");
3451 + parse_ctor_invocation_error ();
3456 -#line 1334 "./parse.y"
3457 +#line 1338 "./parse.y"
3458 {yyerror ("'(' expected"); RECOVER;;
3461 -#line 1336 "./parse.y"
3462 +#line 1340 "./parse.y"
3463 {yyerror ("')' expected"); RECOVER;;
3466 -#line 1338 "./parse.y"
3467 +#line 1342 "./parse.y"
3468 {yyerror ("')' expected"); RECOVER;;
3471 -#line 1340 "./parse.y"
3472 +#line 1344 "./parse.y"
3473 {yyerror ("';' expected"); RECOVER;;
3476 -#line 1342 "./parse.y"
3477 +#line 1346 "./parse.y"
3478 {yyerror ("';' expected"); RECOVER;;
3481 -#line 1357 "./parse.y"
3482 +#line 1361 "./parse.y"
3484 yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node,
3485 yyvsp[0].node, NULL_TREE);
3489 -#line 1362 "./parse.y"
3490 +#line 1366 "./parse.y"
3491 {yyerror ("'(' expected"); RECOVER;;
3494 -#line 1364 "./parse.y"
3495 +#line 1368 "./parse.y"
3496 {yyerror ("Missing term"); RECOVER;;
3499 -#line 1366 "./parse.y"
3500 +#line 1370 "./parse.y"
3501 {yyerror ("')' expected"); RECOVER;;
3504 -#line 1371 "./parse.y"
3505 +#line 1375 "./parse.y"
3506 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3509 -#line 1376 "./parse.y"
3510 +#line 1380 "./parse.y"
3511 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3514 -#line 1381 "./parse.y"
3515 +#line 1385 "./parse.y"
3521 -#line 1385 "./parse.y"
3522 +#line 1389 "./parse.y"
3524 /* Make into "proper list" of COMPOUND_EXPRs.
3525 I.e. make the last statment also have its own
3526 @@ -3693,42 +3696,42 @@
3530 -#line 1397 "./parse.y"
3531 +#line 1401 "./parse.y"
3533 yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE);
3534 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3538 -#line 1402 "./parse.y"
3539 +#line 1406 "./parse.y"
3540 {yyerror ("'(' expected"); RECOVER;;
3543 -#line 1404 "./parse.y"
3544 +#line 1408 "./parse.y"
3545 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;
3548 -#line 1406 "./parse.y"
3549 +#line 1410 "./parse.y"
3550 {yyerror ("'{' expected"); RECOVER;;
3553 -#line 1414 "./parse.y"
3554 +#line 1418 "./parse.y"
3555 { yyval.node = NULL_TREE; ;
3558 -#line 1416 "./parse.y"
3559 +#line 1420 "./parse.y"
3560 { yyval.node = NULL_TREE; ;
3563 -#line 1418 "./parse.y"
3564 +#line 1422 "./parse.y"
3565 { yyval.node = NULL_TREE; ;
3568 -#line 1420 "./parse.y"
3569 +#line 1424 "./parse.y"
3570 { yyval.node = NULL_TREE; ;
3573 -#line 1439 "./parse.y"
3574 +#line 1443 "./parse.y"
3576 tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node);
3577 EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location;
3578 @@ -3736,7 +3739,7 @@
3582 -#line 1445 "./parse.y"
3583 +#line 1449 "./parse.y"
3585 tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
3586 EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location;
3587 @@ -3744,61 +3747,61 @@
3591 -#line 1451 "./parse.y"
3592 +#line 1455 "./parse.y"
3593 {yyerror ("Missing or invalid constant expression"); RECOVER;;
3596 -#line 1453 "./parse.y"
3597 +#line 1457 "./parse.y"
3598 {yyerror ("':' expected"); RECOVER;;
3601 -#line 1455 "./parse.y"
3602 +#line 1459 "./parse.y"
3603 {yyerror ("':' expected"); RECOVER;;
3606 -#line 1460 "./parse.y"
3607 +#line 1464 "./parse.y"
3609 tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
3610 yyval.node = build_new_loop (body);
3614 -#line 1468 "./parse.y"
3615 +#line 1472 "./parse.y"
3616 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3619 -#line 1470 "./parse.y"
3620 +#line 1474 "./parse.y"
3621 {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;
3624 -#line 1472 "./parse.y"
3625 +#line 1476 "./parse.y"
3626 {yyerror ("Missing term and ')' expected"); RECOVER;;
3629 -#line 1474 "./parse.y"
3630 +#line 1478 "./parse.y"
3631 {yyerror ("')' expected"); RECOVER;;
3634 -#line 1479 "./parse.y"
3635 +#line 1483 "./parse.y"
3636 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3639 -#line 1484 "./parse.y"
3640 +#line 1488 "./parse.y"
3642 tree body = build_loop_body (0, NULL_TREE, 1);
3643 yyval.node = build_new_loop (body);
3647 -#line 1493 "./parse.y"
3648 +#line 1497 "./parse.y"
3649 { yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ;
3652 -#line 1498 "./parse.y"
3653 +#line 1502 "./parse.y"
3654 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3657 -#line 1500 "./parse.y"
3658 +#line 1504 "./parse.y"
3660 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3661 /* We have not condition, so we get rid of the EXIT_EXPR */
3662 @@ -3807,23 +3810,23 @@
3666 -#line 1507 "./parse.y"
3667 +#line 1511 "./parse.y"
3668 {yyerror ("Invalid control expression"); RECOVER;;
3671 -#line 1509 "./parse.y"
3672 +#line 1513 "./parse.y"
3673 {yyerror ("Invalid update expression"); RECOVER;;
3676 -#line 1511 "./parse.y"
3677 +#line 1515 "./parse.y"
3678 {yyerror ("Invalid update expression"); RECOVER;;
3681 -#line 1516 "./parse.y"
3682 +#line 1520 "./parse.y"
3683 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
3686 -#line 1518 "./parse.y"
3687 +#line 1522 "./parse.y"
3689 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3690 /* We have not condition, so we get rid of the EXIT_EXPR */
3691 @@ -3832,7 +3835,7 @@
3695 -#line 1528 "./parse.y"
3696 +#line 1532 "./parse.y"
3698 /* This scope defined for local variable that may be
3699 defined within the scope of the for loop */
3700 @@ -3840,15 +3843,15 @@
3704 -#line 1534 "./parse.y"
3705 +#line 1538 "./parse.y"
3706 {yyerror ("'(' expected"); DRECOVER(for_1);;
3709 -#line 1536 "./parse.y"
3710 +#line 1540 "./parse.y"
3711 {yyerror ("Invalid init statement"); RECOVER;;
3714 -#line 1541 "./parse.y"
3715 +#line 1545 "./parse.y"
3717 /* We now declare the loop body. The loop is
3718 declared as a for loop. */
3719 @@ -3861,11 +3864,11 @@
3723 -#line 1553 "./parse.y"
3724 +#line 1557 "./parse.y"
3725 { yyval.node = empty_stmt_node; ;
3728 -#line 1555 "./parse.y"
3729 +#line 1559 "./parse.y"
3731 /* Init statement recorded within the previously
3732 defined block scope */
3733 @@ -3873,7 +3876,7 @@
3737 -#line 1561 "./parse.y"
3738 +#line 1565 "./parse.y"
3740 /* Local variable are recorded within the previously
3741 defined block scope */
3742 @@ -3881,94 +3884,94 @@
3746 -#line 1567 "./parse.y"
3747 +#line 1571 "./parse.y"
3748 {yyerror ("';' expected"); DRECOVER(for_init_1);;
3751 -#line 1571 "./parse.y"
3752 +#line 1575 "./parse.y"
3753 {yyval.node = empty_stmt_node;;
3756 -#line 1573 "./parse.y"
3757 +#line 1577 "./parse.y"
3758 { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ;
3761 -#line 1578 "./parse.y"
3762 +#line 1582 "./parse.y"
3763 { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ;
3766 -#line 1580 "./parse.y"
3767 +#line 1584 "./parse.y"
3768 { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ;
3771 -#line 1582 "./parse.y"
3772 +#line 1586 "./parse.y"
3773 {yyerror ("Missing term"); RECOVER;;
3776 -#line 1587 "./parse.y"
3777 +#line 1591 "./parse.y"
3778 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ;
3781 -#line 1589 "./parse.y"
3782 +#line 1593 "./parse.y"
3783 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ;
3786 -#line 1591 "./parse.y"
3787 +#line 1595 "./parse.y"
3788 {yyerror ("Missing term"); RECOVER;;
3791 -#line 1593 "./parse.y"
3792 +#line 1597 "./parse.y"
3793 {yyerror ("';' expected"); RECOVER;;
3796 -#line 1598 "./parse.y"
3797 +#line 1602 "./parse.y"
3798 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ;
3801 -#line 1600 "./parse.y"
3802 +#line 1604 "./parse.y"
3803 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ;
3806 -#line 1602 "./parse.y"
3807 +#line 1606 "./parse.y"
3808 {yyerror ("Missing term"); RECOVER;;
3811 -#line 1604 "./parse.y"
3812 +#line 1608 "./parse.y"
3813 {yyerror ("';' expected"); RECOVER;;
3816 -#line 1609 "./parse.y"
3817 +#line 1613 "./parse.y"
3818 { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ;
3821 -#line 1611 "./parse.y"
3822 +#line 1615 "./parse.y"
3823 { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3826 -#line 1613 "./parse.y"
3827 +#line 1617 "./parse.y"
3828 {yyerror ("Missing term"); RECOVER;;
3831 -#line 1615 "./parse.y"
3832 +#line 1619 "./parse.y"
3833 {yyerror ("';' expected"); RECOVER;;
3836 -#line 1620 "./parse.y"
3837 +#line 1624 "./parse.y"
3839 yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node);
3840 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3844 -#line 1625 "./parse.y"
3845 +#line 1629 "./parse.y"
3846 {yyerror ("Missing term"); RECOVER;;
3849 -#line 1627 "./parse.y"
3850 +#line 1631 "./parse.y"
3851 {yyerror ("';' expected"); RECOVER;;
3854 -#line 1632 "./parse.y"
3855 +#line 1636 "./parse.y"
3857 yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3858 EXPR_WFL_LINECOL (yyval.node) =
3859 @@ -3976,56 +3979,56 @@
3863 -#line 1638 "./parse.y"
3864 +#line 1642 "./parse.y"
3865 {yyerror ("'{' expected"); RECOVER;;
3868 -#line 1640 "./parse.y"
3869 +#line 1644 "./parse.y"
3870 {yyerror ("'(' expected"); RECOVER;;
3873 -#line 1642 "./parse.y"
3874 +#line 1646 "./parse.y"
3875 {yyerror ("Missing term"); RECOVER;;
3878 -#line 1644 "./parse.y"
3879 +#line 1648 "./parse.y"
3880 {yyerror ("Missing term"); RECOVER;;
3883 -#line 1649 "./parse.y"
3884 +#line 1653 "./parse.y"
3886 if ((1 << yyvsp[0].value) != ACC_SYNCHRONIZED)
3887 fatal ("synchronized was '%d' - yyparse", (1 << yyvsp[0].value));
3891 -#line 1657 "./parse.y"
3892 +#line 1661 "./parse.y"
3893 { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
3896 -#line 1659 "./parse.y"
3897 +#line 1663 "./parse.y"
3898 { yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
3901 -#line 1661 "./parse.y"
3902 +#line 1665 "./parse.y"
3903 { yyval.node = build_try_finally_statement
3904 (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location,
3905 yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node);
3909 -#line 1666 "./parse.y"
3910 +#line 1670 "./parse.y"
3911 {yyerror ("'{' expected"); DRECOVER (try_statement);;
3914 -#line 1672 "./parse.y"
3915 +#line 1676 "./parse.y"
3917 TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node;
3918 yyval.node = yyvsp[0].node;
3922 -#line 1680 "./parse.y"
3923 +#line 1684 "./parse.y"
3925 java_method_add_stmt (current_function_decl, yyvsp[0].node);
3927 @@ -4033,7 +4036,7 @@
3931 -#line 1688 "./parse.y"
3932 +#line 1692 "./parse.y"
3934 /* We add a block to define a scope for
3935 formal_parameter (CCBP). The formal parameter is
3936 @@ -4051,176 +4054,176 @@
3940 -#line 1704 "./parse.y"
3941 +#line 1708 "./parse.y"
3942 {yyerror ("'(' expected"); RECOVER;;
3945 -#line 1706 "./parse.y"
3946 +#line 1710 "./parse.y"
3947 {yyerror ("Missing term or ')' expected"); DRECOVER (2);;
3950 -#line 1708 "./parse.y"
3951 +#line 1712 "./parse.y"
3952 {yyerror ("')' expected"); DRECOVER (1);;
3955 -#line 1713 "./parse.y"
3956 +#line 1717 "./parse.y"
3957 { yyval.node = yyvsp[0].node; ;
3960 -#line 1715 "./parse.y"
3961 +#line 1719 "./parse.y"
3962 {yyerror ("'{' expected"); RECOVER; ;
3965 -#line 1727 "./parse.y"
3966 +#line 1731 "./parse.y"
3967 { yyval.node = build_this (yyvsp[0].operator.location); ;
3970 -#line 1729 "./parse.y"
3971 +#line 1733 "./parse.y"
3972 {yyval.node = yyvsp[-1].node;;
3975 -#line 1738 "./parse.y"
3976 +#line 1742 "./parse.y"
3977 { yyval.node = parse_jdk1_1_error ("named class literals"); ;
3980 -#line 1740 "./parse.y"
3981 +#line 1744 "./parse.y"
3982 { yyval.node = build_class_ref (yyvsp[-2].node); ;
3985 -#line 1742 "./parse.y"
3986 +#line 1746 "./parse.y"
3987 { yyval.node = build_class_ref (void_type_node); ;
3990 -#line 1747 "./parse.y"
3991 +#line 1751 "./parse.y"
3992 { yyval.node = parse_jdk1_1_error ("class literals"); ;
3995 -#line 1749 "./parse.y"
3996 +#line 1753 "./parse.y"
3997 {yyerror ("')' expected"); RECOVER;;
4000 -#line 1751 "./parse.y"
4001 +#line 1755 "./parse.y"
4002 {yyerror ("'class' or 'this' expected" ); RECOVER;;
4005 -#line 1753 "./parse.y"
4006 +#line 1757 "./parse.y"
4007 {yyerror ("'class' expected" ); RECOVER;;
4010 -#line 1755 "./parse.y"
4011 +#line 1759 "./parse.y"
4012 {yyerror ("'class' expected" ); RECOVER;;
4015 -#line 1760 "./parse.y"
4016 +#line 1764 "./parse.y"
4017 { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4020 -#line 1762 "./parse.y"
4021 +#line 1766 "./parse.y"
4022 { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ;
4025 -#line 1767 "./parse.y"
4026 +#line 1771 "./parse.y"
4027 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4030 -#line 1769 "./parse.y"
4031 +#line 1773 "./parse.y"
4032 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4035 -#line 1778 "./parse.y"
4036 +#line 1782 "./parse.y"
4037 {yyerror ("'(' expected"); DRECOVER(new_1);;
4040 -#line 1780 "./parse.y"
4041 +#line 1784 "./parse.y"
4042 {yyerror ("'(' expected"); RECOVER;;
4045 -#line 1782 "./parse.y"
4046 +#line 1786 "./parse.y"
4047 {yyerror ("')' or term expected"); RECOVER;;
4050 -#line 1784 "./parse.y"
4051 +#line 1788 "./parse.y"
4052 {yyerror ("')' expected"); RECOVER;;
4055 -#line 1786 "./parse.y"
4056 +#line 1790 "./parse.y"
4057 {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;;
4060 -#line 1788 "./parse.y"
4061 +#line 1792 "./parse.y"
4062 {yyerror ("'(' expected"); RECOVER;;
4065 -#line 1798 "./parse.y"
4066 +#line 1802 "./parse.y"
4068 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
4069 ctxp->formal_parameter_number = 1;
4073 -#line 1803 "./parse.y"
4074 +#line 1807 "./parse.y"
4076 ctxp->formal_parameter_number += 1;
4077 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
4081 -#line 1808 "./parse.y"
4082 +#line 1812 "./parse.y"
4083 {yyerror ("Missing term"); RECOVER;;
4086 -#line 1813 "./parse.y"
4087 +#line 1817 "./parse.y"
4088 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4091 -#line 1815 "./parse.y"
4092 +#line 1819 "./parse.y"
4093 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4096 -#line 1817 "./parse.y"
4097 +#line 1821 "./parse.y"
4098 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4101 -#line 1819 "./parse.y"
4102 +#line 1823 "./parse.y"
4103 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4106 -#line 1823 "./parse.y"
4107 +#line 1827 "./parse.y"
4108 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4111 -#line 1825 "./parse.y"
4112 +#line 1829 "./parse.y"
4113 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4116 -#line 1827 "./parse.y"
4117 +#line 1831 "./parse.y"
4118 {yyerror ("'[' expected"); DRECOVER ("]");;
4121 -#line 1829 "./parse.y"
4122 +#line 1833 "./parse.y"
4123 {yyerror ("']' expected"); RECOVER;;
4126 -#line 1834 "./parse.y"
4127 +#line 1838 "./parse.y"
4128 { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ;
4131 -#line 1836 "./parse.y"
4132 +#line 1840 "./parse.y"
4133 { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ;
4136 -#line 1841 "./parse.y"
4137 +#line 1845 "./parse.y"
4139 EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
4140 yyval.node = yyvsp[-1].node;
4144 -#line 1846 "./parse.y"
4145 +#line 1850 "./parse.y"
4146 {yyerror ("']' expected"); RECOVER;;
4149 -#line 1848 "./parse.y"
4150 +#line 1852 "./parse.y"
4152 yyerror ("Missing term");
4153 yyerror ("']' expected");
4154 @@ -4228,7 +4231,7 @@
4158 -#line 1857 "./parse.y"
4159 +#line 1861 "./parse.y"
4162 /* If not initialized, allocate memory for the osb
4163 @@ -4256,19 +4259,19 @@
4167 -#line 1883 "./parse.y"
4168 +#line 1887 "./parse.y"
4169 { CURRENT_OSB (ctxp)++; ;
4172 -#line 1885 "./parse.y"
4173 +#line 1889 "./parse.y"
4174 { yyerror ("']' expected"); RECOVER;;
4177 -#line 1890 "./parse.y"
4178 +#line 1894 "./parse.y"
4179 { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
4182 -#line 1894 "./parse.y"
4183 +#line 1898 "./parse.y"
4186 build_wfl_node (super_identifier_node);
4187 @@ -4277,19 +4280,19 @@
4191 -#line 1901 "./parse.y"
4192 +#line 1905 "./parse.y"
4193 {yyerror ("Field expected"); DRECOVER (super_field_acces);;
4196 -#line 1906 "./parse.y"
4197 +#line 1910 "./parse.y"
4198 { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ;
4201 -#line 1908 "./parse.y"
4202 +#line 1912 "./parse.y"
4203 { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4206 -#line 1910 "./parse.y"
4207 +#line 1914 "./parse.y"
4209 if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR)
4210 yyval.node = build_this_super_qualified_invocation
4211 @@ -4302,7 +4305,7 @@
4215 -#line 1921 "./parse.y"
4216 +#line 1925 "./parse.y"
4218 if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR)
4219 yyval.node = build_this_super_qualified_invocation
4220 @@ -4315,121 +4318,121 @@
4224 -#line 1932 "./parse.y"
4225 +#line 1936 "./parse.y"
4227 yyval.node = build_this_super_qualified_invocation
4228 (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location);
4232 -#line 1937 "./parse.y"
4233 +#line 1941 "./parse.y"
4235 yyval.node = build_this_super_qualified_invocation
4236 (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location);
4240 -#line 1946 "./parse.y"
4241 +#line 1950 "./parse.y"
4242 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4245 -#line 1948 "./parse.y"
4246 +#line 1952 "./parse.y"
4247 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4250 -#line 1953 "./parse.y"
4251 +#line 1957 "./parse.y"
4252 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4255 -#line 1955 "./parse.y"
4256 +#line 1959 "./parse.y"
4257 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4260 -#line 1957 "./parse.y"
4261 +#line 1961 "./parse.y"
4263 yyerror ("Missing term and ']' expected");
4264 DRECOVER(array_access);
4268 -#line 1962 "./parse.y"
4269 +#line 1966 "./parse.y"
4271 yyerror ("']' expected");
4272 DRECOVER(array_access);
4276 -#line 1967 "./parse.y"
4277 +#line 1971 "./parse.y"
4279 yyerror ("Missing term and ']' expected");
4280 DRECOVER(array_access);
4284 -#line 1972 "./parse.y"
4285 +#line 1976 "./parse.y"
4287 yyerror ("']' expected");
4288 DRECOVER(array_access);
4292 -#line 1987 "./parse.y"
4293 +#line 1991 "./parse.y"
4294 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4297 -#line 1992 "./parse.y"
4298 +#line 1996 "./parse.y"
4299 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4302 -#line 1999 "./parse.y"
4303 +#line 2003 "./parse.y"
4304 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4307 -#line 2001 "./parse.y"
4308 +#line 2005 "./parse.y"
4309 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4312 -#line 2004 "./parse.y"
4313 +#line 2008 "./parse.y"
4314 {yyerror ("Missing term"); RECOVER;
4317 -#line 2006 "./parse.y"
4318 +#line 2010 "./parse.y"
4319 {yyerror ("Missing term"); RECOVER;
4322 -#line 2011 "./parse.y"
4323 +#line 2015 "./parse.y"
4324 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4327 -#line 2013 "./parse.y"
4328 +#line 2017 "./parse.y"
4329 {yyerror ("Missing term"); RECOVER;
4332 -#line 2018 "./parse.y"
4333 +#line 2022 "./parse.y"
4334 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4337 -#line 2020 "./parse.y"
4338 +#line 2024 "./parse.y"
4339 {yyerror ("Missing term"); RECOVER;
4342 -#line 2026 "./parse.y"
4343 +#line 2030 "./parse.y"
4344 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4347 -#line 2028 "./parse.y"
4348 +#line 2032 "./parse.y"
4349 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4352 -#line 2031 "./parse.y"
4353 +#line 2035 "./parse.y"
4354 {yyerror ("Missing term"); RECOVER;
4357 -#line 2033 "./parse.y"
4358 +#line 2037 "./parse.y"
4359 {yyerror ("Missing term"); RECOVER;
4362 -#line 2038 "./parse.y"
4363 +#line 2042 "./parse.y"
4365 tree type = yyvsp[-3].node;
4366 while (CURRENT_OSB (ctxp)--)
4367 @@ -4439,15 +4442,15 @@
4371 -#line 2046 "./parse.y"
4372 +#line 2050 "./parse.y"
4373 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4376 -#line 2048 "./parse.y"
4377 +#line 2052 "./parse.y"
4378 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4381 -#line 2050 "./parse.y"
4382 +#line 2054 "./parse.y"
4385 while (CURRENT_OSB (ctxp)--)
4386 @@ -4462,11 +4465,11 @@
4390 -#line 2063 "./parse.y"
4391 +#line 2067 "./parse.y"
4392 {yyerror ("']' expected, invalid type expression");;
4395 -#line 2065 "./parse.y"
4396 +#line 2069 "./parse.y"
4398 if (ctxp->prevent_ese != lineno)
4399 yyerror ("Invalid type expression"); RECOVER;
4400 @@ -4474,243 +4477,243 @@
4404 -#line 2071 "./parse.y"
4405 +#line 2075 "./parse.y"
4406 {yyerror ("Missing term"); RECOVER;;
4409 -#line 2073 "./parse.y"
4410 +#line 2077 "./parse.y"
4411 {yyerror ("Missing term"); RECOVER;;
4414 -#line 2075 "./parse.y"
4415 +#line 2079 "./parse.y"
4416 {yyerror ("Missing term"); RECOVER;;
4419 -#line 2081 "./parse.y"
4420 +#line 2085 "./parse.y"
4422 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token),
4423 yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
4427 -#line 2086 "./parse.y"
4428 +#line 2090 "./parse.y"
4430 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4431 yyvsp[-2].node, yyvsp[0].node);
4435 -#line 2091 "./parse.y"
4436 +#line 2095 "./parse.y"
4438 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4439 yyvsp[-2].node, yyvsp[0].node);
4443 -#line 2096 "./parse.y"
4444 +#line 2100 "./parse.y"
4445 {yyerror ("Missing term"); RECOVER;;
4448 -#line 2098 "./parse.y"
4449 +#line 2102 "./parse.y"
4450 {yyerror ("Missing term"); RECOVER;;
4453 -#line 2100 "./parse.y"
4454 +#line 2104 "./parse.y"
4455 {yyerror ("Missing term"); RECOVER;;
4458 -#line 2106 "./parse.y"
4459 +#line 2110 "./parse.y"
4461 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4462 yyvsp[-2].node, yyvsp[0].node);
4466 -#line 2111 "./parse.y"
4467 +#line 2115 "./parse.y"
4469 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4470 yyvsp[-2].node, yyvsp[0].node);
4474 -#line 2116 "./parse.y"
4475 +#line 2120 "./parse.y"
4476 {yyerror ("Missing term"); RECOVER;;
4479 -#line 2118 "./parse.y"
4480 +#line 2122 "./parse.y"
4481 {yyerror ("Missing term"); RECOVER;;
4484 -#line 2124 "./parse.y"
4485 +#line 2128 "./parse.y"
4487 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4488 yyvsp[-2].node, yyvsp[0].node);
4492 -#line 2129 "./parse.y"
4493 +#line 2133 "./parse.y"
4495 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4496 yyvsp[-2].node, yyvsp[0].node);
4500 -#line 2134 "./parse.y"
4501 +#line 2138 "./parse.y"
4503 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4504 yyvsp[-2].node, yyvsp[0].node);
4508 -#line 2139 "./parse.y"
4509 +#line 2143 "./parse.y"
4510 {yyerror ("Missing term"); RECOVER;;
4513 -#line 2141 "./parse.y"
4514 +#line 2145 "./parse.y"
4515 {yyerror ("Missing term"); RECOVER;;
4518 -#line 2143 "./parse.y"
4519 +#line 2147 "./parse.y"
4520 {yyerror ("Missing term"); RECOVER;;
4523 -#line 2149 "./parse.y"
4524 +#line 2153 "./parse.y"
4526 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4527 yyvsp[-2].node, yyvsp[0].node);
4531 -#line 2154 "./parse.y"
4532 +#line 2158 "./parse.y"
4534 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4535 yyvsp[-2].node, yyvsp[0].node);
4539 -#line 2159 "./parse.y"
4540 +#line 2163 "./parse.y"
4542 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4543 yyvsp[-2].node, yyvsp[0].node);
4547 -#line 2164 "./parse.y"
4548 +#line 2168 "./parse.y"
4550 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4551 yyvsp[-2].node, yyvsp[0].node);
4555 -#line 2169 "./parse.y"
4556 +#line 2173 "./parse.y"
4557 { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4560 -#line 2171 "./parse.y"
4561 +#line 2175 "./parse.y"
4562 {yyerror ("Missing term"); RECOVER;;
4565 -#line 2173 "./parse.y"
4566 +#line 2177 "./parse.y"
4567 {yyerror ("Missing term"); RECOVER;;
4570 -#line 2175 "./parse.y"
4571 +#line 2179 "./parse.y"
4572 {yyerror ("Missing term"); RECOVER;;
4575 -#line 2177 "./parse.y"
4576 +#line 2181 "./parse.y"
4577 {yyerror ("Missing term"); RECOVER;;
4580 -#line 2179 "./parse.y"
4581 +#line 2183 "./parse.y"
4582 {yyerror ("Invalid reference type"); RECOVER;;
4585 -#line 2185 "./parse.y"
4586 +#line 2189 "./parse.y"
4588 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4589 yyvsp[-2].node, yyvsp[0].node);
4593 -#line 2190 "./parse.y"
4594 +#line 2194 "./parse.y"
4596 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4597 yyvsp[-2].node, yyvsp[0].node);
4601 -#line 2195 "./parse.y"
4602 +#line 2199 "./parse.y"
4603 {yyerror ("Missing term"); RECOVER;;
4606 -#line 2197 "./parse.y"
4607 +#line 2201 "./parse.y"
4608 {yyerror ("Missing term"); RECOVER;;
4611 -#line 2203 "./parse.y"
4612 +#line 2207 "./parse.y"
4614 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4615 yyvsp[-2].node, yyvsp[0].node);
4619 -#line 2208 "./parse.y"
4620 +#line 2212 "./parse.y"
4621 {yyerror ("Missing term"); RECOVER;;
4624 -#line 2214 "./parse.y"
4625 +#line 2218 "./parse.y"
4627 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4628 yyvsp[-2].node, yyvsp[0].node);
4632 -#line 2219 "./parse.y"
4633 +#line 2223 "./parse.y"
4634 {yyerror ("Missing term"); RECOVER;;
4637 -#line 2225 "./parse.y"
4638 +#line 2229 "./parse.y"
4640 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4641 yyvsp[-2].node, yyvsp[0].node);
4645 -#line 2230 "./parse.y"
4646 +#line 2234 "./parse.y"
4647 {yyerror ("Missing term"); RECOVER;;
4650 -#line 2236 "./parse.y"
4651 +#line 2240 "./parse.y"
4653 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4654 yyvsp[-2].node, yyvsp[0].node);
4658 -#line 2241 "./parse.y"
4659 +#line 2245 "./parse.y"
4660 {yyerror ("Missing term"); RECOVER;;
4663 -#line 2247 "./parse.y"
4664 +#line 2251 "./parse.y"
4666 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4667 yyvsp[-2].node, yyvsp[0].node);
4671 -#line 2252 "./parse.y"
4672 +#line 2256 "./parse.y"
4673 {yyerror ("Missing term"); RECOVER;;
4676 -#line 2258 "./parse.y"
4677 +#line 2262 "./parse.y"
4679 yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
4680 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4684 -#line 2263 "./parse.y"
4685 +#line 2267 "./parse.y"
4688 yyerror ("Missing term");
4689 @@ -4718,19 +4721,19 @@
4693 -#line 2269 "./parse.y"
4694 +#line 2273 "./parse.y"
4695 {yyerror ("Missing term"); DRECOVER (2);;
4698 -#line 2271 "./parse.y"
4699 +#line 2275 "./parse.y"
4700 {yyerror ("Missing term"); DRECOVER (3);;
4703 -#line 2281 "./parse.y"
4704 +#line 2285 "./parse.y"
4705 { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4708 -#line 2283 "./parse.y"
4709 +#line 2287 "./parse.y"
4711 if (ctxp->prevent_ese != lineno)
4712 yyerror ("Missing term");
4713 @@ -4739,7 +4742,7 @@
4716 /* the action file gets copied in in place of this dollarsign */
4717 -#line 542 "/usr/lib/bison.simple"
4718 +#line 543 "/usr/lib/bison.simple"
4722 @@ -4959,7 +4962,7 @@
4726 -#line 2309 "./parse.y"
4727 +#line 2313 "./parse.y"
4731 @@ -5063,7 +5066,17 @@
4735 -/* Reporting JDK1.1 features not implemented */
4736 +/* Reporting an constructor invocation error. */
4738 +parse_ctor_invocation_error ()
4740 + if (DECL_CONSTRUCTOR_P (current_function_decl))
4741 + yyerror ("Constructor invocation must be first thing in a constructor");
4743 + yyerror ("Only constructors can invoke constructors");
4746 +/* Reporting JDK1.1 features not implemented. */
4749 parse_jdk1_1_error (msg)
4750 @@ -5972,13 +5985,18 @@
4752 tree meth = TREE_VALUE (mdecl);
4753 tree id = TREE_PURPOSE (mdecl);
4754 - tree this_class = TREE_TYPE (ctxp->current_parsed_class);
4755 tree type_wfl = NULL_TREE;
4756 - tree meth_name = NULL_TREE, current, orig_arg;
4757 + tree meth_name = NULL_TREE;
4758 + tree current, orig_arg, this_class;
4760 int constructor_ok = 0, must_chain;
4762 check_modifiers_consistency (flags);
4764 + if (ctxp->current_parsed_class)
4765 + this_class = TREE_TYPE (ctxp->current_parsed_class);
4769 /* There are some forbidden modifiers for an abstract method and its
4770 class must be abstract as well. */
4771 @@ -6174,7 +6192,12 @@
4772 finish_method_declaration (method_body)
4775 - int flags = get_access_flags_from_decl (current_function_decl);
4778 + if (!current_function_decl)
4781 + flags = get_access_flags_from_decl (current_function_decl);
4783 /* 8.4.5 Method Body */
4784 if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
4785 @@ -6989,7 +7012,9 @@
4787 /* Resolve and layout if necessary */
4788 layout_class_methods (TREE_TYPE (decl));
4789 - if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))
4790 + /* Check methods, but only once */
4791 + if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl))
4792 + && !CLASS_LOADED_P (TREE_TYPE (decl)))
4793 CHECK_METHODS (decl);
4794 if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
4795 safe_layout_class (TREE_TYPE (decl));
4796 @@ -7170,7 +7195,7 @@
4798 /* Track method being redefined inside the same class. As a side
4799 effect, set DECL_NAME to an IDENTIFIER (prior entering this
4800 - function it's a FWL, so we can track errors more accurately */
4801 + function it's a FWL, so we can track errors more accurately.) */
4804 check_method_redefinition (class, method)
4805 @@ -7206,9 +7231,126 @@
4809 -/* Check all the methods of CLASS. Methods are first completed then
4810 - checked according to regular method existance rules.
4811 - If no constructor were encountered, then build its declaration. */
4813 +check_abstract_method_definitions (do_interface, class_decl, type)
4815 + tree class_decl, type;
4817 + tree class = TREE_TYPE (class_decl);
4818 + tree method, end_type;
4820 + end_type = (do_interface ? object_type_node : type);
4821 + for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
4823 + tree other_super, other_method, method_sig, method_name;
4826 + if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
4829 + /* Now verify that somewhere in between TYPE and CLASS,
4830 + abstract method METHOD gets a non abstract definition
4831 + that is inherited by CLASS. */
4833 + method_sig = build_java_signature (TREE_TYPE (method));
4834 + method_name = DECL_NAME (method);
4835 + if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
4836 + method_name = EXPR_WFL_NODE (method_name);
4838 + for (other_super = class; other_super != end_type;
4839 + other_super = CLASSTYPE_SUPER (other_super))
4841 + for (other_method = TYPE_METHODS (other_super); other_method;
4842 + other_method = TREE_CHAIN (other_method))
4844 + tree s = build_java_signature (TREE_TYPE (other_method));
4845 + tree other_name = DECL_NAME (other_method);
4847 + if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
4848 + other_name = EXPR_WFL_NODE (other_name);
4849 + if (!IS_CLINIT (other_method)
4850 + && !DECL_CONSTRUCTOR_P (other_method)
4851 + && method_name == other_name && method_sig == s)
4859 + /* Report that abstract METHOD didn't find an implementation
4860 + that CLASS can use. */
4863 + char *t = strdup (lang_printable_name
4864 + (TREE_TYPE (TREE_TYPE (method)), 0));
4865 + tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
4866 + tree saved_wfl = NULL_TREE;
4868 + if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION)
4870 + saved_wfl = DECL_NAME (method);
4871 + DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method));
4874 + parse_error_context
4875 + (lookup_cl (class_decl),
4876 + "Class `%s' doesn't define the abstract method `%s %s' from "
4877 + "%s `%s'. This method must be defined or %s `%s' must be "
4878 + "declared abstract",
4879 + IDENTIFIER_POINTER (DECL_NAME (class_decl)),
4880 + t, lang_printable_name (method, 0),
4881 + (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
4882 + "interface" : "class"),
4883 + IDENTIFIER_POINTER (ccn),
4884 + (CLASS_INTERFACE (class_decl) ? "interface" : "class"),
4885 + IDENTIFIER_POINTER (DECL_NAME (class_decl)));
4890 + DECL_NAME (method) = saved_wfl;
4895 +/* Check that CLASS_DECL somehoow implements all inherited abstract
4899 +java_check_abstract_method_definitions (class_decl)
4902 + tree class = TREE_TYPE (class_decl);
4903 + tree super, vector;
4906 + if (CLASS_ABSTRACT (class_decl))
4909 + /* Check for inherited types */
4910 + for (super = CLASSTYPE_SUPER (class); super != object_type_node;
4911 + super = CLASSTYPE_SUPER (super))
4913 + if (!CLASS_ABSTRACT (TYPE_NAME (super)))
4916 + check_abstract_method_definitions (0, class_decl, super);
4919 + /* Check for implemented interfaces. */
4920 + vector = TYPE_BINFO_BASETYPES (class);
4921 + for (i = 1; i < TREE_VEC_LENGTH (vector); i++)
4923 + super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
4924 + check_abstract_method_definitions (1, class_decl, super);
4928 +/* Check all the methods of CLASS_DECL. Methods are first completed
4929 + then checked according to regular method existance rules. If no
4930 + constructor for CLASS_DECL were encountered, then build its
4934 java_check_regular_methods (class_decl)
4935 @@ -7384,7 +7526,7 @@
4937 /* Don't forget eventual pending found and saved_found_wfl. Take
4938 into account that we might have exited because we saw an
4939 - aritifical method as the last entry. */
4940 + artificial method as the last entry. */
4942 if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
4943 DECL_NAME (found) = saved_found_wfl;
4944 @@ -7392,6 +7534,10 @@
4945 if (!TYPE_NVIRTUALS (class))
4946 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
4948 + /* Search for inherited abstract method not yet implemented in this
4950 + java_check_abstract_method_definitions (class_decl);
4952 if (!saw_constructor)
4954 /* No constructor seen, we craft one, at line 0. Since this
4955 @@ -7597,14 +7743,15 @@
4959 -/* Return the line that matches DECL line number. Used during error
4961 +/* Return the line that matches DECL line number, and try its best to
4962 + position the column number. Used during error reports. */
4968 static tree cl = NULL_TREE;
4969 + char *line, *found;
4973 @@ -7615,6 +7762,14 @@
4974 EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
4975 EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
4977 + line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)),
4978 + EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl));
4980 + found = strstr ((const char *)line,
4981 + (const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
4983 + EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line);
4988 @@ -8149,6 +8304,9 @@
4995 current_function_decl = fndecl;
4997 /* New scope for the function */
4998 @@ -8268,6 +8426,9 @@
4999 tree fndecl = current_function_decl;
5000 int flag_asynchronous_exceptions = asynchronous_exceptions;
5005 java_parser_context_save_global ();
5006 lineno = ctxp->last_ccb_indent1;
5008 @@ -8323,6 +8484,8 @@
5009 java_method_add_stmt (fndecl, expr)
5012 + if (!GET_CURRENT_BLOCK (fndecl))
5014 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
5017 @@ -8721,7 +8884,8 @@
5018 for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
5020 if (DECL_CONSTRUCTOR_P (mdecl)
5021 - && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node)
5022 + && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl)))
5023 + == end_params_node)
5027 @@ -9064,6 +9228,8 @@
5028 == soft_initclass_node)
5029 return TREE_OPERAND (op1, 1);
5031 + else if (JDECL_P (op1))
5036 @@ -9085,6 +9251,8 @@
5037 for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
5039 tree qual_wfl = QUAL_WFL (q);
5040 + tree ret_decl; /* for EH checking */
5041 + int location; /* for EH checking */
5043 /* 15.10.1 Field Access Using a Primary */
5044 switch (TREE_CODE (qual_wfl))
5045 @@ -9103,14 +9271,21 @@
5046 /* And code for the function call */
5047 if (complete_function_arguments (qual_wfl))
5050 if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
5051 CALL_USING_SUPER (qual_wfl) = 1;
5053 - patch_method_invocation (qual_wfl, decl, type, &is_static, NULL);
5054 + location = (TREE_CODE (qual_wfl) == CALL_EXPR ?
5055 + EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0);
5056 + *where_found = patch_method_invocation (qual_wfl, decl, type,
5057 + &is_static, &ret_decl);
5058 if (*where_found == error_mark_node)
5060 *type_found = type = QUAL_DECL_TYPE (*where_found);
5064 + check_thrown_exceptions (location, ret_decl);
5066 /* If the previous call was static and this one is too,
5067 build a compound expression to hold the two (because in
5068 that case, previous function calls aren't transported as
5069 @@ -9145,6 +9320,7 @@
5071 case CONDITIONAL_EXPR:
5074 *where_found = decl = java_complete_tree (qual_wfl);
5075 if (decl == error_mark_node)
5077 @@ -9882,6 +10058,11 @@
5078 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
5079 TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
5080 TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
5082 + /* Resolve unresolved returned type isses */
5083 + t = TREE_TYPE (TREE_TYPE (method));
5084 + if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t)))
5085 + resolve_and_layout (TREE_TYPE (t), NULL);
5087 if (flag_emit_class_files || flag_emit_xref)
5089 @@ -10042,7 +10223,7 @@
5090 parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s",
5091 (lc ? "constructor" : "method"),
5093 - IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) :
5094 + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))) :
5095 IDENTIFIER_POINTER (name)),
5096 IDENTIFIER_POINTER (signature),
5097 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
5098 @@ -10061,7 +10242,8 @@
5099 tree list = NULL_TREE, all_list = NULL_TREE;
5101 /* Search interfaces */
5102 - if (CLASS_INTERFACE (TYPE_NAME (class)))
5103 + if (CLASS_INTERFACE (TYPE_NAME (class))
5104 + || CLASS_ABSTRACT (TYPE_NAME (class)))
5106 static tree searched_interfaces = NULL_TREE;
5107 static int search_not_done = 0;
5108 @@ -10292,7 +10474,7 @@
5110 case NEW_ARRAY_EXPR:
5111 qual = TREE_CHAIN (qual);
5112 - new_array_found = 1;
5113 + again = new_array_found = 1;
5115 case NEW_CLASS_EXPR:
5117 @@ -10320,12 +10502,8 @@
5118 && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
5119 name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
5121 - else if (code == ARRAY_REF &&
5122 - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
5123 - name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
5125 - else if (code == CALL_EXPR &&
5126 - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
5127 + else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) &&
5128 + TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
5129 name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
5131 else if (code == STRING_CST || code == CONDITIONAL_EXPR)
5132 @@ -10335,8 +10513,15 @@
5136 - name = EXPR_WFL_NODE (qual_wfl);
5139 + name = EXPR_WFL_NODE (qual_wfl);
5142 + qual = EXPR_WFL_QUALIFICATION (qual_wfl);
5147 /* If we have a THIS (from a primary), we set the context accordingly */
5148 if (name == this_identifier_node)
5150 @@ -10370,7 +10555,8 @@
5151 declaration or parameter declaration, then it is an expression
5152 name. We don't carry this test out if we're in the context of the
5153 use of SUPER or THIS */
5154 - if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
5155 + if (!this_found && !super_found &&
5156 + TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name)))
5158 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
5159 QUAL_RESOLUTION (qual) = decl;
5160 @@ -10387,15 +10573,17 @@
5161 QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
5164 - /* We reclassify NAME as a type name if:
5165 + /* We reclassify NAME as yielding to a type name resolution if:
5166 - NAME is a class/interface declared within the compilation
5167 unit containing NAME,
5168 - NAME is imported via a single-type-import declaration,
5169 - NAME is declared in an another compilation unit of the package
5170 of the compilation unit containing NAME,
5171 - NAME is declared by exactly on type-import-on-demand declaration
5172 - of the compilation unit containing NAME. */
5173 - else if ((decl = resolve_and_layout (name, NULL_TREE)))
5174 + of the compilation unit containing NAME.
5175 + - NAME is actually a STRING_CST. */
5176 + else if (TREE_CODE (name) == STRING_CST ||
5177 + (decl = resolve_and_layout (name, NULL_TREE)))
5179 RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
5180 QUAL_RESOLUTION (qual) = decl;
5181 @@ -10480,7 +10668,9 @@
5183 tree value = DECL_INITIAL (node);
5184 DECL_INITIAL (node) = NULL_TREE;
5185 + push_obstacks (&permanent_obstack, &permanent_obstack);
5186 value = fold_constant_for_init (value, node);
5188 DECL_INITIAL (node) = value;
5189 if (value != NULL_TREE)
5191 @@ -10500,8 +10690,7 @@
5192 TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
5196 - return stabilize_reference (node);
5197 + return stabilize_reference (node);
5200 /* Patch tree nodes in a function body. When a BLOCK is found, push
5201 @@ -10683,8 +10872,12 @@
5202 && JDECL_P (TREE_OPERAND (cn, 1))
5203 && FIELD_FINAL (TREE_OPERAND (cn, 1))
5204 && DECL_INITIAL (TREE_OPERAND (cn, 1)))
5205 - cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
5206 - TREE_OPERAND (cn, 1));
5208 + push_obstacks (&permanent_obstack, &permanent_obstack);
5209 + cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
5210 + TREE_OPERAND (cn, 1));
5214 if (!TREE_CONSTANT (cn) && !flag_emit_xref)
5216 @@ -10937,7 +11130,11 @@
5217 && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
5218 && DECL_INITIAL (nn) != NULL_TREE)
5220 - tree value = fold_constant_for_init (nn, nn);
5223 + push_obstacks (&permanent_obstack, &permanent_obstack);
5224 + value = fold_constant_for_init (nn, nn);
5226 if (value != NULL_TREE)
5228 tree type = TREE_TYPE (value);
5229 @@ -10951,14 +11148,17 @@
5230 if (TREE_OPERAND (node, 0) == error_mark_node)
5231 return error_mark_node;
5233 - if (COMPOUND_ASSIGN_P (wfl_op2))
5234 + flag = COMPOUND_ASSIGN_P (wfl_op2);
5237 tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
5239 /* Hand stablize the lhs on both places */
5240 TREE_OPERAND (node, 0) = lvalue;
5241 - TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue;
5242 + TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
5243 + (flag_emit_class_files ? lvalue : save_expr (lvalue));
5245 + /* 15.25.2.a: Left hand is not an array access. FIXME */
5246 /* Now complete the RHS. We write it back later on. */
5247 nn = java_complete_tree (TREE_OPERAND (node, 1));
5249 @@ -10969,6 +11169,8 @@
5250 E1 = (T)(E1 op E2), with T being the type of E1. */
5251 nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
5252 TREE_TYPE (lvalue), nn));
5254 + /* 15.25.2.b: Left hand is an array access. FIXME */
5257 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
5258 @@ -10992,6 +11194,10 @@
5259 if ((nn = patch_string (TREE_OPERAND (node, 1))))
5260 TREE_OPERAND (node, 1) = nn;
5261 node = patch_assignment (node, wfl_op1, wfl_op2);
5262 + /* Reorganize the tree if necessary. */
5263 + if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
5264 + || JSTRING_P (TREE_TYPE (node))))
5265 + node = java_refold (node);
5266 CAN_COMPLETE_NORMALLY (node) = 1;
5269 @@ -12000,6 +12206,81 @@
5270 #undef BUILD_OPERATOR_STRING
5273 +/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
5276 +java_decl_equiv (var_acc1, var_acc2)
5277 + tree var_acc1, var_acc2;
5279 + if (JDECL_P (var_acc1))
5280 + return (var_acc1 == var_acc2);
5282 + return (TREE_CODE (var_acc1) == COMPONENT_REF
5283 + && TREE_CODE (var_acc2) == COMPONENT_REF
5284 + && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
5285 + == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0)
5286 + && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1));
5289 +/* Return a non zero value if CODE is one of the operators that can be
5290 + used in conjunction with the `=' operator in a compound assignment. */
5293 +binop_compound_p (code)
5294 + enum tree_code code;
5297 + for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++)
5298 + if (binop_lookup [i] == code)
5301 + return i < BINOP_COMPOUND_CANDIDATES;
5304 +/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
5310 + tree c, b, ns, decl;
5312 + if (TREE_CODE (t) != MODIFY_EXPR)
5315 + c = TREE_OPERAND (t, 1);
5316 + if (! (c && TREE_CODE (c) == COMPOUND_EXPR
5317 + && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR
5318 + && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1)))))
5321 + /* Now the left branch of the binary operator. */
5322 + b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
5323 + if (! (b && TREE_CODE (b) == NOP_EXPR
5324 + && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
5327 + ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0);
5328 + if (! (ns && TREE_CODE (ns) == NOP_EXPR
5329 + && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR))
5332 + decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0);
5333 + if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF)
5334 + /* It's got to be the an equivalent decl */
5335 + && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0)))
5337 + /* Shorten the NOP_EXPR/SAVE_EXPR path. */
5338 + TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0);
5339 + /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
5340 + TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1);
5341 + /* Change the right part of the BINOP_EXPR */
5342 + TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0);
5348 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
5349 errors but we modify NODE so that it contains the type computed
5350 according to the expression, when it's fixed. Otherwise, we write
5351 @@ -12046,6 +12327,12 @@
5352 if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
5353 TREE_SET_CODE (node, TRUNC_DIV_EXPR);
5355 + if (TREE_CODE (prom_type) == INTEGER_TYPE
5356 + && flag_use_divide_subroutine
5357 + && ! flag_emit_class_files
5358 + && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
5359 + return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
5361 /* This one is more complicated. FLOATs are processed by a
5362 function call to soft_fmod. Duplicate the value of the
5363 COMPOUND_ASSIGN_P flag. */
5364 @@ -12658,7 +12945,7 @@
5365 case PREINCREMENT_EXPR:
5366 /* 15.14.2 Prefix Decrement Operator -- */
5367 case PREDECREMENT_EXPR:
5368 - decl = strip_out_static_field_access_decl (op);
5369 + op = decl = strip_out_static_field_access_decl (op);
5370 /* We really should have a JAVA_ARRAY_EXPR to avoid this */
5372 && TREE_CODE (decl) != COMPONENT_REF
5373 @@ -12697,15 +12984,28 @@
5376 /* Before the addition, binary numeric promotion is performed on
5378 - value = build_int_2 (1, 0);
5379 - TREE_TYPE (node) =
5380 - binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value);
5381 - /* And write the promoted incremented and increment */
5382 + both operands, if really necessary */
5383 + if (JINTEGRAL_TYPE_P (op_type))
5385 + value = build_int_2 (1, 0);
5386 + TREE_TYPE (value) = TREE_TYPE (node) = op_type;
5390 + value = build_int_2 (1, 0);
5391 + TREE_TYPE (node) =
5392 + binary_numeric_promotion (op_type,
5393 + TREE_TYPE (value), &op, &value);
5395 + /* And write back into the node. */
5396 TREE_OPERAND (node, 0) = op;
5397 TREE_OPERAND (node, 1) = value;
5398 - /* Convert the overall back into its original type. */
5399 - return fold (convert (op_type, node));
5400 + /* Convert the overall back into its original type, if
5401 + necessary, and return */
5402 + if (JINTEGRAL_TYPE_P (op_type))
5403 + return fold (node);
5405 + return fold (convert (op_type, node));
5409 @@ -13210,6 +13510,7 @@
5410 new_value = NULL_TREE;
5411 wfl_value = TREE_VALUE (entry);
5413 + push_obstacks (&permanent_obstack, &permanent_obstack);
5414 value = java_complete_tree (TREE_VALUE (entry));
5415 /* patch_string return error_mark_node if arg is error_mark_node */
5416 if ((patched = patch_string (value)))
5417 @@ -13225,7 +13526,8 @@
5418 new_value = try_builtin_assignconv (wfl_operator, type, value);
5419 if (!new_value && (new_value = try_reference_assignconv (type, value)))
5420 type_value = promote_type (type);
5424 /* Check and report errors */
5427 @@ -13564,6 +13866,54 @@
5431 +/* Try to find the loop a block might be related to. This comprises
5432 + the case where the LOOP_EXPR is found as the second operand of a
5433 + COMPOUND_EXPR, because the loop happens to have an initialization
5434 + part, then expressed as the first operand of the COMPOUND_EXPR. If
5435 + the search finds something, 1 is returned. Otherwise, 0 is
5436 + returned. The search is assumed to start from a
5437 + LABELED_BLOCK_EXPR's block. */
5440 +search_loop (statement)
5443 + if (TREE_CODE (statement) == LOOP_EXPR)
5446 + if (TREE_CODE (statement) == BLOCK)
5447 + statement = BLOCK_SUBBLOCKS (statement);
5451 + if (statement && TREE_CODE (statement) == COMPOUND_EXPR)
5452 + while (statement && TREE_CODE (statement) == COMPOUND_EXPR)
5453 + statement = TREE_OPERAND (statement, 1);
5455 + return (TREE_CODE (statement) == LOOP_EXPR
5456 + && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE);
5459 +/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
5460 + returned otherwise. */
5463 +labeled_block_contains_loop_p (block, loop)
5469 + if (LABELED_BLOCK_BODY (block) == loop)
5472 + if (IS_FOR_LOOP_P (loop)
5473 + && search_loop (LABELED_BLOCK_BODY (block)) == loop)
5479 /* If the loop isn't surrounded by a labeled statement, create one and
5480 insert LOOP as its body. */
5482 @@ -13572,33 +13922,17 @@
5486 - tree block = ctxp->current_labeled_block;
5488 TREE_TYPE (loop) = void_type_node;
5489 - if (block != NULL_TREE)
5491 - tree block_body = LABELED_BLOCK_BODY (block);
5492 - if (IS_FOR_LOOP_P (loop))
5494 - if (TREE_CODE (block_body) == BLOCK)
5496 - block_body = BLOCK_EXPR_BODY (block_body);
5497 - if (block_body == loop
5498 - || (TREE_CODE (block_body) == COMPOUND_EXPR
5499 - && TREE_OPERAND (block_body, 1) == loop))
5505 - if (block_body == loop)
5509 + if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop))
5512 loop_label = build_labeled_block (0, NULL_TREE);
5513 + /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
5514 + that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
5515 LABELED_BLOCK_BODY (loop_label) = loop;
5516 PUSH_LABELED_BLOCK (loop_label);
5517 - loop = loop_label;
5519 + return loop_label;
5522 /* 14.13, 14.14: break and continue Statements */
5523 @@ -13690,7 +14024,7 @@
5525 target_stmt = LABELED_BLOCK_BODY (labeled_block);
5526 if (TREE_CODE (target_stmt) == SWITCH_EXPR
5527 - || TREE_CODE (target_stmt) == LOOP_EXPR)
5528 + || search_loop (target_stmt))
5530 bc_label = labeled_block;
5532 @@ -13704,7 +14038,7 @@
5533 /* Our break/continue don't return values. */
5534 TREE_TYPE (node) = void_type_node;
5535 /* Encapsulate the break within a compound statement so that it's
5536 - expanded all the times by expand_expr (and not clobered
5537 + expanded all the times by expand_expr (and not clobbered
5538 sometimes, like after a if statement) */
5539 node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
5540 TREE_SIDE_EFFECTS (node) = 1;
5541 @@ -14099,11 +14433,20 @@
5544 EXPR_WFL_LINECOL (wfl_operator) = location;
5545 - parse_error_context
5546 - (wfl_operator, "Exception `%s' must be caught, or it must be "
5547 - "declared in the `throws' clause of `%s'",
5548 - lang_printable_name (TREE_VALUE (throws), 0),
5549 - IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
5550 + if (DECL_NAME (current_function_decl) == finit_identifier_node)
5551 + parse_error_context
5552 + (wfl_operator, "Exception `%s' can't be thrown in initializer",
5553 + lang_printable_name (TREE_VALUE (throws), 0));
5556 + parse_error_context
5557 + (wfl_operator, "Exception `%s' must be caught, or it must be "
5558 + "declared in the `throws' clause of `%s'",
5559 + lang_printable_name (TREE_VALUE (throws), 0),
5560 + (DECL_NAME (current_function_decl) == init_identifier_node ?
5561 + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
5562 + IDENTIFIER_POINTER (DECL_NAME (current_function_decl))));
5567 Only in gcc-2.95.2/gcc/java: parse.c.orig
5568 Only in gcc-2.95.2/gcc/java: parse.c.rej
5569 diff -u -r gcc-2.95.2-orig/gcc/java/parse.y gcc-2.95.2/gcc/java/parse.y
5570 --- gcc-2.95.2-orig/gcc/java/parse.y Mon Jun 28 15:56:22 1999
5571 +++ gcc-2.95.2/gcc/java/parse.y Sun Oct 31 21:27:43 1999
5573 static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...))
5575 static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list));
5576 +static void parse_ctor_invocation_error PROTO ((void));
5577 static tree parse_jdk1_1_error PROTO ((char *));
5578 static void complete_class_report_errors PROTO ((jdep *));
5579 static int process_imports PROTO ((void));
5581 static tree strip_out_static_field_access_decl PROTO ((tree));
5582 static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *));
5583 static void static_ref_err PROTO ((tree, tree, tree));
5584 +static tree java_refold PROTO ((tree));
5586 /* Number of error found so far. */
5587 int java_error_count;
5588 @@ -274,6 +276,10 @@
5589 binop_lookup [((VALUE) - PLUS_TK)% \
5590 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
5592 +/* This is the end index for binary operators that can also be used
5593 + in compound assignements. */
5594 +#define BINOP_COMPOUND_CANDIDATES 11
5596 /* Fake WFL used to report error message. It is initialized once if
5597 needed and reused with it's location information is overriden. */
5598 tree wfl_operator = NULL_TREE;
5599 @@ -1318,16 +1324,14 @@
5600 {yyerror ("')' expected"); RECOVER;}
5601 | this_or_super OP_TK CP_TK error
5603 - yyerror ("Constructor invocation must be first "
5604 - "thing in a constructor");
5605 + parse_ctor_invocation_error ();
5608 | this_or_super OP_TK argument_list error
5609 {yyerror ("')' expected"); RECOVER;}
5610 | this_or_super OP_TK argument_list CP_TK error
5612 - yyerror ("Constructor invocation must be first "
5613 - "thing in a constructor");
5614 + parse_ctor_invocation_error ();
5617 | name DOT_TK SUPER_TK error
5618 @@ -2409,7 +2413,17 @@
5622 -/* Reporting JDK1.1 features not implemented */
5623 +/* Reporting an constructor invocation error. */
5625 +parse_ctor_invocation_error ()
5627 + if (DECL_CONSTRUCTOR_P (current_function_decl))
5628 + yyerror ("Constructor invocation must be first thing in a constructor");
5630 + yyerror ("Only constructors can invoke constructors");
5633 +/* Reporting JDK1.1 features not implemented. */
5636 parse_jdk1_1_error (msg)
5637 @@ -3318,13 +3332,18 @@
5639 tree meth = TREE_VALUE (mdecl);
5640 tree id = TREE_PURPOSE (mdecl);
5641 - tree this_class = TREE_TYPE (ctxp->current_parsed_class);
5642 tree type_wfl = NULL_TREE;
5643 - tree meth_name = NULL_TREE, current, orig_arg;
5644 + tree meth_name = NULL_TREE;
5645 + tree current, orig_arg, this_class;
5647 int constructor_ok = 0, must_chain;
5649 check_modifiers_consistency (flags);
5651 + if (ctxp->current_parsed_class)
5652 + this_class = TREE_TYPE (ctxp->current_parsed_class);
5656 /* There are some forbidden modifiers for an abstract method and its
5657 class must be abstract as well. */
5658 @@ -3520,7 +3539,12 @@
5659 finish_method_declaration (method_body)
5662 - int flags = get_access_flags_from_decl (current_function_decl);
5665 + if (!current_function_decl)
5668 + flags = get_access_flags_from_decl (current_function_decl);
5670 /* 8.4.5 Method Body */
5671 if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
5672 @@ -4335,7 +4359,9 @@
5674 /* Resolve and layout if necessary */
5675 layout_class_methods (TREE_TYPE (decl));
5676 - if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))
5677 + /* Check methods, but only once */
5678 + if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl))
5679 + && !CLASS_LOADED_P (TREE_TYPE (decl)))
5680 CHECK_METHODS (decl);
5681 if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
5682 safe_layout_class (TREE_TYPE (decl));
5683 @@ -4516,7 +4542,7 @@
5685 /* Track method being redefined inside the same class. As a side
5686 effect, set DECL_NAME to an IDENTIFIER (prior entering this
5687 - function it's a FWL, so we can track errors more accurately */
5688 + function it's a FWL, so we can track errors more accurately.) */
5691 check_method_redefinition (class, method)
5692 @@ -4552,9 +4578,126 @@
5696 -/* Check all the methods of CLASS. Methods are first completed then
5697 - checked according to regular method existance rules.
5698 - If no constructor were encountered, then build its declaration. */
5700 +check_abstract_method_definitions (do_interface, class_decl, type)
5702 + tree class_decl, type;
5704 + tree class = TREE_TYPE (class_decl);
5705 + tree method, end_type;
5707 + end_type = (do_interface ? object_type_node : type);
5708 + for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
5710 + tree other_super, other_method, method_sig, method_name;
5713 + if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
5716 + /* Now verify that somewhere in between TYPE and CLASS,
5717 + abstract method METHOD gets a non abstract definition
5718 + that is inherited by CLASS. */
5720 + method_sig = build_java_signature (TREE_TYPE (method));
5721 + method_name = DECL_NAME (method);
5722 + if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
5723 + method_name = EXPR_WFL_NODE (method_name);
5725 + for (other_super = class; other_super != end_type;
5726 + other_super = CLASSTYPE_SUPER (other_super))
5728 + for (other_method = TYPE_METHODS (other_super); other_method;
5729 + other_method = TREE_CHAIN (other_method))
5731 + tree s = build_java_signature (TREE_TYPE (other_method));
5732 + tree other_name = DECL_NAME (other_method);
5734 + if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
5735 + other_name = EXPR_WFL_NODE (other_name);
5736 + if (!IS_CLINIT (other_method)
5737 + && !DECL_CONSTRUCTOR_P (other_method)
5738 + && method_name == other_name && method_sig == s)
5746 + /* Report that abstract METHOD didn't find an implementation
5747 + that CLASS can use. */
5750 + char *t = strdup (lang_printable_name
5751 + (TREE_TYPE (TREE_TYPE (method)), 0));
5752 + tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
5753 + tree saved_wfl = NULL_TREE;
5755 + if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION)
5757 + saved_wfl = DECL_NAME (method);
5758 + DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method));
5761 + parse_error_context
5762 + (lookup_cl (class_decl),
5763 + "Class `%s' doesn't define the abstract method `%s %s' from "
5764 + "%s `%s'. This method must be defined or %s `%s' must be "
5765 + "declared abstract",
5766 + IDENTIFIER_POINTER (DECL_NAME (class_decl)),
5767 + t, lang_printable_name (method, 0),
5768 + (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
5769 + "interface" : "class"),
5770 + IDENTIFIER_POINTER (ccn),
5771 + (CLASS_INTERFACE (class_decl) ? "interface" : "class"),
5772 + IDENTIFIER_POINTER (DECL_NAME (class_decl)));
5777 + DECL_NAME (method) = saved_wfl;
5782 +/* Check that CLASS_DECL somehoow implements all inherited abstract
5786 +java_check_abstract_method_definitions (class_decl)
5789 + tree class = TREE_TYPE (class_decl);
5790 + tree super, vector;
5793 + if (CLASS_ABSTRACT (class_decl))
5796 + /* Check for inherited types */
5797 + for (super = CLASSTYPE_SUPER (class); super != object_type_node;
5798 + super = CLASSTYPE_SUPER (super))
5800 + if (!CLASS_ABSTRACT (TYPE_NAME (super)))
5803 + check_abstract_method_definitions (0, class_decl, super);
5806 + /* Check for implemented interfaces. */
5807 + vector = TYPE_BINFO_BASETYPES (class);
5808 + for (i = 1; i < TREE_VEC_LENGTH (vector); i++)
5810 + super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
5811 + check_abstract_method_definitions (1, class_decl, super);
5815 +/* Check all the methods of CLASS_DECL. Methods are first completed
5816 + then checked according to regular method existance rules. If no
5817 + constructor for CLASS_DECL were encountered, then build its
5821 java_check_regular_methods (class_decl)
5822 @@ -4730,7 +4873,7 @@
5824 /* Don't forget eventual pending found and saved_found_wfl. Take
5825 into account that we might have exited because we saw an
5826 - aritifical method as the last entry. */
5827 + artificial method as the last entry. */
5829 if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
5830 DECL_NAME (found) = saved_found_wfl;
5831 @@ -4738,6 +4881,10 @@
5832 if (!TYPE_NVIRTUALS (class))
5833 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
5835 + /* Search for inherited abstract method not yet implemented in this
5837 + java_check_abstract_method_definitions (class_decl);
5839 if (!saw_constructor)
5841 /* No constructor seen, we craft one, at line 0. Since this
5842 @@ -4943,14 +5090,15 @@
5846 -/* Return the line that matches DECL line number. Used during error
5848 +/* Return the line that matches DECL line number, and try its best to
5849 + position the column number. Used during error reports. */
5855 static tree cl = NULL_TREE;
5856 + char *line, *found;
5860 @@ -4961,6 +5109,14 @@
5861 EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
5862 EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
5864 + line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)),
5865 + EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl));
5867 + found = strstr ((const char *)line,
5868 + (const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
5870 + EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line);
5875 @@ -5495,6 +5651,9 @@
5882 current_function_decl = fndecl;
5884 /* New scope for the function */
5885 @@ -5614,6 +5773,9 @@
5886 tree fndecl = current_function_decl;
5887 int flag_asynchronous_exceptions = asynchronous_exceptions;
5892 java_parser_context_save_global ();
5893 lineno = ctxp->last_ccb_indent1;
5895 @@ -5669,6 +5831,8 @@
5896 java_method_add_stmt (fndecl, expr)
5899 + if (!GET_CURRENT_BLOCK (fndecl))
5901 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
5904 @@ -6067,7 +6231,8 @@
5905 for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
5907 if (DECL_CONSTRUCTOR_P (mdecl)
5908 - && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node)
5909 + && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl)))
5910 + == end_params_node)
5914 @@ -6410,6 +6575,8 @@
5915 == soft_initclass_node)
5916 return TREE_OPERAND (op1, 1);
5918 + else if (JDECL_P (op1))
5923 @@ -6431,6 +6598,8 @@
5924 for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
5926 tree qual_wfl = QUAL_WFL (q);
5927 + tree ret_decl; /* for EH checking */
5928 + int location; /* for EH checking */
5930 /* 15.10.1 Field Access Using a Primary */
5931 switch (TREE_CODE (qual_wfl))
5932 @@ -6449,14 +6618,21 @@
5933 /* And code for the function call */
5934 if (complete_function_arguments (qual_wfl))
5937 if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
5938 CALL_USING_SUPER (qual_wfl) = 1;
5940 - patch_method_invocation (qual_wfl, decl, type, &is_static, NULL);
5941 + location = (TREE_CODE (qual_wfl) == CALL_EXPR ?
5942 + EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0);
5943 + *where_found = patch_method_invocation (qual_wfl, decl, type,
5944 + &is_static, &ret_decl);
5945 if (*where_found == error_mark_node)
5947 *type_found = type = QUAL_DECL_TYPE (*where_found);
5951 + check_thrown_exceptions (location, ret_decl);
5953 /* If the previous call was static and this one is too,
5954 build a compound expression to hold the two (because in
5955 that case, previous function calls aren't transported as
5956 @@ -6491,6 +6667,7 @@
5958 case CONDITIONAL_EXPR:
5961 *where_found = decl = java_complete_tree (qual_wfl);
5962 if (decl == error_mark_node)
5964 @@ -7228,6 +7405,11 @@
5965 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
5966 TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
5967 TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
5969 + /* Resolve unresolved returned type isses */
5970 + t = TREE_TYPE (TREE_TYPE (method));
5971 + if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t)))
5972 + resolve_and_layout (TREE_TYPE (t), NULL);
5974 if (flag_emit_class_files || flag_emit_xref)
5976 @@ -7388,7 +7570,7 @@
5977 parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s",
5978 (lc ? "constructor" : "method"),
5980 - IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) :
5981 + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))) :
5982 IDENTIFIER_POINTER (name)),
5983 IDENTIFIER_POINTER (signature),
5984 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
5985 @@ -7407,7 +7589,8 @@
5986 tree list = NULL_TREE, all_list = NULL_TREE;
5988 /* Search interfaces */
5989 - if (CLASS_INTERFACE (TYPE_NAME (class)))
5990 + if (CLASS_INTERFACE (TYPE_NAME (class))
5991 + || CLASS_ABSTRACT (TYPE_NAME (class)))
5993 static tree searched_interfaces = NULL_TREE;
5994 static int search_not_done = 0;
5995 @@ -7638,7 +7821,7 @@
5997 case NEW_ARRAY_EXPR:
5998 qual = TREE_CHAIN (qual);
5999 - new_array_found = 1;
6000 + again = new_array_found = 1;
6002 case NEW_CLASS_EXPR:
6004 @@ -7666,12 +7849,8 @@
6005 && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
6006 name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
6008 - else if (code == ARRAY_REF &&
6009 - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
6010 - name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
6012 - else if (code == CALL_EXPR &&
6013 - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
6014 + else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) &&
6015 + TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
6016 name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
6018 else if (code == STRING_CST || code == CONDITIONAL_EXPR)
6019 @@ -7681,8 +7860,15 @@
6023 - name = EXPR_WFL_NODE (qual_wfl);
6026 + name = EXPR_WFL_NODE (qual_wfl);
6029 + qual = EXPR_WFL_QUALIFICATION (qual_wfl);
6034 /* If we have a THIS (from a primary), we set the context accordingly */
6035 if (name == this_identifier_node)
6037 @@ -7716,7 +7902,8 @@
6038 declaration or parameter declaration, then it is an expression
6039 name. We don't carry this test out if we're in the context of the
6040 use of SUPER or THIS */
6041 - if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
6042 + if (!this_found && !super_found &&
6043 + TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name)))
6045 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
6046 QUAL_RESOLUTION (qual) = decl;
6047 @@ -7733,15 +7920,17 @@
6048 QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
6051 - /* We reclassify NAME as a type name if:
6052 + /* We reclassify NAME as yielding to a type name resolution if:
6053 - NAME is a class/interface declared within the compilation
6054 unit containing NAME,
6055 - NAME is imported via a single-type-import declaration,
6056 - NAME is declared in an another compilation unit of the package
6057 of the compilation unit containing NAME,
6058 - NAME is declared by exactly on type-import-on-demand declaration
6059 - of the compilation unit containing NAME. */
6060 - else if ((decl = resolve_and_layout (name, NULL_TREE)))
6061 + of the compilation unit containing NAME.
6062 + - NAME is actually a STRING_CST. */
6063 + else if (TREE_CODE (name) == STRING_CST ||
6064 + (decl = resolve_and_layout (name, NULL_TREE)))
6066 RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
6067 QUAL_RESOLUTION (qual) = decl;
6068 @@ -7826,7 +8015,9 @@
6070 tree value = DECL_INITIAL (node);
6071 DECL_INITIAL (node) = NULL_TREE;
6072 + push_obstacks (&permanent_obstack, &permanent_obstack);
6073 value = fold_constant_for_init (value, node);
6075 DECL_INITIAL (node) = value;
6076 if (value != NULL_TREE)
6078 @@ -7846,8 +8037,7 @@
6079 TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
6083 - return stabilize_reference (node);
6084 + return stabilize_reference (node);
6087 /* Patch tree nodes in a function body. When a BLOCK is found, push
6088 @@ -8029,8 +8219,12 @@
6089 && JDECL_P (TREE_OPERAND (cn, 1))
6090 && FIELD_FINAL (TREE_OPERAND (cn, 1))
6091 && DECL_INITIAL (TREE_OPERAND (cn, 1)))
6092 - cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
6093 - TREE_OPERAND (cn, 1));
6095 + push_obstacks (&permanent_obstack, &permanent_obstack);
6096 + cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
6097 + TREE_OPERAND (cn, 1));
6101 if (!TREE_CONSTANT (cn) && !flag_emit_xref)
6103 @@ -8283,7 +8477,11 @@
6104 && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
6105 && DECL_INITIAL (nn) != NULL_TREE)
6107 - tree value = fold_constant_for_init (nn, nn);
6110 + push_obstacks (&permanent_obstack, &permanent_obstack);
6111 + value = fold_constant_for_init (nn, nn);
6113 if (value != NULL_TREE)
6115 tree type = TREE_TYPE (value);
6116 @@ -8297,14 +8495,17 @@
6117 if (TREE_OPERAND (node, 0) == error_mark_node)
6118 return error_mark_node;
6120 - if (COMPOUND_ASSIGN_P (wfl_op2))
6121 + flag = COMPOUND_ASSIGN_P (wfl_op2);
6124 tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
6126 /* Hand stablize the lhs on both places */
6127 TREE_OPERAND (node, 0) = lvalue;
6128 - TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue;
6129 + TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
6130 + (flag_emit_class_files ? lvalue : save_expr (lvalue));
6132 + /* 15.25.2.a: Left hand is not an array access. FIXME */
6133 /* Now complete the RHS. We write it back later on. */
6134 nn = java_complete_tree (TREE_OPERAND (node, 1));
6136 @@ -8315,6 +8516,8 @@
6137 E1 = (T)(E1 op E2), with T being the type of E1. */
6138 nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
6139 TREE_TYPE (lvalue), nn));
6141 + /* 15.25.2.b: Left hand is an array access. FIXME */
6144 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
6145 @@ -8338,6 +8541,10 @@
6146 if ((nn = patch_string (TREE_OPERAND (node, 1))))
6147 TREE_OPERAND (node, 1) = nn;
6148 node = patch_assignment (node, wfl_op1, wfl_op2);
6149 + /* Reorganize the tree if necessary. */
6150 + if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
6151 + || JSTRING_P (TREE_TYPE (node))))
6152 + node = java_refold (node);
6153 CAN_COMPLETE_NORMALLY (node) = 1;
6156 @@ -9346,6 +9553,81 @@
6157 #undef BUILD_OPERATOR_STRING
6160 +/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
6163 +java_decl_equiv (var_acc1, var_acc2)
6164 + tree var_acc1, var_acc2;
6166 + if (JDECL_P (var_acc1))
6167 + return (var_acc1 == var_acc2);
6169 + return (TREE_CODE (var_acc1) == COMPONENT_REF
6170 + && TREE_CODE (var_acc2) == COMPONENT_REF
6171 + && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
6172 + == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0)
6173 + && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1));
6176 +/* Return a non zero value if CODE is one of the operators that can be
6177 + used in conjunction with the `=' operator in a compound assignment. */
6180 +binop_compound_p (code)
6181 + enum tree_code code;
6184 + for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++)
6185 + if (binop_lookup [i] == code)
6188 + return i < BINOP_COMPOUND_CANDIDATES;
6191 +/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
6197 + tree c, b, ns, decl;
6199 + if (TREE_CODE (t) != MODIFY_EXPR)
6202 + c = TREE_OPERAND (t, 1);
6203 + if (! (c && TREE_CODE (c) == COMPOUND_EXPR
6204 + && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR
6205 + && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1)))))
6208 + /* Now the left branch of the binary operator. */
6209 + b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
6210 + if (! (b && TREE_CODE (b) == NOP_EXPR
6211 + && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
6214 + ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0);
6215 + if (! (ns && TREE_CODE (ns) == NOP_EXPR
6216 + && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR))
6219 + decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0);
6220 + if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF)
6221 + /* It's got to be the an equivalent decl */
6222 + && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0)))
6224 + /* Shorten the NOP_EXPR/SAVE_EXPR path. */
6225 + TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0);
6226 + /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
6227 + TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1);
6228 + /* Change the right part of the BINOP_EXPR */
6229 + TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0);
6235 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
6236 errors but we modify NODE so that it contains the type computed
6237 according to the expression, when it's fixed. Otherwise, we write
6238 @@ -9392,6 +9674,12 @@
6239 if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
6240 TREE_SET_CODE (node, TRUNC_DIV_EXPR);
6242 + if (TREE_CODE (prom_type) == INTEGER_TYPE
6243 + && flag_use_divide_subroutine
6244 + && ! flag_emit_class_files
6245 + && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
6246 + return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
6248 /* This one is more complicated. FLOATs are processed by a
6249 function call to soft_fmod. Duplicate the value of the
6250 COMPOUND_ASSIGN_P flag. */
6251 @@ -10004,7 +10292,7 @@
6252 case PREINCREMENT_EXPR:
6253 /* 15.14.2 Prefix Decrement Operator -- */
6254 case PREDECREMENT_EXPR:
6255 - decl = strip_out_static_field_access_decl (op);
6256 + op = decl = strip_out_static_field_access_decl (op);
6257 /* We really should have a JAVA_ARRAY_EXPR to avoid this */
6259 && TREE_CODE (decl) != COMPONENT_REF
6260 @@ -10043,15 +10331,28 @@
6263 /* Before the addition, binary numeric promotion is performed on
6265 - value = build_int_2 (1, 0);
6266 - TREE_TYPE (node) =
6267 - binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value);
6268 - /* And write the promoted incremented and increment */
6269 + both operands, if really necessary */
6270 + if (JINTEGRAL_TYPE_P (op_type))
6272 + value = build_int_2 (1, 0);
6273 + TREE_TYPE (value) = TREE_TYPE (node) = op_type;
6277 + value = build_int_2 (1, 0);
6278 + TREE_TYPE (node) =
6279 + binary_numeric_promotion (op_type,
6280 + TREE_TYPE (value), &op, &value);
6282 + /* And write back into the node. */
6283 TREE_OPERAND (node, 0) = op;
6284 TREE_OPERAND (node, 1) = value;
6285 - /* Convert the overall back into its original type. */
6286 - return fold (convert (op_type, node));
6287 + /* Convert the overall back into its original type, if
6288 + necessary, and return */
6289 + if (JINTEGRAL_TYPE_P (op_type))
6290 + return fold (node);
6292 + return fold (convert (op_type, node));
6296 @@ -10556,6 +10857,7 @@
6297 new_value = NULL_TREE;
6298 wfl_value = TREE_VALUE (entry);
6300 + push_obstacks (&permanent_obstack, &permanent_obstack);
6301 value = java_complete_tree (TREE_VALUE (entry));
6302 /* patch_string return error_mark_node if arg is error_mark_node */
6303 if ((patched = patch_string (value)))
6304 @@ -10571,7 +10873,8 @@
6305 new_value = try_builtin_assignconv (wfl_operator, type, value);
6306 if (!new_value && (new_value = try_reference_assignconv (type, value)))
6307 type_value = promote_type (type);
6311 /* Check and report errors */
6314 @@ -10910,6 +11213,54 @@
6318 +/* Try to find the loop a block might be related to. This comprises
6319 + the case where the LOOP_EXPR is found as the second operand of a
6320 + COMPOUND_EXPR, because the loop happens to have an initialization
6321 + part, then expressed as the first operand of the COMPOUND_EXPR. If
6322 + the search finds something, 1 is returned. Otherwise, 0 is
6323 + returned. The search is assumed to start from a
6324 + LABELED_BLOCK_EXPR's block. */
6327 +search_loop (statement)
6330 + if (TREE_CODE (statement) == LOOP_EXPR)
6333 + if (TREE_CODE (statement) == BLOCK)
6334 + statement = BLOCK_SUBBLOCKS (statement);
6338 + if (statement && TREE_CODE (statement) == COMPOUND_EXPR)
6339 + while (statement && TREE_CODE (statement) == COMPOUND_EXPR)
6340 + statement = TREE_OPERAND (statement, 1);
6342 + return (TREE_CODE (statement) == LOOP_EXPR
6343 + && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE);
6346 +/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
6347 + returned otherwise. */
6350 +labeled_block_contains_loop_p (block, loop)
6356 + if (LABELED_BLOCK_BODY (block) == loop)
6359 + if (IS_FOR_LOOP_P (loop)
6360 + && search_loop (LABELED_BLOCK_BODY (block)) == loop)
6366 /* If the loop isn't surrounded by a labeled statement, create one and
6367 insert LOOP as its body. */
6369 @@ -10918,33 +11269,17 @@
6373 - tree block = ctxp->current_labeled_block;
6375 TREE_TYPE (loop) = void_type_node;
6376 - if (block != NULL_TREE)
6378 - tree block_body = LABELED_BLOCK_BODY (block);
6379 - if (IS_FOR_LOOP_P (loop))
6381 - if (TREE_CODE (block_body) == BLOCK)
6383 - block_body = BLOCK_EXPR_BODY (block_body);
6384 - if (block_body == loop
6385 - || (TREE_CODE (block_body) == COMPOUND_EXPR
6386 - && TREE_OPERAND (block_body, 1) == loop))
6392 - if (block_body == loop)
6396 + if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop))
6399 loop_label = build_labeled_block (0, NULL_TREE);
6400 + /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
6401 + that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
6402 LABELED_BLOCK_BODY (loop_label) = loop;
6403 PUSH_LABELED_BLOCK (loop_label);
6404 - loop = loop_label;
6406 + return loop_label;
6409 /* 14.13, 14.14: break and continue Statements */
6410 @@ -11036,7 +11371,7 @@
6412 target_stmt = LABELED_BLOCK_BODY (labeled_block);
6413 if (TREE_CODE (target_stmt) == SWITCH_EXPR
6414 - || TREE_CODE (target_stmt) == LOOP_EXPR)
6415 + || search_loop (target_stmt))
6417 bc_label = labeled_block;
6419 @@ -11050,7 +11385,7 @@
6420 /* Our break/continue don't return values. */
6421 TREE_TYPE (node) = void_type_node;
6422 /* Encapsulate the break within a compound statement so that it's
6423 - expanded all the times by expand_expr (and not clobered
6424 + expanded all the times by expand_expr (and not clobbered
6425 sometimes, like after a if statement) */
6426 node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
6427 TREE_SIDE_EFFECTS (node) = 1;
6428 @@ -11445,11 +11780,20 @@
6431 EXPR_WFL_LINECOL (wfl_operator) = location;
6432 - parse_error_context
6433 - (wfl_operator, "Exception `%s' must be caught, or it must be "
6434 - "declared in the `throws' clause of `%s'",
6435 - lang_printable_name (TREE_VALUE (throws), 0),
6436 - IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
6437 + if (DECL_NAME (current_function_decl) == finit_identifier_node)
6438 + parse_error_context
6439 + (wfl_operator, "Exception `%s' can't be thrown in initializer",
6440 + lang_printable_name (TREE_VALUE (throws), 0));
6443 + parse_error_context
6444 + (wfl_operator, "Exception `%s' must be caught, or it must be "
6445 + "declared in the `throws' clause of `%s'",
6446 + lang_printable_name (TREE_VALUE (throws), 0),
6447 + (DECL_NAME (current_function_decl) == init_identifier_node ?
6448 + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
6449 + IDENTIFIER_POINTER (DECL_NAME (current_function_decl))));
6454 Only in gcc-2.95.2/gcc/java: parse.y.orig
6455 Only in gcc-2.95.2/gcc/java: parse.y.rej
6456 Only in gcc-2.95.2/gcc/java: super.patch
6457 diff -u -r gcc-2.95.2-orig/gcc/java/typeck.c gcc-2.95.2/gcc/java/typeck.c
6458 --- gcc-2.95.2-orig/gcc/java/typeck.c Fri May 14 02:33:34 1999
6459 +++ gcc-2.95.2/gcc/java/typeck.c Sat Oct 30 19:45:50 1999
6462 /* Convert an IEEE real to an integer type. The result of such a
6463 conversion when the source operand is a NaN isn't defined by
6464 - IEEE754, but by the Java language standard: it must be zero. This
6465 - conversion produces something like:
6467 - ({ double tmp = expr; (tmp != tmp) ? 0 : (int)tmp; })
6470 + IEEE754, but by the Java language standard: it must be zero. Also,
6471 + overflows must be clipped to within range. This conversion
6472 + produces something like:
6474 + ((expr >= (float)MAX_INT)
6476 + : ((expr <= (float)MIN_INT)
6483 convert_ieee_real_to_integer (type, expr)
6487 expr = save_expr (expr);
6489 - return build (COND_EXPR, type,
6490 - build (NE_EXPR, boolean_type_node, expr, expr),
6491 - convert (type, integer_zero_node),
6492 - convert_to_integer (type, expr));
6493 + result = build (COND_EXPR, type,
6494 + build (NE_EXPR, boolean_type_node, expr, expr),
6495 + convert (type, integer_zero_node),
6496 + convert_to_integer (type, expr));
6498 + result = build (COND_EXPR, type,
6499 + build (LE_EXPR, boolean_type_node, expr,
6500 + convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))),
6501 + TYPE_MIN_VALUE (type),
6504 + result = build (COND_EXPR, type,
6505 + build (GE_EXPR, boolean_type_node, expr,
6506 + convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))),
6507 + TYPE_MAX_VALUE (type),
6513 /* Create an expression whose value is that of EXPR,
6514 @@ -100,12 +120,9 @@
6515 return fold (convert_to_boolean (type, expr));
6516 if (code == INTEGER_TYPE)
6518 - if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
6519 -#ifdef TARGET_SOFT_FLOAT
6520 - && !TARGET_SOFT_FLOAT
6522 - && !flag_emit_class_files
6523 - && !flag_fast_math
6524 + if (! flag_fast_math
6525 + && ! flag_emit_class_files
6526 + && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
6527 && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
6528 return fold (convert_ieee_real_to_integer (type, expr));
6530 Only in gcc-2.95.2/gcc/java: typeck.c.orig
6531 diff -u -r gcc-2.95.2-orig/gcc/java/verify.c gcc-2.95.2/gcc/java/verify.c
6532 --- gcc-2.95.2-orig/gcc/java/verify.c Wed Jun 23 11:33:10 1999
6533 +++ gcc-2.95.2/gcc/java/verify.c Sun Oct 31 14:53:38 1999
6535 || handler_pc < 0 || handler_pc >= length
6536 || (handler_pc >= start_pc && handler_pc < end_pc)
6537 || ! (instruction_bits [start_pc] & BCODE_INSTRUCTION_START)
6538 - || ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START)
6539 + || (end_pc < length &&
6540 + ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START))
6541 || ! (instruction_bits [handler_pc] & BCODE_INSTRUCTION_START))
6543 error ("bad pc in exception_table");