1 # DP: J*va patch set for gcc-2.95.2
2 # DP: taken from http://waitaki.otago.ac.nz/~bryce/gcj/
4 # DP: This patch consists of new J*va features and fixes extracted
5 # DP: from cvs and back-ported to gcc-2.95.2. It allows compilation of the
6 # DP: latest libgcj snapshots and cvs tree without the problems of the
7 # DP: current unstable cvs gcc tree (last update 1999-10-31).
9 Only in gcc-2.95.2/: build
10 diff -u -r gcc-2.95.2-orig/gcc/java/ChangeLog gcc-2.95.2/gcc/java/ChangeLog
11 --- gcc-2.95.2-orig/gcc/java/ChangeLog Mon Oct 25 19:59:13 1999
12 +++ gcc-2.95.2/gcc/java/ChangeLog Sun Oct 31 19:09:00 1999
14 +Fri Oct 29 14:35:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
16 + * class.c (add_method_1): Set DECL_INLINE to 1 for private, static
19 +Fri Oct 29 14:23:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
21 + * parse.y (expression_statement:): Call function to report
22 + improper invocation of a constructor.
23 + (parse_ctor_invocation_error): New function.
25 +1999-10-04 Tom Tromey <tromey@cygnus.com>
27 + * lex.h (BUILD_OPERATOR2): Return ASSIGN_ANY_TK in `lite' case as
28 + well. Fixes Java PR gcj/59.
29 + * parse-scan.y (yyerror): Report errors.
31 +Thu Oct 21 01:27:31 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
33 + * parse.y (resolve_qualified_expression_name): Handle MODIFY_EXPR.
34 + (qualify_ambiguous_name): Likewise.
36 +1999-10-21 Tom Tromey <tromey@cygnus.com>
38 + * jvgenmain.c (main): _Jv_Compiler_Properties now an extern; set
39 + in generated `main'.
41 +Tue Oct 12 22:28:10 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
43 + * jcf-write.c (RELOCATION_VALUE_1): Fixed integer value from 0 to 1.
45 +1999-10-07 Anthony Green <green@cygnus.com>
47 + * jcf-write.c (generate_classfile): Use UNSAFE_PUTx in cases
48 + where CHECK_PUT may fail for valid reasons.
50 + * jcf-write.c (UNSAFE_PUT1, UNSAFE_PUT2, UNSAFE_PUT3,
51 + UNSAFE_PUTN): New macros.
53 +Tue Sep 14 16:24:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
55 + * jcf-write.c: (RELOCATION_VALUE_0): New macro.
56 + (RELOCATION_VALUE_1): Likewise.
57 + (emit_iinc, emit_reloc, push_constant1, push_constant2,
58 + push_in_const, push_long_const): Prototyped.
59 + (push_constant1): Argument `index' is of type HOST_WIDE_INT.
60 + (push_constant2): Likewise.
61 + (push_int_const): Cast find_constant1's integer arguments to `jword'.
62 + (find_constant_wide): Cast find_constant2's integer arguments to
64 + (find_constant_index): Cast find_constant2's and find_constant2's
65 + integer arguments to `jword'.
66 + (emit_pop): Argument `value' is of type HOST_WIDE_INT.
67 + (emit_switch_reloc): Use RELOCATION_VALUE_0.
68 + (emit_if): Use RELOCATION_VALUE_1.
69 + (emit_goto): Likewise.
70 + (emit_jsr): Likewise.
71 + (generate_bytecode_insns): Use RELOCATION_VALUE_0. Cast second
72 + argument to push_long_const to HOST_WIDE_INT.
74 +Thu Sep 16 15:42:39 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
76 + * parse.y (java_method_add_stmt): Test against GET_CURRENT_BLOCK
79 +Sat Sep 11 16:46:44 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
81 + * parse.y (find_applicable_accessible_methods_list): Search
82 + abstract classes as interfaces.
84 +Thu Sep 9 17:33:28 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
86 + * class.c (finish_class): We're now outside a valid method
87 + declaration. Tell the rest of gcc so.
89 +1999-09-07 Tom Tromey <tromey@cygnus.com>
91 + * gjavah.c (add_class_decl): Generate include for gcj/array.h, not
93 + (decode_signature_piece): Don't emit "::" in JArray<>.
94 + (print_namelet): Only print trailing `;' when printing a class.
96 +1999-09-03 Tom Tromey <tromey@cygnus.com>
98 + * parse.y (strip_out_static_field_access_decl): Return operand if
99 + it satisfies JDECL_P.
101 +1999-09-02 Tom Tromey <tromey@cygnus.com>
103 + * gjavah.c (decode_signature_piece): Emit "::" in JArray<>.
104 + Handle nested arrays, like `[[I'.
106 +1999-08-26 Tom Tromey <tromey@cygnus.com>
108 + * gjavah.c (print_cxx_classname): Print "::" before qualified
111 +1999-10-19 Tom Tromey <tromey@cygnus.com>
113 + * jcf-parse.c (parse_source_file): Call jcf_dependency_add_file.
114 + From Mike Moreton <mike@pillim.demon.co.uk>.
116 +1999-09-23 Tom Tromey <tromey@cygnus.com>
118 + * jvspec.c (lang_specific_driver): Don't read spec file if
119 + -fsyntax-only given.
121 +1999-09-22 Tom Tromey <tromey@cygnus.com>
123 + * lang-specs.h: Added `%(jc1)' to the jc1 spec.
125 +1999-08-25 Tom Tromey <tromey@cygnus.com>
127 + * jvspec.c (lang_specific_driver): Correctly handle --help again.
129 +1999-10-14 Tom Tromey <tromey@cygnus.com>
131 + * jvgenmain.c (usage): New function.
132 + (main): Use it. Also, handle `-D' options.
133 + * jvspec.c (lang_specific_driver): Recognize -D.
134 + (jvgenmain_spec): Added `%{D*}' to jvgenmain invocation.
136 +Thu Aug 26 09:10:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
138 + * parse.y (lookup_cl): Changed leading comment. Now does its best
139 + to set the column number.
140 + (qualify_ambiguous_name): Take WFL wrappers into account.
142 +Wed Aug 25 15:37:15 1999 Gregg Townsend <gmt@cs.arizona.edu>
144 + * verify.c (verify_jvm_instructions): Don't check instruction
145 + validity beyond end of method.
147 +Sun Aug 22 11:07:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
149 + * parse.y (check_method_redefinition): Changed leading comment.
150 + (check_abstract_method_definitions): New function.
151 + (java_check_abstract_method_definitions): New function.
152 + (java_check_regular_methods): Call it.
153 + (verify_constructor_super): Fixed indentation.
154 + (lookup_method_invoke): Likewise.
156 +Thu Aug 19 10:26:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
158 + * parse.y (method_header): Return a null pointer if the current
159 + class node is null.
160 + (finish_method_declaration): Return if the current function decl
162 + (source_start_java_method): Likewise.
163 + (java_method_add_stmt): Likewise.
165 +Wed Aug 18 13:17:15 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
167 + * class.c (emit_register_class): Removed unnecessary call to
169 + * parse.y (labeled_block_contains_loop_p): Removed unused local
172 +Tue Aug 17 22:51:44 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
174 + * parse.y (java_refold): Added prototype.
176 +Tue Aug 17 21:48:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
178 + * parse.y (BINOP_COMPOUND_CANDIDATES): New macro.
179 + (java_stabilize_reference): Removed unnecessary `else'.
180 + (java_complete_lhs): Set flag to remember boolean. Call
181 + java_refold. Added comments.
182 + (java_decl_equiv): New function.
183 + (binop_compound_p): Likewise.
184 + (java_refold): Likewise.
185 + (patch_unaryop): Striped static field access assigned to decl and
186 + op. Changed promotion scheme for ++/-- operators.
187 + (search_loop): New function.
188 + (labeled_block_contains_loop_p): Likewise.
189 + (patch_loop_statement): Call labeled_block_contains_loop_p. Added
191 + (patch_bc_statement): Call search_loop. Fixed comment.
193 +1999-08-15 Anthony Green <green@cygnus.com>
195 + * expr.c (java_lang_expand_expr): Mark static array data as
198 +1999-07-25 Anthony Green <green@cygnus.com>
200 + * gjavah.c (print_stub): New function.
201 + (METHOD_IS_NATIVE): New macro.
202 + (print_mangled_classname): Make static.
203 + (HANDLE_END_FIELD): Don't emit fields during stub generation.
204 + (process_file): Perform stub generation.
205 + (HANDLE_METHOD): Don't emit class decls during stub
207 + (HANDLE_END_METHOD): Take into account stub generation.
208 + (print_method_info): Handle stub generation.
209 + (print_stub): New function.
210 + (print_cxx_classname): Make signature consistant with others.
211 + (help): Describe -stubs option.
212 + (main): Create stub file.
213 + (version): Use version.c.
214 + (print_full_cxx_name): New function.
215 + (print_c_decl): Use print_full_cxx_name.
217 +Thu Jul 22 12:41:12 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
219 + * check-init.c (check_init): Handle MAX_EXPR.
221 +1999-07-15 Andrew Haley <aph@cygnus.com>
223 + * lang.c (flag_use_divide_subroutine): New variable.
224 + * typeck.c: (convert_ieee_real_to_integer): Bounds check
225 + fp-to-integer conversion.
226 + (convert): Call convert_ieee_real_to_integer when flag_fast_math
229 + * expr.c (build_java_soft_divmod): New function.
230 + (build_java_binop): Call build_java_soft_divmod if
231 + flag_use_divide_subroutine is set.
232 + * decl.c: soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
233 + soft_lrem_node: new builtin functions.
234 + (init_decl_processing) Initialize the new builtins.
235 + * java-tree.h soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
236 + soft_lrem_node: new builtin functions.
237 + (build_java_soft_divmod): New function.
238 + * parse.y: Call build_java_soft_divmod if
239 + flag_use_divide_subroutine is set.
240 + * parse.c: Rebuilt.
242 + * jvspec.c (lang_specific_driver): Always allow an extra arg (for
243 + a --specs= arg) even if not linking.
244 + * lang-options.h (DEFINE_LANG_NAME ("Java")): Add
245 + -fuse-divide-subroutine
247 +Tue Jul 20 13:20:05 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
249 + * parse.y (resolve_and_layout): Check methods only once.
250 + (resolve_qualified_expression_name): Verify thrown exceptions
252 + (check_thrown_exceptions): Reject exceptions thrown in
253 + initializer. Error message tuned.
255 +1999-07-14 Andrew Haley <aph@cygnus.com>
257 + * expr.c (expand_expr): Do not return the last statement in a
258 + block as the block's value.
260 +Sat Jul 3 22:26:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
262 + * expr.c (force_evaluation_order): Save the COMPOUND_EXPR'ed
263 + CALL_EXPR, to avoid order of evaluation changes.
265 +Fri Jul 2 17:44:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
267 + * parse.y (qualify_ambiguous_name): Do not use
268 + IDENTIFIER_LOCAL_VALUE when name is a STRING_CST.
270 +Thu Jul 1 23:31:16 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
272 + * check-init.c (check_init): Handle MAX_EXPR.
273 + * expr.c (force_evaluation_order): Force method call arguments to
274 + be evaluated in left-to-right order.
275 + * parse.y (qualify_ambiguous_name): Loop again to qualify
276 + NEW_ARRAY_EXPR properly.
278 +Wed Jun 30 17:27:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
280 + * parse.y (patch_invoke): Resolve unresolved invoked method
282 + (qualify_ambiguous_name): STRING_CST to qualify expression for
283 + type name resolution.
285 +1999-06-24 Andrew Haley <aph@cygnus.com>
287 + * java/class.c (finish_class): Whenever a deferred method is
288 + output, rescan the list of methods to see if a new candidate for
289 + output can be found.
292 +======================================================================
297 Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com)
299 * gcc-2.95.2 Released.
300 diff -u -r gcc-2.95.2-orig/gcc/java/check-init.c gcc-2.95.2/gcc/java/check-init.c
301 --- gcc-2.95.2-orig/gcc/java/check-init.c Sat May 15 01:44:08 1999
302 +++ gcc-2.95.2/gcc/java/check-init.c Sun Oct 31 12:32:14 1999
311 check_init (TREE_OPERAND (exp, 0), before);
312 diff -u -r gcc-2.95.2-orig/gcc/java/class.c gcc-2.95.2/gcc/java/class.c
313 --- gcc-2.95.2-orig/gcc/java/class.c Fri Jun 25 15:27:08 1999
314 +++ gcc-2.95.2/gcc/java/class.c Sun Oct 31 19:08:09 1999
315 @@ -425,10 +425,13 @@
317 if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1;
318 if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1;
319 - if (access_flags & ACC_PRIVATE) METHOD_PRIVATE (fndecl) = 1;
320 + if (access_flags & ACC_PRIVATE)
321 + METHOD_PRIVATE (fndecl) = DECL_INLINE (fndecl) = 1;
322 if (access_flags & ACC_NATIVE) METHOD_NATIVE (fndecl) = 1;
323 - if (access_flags & ACC_STATIC) METHOD_STATIC (fndecl) = 1;
324 - if (access_flags & ACC_FINAL) METHOD_FINAL (fndecl) = 1;
325 + if (access_flags & ACC_STATIC)
326 + METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1;
327 + if (access_flags & ACC_FINAL)
328 + METHOD_FINAL (fndecl) = DECL_INLINE (fndecl) = 1;
329 if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1;
330 if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1;
331 if (access_flags & ACC_TRANSIENT) METHOD_TRANSIENT (fndecl) = 1;
332 @@ -1200,10 +1203,10 @@
336 + tree type_methods = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
338 - /* Emit deferred inline methods. */
339 - for ( method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
340 - method != NULL_TREE; method = TREE_CHAIN (method))
341 + /* Emit deferred inline methods. */
342 + for (method = type_methods; method != NULL_TREE; )
344 if (! TREE_ASM_WRITTEN (method) && DECL_SAVED_INSNS (method) != 0)
346 @@ -1215,10 +1218,16 @@
347 temporary_allocation ();
348 output_inline_function (method);
349 permanent_allocation (1);
350 + /* Scan the list again to see if there are any earlier
351 + methods to emit. */
352 + method = type_methods;
356 + method = TREE_CHAIN (method);
359 + current_function_decl = NULL_TREE;
360 make_class_data (current_class);
362 rest_of_decl_compilation (TYPE_NAME (current_class), (char*) 0, 1, 0);
363 @@ -1721,7 +1730,6 @@
368 init_decl = build_decl (FUNCTION_DECL, init_name, init_type);
369 DECL_ASSEMBLER_NAME (init_decl) = init_name;
370 TREE_STATIC (init_decl) = 1;
371 Only in gcc-2.95.2/gcc/java: class.c.orig
372 diff -u -r gcc-2.95.2-orig/gcc/java/decl.c gcc-2.95.2/gcc/java/decl.c
373 --- gcc-2.95.2-orig/gcc/java/decl.c Sat Jun 5 20:18:17 1999
374 +++ gcc-2.95.2/gcc/java/decl.c Sat Oct 30 19:53:18 1999
376 tree soft_lookupinterfacemethod_node;
378 tree soft_exceptioninfo_call_node;
379 +tree soft_idiv_node;
380 +tree soft_irem_node;
381 +tree soft_ldiv_node;
382 +tree soft_lrem_node;
385 /* Build (and pushdecl) a "promoted type" for all standard
386 types shorter than int. */
388 BUILT_IN_FMOD, "fmodf");
392 + = builtin_function ("_Jv_divI",
393 + build_function_type (int_type_node, t),
394 + NOT_BUILT_IN, NULL_PTR);
397 + = builtin_function ("_Jv_remI",
398 + build_function_type (int_type_node, t),
399 + NOT_BUILT_IN, NULL_PTR);
402 + = builtin_function ("_Jv_divJ",
403 + build_function_type (long_type_node, t),
404 + NOT_BUILT_IN, NULL_PTR);
407 + = builtin_function ("_Jv_remJ",
408 + build_function_type (long_type_node, t),
409 + NOT_BUILT_IN, NULL_PTR);
411 init_class_processing ();
414 Only in gcc-2.95.2/gcc/java: decl.c.orig
415 diff -u -r gcc-2.95.2-orig/gcc/java/expr.c gcc-2.95.2/gcc/java/expr.c
416 --- gcc-2.95.2-orig/gcc/java/expr.c Sat Jun 5 20:18:19 1999
417 +++ gcc-2.95.2/gcc/java/expr.c Sun Oct 31 13:00:28 1999
418 @@ -1052,6 +1052,53 @@
419 expand_assignment (local_var, res, 0, 0);
424 +build_java_soft_divmod (op, type, op1, op2)
426 + tree type, op1, op2;
429 + tree arg1 = convert (type, op1);
430 + tree arg2 = convert (type, op2);
432 + if (type == int_type_node)
436 + case TRUNC_DIV_EXPR:
437 + call = soft_idiv_node;
439 + case TRUNC_MOD_EXPR:
440 + call = soft_irem_node;
444 + else if (type == long_type_node)
448 + case TRUNC_DIV_EXPR:
449 + call = soft_ldiv_node;
451 + case TRUNC_MOD_EXPR:
452 + call = soft_lrem_node;
458 + fatal ("Internal compiler error in build_java_soft_divmod");
460 + call = build (CALL_EXPR, type,
461 + build_address_of (call),
462 + tree_cons (NULL_TREE, arg1,
463 + build_tree_list (NULL_TREE, arg2)),
470 build_java_binop (op, type, arg1, arg2)
472 @@ -1100,10 +1147,11 @@
474 return fold (build (COND_EXPR, int_type_node,
475 ifexp1, integer_negative_one_node, second_compare));
479 + case TRUNC_DIV_EXPR:
481 - if (TREE_CODE (type) == REAL_TYPE)
482 + if (TREE_CODE (type) == REAL_TYPE
483 + && op == TRUNC_MOD_EXPR)
486 if (type != double_type_node)
487 @@ -1120,6 +1168,12 @@
488 call = convert (type, call);
492 + if (TREE_CODE (type) == INTEGER_TYPE
493 + && flag_use_divide_subroutine
494 + && ! flag_syntax_only)
495 + return build_java_soft_divmod (op, type, arg1, arg2);
500 @@ -1881,6 +1935,7 @@
501 DECL_INITIAL (init_decl) = init;
502 DECL_IGNORED_P (init_decl) = 1;
503 TREE_READONLY (init_decl) = 1;
504 + TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1;
505 make_decl_rtl (init_decl, NULL, 1);
508 @@ -1895,7 +1950,6 @@
511 tree body = BLOCK_EXPR_BODY (exp);
512 - struct rtx_def *to_return;
513 pushlevel (2); /* 2 and above */
514 expand_start_bindings (0);
515 local = BLOCK_EXPR_DECLS (exp);
516 @@ -1913,10 +1967,11 @@
518 body = TREE_OPERAND (body, 1);
520 - to_return = expand_expr (body, target, tmode, modifier);
521 + expand_expr (body, const0_rtx, VOIDmode, 0);
524 expand_end_bindings (getdecls (), 1, 0);
530 @@ -2578,6 +2633,10 @@
532 We fix this by using save_expr. This forces the sub-operand to be
533 copied into a fresh virtual register,
535 + For method invocation, we modify the arguments so that a
536 + left-to-right order evaluation is performed. Saved expressions
537 + will, in CALL_EXPR order, be reused when the call will be expanded.
541 @@ -2593,19 +2652,30 @@
543 else if (TREE_CODE (node) == CALL_EXPR || TREE_CODE (node) == NEW_CLASS_EXPR)
545 - tree last_side_effecting_arg = NULL_TREE;
546 - tree arg = TREE_OPERAND (node, 1);
547 - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg))
550 + if (!TREE_OPERAND (node, 1))
553 + /* This reverses the evaluation order. This is a desired effect. */
554 + for (cmp = NULL_TREE, arg = TREE_OPERAND (node, 1);
555 + arg; arg = TREE_CHAIN (arg))
557 - if (TREE_SIDE_EFFECTS (TREE_VALUE (arg)))
558 - last_side_effecting_arg = arg;
559 + tree saved = save_expr (TREE_VALUE (arg));
560 + cmp = (cmp == NULL_TREE ? saved :
561 + build (COMPOUND_EXPR, void_type_node, cmp, saved));
562 + TREE_VALUE (arg) = saved;
564 - arg = TREE_OPERAND (node, 1);
565 - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg))
567 + if (cmp && TREE_CODE (cmp) == COMPOUND_EXPR)
568 + TREE_SIDE_EFFECTS (cmp) = 1;
572 - if (arg == last_side_effecting_arg)
574 - TREE_VALUE (arg) = save_expr (TREE_VALUE (arg));
575 + cmp = save_expr (build (COMPOUND_EXPR, TREE_TYPE (node), cmp, node));
576 + CAN_COMPLETE_NORMALLY (cmp) = CAN_COMPLETE_NORMALLY (node);
577 + TREE_SIDE_EFFECTS (cmp) = 1;
582 Only in gcc-2.95.2/gcc/java: expr.c.orig
583 Only in gcc-2.95.2/gcc/java: expr.c.rej
584 diff -u -r gcc-2.95.2-orig/gcc/java/gjavah.c gcc-2.95.2/gcc/java/gjavah.c
585 --- gcc-2.95.2-orig/gcc/java/gjavah.c Fri May 14 00:05:02 1999
586 +++ gcc-2.95.2/gcc/java/gjavah.c Sat Oct 30 15:06:45 1999
588 #include "java-tree.h"
589 #include "java-opcodes.h"
591 +#include "version.c"
593 /* The output file. */
597 #define METHOD_IS_FINAL(Class, Method) \
598 (((Class) & ACC_FINAL) || ((Method) & (ACC_FINAL | ACC_PRIVATE)))
600 +/* Pass this macro the flags for a method. It will return true if the
601 + method is native. */
602 +#define METHOD_IS_NATIVE(Method) \
603 + ((Method) & ACC_NATIVE)
605 /* We keep a linked list of all method names we have seen. This lets
606 us determine if a method name and a field name are in conflict. */
608 @@ -100,11 +107,15 @@
609 /* List of method names we've seen. */
610 static struct method_name *method_name_list;
612 -static void print_field_info PROTO ((FILE *, JCF*, int, int, JCF_u2));
613 -static void print_method_info PROTO ((FILE *, JCF*, int, int, JCF_u2));
614 +static void print_field_info PROTO ((FILE*, JCF*, int, int, JCF_u2));
615 +static void print_mangled_classname PROTO ((FILE*, JCF*, const char*, int));
616 +static int print_cxx_classname PROTO ((FILE*, const char*, JCF*, int));
617 +static void print_method_info PROTO ((FILE*, JCF*, int, int, JCF_u2));
618 static void print_c_decl PROTO ((FILE*, JCF*, int, int, int, const char *));
619 -static void decompile_method PROTO ((FILE *, JCF *, int));
620 -static void add_class_decl PROTO ((FILE *, JCF *, JCF_u2));
621 +static void print_stub PROTO ((FILE*, JCF*, int, int, int, const char *));
622 +static void print_full_cxx_name PROTO ((FILE*, JCF*, int, int, int, const char *));
623 +static void decompile_method PROTO ((FILE*, JCF*, int));
624 +static void add_class_decl PROTO ((FILE*, JCF*, JCF_u2));
626 static int java_float_finite PROTO ((jfloat));
627 static int java_double_finite PROTO ((jdouble));
628 @@ -130,13 +141,13 @@
629 #define HANDLE_END_FIELD() \
633 + if (out && ! stubs) \
634 print_field_info (out, jcf, current_field_name, \
635 current_field_signature, \
636 current_field_flags); \
639 - add_class_decl (out, jcf, current_field_signature);
640 + if (! stubs) add_class_decl (out, jcf, current_field_signature);
642 #define HANDLE_CONSTANTVALUE(VALUEINDEX) current_field_value = (VALUEINDEX)
644 @@ -151,14 +162,14 @@
645 print_method_info (out, jcf, NAME, SIGNATURE, ACCESS_FLAGS); \
648 - add_class_decl (out, jcf, SIGNATURE);
649 + if (! stubs) add_class_decl (out, jcf, SIGNATURE);
651 #define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
652 if (out && method_declared) decompile_method (out, jcf, CODE_LENGTH);
654 static int decompiled = 0;
655 #define HANDLE_END_METHOD() \
656 - if (out && method_printed) fputs (decompiled ? "\n" : ";\n", out);
657 + if (out && method_printed) fputs (decompiled || stubs ? "\n" : ";\n", out);
659 #include "jcf-reader.c"
661 @@ -562,24 +573,36 @@
665 - method_printed = 1;
666 - generate_access (stream, flags);
669 - if ((flags & ACC_STATIC))
670 - fputs ("static ", out);
671 - else if (! METHOD_IS_FINAL (jcf->access_flags, flags))
674 - /* Don't print `virtual' if we have a constructor. */
676 - fputs ("virtual ", out);
678 - print_c_decl (out, jcf, name_index, sig_index, is_init, override);
679 + method_printed = 1;
681 - if ((flags & ACC_ABSTRACT))
682 - fputs (" = 0", out);
683 + generate_access (stream, flags);
686 + if ((flags & ACC_STATIC))
687 + fputs ("static ", out);
688 + else if (! METHOD_IS_FINAL (jcf->access_flags, flags))
690 + /* Don't print `virtual' if we have a constructor. */
692 + fputs ("virtual ", out);
694 + print_c_decl (out, jcf, name_index, sig_index, is_init, override);
696 + if ((flags & ACC_ABSTRACT))
697 + fputs (" = 0", out);
699 + method_declared = 1;
702 - method_declared = 1;
704 + if (METHOD_IS_NATIVE(flags))
706 + method_printed = 1;
707 + print_stub (out, jcf, name_index, sig_index, is_init, override);
712 /* Try to decompile a method body. Right now we just try to handle a
713 @@ -653,10 +676,13 @@
717 + int array_depth = 0;
719 switch (signature[0])
722 + /* More spaghetti. */
724 for (signature++; (signature < limit
726 && *signature <= '9'); signature++)
727 @@ -671,13 +697,17 @@
728 case 'S': ctype = "jshortArray"; goto printit;
729 case 'J': ctype = "jlongArray"; goto printit;
730 case 'Z': ctype = "jbooleanArray"; goto printit;
731 - case '[': ctype = "jobjectArray"; goto printit;
733 + /* We have a nested array. */
735 + fputs ("JArray<", stream);
739 - /* We have to generate a reference to JArray here,
740 - so that our output matches what the compiler
742 + /* We have to generate a reference to JArray here, so that
743 + our output matches what the compiler does. */
745 - fputs ("JArray<", stream);
746 + fputs ("JArray<", stream);
747 while (signature < limit && *signature != ';')
749 int ch = UTF8_GET (signature, limit);
751 case 'Z': ctype = "jboolean"; goto printit;
752 case 'V': ctype = "void"; goto printit;
754 + /* Print a leading "::" so we look in the right namespace. */
755 + fputs ("::", stream);
757 while (*signature && *signature != ';')
763 + while (array_depth-- > 0)
764 + fputs ("> *", stream);
769 @@ -791,40 +826,121 @@
770 /* Now print the name of the thing. */
774 - fputs (name_override, stream);
775 - else if (name_index)
777 - /* Declare constructors specially. */
779 - print_base_classname (stream, jcf, jcf->this_class);
781 - print_name (stream, jcf, name_index);
783 + print_full_cxx_name (stream, jcf, name_index,
784 + signature_index, is_init, name_override);
789 +// Print the unqualified method name followed by the signature.
791 +DEFUN(print_full_cxx_name, (stream, jcf, name_index, signature_index, is_init, name_override),
792 + FILE* stream AND JCF* jcf
793 + AND int name_index AND int signature_index AND int is_init
794 + AND const char *name_override)
796 + int length = JPOOL_UTF_LENGTH (jcf, signature_index);
797 + unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
798 + register unsigned char *str = str0;
799 + unsigned char *limit = str + length;
800 + int need_space = 0;
801 + int is_method = str[0] == '(';
802 + unsigned char *next;
805 + fputs (name_override, stream);
806 + else if (name_index)
808 + /* Declare constructors specially. */
810 + print_base_classname (stream, jcf, jcf->this_class);
812 + print_name (stream, jcf, name_index);
817 + /* Have a method or a constructor. Print signature pieces
819 + fputs (" (", stream);
821 + while (str < limit && *str != ')')
823 - /* Have a method or a constructor. Print signature pieces
825 - fputs (" (", stream);
827 - while (str < limit && *str != ')')
828 + next = decode_signature_piece (stream, str, limit, &need_space);
831 - next = decode_signature_piece (stream, str, limit, &need_space);
834 - fprintf (stderr, "unparseable signature: `%s'\n", str0);
838 + fprintf (stderr, "unparseable signature: `%s'\n", str0);
843 + if (next < limit && *next != ')')
844 + fputs (", ", stream);
848 + fputs (")", stream);
853 +DEFUN(print_stub, (stream, jcf, name_index, signature_index, is_init,
855 + FILE* stream AND JCF* jcf
856 + AND int name_index AND int signature_index
857 + AND int is_init AND const char *name_override)
859 + if (JPOOL_TAG (jcf, signature_index) != CONSTANT_Utf8)
861 + fprintf (stream, "<not a UTF8 constant>");
866 + int length = JPOOL_UTF_LENGTH (jcf, signature_index);
867 + unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
868 + register unsigned char *str = str0;
869 + unsigned char *limit = str + length;
870 + int need_space = 0;
871 + int is_method = str[0] == '(';
872 + unsigned char *next;
874 - if (next < limit && *next != ')')
875 - fputs (", ", stream);
877 + /* If printing a method, skip to the return signature and print
878 + that first. However, there is no return value if this is a
880 + if (is_method && ! is_init)
882 + while (str < limit)
890 - fputs (")", stream);
891 + /* If printing a field or an ordinary method, then print the
892 + "return value" now. */
893 + if (! is_method || ! is_init)
895 + next = decode_signature_piece (stream, str, limit, &need_space);
898 + fprintf (stderr, "unparseable signature: `%s'\n", str0);
904 + /* Now print the name of the thing. */
905 + print_cxx_classname (stream, "\n", jcf, jcf->this_class);
906 + fputs ("::", stream);
907 + print_full_cxx_name (stream, jcf, name_index,
908 + signature_index, is_init, name_override);
909 + fputs ("\n{\n JvFail (\"", stream);
910 + print_cxx_classname (stream, "", jcf, jcf->this_class);
911 + fputs ("::", stream);
912 + print_full_cxx_name (stream, jcf, name_index,
913 + signature_index, is_init, name_override);
914 + fputs (" not implemented\");\n}\n\n", stream);
920 print_cxx_classname (stream, prefix, jcf, index)
923 + const char *prefix;
930 fputs (prefix, stream);
932 + /* Print a leading "::" so we look in the right namespace. */
933 + fputs ("::", stream);
937 c = UTF8_GET (s, limit);
938 @@ -1071,7 +1191,10 @@
940 for (i = 0; i < depth; ++i)
942 - fputs ("};\n", out);
943 + fputs ("}\n", out);
944 + /* Only print a `;' when printing a class. C++ is evil. */
945 + if (name->is_class)
950 @@ -1103,7 +1226,7 @@
951 /* If we see an array, then we include the array header. */
954 - print_include (out, "java-array", -1);
955 + print_include (out, "gcj/array", -1);
959 @@ -1204,30 +1327,49 @@
960 jcf_parse_class (jcf);
962 if (written_class_count++ == 0 && out)
963 - fputs ("// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-\n\n",
966 + fputs ("// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-\n\n",
970 + fputs ("// This file was created by `gcjh -stubs'. It is -*- c++ -*-.
972 +// This file is intended to give you a head start on implementing native
973 +// methods using CNI.
974 +// Be aware: running `gcjh -stubs' once more for this class may overwrite any
975 +// edits you have made to this file.\n\n", out);
980 - print_mangled_classname (out, jcf, "#ifndef __", jcf->this_class);
981 - fprintf (out, "__\n");
983 - print_mangled_classname (out, jcf, "#define __", jcf->this_class);
984 - fprintf (out, "__\n\n");
986 - /* We do this to ensure that inline methods won't be `outlined'
987 - by g++. This works as long as method and fields are not
988 - added by the user. */
989 - fprintf (out, "#pragma interface\n");
992 - if (jcf->super_class && out)
995 - unsigned char *supername = super_class_name (jcf, &super_length);
998 - print_include (out, supername, super_length);
1001 + print_mangled_classname (out, jcf, "#ifndef __", jcf->this_class);
1002 + fprintf (out, "__\n");
1004 + print_mangled_classname (out, jcf, "#define __", jcf->this_class);
1005 + fprintf (out, "__\n\n");
1007 + /* We do this to ensure that inline methods won't be `outlined'
1008 + by g++. This works as long as method and fields are not
1009 + added by the user. */
1010 + fprintf (out, "#pragma interface\n");
1012 + if (jcf->super_class)
1015 + unsigned char *supername = super_class_name (jcf, &super_length);
1017 + fputs ("\n", out);
1018 + print_include (out, supername, super_length);
1023 + /* Strip off the ".class" portion of the name when printing
1024 + the include file name. */
1025 + print_include (out, jcf->classname, strlen (jcf->classname) - 6);
1029 /* We want to parse the methods first. But we need to find where
1030 @@ -1246,31 +1388,37 @@
1034 - print_class_decls (out, jcf, jcf->this_class);
1037 + print_class_decls (out, jcf, jcf->this_class);
1039 for (i = 0; i < prepend_count; ++i)
1040 fprintf (out, "%s\n", prepend_specs[i]);
1041 if (prepend_count > 0)
1045 - if (out && ! print_cxx_classname (out, "class ", jcf, jcf->this_class))
1047 - fprintf (stderr, "class is of array type\n");
1051 - if (out && jcf->super_class)
1053 - if (! print_cxx_classname (out, " : public ", jcf, jcf->super_class))
1057 - fprintf (stderr, "base class is of array type\n");
1060 + if (! print_cxx_classname (out, "class ", jcf, jcf->this_class))
1062 + fprintf (stderr, "class is of array type\n");
1066 + if (jcf->super_class)
1068 + if (! print_cxx_classname (out, " : public ",
1069 + jcf, jcf->super_class))
1071 + fprintf (stderr, "base class is of array type\n");
1077 + fputs ("\n{\n", out);
1081 - fputs ("\n{\n", out);
1083 /* Now go back for second pass over methods and fields. */
1084 JCF_SEEK (jcf, method_start);
1085 @@ -1297,15 +1445,20 @@
1086 for (i = 0; i < add_count; ++i)
1087 fprintf (out, " %s\n", add_specs[i]);
1089 - fputs ("};\n", out);
1091 + fputs ("};\n", out);
1093 if (append_count > 0)
1095 for (i = 0; i < append_count; ++i)
1096 fprintf (out, "%s\n", append_specs[i]);
1098 - print_mangled_classname (out, jcf, "\n#endif /* __", jcf->this_class);
1099 - fprintf (out, "__ */\n");
1102 + print_mangled_classname (out, jcf,
1103 + "\n#endif /* __", jcf->this_class);
1104 + fprintf (out, "__ */\n");
1109 @@ -1327,6 +1480,7 @@
1110 printf (" -d DIRECTORY Set output directory name\n");
1111 printf (" --help Print this help, then exit\n");
1112 printf (" -o FILE Set output file name\n");
1113 + printf (" -stubs Generate a C++ implementation stub file\n");
1114 printf (" -td DIRECTORY Set temporary directory name\n");
1115 printf (" -v, --verbose Print extra information while running\n");
1116 printf (" --version Print version number, then exit\n");
1117 @@ -1346,8 +1500,8 @@
1120 /* FIXME: use version.c? */
1121 - printf ("gcjh (GNU gcc) 0.0\n\n");
1122 - printf ("Copyright (C) 1998 Free Software Foundation, Inc.\n");
1123 + printf ("gcjh (%s)\n\n", version_string);
1124 + printf ("Copyright (C) 1998, 1999 Free Software Foundation, Inc.\n");
1125 printf ("This is free software; see the source for copying conditions. There is NO\n");
1126 printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
1128 @@ -1548,7 +1702,7 @@
1130 int dir_len = strlen (output_directory);
1131 int i, classname_length = strlen (classname);
1132 - current_output_file = (char*) ALLOC (dir_len + classname_length + 4);
1133 + current_output_file = (char*) ALLOC (dir_len + classname_length + 5);
1134 strcpy (current_output_file, output_directory);
1135 if (dir_len > 0 && output_directory[dir_len-1] != '/')
1136 current_output_file[dir_len++] = '/';
1137 @@ -1574,7 +1728,8 @@
1138 jcf_dependency_set_dep_file (current_output_file);
1141 - strcpy (current_output_file + dir_len, ".h");
1142 + strcpy (current_output_file + dir_len,
1143 + stubs ? ".cc" : ".h");
1144 jcf_dependency_set_target (current_output_file);
1145 if (! suppress_output)
1147 @@ -1601,10 +1756,9 @@
1151 - * Do whatever the javah -stubs flag does.
1153 * Emit "structure forward declarations" when needed.
1155 * Generate C headers, like javah
1159 Only in gcc-2.95.2/gcc/java: gjavah.c.orig
1160 Only in gcc-2.95.2/gcc/java: gjavah.c.rej
1161 diff -u -r gcc-2.95.2-orig/gcc/java/java-tree.h gcc-2.95.2/gcc/java/java-tree.h
1162 --- gcc-2.95.2-orig/gcc/java/java-tree.h Fri May 14 02:33:28 1999
1163 +++ gcc-2.95.2/gcc/java/java-tree.h Sat Oct 30 19:45:50 1999
1165 extern int flag_not_overriding;
1166 extern int flag_static_local_jdk1_1;
1168 +/* When non zero, call a library routine to do integer divisions. */
1169 +extern int flag_use_divide_subroutine;
1171 /* The Java .class file that provides main_class; the main input file. */
1172 extern struct JCF *current_jcf;
1174 @@ -283,6 +286,10 @@
1175 extern tree soft_lookupinterfacemethod_node;
1176 extern tree soft_fmod_node;
1177 extern tree soft_exceptioninfo_call_node;
1178 +extern tree soft_idiv_node;
1179 +extern tree soft_irem_node;
1180 +extern tree soft_ldiv_node;
1181 +extern tree soft_lrem_node;
1183 extern tree access_flags_type_node;
1186 extern tree build_field_ref PROTO ((tree, tree, tree));
1187 extern void pushdecl_force_head PROTO ((tree));
1188 extern tree build_java_binop PROTO ((enum tree_code, tree, tree, tree));
1189 +extern tree build_java_soft_divmod PROTO ((enum tree_code, tree, tree, tree));
1190 extern tree binary_numeric_promotion PROTO ((tree, tree, tree *, tree *));
1191 extern tree build_java_arrayaccess PROTO ((tree, tree, tree));
1192 extern tree build_newarray PROTO ((int, tree));
1193 Only in gcc-2.95.2/gcc/java: java-tree.h.orig
1194 diff -u -r gcc-2.95.2-orig/gcc/java/jcf-parse.c gcc-2.95.2/gcc/java/jcf-parse.c
1195 --- gcc-2.95.2-orig/gcc/java/jcf-parse.c Thu Apr 22 01:49:42 1999
1196 +++ gcc-2.95.2/gcc/java/jcf-parse.c Sat Oct 30 14:02:11 1999
1198 /* Mark the file as parsed */
1199 HAS_BEEN_ALREADY_PARSED_P (file) = 1;
1201 + jcf_dependency_add_file (input_filename, 0);
1203 lang_init_source (1); /* Error msgs have no method prototypes */
1205 java_init_lex (); /* Initialize the parser */
1206 diff -u -r gcc-2.95.2-orig/gcc/java/jcf-write.c gcc-2.95.2/gcc/java/jcf-write.c
1207 --- gcc-2.95.2-orig/gcc/java/jcf-write.c Sun Mar 21 18:09:14 1999
1208 +++ gcc-2.95.2/gcc/java/jcf-write.c Sun Oct 31 18:54:12 1999
1210 struct jcf_block *label;
1213 +#define RELOCATION_VALUE_0 ((HOST_WIDE_INT)0)
1214 +#define RELOCATION_VALUE_1 ((HOST_WIDE_INT)1)
1216 /* State for single catch clause. */
1219 @@ -299,8 +302,14 @@
1220 static void init_jcf_method PROTO ((struct jcf_partial *, tree));
1221 static void release_jcf_state PROTO ((struct jcf_partial *));
1222 static struct chunk * generate_classfile PROTO ((tree, struct jcf_partial *));
1223 +static void emit_iinc PROTO ((tree, HOST_WIDE_INT, struct jcf_partial *));
1224 +static void emit_reloc PROTO ((HOST_WIDE_INT, int, struct jcf_block *,
1225 + struct jcf_partial *));
1226 +static void push_constant1 PROTO ((HOST_WIDE_INT, struct jcf_partial *));
1227 +static void push_constant2 PROTO ((HOST_WIDE_INT, struct jcf_partial *));
1230 +static void push_long_const PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1231 + struct jcf_partial *));
1232 /* Utility macros for appending (big-endian) data to a buffer.
1233 We assume a local variable 'ptr' points into where we want to
1234 write next, and we assume enoygh space has been allocated. */
1235 @@ -326,7 +335,13 @@
1236 #define PUT4(X) (PUT2((X) >> 16), PUT2((X) & 0xFFFF))
1237 #define PUTN(P, N) (CHECK_PUT(ptr, state, N), memcpy(ptr, P, N), ptr += (N))
1240 +/* There are some cases below where CHECK_PUT is guaranteed to fail.
1241 + Use the following macros in those specific cases. */
1242 +#define UNSAFE_PUT1(X) (*ptr++ = (X))
1243 +#define UNSAFE_PUT2(X) (UNSAFE_PUT1((X) >> 8), UNSAFE_PUT1((X) & 0xFF))
1244 +#define UNSAFE_PUT4(X) (UNSAFE_PUT2((X) >> 16), UNSAFE_PUT2((X) & 0xFFFF))
1245 +#define UNSAFE_PUTN(P, N) (memcpy(ptr, P, N), ptr += (N))
1247 /* Allocate a new chunk on obstack WORK, and link it in after LAST.
1248 Set the data and size fields to DATA and SIZE, respectively.
1249 However, if DATA is NULL and SIZE>0, allocate a buffer as well. */
1253 push_constant1 (index, state)
1255 + HOST_WIDE_INT index;
1256 struct jcf_partial *state;
1262 push_constant2 (index, state)
1264 + HOST_WIDE_INT index;
1265 struct jcf_partial *state;
1272 - i = find_constant1 (&state->cpool, CONSTANT_Integer, i & 0xFFFFFFFF);
1273 + i = find_constant1 (&state->cpool, CONSTANT_Integer,
1274 + (jword)(i & 0xFFFFFFFF));
1275 push_constant1 (i, state);
1279 HOST_WIDE_INT w1, w2;
1280 lshift_double (lo, hi, -32, 64, &w1, &w2, 1);
1281 return find_constant2 (&state->cpool, CONSTANT_Long,
1282 - w1 & 0xFFFFFFFF, lo & 0xFFFFFFFF);
1283 + (jword)(w1 & 0xFFFFFFFF), (jword)(lo & 0xFFFFFFFF));
1286 /* Find or allocate a constant pool entry for the given VALUE.
1289 if (TYPE_PRECISION (TREE_TYPE (value)) <= 32)
1290 return find_constant1 (&state->cpool, CONSTANT_Integer,
1291 - TREE_INT_CST_LOW (value) & 0xFFFFFFFF);
1292 + (jword)(TREE_INT_CST_LOW (value) & 0xFFFFFFFF));
1294 return find_constant_wide (TREE_INT_CST_LOW (value),
1295 TREE_INT_CST_HIGH (value), state);
1296 @@ -756,14 +772,17 @@
1297 if (TYPE_PRECISION (TREE_TYPE (value)) == 32)
1299 words[0] = etarsingle (TREE_REAL_CST (value)) & 0xFFFFFFFF;
1300 - return find_constant1 (&state->cpool, CONSTANT_Float, words[0]);
1301 + return find_constant1 (&state->cpool, CONSTANT_Float,
1306 etardouble (TREE_REAL_CST (value), words);
1307 return find_constant2 (&state->cpool, CONSTANT_Double,
1308 - words[1-FLOAT_WORDS_BIG_ENDIAN] & 0xFFFFFFFF,
1309 - words[FLOAT_WORDS_BIG_ENDIAN] & 0xFFFFFFFF);
1310 + (jword)(words[1-FLOAT_WORDS_BIG_ENDIAN] &
1312 + (jword)(words[FLOAT_WORDS_BIG_ENDIAN] &
1316 else if (TREE_CODE (value) == STRING_CST)
1319 emit_iinc (var, value, state)
1322 + HOST_WIDE_INT value;
1323 struct jcf_partial *state;
1325 int slot = DECL_LOCAL_INDEX (var);
1326 @@ -1012,7 +1031,7 @@
1327 struct jcf_block *label;
1328 struct jcf_partial *state;
1330 - emit_reloc (0, BLOCK_START_RELOC, label, state);
1331 + emit_reloc (RELOCATION_VALUE_0, BLOCK_START_RELOC, label, state);
1334 /* Similar to emit_switch_reloc,
1335 @@ -1041,8 +1060,8 @@
1336 struct jcf_partial *state;
1339 - // value is 1 byte from reloc back to start of instruction.
1340 - emit_reloc (1, - inv_opcode, target, state);
1341 + /* value is 1 byte from reloc back to start of instruction. */
1342 + emit_reloc (RELOCATION_VALUE_1, - inv_opcode, target, state);
1346 @@ -1051,8 +1070,8 @@
1347 struct jcf_partial *state;
1350 - // Value is 1 byte from reloc back to start of instruction.
1351 - emit_reloc (1, OPCODE_goto_w, target, state);
1352 + /* Value is 1 byte from reloc back to start of instruction. */
1353 + emit_reloc (RELOCATION_VALUE_1, OPCODE_goto_w, target, state);
1357 @@ -1061,8 +1080,8 @@
1358 struct jcf_partial *state;
1361 - // Value is 1 byte from reloc back to start of instruction.
1362 - emit_reloc (1, OPCODE_jsr_w, target, state);
1363 + /* Value is 1 byte from reloc back to start of instruction. */
1364 + emit_reloc (RELOCATION_VALUE_1, OPCODE_jsr_w, target, state);
1367 /* Generate code to evaluate EXP. If the result is true,
1368 @@ -1690,7 +1709,8 @@
1370 RESERVE (13 + 4 * (sw_state.max_case - sw_state.min_case + 1));
1371 OP1 (OPCODE_tableswitch);
1372 - emit_reloc (0, SWITCH_ALIGN_RELOC, NULL, state);
1373 + emit_reloc (RELOCATION_VALUE_0,
1374 + SWITCH_ALIGN_RELOC, NULL, state);
1375 emit_switch_reloc (sw_state.default_label, state);
1376 OP4 (sw_state.min_case);
1377 OP4 (sw_state.max_case);
1378 @@ -1713,7 +1733,8 @@
1379 { /* Use lookupswitch. */
1380 RESERVE(9 + 8 * sw_state.num_cases);
1381 OP1 (OPCODE_lookupswitch);
1382 - emit_reloc (0, SWITCH_ALIGN_RELOC, NULL, state);
1383 + emit_reloc (RELOCATION_VALUE_0,
1384 + SWITCH_ALIGN_RELOC, NULL, state);
1385 emit_switch_reloc (sw_state.default_label, state);
1386 OP4 (sw_state.num_cases);
1387 for (i = 0; i < sw_state.num_cases; i++)
1388 @@ -1886,7 +1907,7 @@
1390 push_int_const (value, state);
1392 - push_long_const (value, value >= 0 ? 0 : -1, state);
1393 + push_long_const (value, (HOST_WIDE_INT)(value >= 0 ? 0 : -1), state);
1395 emit_binop (OPCODE_iadd + adjust_typed_op (type, 3), type, state);
1396 if (target != IGNORE_TARGET && ! post_op)
1397 @@ -2775,7 +2796,7 @@
1401 - ptr = fields_count_ptr; PUT2 (fields_count);
1402 + ptr = fields_count_ptr; UNSAFE_PUT2 (fields_count);
1404 ptr = methods_count_ptr = append_chunk (NULL, 2, state);
1406 @@ -2841,10 +2862,10 @@
1407 code_attributes_count++;
1408 i += 8 + 10 * state->lvar_count;
1410 - PUT4 (i); /* attribute_length */
1411 - PUT2 (state->code_SP_max); /* max_stack */
1412 - PUT2 (localvar_max); /* max_locals */
1413 - PUT4 (state->code_length);
1414 + UNSAFE_PUT4 (i); /* attribute_length */
1415 + UNSAFE_PUT2 (state->code_SP_max); /* max_stack */
1416 + UNSAFE_PUT2 (localvar_max); /* max_locals */
1417 + UNSAFE_PUT4 (state->code_length);
1419 /* Emit the exception table. */
1420 ptr = append_chunk (NULL, 2 + 8 * state->num_handlers, state);
1421 @@ -2934,7 +2955,7 @@
1423 current_function_decl = save_function;
1425 - ptr = methods_count_ptr; PUT2 (methods_count);
1426 + ptr = methods_count_ptr; UNSAFE_PUT2 (methods_count);
1428 source_file = DECL_SOURCE_FILE (TYPE_NAME (clas));
1429 for (ptr = source_file; ; ptr++)
1430 Only in gcc-2.95.2/gcc/java: jcf-write.c.orig
1431 Only in gcc-2.95.2/gcc/java: jcf-write.c.rej
1432 diff -u -r gcc-2.95.2-orig/gcc/java/jvgenmain.c gcc-2.95.2/gcc/java/jvgenmain.c
1433 --- gcc-2.95.2-orig/gcc/java/jvgenmain.c Wed Aug 11 17:08:32 1999
1434 +++ gcc-2.95.2/gcc/java/jvgenmain.c Sat Oct 30 14:02:48 1999
1436 /* Program to generate "main" a Java(TM) class containing a main method.
1437 - Copyright (C) 1998 Free Software Foundation, Inc.
1438 + Copyright (C) 1998, 1999 Free Software Foundation, Inc.
1440 This file is part of GNU CC.
1443 (void (*) ()) OBSTACK_CHUNK_FREE);
1447 +usage (const char *name)
1449 + fprintf (stderr, "Usage: %s [OPTIONS]... CLASSNAME [OUTFILE]\n", name);
1454 main (int argc, const char **argv)
1456 const char *classname;
1458 char *mangled_classname;
1461 - if (argc < 2 || argc > 3)
1464 + for (i = 1; i < argc; ++i)
1466 - fprintf (stderr, "Usage: %s CLASSNAME [OUTFILE]\n", argv[0]);
1468 + if (! strncmp (argv[i], "-D", 2))
1470 + /* Handled later. */
1476 + if (i < argc - 2 || i == argc)
1480 classname = argv[1];
1482 gcc_obstack_init (&name_obstack);
1483 @@ -99,23 +117,46 @@
1484 obstack_1grow (&name_obstack, '\0');
1485 mangled_classname = obstack_finish (&name_obstack);
1487 - if (argc > 2 && strcmp (argv[2], "-") != 0)
1488 + if (i < argc - 1 && strcmp (argv[i + 1], "-") != 0)
1490 - const char *outfile = argv[2];
1491 + const char *outfile = argv[i + 1];
1492 stream = fopen (outfile, "w");
1495 fprintf (stderr, "%s: Cannot open output file: %s\n",
1504 + /* At this point every element of ARGV from 1 to LAST_ARG is a `-D'
1505 + option. Process them appropriately. */
1506 + fprintf (stream, "extern const char **_Jv_Compiler_Properties;\n");
1507 + fprintf (stream, "static const char *props[] =\n{\n");
1508 + for (i = 1; i < last_arg; ++i)
1511 + fprintf (stream, " \"");
1512 + for (p = &argv[i][2]; *p; ++p)
1514 + if (! isascii (*p))
1515 + fprintf (stream, "\\%o", *p);
1516 + else if (*p == '\\' || *p == '"')
1517 + fprintf (stream, "\\%c", *p);
1519 + putc (*p, stream);
1521 + fprintf (stream, "\",\n");
1523 + fprintf (stream, " 0\n};\n\n");
1525 fprintf (stream, "extern struct Class %s%s;\n",
1526 class_mangling_prefix, mangled_classname);
1527 fprintf (stream, "int main (int argc, const char **argv)\n");
1528 fprintf (stream, "{\n");
1529 + fprintf (stream, " _Jv_Compiler_Properties = props;\n");
1530 fprintf (stream, " JvRunMain (&%s%s, argc, argv);\n",
1531 class_mangling_prefix, mangled_classname);
1532 fprintf (stream, "}\n");
1535 fprintf (stderr, "%s: Failed to close output file %s\n",
1542 Only in gcc-2.95.2/gcc/java: jvgenmain.c.orig
1543 diff -u -r gcc-2.95.2-orig/gcc/java/jvspec.c gcc-2.95.2/gcc/java/jvspec.c
1544 --- gcc-2.95.2-orig/gcc/java/jvspec.c Sun Oct 17 10:18:28 1999
1545 +++ gcc-2.95.2/gcc/java/jvspec.c Sat Oct 30 20:09:50 1999
1547 #define COMBINE_INPUTS 0
1549 char jvgenmain_spec[] =
1550 - "jvgenmain %i %{!pipe:%umain.i} |\n\
1551 + "jvgenmain %{D*} %i %{!pipe:%umain.i} |\n\
1552 cc1 %{!pipe:%Umain.i} %1 \
1553 %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\
1559 + /* Saw a `-D' option. */
1562 /* An array used to flag each argument that needs a bit set for
1563 LANGSPEC, MATHLIB, WITHLIBC, or GCLIB. */
1566 /* Non-zero if linking is supposed to happen. */
1569 + /* Non-zero if we want to find the spec file. */
1570 + int want_spec_file = 1;
1572 /* The argument we use to specify the spec file. */
1573 char *spec_file = NULL;
1578 else if (strcmp (argv[i], "-fhelp") == 0)
1580 + want_spec_file = 0;
1581 else if (strcmp (argv[i], "-v") == 0)
1583 saw_verbose_flag = 1;
1585 else if (strcmp (argv[i], "-C") == 0)
1588 + want_spec_file = 0;
1596 + else if (argv[i][1] == 'D')
1598 else if (argv[i][1] == 'g')
1600 else if (argv[i][1] == 'O')
1602 else if (strcmp (argv[i], "-fsyntax-only") == 0
1603 || strcmp (argv[i], "--syntax-only") == 0)
1605 + want_spec_file = 0;
1611 (*fn) ("argument to `%s' missing\n", quote);
1613 + if (saw_D && ! main_class_name)
1614 + fatal ("can't specify `-D' without `--main'\n");
1616 num_args = argc + added;
1621 if (saw_g + saw_O == 0)
1626 arglist = (char **) xmalloc ((num_args + 1) * sizeof (char *));
1628 for (i = 0, j = 0; i < argc; i++, j++)
1633 - if (will_link && spec_file == NULL && strncmp (argv[i], "-L", 2) == 0)
1634 + if (spec_file == NULL && strncmp (argv[i], "-L", 2) == 0)
1635 spec_file = find_spec_file (argv[i] + 2);
1637 if (strncmp (argv[i], "-fmain=", 7) == 0)
1638 @@ -453,10 +465,10 @@
1639 if (saw_g + saw_O == 0)
1640 arglist[j++] = "-g1";
1642 - /* Read the specs file corresponding to libgcj, but only if linking.
1643 + /* Read the specs file corresponding to libgcj.
1644 If we didn't find the spec file on the -L path, then we hope it
1645 is somewhere in the standard install areas. */
1647 + if (want_spec_file)
1648 arglist[j++] = spec_file == NULL ? "-specs=libgcj.spec" : spec_file;
1651 Only in gcc-2.95.2/gcc/java: jvspec.c.orig
1652 Only in gcc-2.95.2/gcc/java: jvspec.c.rej
1653 diff -u -r gcc-2.95.2-orig/gcc/java/lang-options.h gcc-2.95.2/gcc/java/lang-options.h
1654 --- gcc-2.95.2-orig/gcc/java/lang-options.h Tue May 11 20:50:13 1999
1655 +++ gcc-2.95.2/gcc/java/lang-options.h Sat Oct 30 19:45:50 1999
1657 { "-fCLASSPATH", "Set class path" },
1658 { "-I", "Add directory to class path" },
1659 { "-foutput-class-dir", "Directory where class files should be written" },
1660 + { "-fuse-divide-subroutine", "" },
1661 + { "-fno-use-divide-subroutine", "Use built-in instructions for division" },
1662 { "-Wredundant-modifiers",
1663 "Warn if modifiers are specified when not necessary"},
1664 - { "-Wunsupported-jdk11", "Warn if `final' local variables are specified"},
1665 + { "-Wunsupported-jdk11", "Warn if `final' local variables are specified"},
1666 Only in gcc-2.95.2/gcc/java: lang-options.h.orig
1667 diff -u -r gcc-2.95.2-orig/gcc/java/lang-specs.h gcc-2.95.2/gcc/java/lang-specs.h
1668 --- gcc-2.95.2-orig/gcc/java/lang-specs.h Mon Feb 1 06:46:51 1999
1669 +++ gcc-2.95.2/gcc/java/lang-specs.h Sat Oct 30 20:07:34 1999
1671 {".zip", {"@java"} },
1672 {".jar", {"@java"} },
1674 - {"%{!E:jc1 %i %1 %{!Q:-quiet} %{d*} %{m*} %{a}\
1675 + {"%{!E:jc1 %i %1 %(jc1) %{!Q:-quiet} %{d*} %{m*} %{a}\
1676 %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
1677 %{traditional} %{v:-version} %{pg:-p} %{p}\
1678 %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\
1679 Only in gcc-2.95.2/gcc/java: lang-specs.h.orig
1680 Only in gcc-2.95.2/gcc/java: lang-specs.h.rej
1681 diff -u -r gcc-2.95.2-orig/gcc/java/lang.c gcc-2.95.2/gcc/java/lang.c
1682 --- gcc-2.95.2-orig/gcc/java/lang.c Sat May 15 01:44:09 1999
1683 +++ gcc-2.95.2/gcc/java/lang.c Sat Oct 30 19:45:50 1999
1685 /* When non zero, warns that final local are treated as non final. */
1686 int flag_static_local_jdk1_1 = 0;
1688 +/* When non zero, call a library routine to do integer divisions. */
1689 +int flag_use_divide_subroutine = 1;
1691 /* From gcc/flags.h, and indicates if exceptions are turned on or not. */
1693 extern int flag_new_exceptions;
1695 {"assume-compiled", &flag_assume_compiled, 1},
1696 {"emit-class-file", &flag_emit_class_files, 1},
1697 {"emit-class-files", &flag_emit_class_files, 1},
1698 + {"use-divide-subroutine", &flag_use_divide_subroutine, 1},
1702 Only in gcc-2.95.2/gcc/java: lang.c.orig
1703 diff -u -r gcc-2.95.2-orig/gcc/java/lex.h gcc-2.95.2/gcc/java/lex.h
1704 --- gcc-2.95.2-orig/gcc/java/lex.h Thu May 13 04:52:35 1999
1705 +++ gcc-2.95.2/gcc/java/lex.h Sun Oct 31 18:48:35 1999
1707 #define SET_MODIFIER_CTX(TOKEN) java_lval->value = (TOKEN)
1708 #define GET_TYPE_PRECISION(NODE) 4
1709 #define BUILD_OPERATOR(TOKEN) return TOKEN
1710 -#define BUILD_OPERATOR2(TOKEN) return TOKEN
1711 +#define BUILD_OPERATOR2(TOKEN) return ASSIGN_ANY_TK
1712 #define SET_LVAL_NODE(NODE)
1713 #define SET_LVAL_NODE_TYPE(NODE, TYPE)
1714 #define BUILD_ID_WFL(EXP) (EXP)
1715 diff -u -r gcc-2.95.2-orig/gcc/java/parse-scan.c gcc-2.95.2/gcc/java/parse-scan.c
1716 --- gcc-2.95.2-orig/gcc/java/parse-scan.c Mon Oct 25 21:02:09 1999
1717 +++ gcc-2.95.2/gcc/java/parse-scan.c Sun Oct 31 19:10:26 1999
1720 /* A Bison parser, made from ./parse-scan.y
1721 - by GNU Bison version 1.25
1723 + by GNU Bison version 1.28 */
1725 #define YYBISON 1 /* Identify Bison output. */
1727 -#define PLUS_TK 258
1728 -#define MINUS_TK 259
1729 -#define MULT_TK 260
1738 -#define BOOL_AND_TK 269
1739 -#define BOOL_OR_TK 270
1746 -#define PLUS_ASSIGN_TK 277
1747 -#define MINUS_ASSIGN_TK 278
1748 -#define MULT_ASSIGN_TK 279
1749 -#define DIV_ASSIGN_TK 280
1750 -#define REM_ASSIGN_TK 281
1751 -#define LS_ASSIGN_TK 282
1752 -#define SRS_ASSIGN_TK 283
1753 -#define ZRS_ASSIGN_TK 284
1754 -#define AND_ASSIGN_TK 285
1755 -#define XOR_ASSIGN_TK 286
1756 -#define OR_ASSIGN_TK 287
1757 -#define PUBLIC_TK 288
1758 -#define PRIVATE_TK 289
1759 -#define PROTECTED_TK 290
1760 -#define STATIC_TK 291
1761 -#define FINAL_TK 292
1762 -#define SYNCHRONIZED_TK 293
1763 -#define VOLATILE_TK 294
1764 -#define TRANSIENT_TK 295
1765 -#define NATIVE_TK 296
1767 -#define ABSTRACT_TK 298
1768 -#define MODIFIER_TK 299
1769 -#define DECR_TK 300
1770 -#define INCR_TK 301
1771 -#define DEFAULT_TK 302
1773 -#define THROW_TK 304
1774 -#define BOOLEAN_TK 305
1776 -#define IMPLEMENTS_TK 307
1777 -#define THROWS_TK 308
1778 -#define BREAK_TK 309
1779 -#define IMPORT_TK 310
1780 -#define ELSE_TK 311
1781 -#define INSTANCEOF_TK 312
1782 -#define RETURN_TK 313
1783 -#define VOID_TK 314
1784 -#define CATCH_TK 315
1785 -#define INTERFACE_TK 316
1786 -#define CASE_TK 317
1787 -#define EXTENDS_TK 318
1788 -#define FINALLY_TK 319
1789 -#define SUPER_TK 320
1790 -#define WHILE_TK 321
1791 -#define CLASS_TK 322
1792 -#define SWITCH_TK 323
1793 -#define CONST_TK 324
1797 -#define CONTINUE_TK 328
1798 -#define GOTO_TK 329
1799 -#define PACKAGE_TK 330
1800 -#define THIS_TK 331
1801 -#define BYTE_TK 332
1802 -#define SHORT_TK 333
1804 -#define LONG_TK 335
1805 -#define CHAR_TK 336
1806 -#define INTEGRAL_TK 337
1807 -#define FLOAT_TK 338
1808 -#define DOUBLE_TK 339
1811 -#define REL_QM_TK 342
1812 -#define REL_CL_TK 343
1815 -#define ASSIGN_ANY_TK 346
1816 -#define ASSIGN_TK 347
1826 -#define STRING_LIT_TK 357
1827 -#define CHAR_LIT_TK 358
1828 -#define INT_LIT_TK 359
1829 -#define FP_LIT_TK 360
1830 -#define TRUE_TK 361
1831 -#define FALSE_TK 362
1832 -#define BOOL_LIT_TK 363
1833 -#define NULL_TK 364
1834 +#define PLUS_TK 257
1835 +#define MINUS_TK 258
1836 +#define MULT_TK 259
1845 +#define BOOL_AND_TK 268
1846 +#define BOOL_OR_TK 269
1853 +#define PLUS_ASSIGN_TK 276
1854 +#define MINUS_ASSIGN_TK 277
1855 +#define MULT_ASSIGN_TK 278
1856 +#define DIV_ASSIGN_TK 279
1857 +#define REM_ASSIGN_TK 280
1858 +#define LS_ASSIGN_TK 281
1859 +#define SRS_ASSIGN_TK 282
1860 +#define ZRS_ASSIGN_TK 283
1861 +#define AND_ASSIGN_TK 284
1862 +#define XOR_ASSIGN_TK 285
1863 +#define OR_ASSIGN_TK 286
1864 +#define PUBLIC_TK 287
1865 +#define PRIVATE_TK 288
1866 +#define PROTECTED_TK 289
1867 +#define STATIC_TK 290
1868 +#define FINAL_TK 291
1869 +#define SYNCHRONIZED_TK 292
1870 +#define VOLATILE_TK 293
1871 +#define TRANSIENT_TK 294
1872 +#define NATIVE_TK 295
1874 +#define ABSTRACT_TK 297
1875 +#define MODIFIER_TK 298
1876 +#define DECR_TK 299
1877 +#define INCR_TK 300
1878 +#define DEFAULT_TK 301
1880 +#define THROW_TK 303
1881 +#define BOOLEAN_TK 304
1883 +#define IMPLEMENTS_TK 306
1884 +#define THROWS_TK 307
1885 +#define BREAK_TK 308
1886 +#define IMPORT_TK 309
1887 +#define ELSE_TK 310
1888 +#define INSTANCEOF_TK 311
1889 +#define RETURN_TK 312
1890 +#define VOID_TK 313
1891 +#define CATCH_TK 314
1892 +#define INTERFACE_TK 315
1893 +#define CASE_TK 316
1894 +#define EXTENDS_TK 317
1895 +#define FINALLY_TK 318
1896 +#define SUPER_TK 319
1897 +#define WHILE_TK 320
1898 +#define CLASS_TK 321
1899 +#define SWITCH_TK 322
1900 +#define CONST_TK 323
1904 +#define CONTINUE_TK 327
1905 +#define GOTO_TK 328
1906 +#define PACKAGE_TK 329
1907 +#define THIS_TK 330
1908 +#define BYTE_TK 331
1909 +#define SHORT_TK 332
1911 +#define LONG_TK 334
1912 +#define CHAR_TK 335
1913 +#define INTEGRAL_TK 336
1914 +#define FLOAT_TK 337
1915 +#define DOUBLE_TK 338
1918 +#define REL_QM_TK 341
1919 +#define REL_CL_TK 342
1922 +#define ASSIGN_ANY_TK 345
1923 +#define ASSIGN_TK 346
1933 +#define STRING_LIT_TK 356
1934 +#define CHAR_LIT_TK 357
1935 +#define INT_LIT_TK 358
1936 +#define FP_LIT_TK 359
1937 +#define TRUE_TK 360
1938 +#define FALSE_TK 361
1939 +#define BOOL_LIT_TK 362
1940 +#define NULL_TK 363
1942 #line 37 "./parse-scan.y"
1945 #define YYFLAG -32768
1946 #define YYNTBASE 110
1948 -#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 253)
1949 +#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 253)
1951 static const char yytranslate[] = { 0,
1952 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1953 @@ -228,18 +227,18 @@
1954 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1955 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1956 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1957 - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
1958 - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1959 - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1960 - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1961 - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
1962 - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
1963 - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
1964 - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
1965 - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1966 - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
1967 - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1968 - 106, 107, 108, 109
1969 + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1970 + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1971 + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1972 + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1973 + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1974 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1975 + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1976 + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1977 + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1978 + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1979 + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1984 @@ -1375,7 +1374,8 @@
1987 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1988 -#line 3 "/usr/cygnus/gnupro-98r2/share/bison.simple"
1989 +#line 3 "/usr/lib/bison.simple"
1990 +/* This file comes from bison-1.28. */
1992 /* Skeleton output parser for bison,
1993 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
1994 @@ -1392,46 +1392,66 @@
1996 You should have received a copy of the GNU General Public License
1997 along with this program; if not, write to the Free Software
1998 - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
1999 + Foundation, Inc., 59 Temple Place - Suite 330,
2000 + Boston, MA 02111-1307, USA. */
2002 /* As a special exception, when this file is copied by Bison into a
2003 Bison output file, you may use that output file without restriction.
2004 This special exception was added by the Free Software Foundation
2005 in version 1.24 of Bison. */
2008 +/* This is the parser code that is written into each bison parser
2009 + when the %semantic_parser declaration is not specified in the grammar.
2010 + It was written by Richard Stallman by simplifying the hairy parser
2011 + used when %semantic_parser is specified. */
2013 +#ifndef YYSTACK_USE_ALLOCA
2015 +#define YYSTACK_USE_ALLOCA
2016 +#else /* alloca not defined */
2018 +#define YYSTACK_USE_ALLOCA
2019 #define alloca __builtin_alloca
2020 #else /* not GNU C. */
2021 -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
2022 +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2023 +#define YYSTACK_USE_ALLOCA
2025 #else /* not sparc */
2026 -#if defined (MSDOS) && !defined (__TURBOC__)
2027 +/* We think this test detects Watcom and Microsoft C. */
2028 +/* This used to test MSDOS, but that is a bad idea
2029 + since that symbol is in the user namespace. */
2030 +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2031 +#if 0 /* No need for malloc.h, which pollutes the namespace;
2032 + instead, just don't use alloca. */
2035 #else /* not MSDOS, or __TURBOC__ */
2037 -#include <malloc.h>
2038 +/* I don't know what this was needed for, but it pollutes the namespace.
2039 + So I turned it off. rms, 2 May 1997. */
2040 +/* #include <malloc.h> */
2042 -#else /* not MSDOS, __TURBOC__, or _AIX */
2046 -void *alloca (unsigned int);
2048 -#else /* not __cplusplus */
2050 -#endif /* not __cplusplus */
2051 +#define YYSTACK_USE_ALLOCA
2052 +#else /* not MSDOS, or __TURBOC__, or _AIX */
2054 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2055 + and on HPUX 10. Eventually we can turn this on. */
2056 +#define YYSTACK_USE_ALLOCA
2057 +#define alloca __builtin_alloca
2060 #endif /* not _AIX */
2061 #endif /* not MSDOS, or __TURBOC__ */
2062 -#endif /* not sparc. */
2063 -#endif /* not GNU C. */
2064 -#endif /* alloca not defined. */
2065 +#endif /* not sparc */
2066 +#endif /* not GNU C */
2067 +#endif /* alloca not defined */
2068 +#endif /* YYSTACK_USE_ALLOCA not defined */
2070 -/* This is the parser code that is written into each bison parser
2071 - when the %semantic_parser declaration is not specified in the grammar.
2072 - It was written by Richard Stallman by simplifying the hairy parser
2073 - used when %semantic_parser is specified. */
2074 +#ifdef YYSTACK_USE_ALLOCA
2075 +#define YYSTACK_ALLOC alloca
2077 +#define YYSTACK_ALLOC malloc
2080 /* Note: there must be only one dollar sign in this file.
2081 It is replaced by the list of actions, each action
2082 @@ -1441,8 +1461,8 @@
2083 #define yyclearin (yychar = YYEMPTY)
2086 -#define YYACCEPT return(0)
2087 -#define YYABORT return(1)
2088 +#define YYACCEPT goto yyacceptlab
2089 +#define YYABORT goto yyabortlab
2090 #define YYERROR goto yyerrlab1
2091 /* Like YYERROR except do call yyerror.
2092 This remains here temporarily to ease the
2093 @@ -1523,12 +1543,12 @@
2095 #define YYMAXDEPTH 10000
2098 -/* Prevent warning if -Wstrict-prototypes. */
2100 -int yyparse (void);
2103 +/* Define __yy_memcpy. Note that the size argument
2104 + should be passed with type unsigned int, because that is what the non-GCC
2105 + definitions require. With GCC, __builtin_memcpy takes an arg
2106 + of type size_t, but it can handle unsigned int. */
2108 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2109 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2110 #else /* not GNU C or C++ */
2111 @@ -1540,7 +1560,7 @@
2112 __yy_memcpy (to, from, count)
2116 + unsigned int count;
2118 register char *f = from;
2119 register char *t = to;
2120 @@ -1555,10 +1575,10 @@
2121 /* This is the most reliable way to avoid incompatibilities
2122 in available built-in functions on various systems. */
2124 -__yy_memcpy (char *to, char *from, int count)
2125 +__yy_memcpy (char *to, char *from, unsigned int count)
2127 - register char *f = from;
2128 register char *t = to;
2129 + register char *f = from;
2130 register int i = count;
2133 @@ -1568,7 +1588,7 @@
2137 -#line 196 "/usr/cygnus/gnupro-98r2/share/bison.simple"
2138 +#line 217 "/usr/lib/bison.simple"
2140 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2141 into yyparse. The argument should have type void *.
2142 @@ -1589,6 +1609,15 @@
2143 #define YYPARSE_PARAM_DECL
2144 #endif /* not YYPARSE_PARAM */
2146 +/* Prevent warning if -Wstrict-prototypes. */
2148 +#ifdef YYPARSE_PARAM
2149 +int yyparse (void *);
2151 +int yyparse (void);
2156 yyparse(YYPARSE_PARAM_ARG)
2158 @@ -1617,6 +1646,7 @@
2161 int yystacksize = YYINITDEPTH;
2162 + int yyfree_stacks = 0;
2166 @@ -1701,18 +1731,32 @@
2167 if (yystacksize >= YYMAXDEPTH)
2169 yyerror("parser stack overflow");
2170 + if (yyfree_stacks)
2174 +#ifdef YYLSP_NEEDED
2181 if (yystacksize > YYMAXDEPTH)
2182 yystacksize = YYMAXDEPTH;
2183 - yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
2184 - __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
2185 - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
2186 - __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
2187 +#ifndef YYSTACK_USE_ALLOCA
2188 + yyfree_stacks = 1;
2190 + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2191 + __yy_memcpy ((char *)yyss, (char *)yyss1,
2192 + size * (unsigned int) sizeof (*yyssp));
2193 + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2194 + __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2195 + size * (unsigned int) sizeof (*yyvsp));
2197 - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
2198 - __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
2199 + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2200 + __yy_memcpy ((char *)yyls, (char *)yyls1,
2201 + size * (unsigned int) sizeof (*yylsp));
2203 #endif /* no yyoverflow */
2205 @@ -2156,7 +2200,7 @@
2208 /* the action file gets copied in in place of this dollarsign */
2209 -#line 498 "/usr/cygnus/gnupro-98r2/share/bison.simple"
2210 +#line 543 "/usr/lib/bison.simple"
2214 @@ -2351,6 +2395,30 @@
2220 + /* YYACCEPT comes here. */
2221 + if (yyfree_stacks)
2225 +#ifdef YYLSP_NEEDED
2232 + /* YYABORT comes here. */
2233 + if (yyfree_stacks)
2237 +#ifdef YYLSP_NEEDED
2243 #line 1105 "./parse-scan.y"
2245 @@ -2434,6 +2502,8 @@
2247 char *msg ATTRIBUTE_UNUSED;
2249 + fprintf (stderr, "%s: %d: %s\n", input_filename, lineno, msg);
2254 diff -u -r gcc-2.95.2-orig/gcc/java/parse-scan.y gcc-2.95.2/gcc/java/parse-scan.y
2255 --- gcc-2.95.2-orig/gcc/java/parse-scan.y Tue May 4 04:59:16 1999
2256 +++ gcc-2.95.2/gcc/java/parse-scan.y Sun Oct 31 18:48:35 1999
2257 @@ -1183,6 +1183,8 @@
2259 char *msg ATTRIBUTE_UNUSED;
2261 + fprintf (stderr, "%s: %d: %s\n", input_filename, lineno, msg);
2266 Only in gcc-2.95.2/gcc/java: parse-scan.y.orig
2267 diff -u -r gcc-2.95.2-orig/gcc/java/parse.c gcc-2.95.2/gcc/java/parse.c
2268 --- gcc-2.95.2-orig/gcc/java/parse.c Mon Oct 25 21:02:09 1999
2269 +++ gcc-2.95.2/gcc/java/parse.c Sun Oct 31 21:39:17 1999
2272 /* A Bison parser, made from ./parse.y
2273 - by GNU Bison version 1.27
2275 + by GNU Bison version 1.28 */
2277 #define YYBISON 1 /* Identify Bison output. */
2280 static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...))
2282 static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list));
2283 +static void parse_ctor_invocation_error PROTO ((void));
2284 static tree parse_jdk1_1_error PROTO ((char *));
2285 static void complete_class_report_errors PROTO ((jdep *));
2286 static int process_imports PROTO ((void));
2288 static tree strip_out_static_field_access_decl PROTO ((tree));
2289 static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *));
2290 static void static_ref_err PROTO ((tree, tree, tree));
2291 +static tree java_refold PROTO ((tree));
2293 /* Number of error found so far. */
2294 int java_error_count;
2295 @@ -350,6 +351,10 @@
2296 binop_lookup [((VALUE) - PLUS_TK)% \
2297 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
2299 +/* This is the end index for binary operators that can also be used
2300 + in compound assignements. */
2301 +#define BINOP_COMPOUND_CANDIDATES 11
2303 /* Fake WFL used to report error message. It is initialized once if
2304 needed and reused with it's location information is overriden. */
2305 tree wfl_operator = NULL_TREE;
2307 static tree current_static_block = NULL_TREE;
2310 -#line 304 "./parse.y"
2311 +#line 310 "./parse.y"
2319 -#line 314 "./parse.y"
2320 +#line 320 "./parse.y"
2324 @@ -684,57 +689,57 @@
2327 static const short yyrline[] = { 0,
2328 - 458, 464, 466, 467, 468, 469, 470, 474, 476, 479,
2329 - 481, 482, 485, 487, 490, 494, 498, 502, 508, 510,
2330 - 512, 514, 519, 521, 524, 528, 533, 538, 540, 541,
2331 - 542, 543, 544, 545, 546, 549, 554, 560, 562, 565,
2332 - 568, 570, 574, 576, 579, 606, 608, 612, 625, 627,
2333 - 631, 638, 643, 645, 655, 660, 675, 679, 682, 685,
2334 - 688, 690, 692, 697, 701, 703, 705, 707, 711, 713,
2335 - 715, 722, 728, 733, 737, 746, 756, 758, 761, 763,
2336 - 764, 765, 769, 771, 773, 774, 776, 781, 784, 794,
2337 - 797, 799, 803, 806, 813, 819, 827, 829, 831, 833,
2338 - 835, 839, 841, 845, 852, 853, 857, 860, 862, 864,
2339 - 866, 868, 870, 872, 874, 881, 884, 886, 895, 897,
2340 - 901, 906, 911, 915, 920, 925, 927, 934, 936, 938,
2341 - 942, 945, 947, 951, 953, 954, 959, 965, 972, 980,
2342 - 987, 990, 993, 997, 1000, 1004, 1013, 1015, 1017, 1021,
2343 - 1023, 1026, 1033, 1041, 1043, 1047, 1054, 1064, 1068, 1071,
2344 - 1074, 1077, 1080, 1083, 1086, 1089, 1091, 1095, 1101, 1106,
2345 - 1108, 1112, 1115, 1119, 1121, 1124, 1126, 1127, 1129, 1133,
2346 - 1137, 1143, 1148, 1151, 1153, 1157, 1163, 1167, 1172, 1181,
2347 - 1185, 1190, 1202, 1204, 1207, 1209, 1211, 1215, 1219, 1222,
2348 - 1226, 1228, 1229, 1230, 1231, 1232, 1236, 1238, 1239, 1240,
2349 - 1241, 1245, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254,
2350 - 1255, 1256, 1259, 1264, 1275, 1278, 1282, 1289, 1299, 1305,
2351 - 1311, 1317, 1319, 1325, 1327, 1333, 1335, 1337, 1339, 1341,
2352 - 1345, 1347, 1348, 1349, 1350, 1351, 1352, 1355, 1361, 1363,
2353 - 1365, 1369, 1374, 1379, 1385, 1395, 1401, 1403, 1405, 1412,
2354 - 1415, 1417, 1419, 1423, 1425, 1428, 1432, 1434, 1437, 1444,
2355 - 1450, 1452, 1454, 1458, 1466, 1469, 1471, 1473, 1477, 1482,
2356 - 1491, 1496, 1499, 1506, 1508, 1510, 1514, 1517, 1526, 1533,
2357 - 1535, 1539, 1552, 1554, 1560, 1566, 1570, 1572, 1576, 1579,
2358 - 1581, 1585, 1588, 1590, 1592, 1596, 1599, 1601, 1603, 1607,
2359 - 1610, 1612, 1614, 1618, 1624, 1626, 1630, 1637, 1639, 1641,
2360 - 1643, 1647, 1655, 1658, 1660, 1665, 1669, 1671, 1678, 1686,
2361 - 1703, 1705, 1707, 1711, 1714, 1719, 1721, 1724, 1726, 1728,
2362 - 1730, 1731, 1732, 1733, 1737, 1739, 1741, 1746, 1748, 1750,
2363 - 1752, 1754, 1758, 1761, 1766, 1768, 1773, 1774, 1775, 1776,
2364 - 1777, 1779, 1781, 1783, 1785, 1787, 1791, 1793, 1796, 1802,
2365 - 1807, 1811, 1814, 1816, 1818, 1822, 1824, 1826, 1828, 1832,
2366 - 1835, 1839, 1845, 1847, 1855, 1882, 1884, 1888, 1893, 1900,
2367 - 1904, 1907, 1909, 1920, 1931, 1936, 1945, 1947, 1951, 1954,
2368 - 1956, 1961, 1966, 1971, 1978, 1980, 1981, 1982, 1985, 1990,
2369 - 1995, 1997, 1998, 2000, 2002, 2003, 2005, 2009, 2012, 2016,
2370 - 2019, 2023, 2025, 2027, 2029, 2030, 2032, 2036, 2045, 2047,
2371 - 2049, 2062, 2064, 2070, 2072, 2074, 2078, 2080, 2085, 2090,
2372 - 2095, 2097, 2099, 2103, 2105, 2110, 2115, 2117, 2121, 2123,
2373 - 2128, 2133, 2138, 2140, 2142, 2146, 2148, 2153, 2158, 2163,
2374 - 2168, 2170, 2172, 2174, 2176, 2178, 2182, 2184, 2189, 2194,
2375 - 2196, 2200, 2202, 2207, 2211, 2213, 2218, 2222, 2224, 2229,
2376 - 2233, 2235, 2240, 2244, 2246, 2251, 2255, 2257, 2262, 2268,
2377 - 2270, 2274, 2276, 2279, 2282, 2290, 2292, 2293, 2296, 2298,
2379 + 464, 470, 472, 473, 474, 475, 476, 480, 482, 485,
2380 + 487, 488, 491, 493, 496, 500, 504, 508, 514, 516,
2381 + 518, 520, 525, 527, 530, 534, 539, 544, 546, 547,
2382 + 548, 549, 550, 551, 552, 555, 560, 566, 568, 571,
2383 + 574, 576, 580, 582, 585, 612, 614, 618, 631, 633,
2384 + 637, 644, 649, 651, 661, 666, 681, 685, 688, 691,
2385 + 694, 696, 698, 703, 707, 709, 711, 713, 717, 719,
2386 + 721, 728, 734, 739, 743, 752, 762, 764, 767, 769,
2387 + 770, 771, 775, 777, 779, 780, 782, 787, 790, 800,
2388 + 803, 805, 809, 812, 819, 825, 833, 835, 837, 839,
2389 + 841, 845, 847, 851, 858, 859, 863, 866, 868, 870,
2390 + 872, 874, 876, 878, 880, 887, 890, 892, 901, 903,
2391 + 907, 912, 917, 921, 926, 931, 933, 940, 942, 944,
2392 + 948, 951, 953, 957, 959, 960, 965, 971, 978, 986,
2393 + 993, 996, 999, 1003, 1006, 1010, 1019, 1021, 1023, 1027,
2394 + 1029, 1032, 1039, 1047, 1049, 1053, 1060, 1070, 1074, 1077,
2395 + 1080, 1083, 1086, 1089, 1092, 1095, 1097, 1101, 1107, 1112,
2396 + 1114, 1118, 1121, 1125, 1127, 1130, 1132, 1133, 1135, 1139,
2397 + 1143, 1149, 1154, 1157, 1159, 1163, 1169, 1173, 1178, 1187,
2398 + 1191, 1196, 1208, 1210, 1213, 1215, 1217, 1221, 1225, 1228,
2399 + 1232, 1234, 1235, 1236, 1237, 1238, 1242, 1244, 1245, 1246,
2400 + 1247, 1251, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260,
2401 + 1261, 1262, 1265, 1270, 1281, 1284, 1288, 1295, 1305, 1311,
2402 + 1317, 1323, 1325, 1330, 1332, 1337, 1339, 1341, 1343, 1345,
2403 + 1349, 1351, 1352, 1353, 1354, 1355, 1356, 1359, 1365, 1367,
2404 + 1369, 1373, 1378, 1383, 1389, 1399, 1405, 1407, 1409, 1416,
2405 + 1419, 1421, 1423, 1427, 1429, 1432, 1436, 1438, 1441, 1448,
2406 + 1454, 1456, 1458, 1462, 1470, 1473, 1475, 1477, 1481, 1486,
2407 + 1495, 1500, 1503, 1510, 1512, 1514, 1518, 1521, 1530, 1537,
2408 + 1539, 1543, 1556, 1558, 1564, 1570, 1574, 1576, 1580, 1583,
2409 + 1585, 1589, 1592, 1594, 1596, 1600, 1603, 1605, 1607, 1611,
2410 + 1614, 1616, 1618, 1622, 1628, 1630, 1634, 1641, 1643, 1645,
2411 + 1647, 1651, 1659, 1662, 1664, 1669, 1673, 1675, 1682, 1690,
2412 + 1707, 1709, 1711, 1715, 1718, 1723, 1725, 1728, 1730, 1732,
2413 + 1734, 1735, 1736, 1737, 1741, 1743, 1745, 1750, 1752, 1754,
2414 + 1756, 1758, 1762, 1765, 1770, 1772, 1777, 1778, 1779, 1780,
2415 + 1781, 1783, 1785, 1787, 1789, 1791, 1795, 1797, 1800, 1806,
2416 + 1811, 1815, 1818, 1820, 1822, 1826, 1828, 1830, 1832, 1836,
2417 + 1839, 1843, 1849, 1851, 1859, 1886, 1888, 1892, 1897, 1904,
2418 + 1908, 1911, 1913, 1924, 1935, 1940, 1949, 1951, 1955, 1958,
2419 + 1960, 1965, 1970, 1975, 1982, 1984, 1985, 1986, 1989, 1994,
2420 + 1999, 2001, 2002, 2004, 2006, 2007, 2009, 2013, 2016, 2020,
2421 + 2023, 2027, 2029, 2031, 2033, 2034, 2036, 2040, 2049, 2051,
2422 + 2053, 2066, 2068, 2074, 2076, 2078, 2082, 2084, 2089, 2094,
2423 + 2099, 2101, 2103, 2107, 2109, 2114, 2119, 2121, 2125, 2127,
2424 + 2132, 2137, 2142, 2144, 2146, 2150, 2152, 2157, 2162, 2167,
2425 + 2172, 2174, 2176, 2178, 2180, 2182, 2186, 2188, 2193, 2198,
2426 + 2200, 2204, 2206, 2211, 2215, 2217, 2222, 2226, 2228, 2233,
2427 + 2237, 2239, 2244, 2248, 2250, 2255, 2259, 2261, 2266, 2272,
2428 + 2274, 2278, 2280, 2283, 2286, 2294, 2296, 2297, 2300, 2302,
2433 @@ -2213,7 +2218,7 @@
2435 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2436 #line 3 "/usr/lib/bison.simple"
2437 -/* This file comes from bison-1.27. */
2438 +/* This file comes from bison-1.28. */
2440 /* Skeleton output parser for bison,
2441 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2442 @@ -2426,7 +2431,7 @@
2446 -#line 216 "/usr/lib/bison.simple"
2447 +#line 217 "/usr/lib/bison.simple"
2449 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2450 into yyparse. The argument should have type void *.
2451 @@ -2755,66 +2760,66 @@
2455 -#line 460 "./parse.y"
2456 +#line 466 "./parse.y"
2460 -#line 504 "./parse.y"
2461 +#line 510 "./parse.y"
2463 yyval.node = build_java_array_type (yyvsp[-2].node, -1);
2464 CLASS_LOADED_P (yyval.node) = 1;
2468 -#line 509 "./parse.y"
2469 +#line 515 "./parse.y"
2470 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2473 -#line 511 "./parse.y"
2474 +#line 517 "./parse.y"
2475 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2478 -#line 513 "./parse.y"
2479 +#line 519 "./parse.y"
2480 {RULE ("']' expected"); RECOVER;;
2483 -#line 515 "./parse.y"
2484 +#line 521 "./parse.y"
2485 {RULE ("']' expected"); RECOVER;;
2488 -#line 530 "./parse.y"
2489 +#line 536 "./parse.y"
2490 { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
2493 -#line 539 "./parse.y"
2494 +#line 545 "./parse.y"
2495 {yyval.node = NULL;;
2498 -#line 551 "./parse.y"
2499 +#line 557 "./parse.y"
2505 -#line 555 "./parse.y"
2506 +#line 561 "./parse.y"
2512 -#line 567 "./parse.y"
2513 +#line 573 "./parse.y"
2514 { ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ;
2517 -#line 569 "./parse.y"
2518 +#line 575 "./parse.y"
2519 {yyerror ("Missing name"); RECOVER;;
2522 -#line 571 "./parse.y"
2523 +#line 577 "./parse.y"
2524 {yyerror ("';' expected"); RECOVER;;
2527 -#line 581 "./parse.y"
2528 +#line 587 "./parse.y"
2530 tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name;
2531 int i = IDENTIFIER_LENGTH (name)-1;
2532 @@ -2842,15 +2847,15 @@
2536 -#line 607 "./parse.y"
2537 +#line 613 "./parse.y"
2538 {yyerror ("Missing name"); RECOVER;;
2541 -#line 609 "./parse.y"
2542 +#line 615 "./parse.y"
2543 {yyerror ("';' expected"); RECOVER;;
2546 -#line 614 "./parse.y"
2547 +#line 620 "./parse.y"
2549 tree name = EXPR_WFL_NODE (yyvsp[-3].node);
2550 /* Don't import java.lang.* twice. */
2551 @@ -2864,15 +2869,15 @@
2555 -#line 626 "./parse.y"
2556 +#line 632 "./parse.y"
2557 {yyerror ("'*' expected"); RECOVER;;
2560 -#line 628 "./parse.y"
2561 +#line 634 "./parse.y"
2562 {yyerror ("';' expected"); RECOVER;;
2565 -#line 633 "./parse.y"
2566 +#line 639 "./parse.y"
2568 maybe_generate_finit ();
2569 maybe_generate_clinit ();
2570 @@ -2880,31 +2885,31 @@
2574 -#line 639 "./parse.y"
2575 +#line 645 "./parse.y"
2577 maybe_generate_clinit ();
2578 yyval.node = yyvsp[0].node;
2582 -#line 644 "./parse.y"
2583 +#line 650 "./parse.y"
2584 { yyval.node = NULL; ;
2587 -#line 646 "./parse.y"
2588 +#line 652 "./parse.y"
2591 yyerror ("Class or interface declaration expected");
2595 -#line 657 "./parse.y"
2596 +#line 663 "./parse.y"
2598 yyval.value = (1 << yyvsp[0].value);
2602 -#line 661 "./parse.y"
2603 +#line 667 "./parse.y"
2605 int acc = (1 << yyvsp[0].value);
2606 if (yyval.value & acc)
2607 @@ -2918,95 +2923,95 @@
2611 -#line 677 "./parse.y"
2612 +#line 683 "./parse.y"
2613 { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2616 -#line 679 "./parse.y"
2617 +#line 685 "./parse.y"
2619 yyval.node = yyvsp[0].node;
2623 -#line 683 "./parse.y"
2624 +#line 689 "./parse.y"
2625 { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2628 -#line 685 "./parse.y"
2629 +#line 691 "./parse.y"
2631 yyval.node = yyvsp[0].node;
2635 -#line 689 "./parse.y"
2636 +#line 695 "./parse.y"
2637 {yyerror ("Missing class name"); RECOVER;;
2640 -#line 691 "./parse.y"
2641 +#line 697 "./parse.y"
2642 {yyerror ("Missing class name"); RECOVER;;
2645 -#line 693 "./parse.y"
2646 +#line 699 "./parse.y"
2648 if (!ctxp->class_err) yyerror ("'{' expected");
2653 -#line 698 "./parse.y"
2654 +#line 704 "./parse.y"
2655 {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;;
2658 -#line 702 "./parse.y"
2659 +#line 708 "./parse.y"
2660 { yyval.node = NULL; ;
2663 -#line 704 "./parse.y"
2664 +#line 710 "./parse.y"
2665 { yyval.node = yyvsp[0].node; ;
2668 -#line 706 "./parse.y"
2669 +#line 712 "./parse.y"
2670 {yyerror ("'{' expected"); ctxp->class_err=1;;
2673 -#line 708 "./parse.y"
2674 +#line 714 "./parse.y"
2675 {yyerror ("Missing super class name"); ctxp->class_err=1;;
2678 -#line 712 "./parse.y"
2679 +#line 718 "./parse.y"
2680 { yyval.node = NULL_TREE; ;
2683 -#line 714 "./parse.y"
2684 +#line 720 "./parse.y"
2685 { yyval.node = yyvsp[0].node; ;
2688 -#line 716 "./parse.y"
2689 +#line 722 "./parse.y"
2692 yyerror ("Missing interface name");
2696 -#line 724 "./parse.y"
2697 +#line 730 "./parse.y"
2699 ctxp->interface_number = 1;
2700 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
2704 -#line 729 "./parse.y"
2705 +#line 735 "./parse.y"
2707 ctxp->interface_number++;
2708 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
2712 -#line 734 "./parse.y"
2713 +#line 740 "./parse.y"
2714 {yyerror ("Missing interface name"); RECOVER;;
2717 -#line 739 "./parse.y"
2718 +#line 745 "./parse.y"
2720 /* Store the location of the `}' when doing xrefs */
2722 @@ -3016,7 +3021,7 @@
2726 -#line 747 "./parse.y"
2727 +#line 753 "./parse.y"
2729 /* Store the location of the `}' when doing xrefs */
2731 @@ -3026,27 +3031,27 @@
2735 -#line 766 "./parse.y"
2736 +#line 772 "./parse.y"
2737 { yyval.node = parse_jdk1_1_error ("instance initializer"); ;
2740 -#line 772 "./parse.y"
2741 +#line 778 "./parse.y"
2742 { yyval.node = yyvsp[-1].node; ;
2745 -#line 775 "./parse.y"
2746 +#line 781 "./parse.y"
2747 { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ;
2750 -#line 777 "./parse.y"
2751 +#line 783 "./parse.y"
2752 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
2755 -#line 783 "./parse.y"
2756 +#line 789 "./parse.y"
2757 { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ;
2760 -#line 785 "./parse.y"
2761 +#line 791 "./parse.y"
2764 ("Illegal modifier `%s' for field declaration",
2765 @@ -3056,19 +3061,19 @@
2769 -#line 798 "./parse.y"
2770 +#line 804 "./parse.y"
2771 { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ;
2774 -#line 800 "./parse.y"
2775 +#line 806 "./parse.y"
2776 {yyerror ("Missing term"); RECOVER;;
2779 -#line 805 "./parse.y"
2780 +#line 811 "./parse.y"
2781 { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ;
2784 -#line 807 "./parse.y"
2785 +#line 813 "./parse.y"
2787 if (java_error_count)
2788 yyvsp[0].node = NULL_TREE;
2789 @@ -3077,7 +3082,7 @@
2793 -#line 814 "./parse.y"
2794 +#line 820 "./parse.y"
2796 yyerror ("Missing variable initializer");
2797 yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
2798 @@ -3085,7 +3090,7 @@
2802 -#line 820 "./parse.y"
2803 +#line 826 "./parse.y"
2805 yyerror ("';' expected");
2806 yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
2807 @@ -3093,85 +3098,85 @@
2811 -#line 830 "./parse.y"
2812 +#line 836 "./parse.y"
2813 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2816 -#line 832 "./parse.y"
2817 +#line 838 "./parse.y"
2818 {yyerror ("Invalid declaration"); DRECOVER(vdi);;
2821 -#line 834 "./parse.y"
2822 +#line 840 "./parse.y"
2823 {yyerror ("']' expected"); DRECOVER(vdi);;
2826 -#line 836 "./parse.y"
2827 +#line 842 "./parse.y"
2828 {yyerror ("Unbalanced ']'"); DRECOVER(vdi);;
2831 -#line 847 "./parse.y"
2832 +#line 853 "./parse.y"
2834 current_function_decl = yyvsp[0].node;
2835 source_start_java_method (current_function_decl);
2839 -#line 852 "./parse.y"
2840 +#line 858 "./parse.y"
2841 { finish_method_declaration (yyvsp[0].node); ;
2844 -#line 854 "./parse.y"
2845 +#line 860 "./parse.y"
2846 {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;
2849 -#line 859 "./parse.y"
2850 +#line 865 "./parse.y"
2851 { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2854 -#line 861 "./parse.y"
2855 +#line 867 "./parse.y"
2856 { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
2859 -#line 863 "./parse.y"
2860 +#line 869 "./parse.y"
2861 { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2864 -#line 865 "./parse.y"
2865 +#line 871 "./parse.y"
2866 { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
2869 -#line 867 "./parse.y"
2870 +#line 873 "./parse.y"
2874 -#line 869 "./parse.y"
2875 +#line 875 "./parse.y"
2879 -#line 871 "./parse.y"
2880 +#line 877 "./parse.y"
2881 {yyerror ("Identifier expected"); RECOVER;;
2884 -#line 873 "./parse.y"
2885 +#line 879 "./parse.y"
2886 {yyerror ("Identifier expected"); RECOVER;;
2889 -#line 875 "./parse.y"
2890 +#line 881 "./parse.y"
2892 yyerror ("Invalid method declaration, return type required");
2897 -#line 883 "./parse.y"
2898 +#line 889 "./parse.y"
2899 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
2902 -#line 885 "./parse.y"
2903 +#line 891 "./parse.y"
2904 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
2907 -#line 887 "./parse.y"
2908 +#line 893 "./parse.y"
2910 EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location;
2911 TREE_PURPOSE (yyvsp[-2].node) =
2912 @@ -3182,150 +3187,150 @@
2916 -#line 896 "./parse.y"
2917 +#line 902 "./parse.y"
2918 {yyerror ("')' expected"); DRECOVER(method_declarator);;
2921 -#line 898 "./parse.y"
2922 +#line 904 "./parse.y"
2923 {yyerror ("']' expected"); RECOVER;;
2926 -#line 903 "./parse.y"
2927 +#line 909 "./parse.y"
2929 ctxp->formal_parameter_number = 1;
2933 -#line 907 "./parse.y"
2934 +#line 913 "./parse.y"
2936 ctxp->formal_parameter_number += 1;
2937 yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
2941 -#line 912 "./parse.y"
2942 +#line 918 "./parse.y"
2943 {yyerror ("Missing formal parameter term"); RECOVER;;
2946 -#line 917 "./parse.y"
2947 +#line 923 "./parse.y"
2949 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
2953 -#line 921 "./parse.y"
2954 +#line 927 "./parse.y"
2956 parse_jdk1_1_error ("final parameters");
2957 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
2961 -#line 926 "./parse.y"
2962 +#line 932 "./parse.y"
2963 {yyerror ("Missing identifier"); RECOVER;;
2966 -#line 928 "./parse.y"
2967 +#line 934 "./parse.y"
2969 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value));
2970 yyerror ("Missing identifier"); RECOVER;
2974 -#line 935 "./parse.y"
2975 +#line 941 "./parse.y"
2976 { yyval.node = NULL_TREE; ;
2979 -#line 937 "./parse.y"
2980 +#line 943 "./parse.y"
2981 { yyval.node = yyvsp[0].node; ;
2984 -#line 939 "./parse.y"
2985 +#line 945 "./parse.y"
2986 {yyerror ("Missing class type term"); RECOVER;;
2989 -#line 944 "./parse.y"
2990 +#line 950 "./parse.y"
2991 { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ;
2994 -#line 946 "./parse.y"
2995 +#line 952 "./parse.y"
2996 { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ;
2999 -#line 948 "./parse.y"
3000 +#line 954 "./parse.y"
3001 {yyerror ("Missing class type term"); RECOVER;;
3004 -#line 955 "./parse.y"
3005 +#line 961 "./parse.y"
3006 { yyval.node = NULL_TREE; ;
3009 -#line 961 "./parse.y"
3010 +#line 967 "./parse.y"
3012 TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized;
3013 ctxp->static_initialized = yyvsp[0].node;
3017 -#line 966 "./parse.y"
3018 +#line 972 "./parse.y"
3020 TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized;
3021 ctxp->static_initialized = yyvsp[-1].node;
3025 -#line 974 "./parse.y"
3026 +#line 980 "./parse.y"
3028 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
3032 -#line 982 "./parse.y"
3033 +#line 988 "./parse.y"
3035 current_function_decl = yyvsp[0].node;
3036 source_start_java_method (current_function_decl);
3040 -#line 987 "./parse.y"
3041 +#line 993 "./parse.y"
3042 { finish_method_declaration (yyvsp[0].node); ;
3045 -#line 992 "./parse.y"
3046 +#line 998 "./parse.y"
3047 { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3050 -#line 994 "./parse.y"
3051 +#line 1000 "./parse.y"
3052 { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3055 -#line 999 "./parse.y"
3056 +#line 1005 "./parse.y"
3057 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3060 -#line 1001 "./parse.y"
3061 +#line 1007 "./parse.y"
3062 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3065 -#line 1009 "./parse.y"
3066 +#line 1015 "./parse.y"
3068 BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node;
3069 yyval.node = yyvsp[0].node;
3073 -#line 1014 "./parse.y"
3074 +#line 1020 "./parse.y"
3075 { yyval.node = yyvsp[0].node; ;
3078 -#line 1016 "./parse.y"
3079 +#line 1022 "./parse.y"
3080 { yyval.node = yyvsp[0].node; ;
3083 -#line 1018 "./parse.y"
3084 +#line 1024 "./parse.y"
3085 { yyval.node = yyvsp[0].node; ;
3088 -#line 1028 "./parse.y"
3089 +#line 1034 "./parse.y"
3091 yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE);
3092 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node);
3093 @@ -3333,7 +3338,7 @@
3097 -#line 1034 "./parse.y"
3098 +#line 1040 "./parse.y"
3100 yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node);
3101 yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node);
3102 @@ -3341,15 +3346,15 @@
3106 -#line 1042 "./parse.y"
3107 +#line 1048 "./parse.y"
3108 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3111 -#line 1044 "./parse.y"
3112 +#line 1050 "./parse.y"
3113 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3116 -#line 1049 "./parse.y"
3117 +#line 1055 "./parse.y"
3119 tree wfl = build_wfl_node (this_identifier_node);
3120 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3121 @@ -3357,7 +3362,7 @@
3125 -#line 1055 "./parse.y"
3126 +#line 1061 "./parse.y"
3128 tree wfl = build_wfl_node (super_identifier_node);
3129 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3130 @@ -3365,133 +3370,133 @@
3134 -#line 1066 "./parse.y"
3135 +#line 1072 "./parse.y"
3136 { create_interface (0, yyvsp[0].node, NULL_TREE); ;
3139 -#line 1068 "./parse.y"
3140 +#line 1074 "./parse.y"
3142 yyval.node = yyvsp[0].node;
3146 -#line 1072 "./parse.y"
3147 +#line 1078 "./parse.y"
3148 { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ;
3151 -#line 1074 "./parse.y"
3152 +#line 1080 "./parse.y"
3154 yyval.node = yyvsp[0].node;
3158 -#line 1078 "./parse.y"
3159 +#line 1084 "./parse.y"
3160 { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ;
3163 -#line 1080 "./parse.y"
3164 +#line 1086 "./parse.y"
3166 yyval.node = yyvsp[0].node;
3170 -#line 1084 "./parse.y"
3171 +#line 1090 "./parse.y"
3172 { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ;
3175 -#line 1086 "./parse.y"
3176 +#line 1092 "./parse.y"
3178 yyval.node = yyvsp[0].node;
3182 -#line 1090 "./parse.y"
3183 +#line 1096 "./parse.y"
3184 {yyerror ("'{' expected"); RECOVER;;
3187 -#line 1092 "./parse.y"
3188 +#line 1098 "./parse.y"
3189 {yyerror ("'{' expected"); RECOVER;;
3192 -#line 1097 "./parse.y"
3193 +#line 1103 "./parse.y"
3195 ctxp->interface_number = 1;
3196 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3200 -#line 1102 "./parse.y"
3201 +#line 1108 "./parse.y"
3203 ctxp->interface_number++;
3204 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3208 -#line 1107 "./parse.y"
3209 +#line 1113 "./parse.y"
3210 {yyerror ("Invalid interface type"); RECOVER;;
3213 -#line 1109 "./parse.y"
3214 +#line 1115 "./parse.y"
3215 {yyerror ("Missing term"); RECOVER;;
3218 -#line 1114 "./parse.y"
3219 +#line 1120 "./parse.y"
3220 { yyval.node = NULL_TREE; ;
3223 -#line 1116 "./parse.y"
3224 +#line 1122 "./parse.y"
3225 { yyval.node = NULL_TREE; ;
3228 -#line 1128 "./parse.y"
3229 +#line 1134 "./parse.y"
3230 { yyval.node = parse_jdk1_1_error ("inner class declaration"); ;
3233 -#line 1130 "./parse.y"
3234 +#line 1136 "./parse.y"
3235 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
3238 -#line 1139 "./parse.y"
3239 +#line 1145 "./parse.y"
3241 check_abstract_method_header (yyvsp[-1].node);
3242 current_function_decl = NULL_TREE; /* FIXME ? */
3246 -#line 1144 "./parse.y"
3247 +#line 1150 "./parse.y"
3248 {yyerror ("';' expected"); RECOVER;;
3251 -#line 1150 "./parse.y"
3252 +#line 1156 "./parse.y"
3253 { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ;
3256 -#line 1152 "./parse.y"
3257 +#line 1158 "./parse.y"
3258 { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3261 -#line 1154 "./parse.y"
3262 +#line 1160 "./parse.y"
3263 { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ;
3266 -#line 1159 "./parse.y"
3267 +#line 1165 "./parse.y"
3269 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node),
3270 yyvsp[0].node, NULL_TREE);
3274 -#line 1164 "./parse.y"
3275 +#line 1170 "./parse.y"
3277 yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node);
3281 -#line 1168 "./parse.y"
3282 +#line 1174 "./parse.y"
3283 {yyerror ("Missing term"); RECOVER;;
3286 -#line 1174 "./parse.y"
3287 +#line 1180 "./parse.y"
3289 /* Store the location of the `}' when doing xrefs */
3290 if (current_function_decl && flag_emit_xref)
3291 @@ -3501,15 +3506,15 @@
3295 -#line 1182 "./parse.y"
3296 +#line 1188 "./parse.y"
3297 { yyval.node = yyvsp[0].node; ;
3300 -#line 1187 "./parse.y"
3301 +#line 1193 "./parse.y"
3305 -#line 1192 "./parse.y"
3306 +#line 1198 "./parse.y"
3308 maybe_absorb_scoping_blocks ();
3309 /* Store the location of the `}' when doing xrefs */
3310 @@ -3520,35 +3525,35 @@
3314 -#line 1210 "./parse.y"
3315 +#line 1216 "./parse.y"
3316 { java_method_add_stmt (current_function_decl, yyvsp[0].node); ;
3319 -#line 1212 "./parse.y"
3320 +#line 1218 "./parse.y"
3321 { parse_jdk1_1_error ("inner class declaration"); ;
3324 -#line 1221 "./parse.y"
3325 +#line 1227 "./parse.y"
3326 { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ;
3329 -#line 1223 "./parse.y"
3330 +#line 1229 "./parse.y"
3331 { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ;
3334 -#line 1233 "./parse.y"
3335 +#line 1239 "./parse.y"
3336 { yyval.node = exit_block (); ;
3339 -#line 1242 "./parse.y"
3340 +#line 1248 "./parse.y"
3341 { yyval.node = exit_block (); ;
3344 -#line 1261 "./parse.y"
3345 +#line 1267 "./parse.y"
3346 { yyval.node = empty_stmt_node; ;
3349 -#line 1266 "./parse.y"
3350 +#line 1272 "./parse.y"
3352 yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node),
3353 EXPR_WFL_NODE (yyvsp[-1].node));
3354 @@ -3558,19 +3563,19 @@
3358 -#line 1277 "./parse.y"
3359 +#line 1283 "./parse.y"
3360 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3363 -#line 1279 "./parse.y"
3364 +#line 1285 "./parse.y"
3365 {yyerror ("':' expected"); RECOVER;;
3368 -#line 1284 "./parse.y"
3369 +#line 1290 "./parse.y"
3370 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3373 -#line 1291 "./parse.y"
3374 +#line 1297 "./parse.y"
3376 /* We have a statement. Generate a WFL around it so
3378 @@ -3581,7 +3586,7 @@
3382 -#line 1300 "./parse.y"
3383 +#line 1306 "./parse.y"
3385 if (ctxp->prevent_ese != lineno)
3386 yyerror ("Invalid expression statement");
3387 @@ -3589,7 +3594,7 @@
3391 -#line 1306 "./parse.y"
3392 +#line 1312 "./parse.y"
3394 if (ctxp->prevent_ese != lineno)
3395 yyerror ("Invalid expression statement");
3396 @@ -3597,7 +3602,7 @@
3400 -#line 1312 "./parse.y"
3401 +#line 1318 "./parse.y"
3403 if (ctxp->prevent_ese != lineno)
3404 yyerror ("Invalid expression statement");
3405 @@ -3605,84 +3610,82 @@
3409 -#line 1318 "./parse.y"
3410 +#line 1324 "./parse.y"
3411 {yyerror ("')' expected"); RECOVER;;
3414 -#line 1320 "./parse.y"
3415 +#line 1326 "./parse.y"
3417 - yyerror ("Constructor invocation must be first "
3418 - "thing in a constructor");
3419 + parse_ctor_invocation_error ();
3424 -#line 1326 "./parse.y"
3425 +#line 1331 "./parse.y"
3426 {yyerror ("')' expected"); RECOVER;;
3429 -#line 1328 "./parse.y"
3430 +#line 1333 "./parse.y"
3432 - yyerror ("Constructor invocation must be first "
3433 - "thing in a constructor");
3434 + parse_ctor_invocation_error ();
3439 -#line 1334 "./parse.y"
3440 +#line 1338 "./parse.y"
3441 {yyerror ("'(' expected"); RECOVER;;
3444 -#line 1336 "./parse.y"
3445 +#line 1340 "./parse.y"
3446 {yyerror ("')' expected"); RECOVER;;
3449 -#line 1338 "./parse.y"
3450 +#line 1342 "./parse.y"
3451 {yyerror ("')' expected"); RECOVER;;
3454 -#line 1340 "./parse.y"
3455 +#line 1344 "./parse.y"
3456 {yyerror ("';' expected"); RECOVER;;
3459 -#line 1342 "./parse.y"
3460 +#line 1346 "./parse.y"
3461 {yyerror ("';' expected"); RECOVER;;
3464 -#line 1357 "./parse.y"
3465 +#line 1361 "./parse.y"
3467 yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node,
3468 yyvsp[0].node, NULL_TREE);
3472 -#line 1362 "./parse.y"
3473 +#line 1366 "./parse.y"
3474 {yyerror ("'(' expected"); RECOVER;;
3477 -#line 1364 "./parse.y"
3478 +#line 1368 "./parse.y"
3479 {yyerror ("Missing term"); RECOVER;;
3482 -#line 1366 "./parse.y"
3483 +#line 1370 "./parse.y"
3484 {yyerror ("')' expected"); RECOVER;;
3487 -#line 1371 "./parse.y"
3488 +#line 1375 "./parse.y"
3489 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3492 -#line 1376 "./parse.y"
3493 +#line 1380 "./parse.y"
3494 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3497 -#line 1381 "./parse.y"
3498 +#line 1385 "./parse.y"
3504 -#line 1385 "./parse.y"
3505 +#line 1389 "./parse.y"
3507 /* Make into "proper list" of COMPOUND_EXPRs.
3508 I.e. make the last statment also have its own
3509 @@ -3693,42 +3696,42 @@
3513 -#line 1397 "./parse.y"
3514 +#line 1401 "./parse.y"
3516 yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE);
3517 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3521 -#line 1402 "./parse.y"
3522 +#line 1406 "./parse.y"
3523 {yyerror ("'(' expected"); RECOVER;;
3526 -#line 1404 "./parse.y"
3527 +#line 1408 "./parse.y"
3528 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;
3531 -#line 1406 "./parse.y"
3532 +#line 1410 "./parse.y"
3533 {yyerror ("'{' expected"); RECOVER;;
3536 -#line 1414 "./parse.y"
3537 +#line 1418 "./parse.y"
3538 { yyval.node = NULL_TREE; ;
3541 -#line 1416 "./parse.y"
3542 +#line 1420 "./parse.y"
3543 { yyval.node = NULL_TREE; ;
3546 -#line 1418 "./parse.y"
3547 +#line 1422 "./parse.y"
3548 { yyval.node = NULL_TREE; ;
3551 -#line 1420 "./parse.y"
3552 +#line 1424 "./parse.y"
3553 { yyval.node = NULL_TREE; ;
3556 -#line 1439 "./parse.y"
3557 +#line 1443 "./parse.y"
3559 tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node);
3560 EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location;
3561 @@ -3736,7 +3739,7 @@
3565 -#line 1445 "./parse.y"
3566 +#line 1449 "./parse.y"
3568 tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
3569 EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location;
3570 @@ -3744,61 +3747,61 @@
3574 -#line 1451 "./parse.y"
3575 +#line 1455 "./parse.y"
3576 {yyerror ("Missing or invalid constant expression"); RECOVER;;
3579 -#line 1453 "./parse.y"
3580 +#line 1457 "./parse.y"
3581 {yyerror ("':' expected"); RECOVER;;
3584 -#line 1455 "./parse.y"
3585 +#line 1459 "./parse.y"
3586 {yyerror ("':' expected"); RECOVER;;
3589 -#line 1460 "./parse.y"
3590 +#line 1464 "./parse.y"
3592 tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
3593 yyval.node = build_new_loop (body);
3597 -#line 1468 "./parse.y"
3598 +#line 1472 "./parse.y"
3599 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3602 -#line 1470 "./parse.y"
3603 +#line 1474 "./parse.y"
3604 {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;
3607 -#line 1472 "./parse.y"
3608 +#line 1476 "./parse.y"
3609 {yyerror ("Missing term and ')' expected"); RECOVER;;
3612 -#line 1474 "./parse.y"
3613 +#line 1478 "./parse.y"
3614 {yyerror ("')' expected"); RECOVER;;
3617 -#line 1479 "./parse.y"
3618 +#line 1483 "./parse.y"
3619 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3622 -#line 1484 "./parse.y"
3623 +#line 1488 "./parse.y"
3625 tree body = build_loop_body (0, NULL_TREE, 1);
3626 yyval.node = build_new_loop (body);
3630 -#line 1493 "./parse.y"
3631 +#line 1497 "./parse.y"
3632 { yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ;
3635 -#line 1498 "./parse.y"
3636 +#line 1502 "./parse.y"
3637 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3640 -#line 1500 "./parse.y"
3641 +#line 1504 "./parse.y"
3643 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3644 /* We have not condition, so we get rid of the EXIT_EXPR */
3645 @@ -3807,23 +3810,23 @@
3649 -#line 1507 "./parse.y"
3650 +#line 1511 "./parse.y"
3651 {yyerror ("Invalid control expression"); RECOVER;;
3654 -#line 1509 "./parse.y"
3655 +#line 1513 "./parse.y"
3656 {yyerror ("Invalid update expression"); RECOVER;;
3659 -#line 1511 "./parse.y"
3660 +#line 1515 "./parse.y"
3661 {yyerror ("Invalid update expression"); RECOVER;;
3664 -#line 1516 "./parse.y"
3665 +#line 1520 "./parse.y"
3666 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
3669 -#line 1518 "./parse.y"
3670 +#line 1522 "./parse.y"
3672 yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3673 /* We have not condition, so we get rid of the EXIT_EXPR */
3674 @@ -3832,7 +3835,7 @@
3678 -#line 1528 "./parse.y"
3679 +#line 1532 "./parse.y"
3681 /* This scope defined for local variable that may be
3682 defined within the scope of the for loop */
3683 @@ -3840,15 +3843,15 @@
3687 -#line 1534 "./parse.y"
3688 +#line 1538 "./parse.y"
3689 {yyerror ("'(' expected"); DRECOVER(for_1);;
3692 -#line 1536 "./parse.y"
3693 +#line 1540 "./parse.y"
3694 {yyerror ("Invalid init statement"); RECOVER;;
3697 -#line 1541 "./parse.y"
3698 +#line 1545 "./parse.y"
3700 /* We now declare the loop body. The loop is
3701 declared as a for loop. */
3702 @@ -3861,11 +3864,11 @@
3706 -#line 1553 "./parse.y"
3707 +#line 1557 "./parse.y"
3708 { yyval.node = empty_stmt_node; ;
3711 -#line 1555 "./parse.y"
3712 +#line 1559 "./parse.y"
3714 /* Init statement recorded within the previously
3715 defined block scope */
3716 @@ -3873,7 +3876,7 @@
3720 -#line 1561 "./parse.y"
3721 +#line 1565 "./parse.y"
3723 /* Local variable are recorded within the previously
3724 defined block scope */
3725 @@ -3881,94 +3884,94 @@
3729 -#line 1567 "./parse.y"
3730 +#line 1571 "./parse.y"
3731 {yyerror ("';' expected"); DRECOVER(for_init_1);;
3734 -#line 1571 "./parse.y"
3735 +#line 1575 "./parse.y"
3736 {yyval.node = empty_stmt_node;;
3739 -#line 1573 "./parse.y"
3740 +#line 1577 "./parse.y"
3741 { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ;
3744 -#line 1578 "./parse.y"
3745 +#line 1582 "./parse.y"
3746 { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ;
3749 -#line 1580 "./parse.y"
3750 +#line 1584 "./parse.y"
3751 { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ;
3754 -#line 1582 "./parse.y"
3755 +#line 1586 "./parse.y"
3756 {yyerror ("Missing term"); RECOVER;;
3759 -#line 1587 "./parse.y"
3760 +#line 1591 "./parse.y"
3761 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ;
3764 -#line 1589 "./parse.y"
3765 +#line 1593 "./parse.y"
3766 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ;
3769 -#line 1591 "./parse.y"
3770 +#line 1595 "./parse.y"
3771 {yyerror ("Missing term"); RECOVER;;
3774 -#line 1593 "./parse.y"
3775 +#line 1597 "./parse.y"
3776 {yyerror ("';' expected"); RECOVER;;
3779 -#line 1598 "./parse.y"
3780 +#line 1602 "./parse.y"
3781 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ;
3784 -#line 1600 "./parse.y"
3785 +#line 1604 "./parse.y"
3786 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ;
3789 -#line 1602 "./parse.y"
3790 +#line 1606 "./parse.y"
3791 {yyerror ("Missing term"); RECOVER;;
3794 -#line 1604 "./parse.y"
3795 +#line 1608 "./parse.y"
3796 {yyerror ("';' expected"); RECOVER;;
3799 -#line 1609 "./parse.y"
3800 +#line 1613 "./parse.y"
3801 { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ;
3804 -#line 1611 "./parse.y"
3805 +#line 1615 "./parse.y"
3806 { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3809 -#line 1613 "./parse.y"
3810 +#line 1617 "./parse.y"
3811 {yyerror ("Missing term"); RECOVER;;
3814 -#line 1615 "./parse.y"
3815 +#line 1619 "./parse.y"
3816 {yyerror ("';' expected"); RECOVER;;
3819 -#line 1620 "./parse.y"
3820 +#line 1624 "./parse.y"
3822 yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node);
3823 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3827 -#line 1625 "./parse.y"
3828 +#line 1629 "./parse.y"
3829 {yyerror ("Missing term"); RECOVER;;
3832 -#line 1627 "./parse.y"
3833 +#line 1631 "./parse.y"
3834 {yyerror ("';' expected"); RECOVER;;
3837 -#line 1632 "./parse.y"
3838 +#line 1636 "./parse.y"
3840 yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3841 EXPR_WFL_LINECOL (yyval.node) =
3842 @@ -3976,56 +3979,56 @@
3846 -#line 1638 "./parse.y"
3847 +#line 1642 "./parse.y"
3848 {yyerror ("'{' expected"); RECOVER;;
3851 -#line 1640 "./parse.y"
3852 +#line 1644 "./parse.y"
3853 {yyerror ("'(' expected"); RECOVER;;
3856 -#line 1642 "./parse.y"
3857 +#line 1646 "./parse.y"
3858 {yyerror ("Missing term"); RECOVER;;
3861 -#line 1644 "./parse.y"
3862 +#line 1648 "./parse.y"
3863 {yyerror ("Missing term"); RECOVER;;
3866 -#line 1649 "./parse.y"
3867 +#line 1653 "./parse.y"
3869 if ((1 << yyvsp[0].value) != ACC_SYNCHRONIZED)
3870 fatal ("synchronized was '%d' - yyparse", (1 << yyvsp[0].value));
3874 -#line 1657 "./parse.y"
3875 +#line 1661 "./parse.y"
3876 { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
3879 -#line 1659 "./parse.y"
3880 +#line 1663 "./parse.y"
3881 { yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
3884 -#line 1661 "./parse.y"
3885 +#line 1665 "./parse.y"
3886 { yyval.node = build_try_finally_statement
3887 (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location,
3888 yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node);
3892 -#line 1666 "./parse.y"
3893 +#line 1670 "./parse.y"
3894 {yyerror ("'{' expected"); DRECOVER (try_statement);;
3897 -#line 1672 "./parse.y"
3898 +#line 1676 "./parse.y"
3900 TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node;
3901 yyval.node = yyvsp[0].node;
3905 -#line 1680 "./parse.y"
3906 +#line 1684 "./parse.y"
3908 java_method_add_stmt (current_function_decl, yyvsp[0].node);
3910 @@ -4033,7 +4036,7 @@
3914 -#line 1688 "./parse.y"
3915 +#line 1692 "./parse.y"
3917 /* We add a block to define a scope for
3918 formal_parameter (CCBP). The formal parameter is
3919 @@ -4051,176 +4054,176 @@
3923 -#line 1704 "./parse.y"
3924 +#line 1708 "./parse.y"
3925 {yyerror ("'(' expected"); RECOVER;;
3928 -#line 1706 "./parse.y"
3929 +#line 1710 "./parse.y"
3930 {yyerror ("Missing term or ')' expected"); DRECOVER (2);;
3933 -#line 1708 "./parse.y"
3934 +#line 1712 "./parse.y"
3935 {yyerror ("')' expected"); DRECOVER (1);;
3938 -#line 1713 "./parse.y"
3939 +#line 1717 "./parse.y"
3940 { yyval.node = yyvsp[0].node; ;
3943 -#line 1715 "./parse.y"
3944 +#line 1719 "./parse.y"
3945 {yyerror ("'{' expected"); RECOVER; ;
3948 -#line 1727 "./parse.y"
3949 +#line 1731 "./parse.y"
3950 { yyval.node = build_this (yyvsp[0].operator.location); ;
3953 -#line 1729 "./parse.y"
3954 +#line 1733 "./parse.y"
3955 {yyval.node = yyvsp[-1].node;;
3958 -#line 1738 "./parse.y"
3959 +#line 1742 "./parse.y"
3960 { yyval.node = parse_jdk1_1_error ("named class literals"); ;
3963 -#line 1740 "./parse.y"
3964 +#line 1744 "./parse.y"
3965 { yyval.node = build_class_ref (yyvsp[-2].node); ;
3968 -#line 1742 "./parse.y"
3969 +#line 1746 "./parse.y"
3970 { yyval.node = build_class_ref (void_type_node); ;
3973 -#line 1747 "./parse.y"
3974 +#line 1751 "./parse.y"
3975 { yyval.node = parse_jdk1_1_error ("class literals"); ;
3978 -#line 1749 "./parse.y"
3979 +#line 1753 "./parse.y"
3980 {yyerror ("')' expected"); RECOVER;;
3983 -#line 1751 "./parse.y"
3984 +#line 1755 "./parse.y"
3985 {yyerror ("'class' or 'this' expected" ); RECOVER;;
3988 -#line 1753 "./parse.y"
3989 +#line 1757 "./parse.y"
3990 {yyerror ("'class' expected" ); RECOVER;;
3993 -#line 1755 "./parse.y"
3994 +#line 1759 "./parse.y"
3995 {yyerror ("'class' expected" ); RECOVER;;
3998 -#line 1760 "./parse.y"
3999 +#line 1764 "./parse.y"
4000 { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4003 -#line 1762 "./parse.y"
4004 +#line 1766 "./parse.y"
4005 { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ;
4008 -#line 1767 "./parse.y"
4009 +#line 1771 "./parse.y"
4010 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4013 -#line 1769 "./parse.y"
4014 +#line 1773 "./parse.y"
4015 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4018 -#line 1778 "./parse.y"
4019 +#line 1782 "./parse.y"
4020 {yyerror ("'(' expected"); DRECOVER(new_1);;
4023 -#line 1780 "./parse.y"
4024 +#line 1784 "./parse.y"
4025 {yyerror ("'(' expected"); RECOVER;;
4028 -#line 1782 "./parse.y"
4029 +#line 1786 "./parse.y"
4030 {yyerror ("')' or term expected"); RECOVER;;
4033 -#line 1784 "./parse.y"
4034 +#line 1788 "./parse.y"
4035 {yyerror ("')' expected"); RECOVER;;
4038 -#line 1786 "./parse.y"
4039 +#line 1790 "./parse.y"
4040 {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;;
4043 -#line 1788 "./parse.y"
4044 +#line 1792 "./parse.y"
4045 {yyerror ("'(' expected"); RECOVER;;
4048 -#line 1798 "./parse.y"
4049 +#line 1802 "./parse.y"
4051 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
4052 ctxp->formal_parameter_number = 1;
4056 -#line 1803 "./parse.y"
4057 +#line 1807 "./parse.y"
4059 ctxp->formal_parameter_number += 1;
4060 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
4064 -#line 1808 "./parse.y"
4065 +#line 1812 "./parse.y"
4066 {yyerror ("Missing term"); RECOVER;;
4069 -#line 1813 "./parse.y"
4070 +#line 1817 "./parse.y"
4071 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4074 -#line 1815 "./parse.y"
4075 +#line 1819 "./parse.y"
4076 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4079 -#line 1817 "./parse.y"
4080 +#line 1821 "./parse.y"
4081 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4084 -#line 1819 "./parse.y"
4085 +#line 1823 "./parse.y"
4086 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4089 -#line 1823 "./parse.y"
4090 +#line 1827 "./parse.y"
4091 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4094 -#line 1825 "./parse.y"
4095 +#line 1829 "./parse.y"
4096 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4099 -#line 1827 "./parse.y"
4100 +#line 1831 "./parse.y"
4101 {yyerror ("'[' expected"); DRECOVER ("]");;
4104 -#line 1829 "./parse.y"
4105 +#line 1833 "./parse.y"
4106 {yyerror ("']' expected"); RECOVER;;
4109 -#line 1834 "./parse.y"
4110 +#line 1838 "./parse.y"
4111 { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ;
4114 -#line 1836 "./parse.y"
4115 +#line 1840 "./parse.y"
4116 { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ;
4119 -#line 1841 "./parse.y"
4120 +#line 1845 "./parse.y"
4122 EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
4123 yyval.node = yyvsp[-1].node;
4127 -#line 1846 "./parse.y"
4128 +#line 1850 "./parse.y"
4129 {yyerror ("']' expected"); RECOVER;;
4132 -#line 1848 "./parse.y"
4133 +#line 1852 "./parse.y"
4135 yyerror ("Missing term");
4136 yyerror ("']' expected");
4137 @@ -4228,7 +4231,7 @@
4141 -#line 1857 "./parse.y"
4142 +#line 1861 "./parse.y"
4145 /* If not initialized, allocate memory for the osb
4146 @@ -4256,19 +4259,19 @@
4150 -#line 1883 "./parse.y"
4151 +#line 1887 "./parse.y"
4152 { CURRENT_OSB (ctxp)++; ;
4155 -#line 1885 "./parse.y"
4156 +#line 1889 "./parse.y"
4157 { yyerror ("']' expected"); RECOVER;;
4160 -#line 1890 "./parse.y"
4161 +#line 1894 "./parse.y"
4162 { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
4165 -#line 1894 "./parse.y"
4166 +#line 1898 "./parse.y"
4169 build_wfl_node (super_identifier_node);
4170 @@ -4277,19 +4280,19 @@
4174 -#line 1901 "./parse.y"
4175 +#line 1905 "./parse.y"
4176 {yyerror ("Field expected"); DRECOVER (super_field_acces);;
4179 -#line 1906 "./parse.y"
4180 +#line 1910 "./parse.y"
4181 { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ;
4184 -#line 1908 "./parse.y"
4185 +#line 1912 "./parse.y"
4186 { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4189 -#line 1910 "./parse.y"
4190 +#line 1914 "./parse.y"
4192 if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR)
4193 yyval.node = build_this_super_qualified_invocation
4194 @@ -4302,7 +4305,7 @@
4198 -#line 1921 "./parse.y"
4199 +#line 1925 "./parse.y"
4201 if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR)
4202 yyval.node = build_this_super_qualified_invocation
4203 @@ -4315,121 +4318,121 @@
4207 -#line 1932 "./parse.y"
4208 +#line 1936 "./parse.y"
4210 yyval.node = build_this_super_qualified_invocation
4211 (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location);
4215 -#line 1937 "./parse.y"
4216 +#line 1941 "./parse.y"
4218 yyval.node = build_this_super_qualified_invocation
4219 (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location);
4223 -#line 1946 "./parse.y"
4224 +#line 1950 "./parse.y"
4225 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4228 -#line 1948 "./parse.y"
4229 +#line 1952 "./parse.y"
4230 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4233 -#line 1953 "./parse.y"
4234 +#line 1957 "./parse.y"
4235 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4238 -#line 1955 "./parse.y"
4239 +#line 1959 "./parse.y"
4240 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4243 -#line 1957 "./parse.y"
4244 +#line 1961 "./parse.y"
4246 yyerror ("Missing term and ']' expected");
4247 DRECOVER(array_access);
4251 -#line 1962 "./parse.y"
4252 +#line 1966 "./parse.y"
4254 yyerror ("']' expected");
4255 DRECOVER(array_access);
4259 -#line 1967 "./parse.y"
4260 +#line 1971 "./parse.y"
4262 yyerror ("Missing term and ']' expected");
4263 DRECOVER(array_access);
4267 -#line 1972 "./parse.y"
4268 +#line 1976 "./parse.y"
4270 yyerror ("']' expected");
4271 DRECOVER(array_access);
4275 -#line 1987 "./parse.y"
4276 +#line 1991 "./parse.y"
4277 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4280 -#line 1992 "./parse.y"
4281 +#line 1996 "./parse.y"
4282 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4285 -#line 1999 "./parse.y"
4286 +#line 2003 "./parse.y"
4287 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4290 -#line 2001 "./parse.y"
4291 +#line 2005 "./parse.y"
4292 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4295 -#line 2004 "./parse.y"
4296 +#line 2008 "./parse.y"
4297 {yyerror ("Missing term"); RECOVER;
4300 -#line 2006 "./parse.y"
4301 +#line 2010 "./parse.y"
4302 {yyerror ("Missing term"); RECOVER;
4305 -#line 2011 "./parse.y"
4306 +#line 2015 "./parse.y"
4307 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4310 -#line 2013 "./parse.y"
4311 +#line 2017 "./parse.y"
4312 {yyerror ("Missing term"); RECOVER;
4315 -#line 2018 "./parse.y"
4316 +#line 2022 "./parse.y"
4317 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4320 -#line 2020 "./parse.y"
4321 +#line 2024 "./parse.y"
4322 {yyerror ("Missing term"); RECOVER;
4325 -#line 2026 "./parse.y"
4326 +#line 2030 "./parse.y"
4327 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4330 -#line 2028 "./parse.y"
4331 +#line 2032 "./parse.y"
4332 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4335 -#line 2031 "./parse.y"
4336 +#line 2035 "./parse.y"
4337 {yyerror ("Missing term"); RECOVER;
4340 -#line 2033 "./parse.y"
4341 +#line 2037 "./parse.y"
4342 {yyerror ("Missing term"); RECOVER;
4345 -#line 2038 "./parse.y"
4346 +#line 2042 "./parse.y"
4348 tree type = yyvsp[-3].node;
4349 while (CURRENT_OSB (ctxp)--)
4350 @@ -4439,15 +4442,15 @@
4354 -#line 2046 "./parse.y"
4355 +#line 2050 "./parse.y"
4356 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4359 -#line 2048 "./parse.y"
4360 +#line 2052 "./parse.y"
4361 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4364 -#line 2050 "./parse.y"
4365 +#line 2054 "./parse.y"
4368 while (CURRENT_OSB (ctxp)--)
4369 @@ -4462,11 +4465,11 @@
4373 -#line 2063 "./parse.y"
4374 +#line 2067 "./parse.y"
4375 {yyerror ("']' expected, invalid type expression");;
4378 -#line 2065 "./parse.y"
4379 +#line 2069 "./parse.y"
4381 if (ctxp->prevent_ese != lineno)
4382 yyerror ("Invalid type expression"); RECOVER;
4383 @@ -4474,243 +4477,243 @@
4387 -#line 2071 "./parse.y"
4388 +#line 2075 "./parse.y"
4389 {yyerror ("Missing term"); RECOVER;;
4392 -#line 2073 "./parse.y"
4393 +#line 2077 "./parse.y"
4394 {yyerror ("Missing term"); RECOVER;;
4397 -#line 2075 "./parse.y"
4398 +#line 2079 "./parse.y"
4399 {yyerror ("Missing term"); RECOVER;;
4402 -#line 2081 "./parse.y"
4403 +#line 2085 "./parse.y"
4405 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token),
4406 yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
4410 -#line 2086 "./parse.y"
4411 +#line 2090 "./parse.y"
4413 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4414 yyvsp[-2].node, yyvsp[0].node);
4418 -#line 2091 "./parse.y"
4419 +#line 2095 "./parse.y"
4421 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4422 yyvsp[-2].node, yyvsp[0].node);
4426 -#line 2096 "./parse.y"
4427 +#line 2100 "./parse.y"
4428 {yyerror ("Missing term"); RECOVER;;
4431 -#line 2098 "./parse.y"
4432 +#line 2102 "./parse.y"
4433 {yyerror ("Missing term"); RECOVER;;
4436 -#line 2100 "./parse.y"
4437 +#line 2104 "./parse.y"
4438 {yyerror ("Missing term"); RECOVER;;
4441 -#line 2106 "./parse.y"
4442 +#line 2110 "./parse.y"
4444 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4445 yyvsp[-2].node, yyvsp[0].node);
4449 -#line 2111 "./parse.y"
4450 +#line 2115 "./parse.y"
4452 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4453 yyvsp[-2].node, yyvsp[0].node);
4457 -#line 2116 "./parse.y"
4458 +#line 2120 "./parse.y"
4459 {yyerror ("Missing term"); RECOVER;;
4462 -#line 2118 "./parse.y"
4463 +#line 2122 "./parse.y"
4464 {yyerror ("Missing term"); RECOVER;;
4467 -#line 2124 "./parse.y"
4468 +#line 2128 "./parse.y"
4470 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4471 yyvsp[-2].node, yyvsp[0].node);
4475 -#line 2129 "./parse.y"
4476 +#line 2133 "./parse.y"
4478 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4479 yyvsp[-2].node, yyvsp[0].node);
4483 -#line 2134 "./parse.y"
4484 +#line 2138 "./parse.y"
4486 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4487 yyvsp[-2].node, yyvsp[0].node);
4491 -#line 2139 "./parse.y"
4492 +#line 2143 "./parse.y"
4493 {yyerror ("Missing term"); RECOVER;;
4496 -#line 2141 "./parse.y"
4497 +#line 2145 "./parse.y"
4498 {yyerror ("Missing term"); RECOVER;;
4501 -#line 2143 "./parse.y"
4502 +#line 2147 "./parse.y"
4503 {yyerror ("Missing term"); RECOVER;;
4506 -#line 2149 "./parse.y"
4507 +#line 2153 "./parse.y"
4509 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4510 yyvsp[-2].node, yyvsp[0].node);
4514 -#line 2154 "./parse.y"
4515 +#line 2158 "./parse.y"
4517 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4518 yyvsp[-2].node, yyvsp[0].node);
4522 -#line 2159 "./parse.y"
4523 +#line 2163 "./parse.y"
4525 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4526 yyvsp[-2].node, yyvsp[0].node);
4530 -#line 2164 "./parse.y"
4531 +#line 2168 "./parse.y"
4533 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4534 yyvsp[-2].node, yyvsp[0].node);
4538 -#line 2169 "./parse.y"
4539 +#line 2173 "./parse.y"
4540 { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4543 -#line 2171 "./parse.y"
4544 +#line 2175 "./parse.y"
4545 {yyerror ("Missing term"); RECOVER;;
4548 -#line 2173 "./parse.y"
4549 +#line 2177 "./parse.y"
4550 {yyerror ("Missing term"); RECOVER;;
4553 -#line 2175 "./parse.y"
4554 +#line 2179 "./parse.y"
4555 {yyerror ("Missing term"); RECOVER;;
4558 -#line 2177 "./parse.y"
4559 +#line 2181 "./parse.y"
4560 {yyerror ("Missing term"); RECOVER;;
4563 -#line 2179 "./parse.y"
4564 +#line 2183 "./parse.y"
4565 {yyerror ("Invalid reference type"); RECOVER;;
4568 -#line 2185 "./parse.y"
4569 +#line 2189 "./parse.y"
4571 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4572 yyvsp[-2].node, yyvsp[0].node);
4576 -#line 2190 "./parse.y"
4577 +#line 2194 "./parse.y"
4579 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4580 yyvsp[-2].node, yyvsp[0].node);
4584 -#line 2195 "./parse.y"
4585 +#line 2199 "./parse.y"
4586 {yyerror ("Missing term"); RECOVER;;
4589 -#line 2197 "./parse.y"
4590 +#line 2201 "./parse.y"
4591 {yyerror ("Missing term"); RECOVER;;
4594 -#line 2203 "./parse.y"
4595 +#line 2207 "./parse.y"
4597 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4598 yyvsp[-2].node, yyvsp[0].node);
4602 -#line 2208 "./parse.y"
4603 +#line 2212 "./parse.y"
4604 {yyerror ("Missing term"); RECOVER;;
4607 -#line 2214 "./parse.y"
4608 +#line 2218 "./parse.y"
4610 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4611 yyvsp[-2].node, yyvsp[0].node);
4615 -#line 2219 "./parse.y"
4616 +#line 2223 "./parse.y"
4617 {yyerror ("Missing term"); RECOVER;;
4620 -#line 2225 "./parse.y"
4621 +#line 2229 "./parse.y"
4623 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4624 yyvsp[-2].node, yyvsp[0].node);
4628 -#line 2230 "./parse.y"
4629 +#line 2234 "./parse.y"
4630 {yyerror ("Missing term"); RECOVER;;
4633 -#line 2236 "./parse.y"
4634 +#line 2240 "./parse.y"
4636 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4637 yyvsp[-2].node, yyvsp[0].node);
4641 -#line 2241 "./parse.y"
4642 +#line 2245 "./parse.y"
4643 {yyerror ("Missing term"); RECOVER;;
4646 -#line 2247 "./parse.y"
4647 +#line 2251 "./parse.y"
4649 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4650 yyvsp[-2].node, yyvsp[0].node);
4654 -#line 2252 "./parse.y"
4655 +#line 2256 "./parse.y"
4656 {yyerror ("Missing term"); RECOVER;;
4659 -#line 2258 "./parse.y"
4660 +#line 2262 "./parse.y"
4662 yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
4663 EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4667 -#line 2263 "./parse.y"
4668 +#line 2267 "./parse.y"
4671 yyerror ("Missing term");
4672 @@ -4718,19 +4721,19 @@
4676 -#line 2269 "./parse.y"
4677 +#line 2273 "./parse.y"
4678 {yyerror ("Missing term"); DRECOVER (2);;
4681 -#line 2271 "./parse.y"
4682 +#line 2275 "./parse.y"
4683 {yyerror ("Missing term"); DRECOVER (3);;
4686 -#line 2281 "./parse.y"
4687 +#line 2285 "./parse.y"
4688 { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4691 -#line 2283 "./parse.y"
4692 +#line 2287 "./parse.y"
4694 if (ctxp->prevent_ese != lineno)
4695 yyerror ("Missing term");
4696 @@ -4739,7 +4742,7 @@
4699 /* the action file gets copied in in place of this dollarsign */
4700 -#line 542 "/usr/lib/bison.simple"
4701 +#line 543 "/usr/lib/bison.simple"
4705 @@ -4959,7 +4962,7 @@
4709 -#line 2309 "./parse.y"
4710 +#line 2313 "./parse.y"
4714 @@ -5063,7 +5066,17 @@
4718 -/* Reporting JDK1.1 features not implemented */
4719 +/* Reporting an constructor invocation error. */
4721 +parse_ctor_invocation_error ()
4723 + if (DECL_CONSTRUCTOR_P (current_function_decl))
4724 + yyerror ("Constructor invocation must be first thing in a constructor");
4726 + yyerror ("Only constructors can invoke constructors");
4729 +/* Reporting JDK1.1 features not implemented. */
4732 parse_jdk1_1_error (msg)
4733 @@ -5972,13 +5985,18 @@
4735 tree meth = TREE_VALUE (mdecl);
4736 tree id = TREE_PURPOSE (mdecl);
4737 - tree this_class = TREE_TYPE (ctxp->current_parsed_class);
4738 tree type_wfl = NULL_TREE;
4739 - tree meth_name = NULL_TREE, current, orig_arg;
4740 + tree meth_name = NULL_TREE;
4741 + tree current, orig_arg, this_class;
4743 int constructor_ok = 0, must_chain;
4745 check_modifiers_consistency (flags);
4747 + if (ctxp->current_parsed_class)
4748 + this_class = TREE_TYPE (ctxp->current_parsed_class);
4752 /* There are some forbidden modifiers for an abstract method and its
4753 class must be abstract as well. */
4754 @@ -6174,7 +6192,12 @@
4755 finish_method_declaration (method_body)
4758 - int flags = get_access_flags_from_decl (current_function_decl);
4761 + if (!current_function_decl)
4764 + flags = get_access_flags_from_decl (current_function_decl);
4766 /* 8.4.5 Method Body */
4767 if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
4768 @@ -6989,7 +7012,9 @@
4770 /* Resolve and layout if necessary */
4771 layout_class_methods (TREE_TYPE (decl));
4772 - if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))
4773 + /* Check methods, but only once */
4774 + if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl))
4775 + && !CLASS_LOADED_P (TREE_TYPE (decl)))
4776 CHECK_METHODS (decl);
4777 if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
4778 safe_layout_class (TREE_TYPE (decl));
4779 @@ -7170,7 +7195,7 @@
4781 /* Track method being redefined inside the same class. As a side
4782 effect, set DECL_NAME to an IDENTIFIER (prior entering this
4783 - function it's a FWL, so we can track errors more accurately */
4784 + function it's a FWL, so we can track errors more accurately.) */
4787 check_method_redefinition (class, method)
4788 @@ -7206,9 +7231,126 @@
4792 -/* Check all the methods of CLASS. Methods are first completed then
4793 - checked according to regular method existance rules.
4794 - If no constructor were encountered, then build its declaration. */
4796 +check_abstract_method_definitions (do_interface, class_decl, type)
4798 + tree class_decl, type;
4800 + tree class = TREE_TYPE (class_decl);
4801 + tree method, end_type;
4803 + end_type = (do_interface ? object_type_node : type);
4804 + for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
4806 + tree other_super, other_method, method_sig, method_name;
4809 + if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
4812 + /* Now verify that somewhere in between TYPE and CLASS,
4813 + abstract method METHOD gets a non abstract definition
4814 + that is inherited by CLASS. */
4816 + method_sig = build_java_signature (TREE_TYPE (method));
4817 + method_name = DECL_NAME (method);
4818 + if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
4819 + method_name = EXPR_WFL_NODE (method_name);
4821 + for (other_super = class; other_super != end_type;
4822 + other_super = CLASSTYPE_SUPER (other_super))
4824 + for (other_method = TYPE_METHODS (other_super); other_method;
4825 + other_method = TREE_CHAIN (other_method))
4827 + tree s = build_java_signature (TREE_TYPE (other_method));
4828 + tree other_name = DECL_NAME (other_method);
4830 + if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
4831 + other_name = EXPR_WFL_NODE (other_name);
4832 + if (!IS_CLINIT (other_method)
4833 + && !DECL_CONSTRUCTOR_P (other_method)
4834 + && method_name == other_name && method_sig == s)
4842 + /* Report that abstract METHOD didn't find an implementation
4843 + that CLASS can use. */
4846 + char *t = strdup (lang_printable_name
4847 + (TREE_TYPE (TREE_TYPE (method)), 0));
4848 + tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
4849 + tree saved_wfl = NULL_TREE;
4851 + if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION)
4853 + saved_wfl = DECL_NAME (method);
4854 + DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method));
4857 + parse_error_context
4858 + (lookup_cl (class_decl),
4859 + "Class `%s' doesn't define the abstract method `%s %s' from "
4860 + "%s `%s'. This method must be defined or %s `%s' must be "
4861 + "declared abstract",
4862 + IDENTIFIER_POINTER (DECL_NAME (class_decl)),
4863 + t, lang_printable_name (method, 0),
4864 + (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
4865 + "interface" : "class"),
4866 + IDENTIFIER_POINTER (ccn),
4867 + (CLASS_INTERFACE (class_decl) ? "interface" : "class"),
4868 + IDENTIFIER_POINTER (DECL_NAME (class_decl)));
4873 + DECL_NAME (method) = saved_wfl;
4878 +/* Check that CLASS_DECL somehoow implements all inherited abstract
4882 +java_check_abstract_method_definitions (class_decl)
4885 + tree class = TREE_TYPE (class_decl);
4886 + tree super, vector;
4889 + if (CLASS_ABSTRACT (class_decl))
4892 + /* Check for inherited types */
4893 + for (super = CLASSTYPE_SUPER (class); super != object_type_node;
4894 + super = CLASSTYPE_SUPER (super))
4896 + if (!CLASS_ABSTRACT (TYPE_NAME (super)))
4899 + check_abstract_method_definitions (0, class_decl, super);
4902 + /* Check for implemented interfaces. */
4903 + vector = TYPE_BINFO_BASETYPES (class);
4904 + for (i = 1; i < TREE_VEC_LENGTH (vector); i++)
4906 + super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
4907 + check_abstract_method_definitions (1, class_decl, super);
4911 +/* Check all the methods of CLASS_DECL. Methods are first completed
4912 + then checked according to regular method existance rules. If no
4913 + constructor for CLASS_DECL were encountered, then build its
4917 java_check_regular_methods (class_decl)
4918 @@ -7384,7 +7526,7 @@
4920 /* Don't forget eventual pending found and saved_found_wfl. Take
4921 into account that we might have exited because we saw an
4922 - aritifical method as the last entry. */
4923 + artificial method as the last entry. */
4925 if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
4926 DECL_NAME (found) = saved_found_wfl;
4927 @@ -7392,6 +7534,10 @@
4928 if (!TYPE_NVIRTUALS (class))
4929 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
4931 + /* Search for inherited abstract method not yet implemented in this
4933 + java_check_abstract_method_definitions (class_decl);
4935 if (!saw_constructor)
4937 /* No constructor seen, we craft one, at line 0. Since this
4938 @@ -7597,14 +7743,15 @@
4942 -/* Return the line that matches DECL line number. Used during error
4944 +/* Return the line that matches DECL line number, and try its best to
4945 + position the column number. Used during error reports. */
4951 static tree cl = NULL_TREE;
4952 + char *line, *found;
4956 @@ -7615,6 +7762,14 @@
4957 EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
4958 EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
4960 + line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)),
4961 + EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl));
4963 + found = strstr ((const char *)line,
4964 + (const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
4966 + EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line);
4971 @@ -8149,6 +8304,9 @@
4978 current_function_decl = fndecl;
4980 /* New scope for the function */
4981 @@ -8268,6 +8426,9 @@
4982 tree fndecl = current_function_decl;
4983 int flag_asynchronous_exceptions = asynchronous_exceptions;
4988 java_parser_context_save_global ();
4989 lineno = ctxp->last_ccb_indent1;
4991 @@ -8323,6 +8484,8 @@
4992 java_method_add_stmt (fndecl, expr)
4995 + if (!GET_CURRENT_BLOCK (fndecl))
4997 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
5000 @@ -8721,7 +8884,8 @@
5001 for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
5003 if (DECL_CONSTRUCTOR_P (mdecl)
5004 - && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node)
5005 + && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl)))
5006 + == end_params_node)
5010 @@ -9064,6 +9228,8 @@
5011 == soft_initclass_node)
5012 return TREE_OPERAND (op1, 1);
5014 + else if (JDECL_P (op1))
5019 @@ -9085,6 +9251,8 @@
5020 for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
5022 tree qual_wfl = QUAL_WFL (q);
5023 + tree ret_decl; /* for EH checking */
5024 + int location; /* for EH checking */
5026 /* 15.10.1 Field Access Using a Primary */
5027 switch (TREE_CODE (qual_wfl))
5028 @@ -9103,14 +9271,21 @@
5029 /* And code for the function call */
5030 if (complete_function_arguments (qual_wfl))
5033 if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
5034 CALL_USING_SUPER (qual_wfl) = 1;
5036 - patch_method_invocation (qual_wfl, decl, type, &is_static, NULL);
5037 + location = (TREE_CODE (qual_wfl) == CALL_EXPR ?
5038 + EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0);
5039 + *where_found = patch_method_invocation (qual_wfl, decl, type,
5040 + &is_static, &ret_decl);
5041 if (*where_found == error_mark_node)
5043 *type_found = type = QUAL_DECL_TYPE (*where_found);
5047 + check_thrown_exceptions (location, ret_decl);
5049 /* If the previous call was static and this one is too,
5050 build a compound expression to hold the two (because in
5051 that case, previous function calls aren't transported as
5052 @@ -9145,6 +9320,7 @@
5054 case CONDITIONAL_EXPR:
5057 *where_found = decl = java_complete_tree (qual_wfl);
5058 if (decl == error_mark_node)
5060 @@ -9882,6 +10058,11 @@
5061 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
5062 TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
5063 TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
5065 + /* Resolve unresolved returned type isses */
5066 + t = TREE_TYPE (TREE_TYPE (method));
5067 + if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t)))
5068 + resolve_and_layout (TREE_TYPE (t), NULL);
5070 if (flag_emit_class_files || flag_emit_xref)
5072 @@ -10042,7 +10223,7 @@
5073 parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s",
5074 (lc ? "constructor" : "method"),
5076 - IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) :
5077 + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))) :
5078 IDENTIFIER_POINTER (name)),
5079 IDENTIFIER_POINTER (signature),
5080 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
5081 @@ -10061,7 +10242,8 @@
5082 tree list = NULL_TREE, all_list = NULL_TREE;
5084 /* Search interfaces */
5085 - if (CLASS_INTERFACE (TYPE_NAME (class)))
5086 + if (CLASS_INTERFACE (TYPE_NAME (class))
5087 + || CLASS_ABSTRACT (TYPE_NAME (class)))
5089 static tree searched_interfaces = NULL_TREE;
5090 static int search_not_done = 0;
5091 @@ -10292,7 +10474,7 @@
5093 case NEW_ARRAY_EXPR:
5094 qual = TREE_CHAIN (qual);
5095 - new_array_found = 1;
5096 + again = new_array_found = 1;
5098 case NEW_CLASS_EXPR:
5100 @@ -10320,12 +10502,8 @@
5101 && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
5102 name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
5104 - else if (code == ARRAY_REF &&
5105 - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
5106 - name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
5108 - else if (code == CALL_EXPR &&
5109 - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
5110 + else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) &&
5111 + TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
5112 name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
5114 else if (code == STRING_CST || code == CONDITIONAL_EXPR)
5115 @@ -10335,8 +10513,15 @@
5119 - name = EXPR_WFL_NODE (qual_wfl);
5122 + name = EXPR_WFL_NODE (qual_wfl);
5125 + qual = EXPR_WFL_QUALIFICATION (qual_wfl);
5130 /* If we have a THIS (from a primary), we set the context accordingly */
5131 if (name == this_identifier_node)
5133 @@ -10370,7 +10555,8 @@
5134 declaration or parameter declaration, then it is an expression
5135 name. We don't carry this test out if we're in the context of the
5136 use of SUPER or THIS */
5137 - if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
5138 + if (!this_found && !super_found &&
5139 + TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name)))
5141 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
5142 QUAL_RESOLUTION (qual) = decl;
5143 @@ -10387,15 +10573,17 @@
5144 QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
5147 - /* We reclassify NAME as a type name if:
5148 + /* We reclassify NAME as yielding to a type name resolution if:
5149 - NAME is a class/interface declared within the compilation
5150 unit containing NAME,
5151 - NAME is imported via a single-type-import declaration,
5152 - NAME is declared in an another compilation unit of the package
5153 of the compilation unit containing NAME,
5154 - NAME is declared by exactly on type-import-on-demand declaration
5155 - of the compilation unit containing NAME. */
5156 - else if ((decl = resolve_and_layout (name, NULL_TREE)))
5157 + of the compilation unit containing NAME.
5158 + - NAME is actually a STRING_CST. */
5159 + else if (TREE_CODE (name) == STRING_CST ||
5160 + (decl = resolve_and_layout (name, NULL_TREE)))
5162 RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
5163 QUAL_RESOLUTION (qual) = decl;
5164 @@ -10480,7 +10668,9 @@
5166 tree value = DECL_INITIAL (node);
5167 DECL_INITIAL (node) = NULL_TREE;
5168 + push_obstacks (&permanent_obstack, &permanent_obstack);
5169 value = fold_constant_for_init (value, node);
5171 DECL_INITIAL (node) = value;
5172 if (value != NULL_TREE)
5174 @@ -10500,8 +10690,7 @@
5175 TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
5179 - return stabilize_reference (node);
5180 + return stabilize_reference (node);
5183 /* Patch tree nodes in a function body. When a BLOCK is found, push
5184 @@ -10683,8 +10872,12 @@
5185 && JDECL_P (TREE_OPERAND (cn, 1))
5186 && FIELD_FINAL (TREE_OPERAND (cn, 1))
5187 && DECL_INITIAL (TREE_OPERAND (cn, 1)))
5188 - cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
5189 - TREE_OPERAND (cn, 1));
5191 + push_obstacks (&permanent_obstack, &permanent_obstack);
5192 + cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
5193 + TREE_OPERAND (cn, 1));
5197 if (!TREE_CONSTANT (cn) && !flag_emit_xref)
5199 @@ -10937,7 +11130,11 @@
5200 && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
5201 && DECL_INITIAL (nn) != NULL_TREE)
5203 - tree value = fold_constant_for_init (nn, nn);
5206 + push_obstacks (&permanent_obstack, &permanent_obstack);
5207 + value = fold_constant_for_init (nn, nn);
5209 if (value != NULL_TREE)
5211 tree type = TREE_TYPE (value);
5212 @@ -10951,14 +11148,17 @@
5213 if (TREE_OPERAND (node, 0) == error_mark_node)
5214 return error_mark_node;
5216 - if (COMPOUND_ASSIGN_P (wfl_op2))
5217 + flag = COMPOUND_ASSIGN_P (wfl_op2);
5220 tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
5222 /* Hand stablize the lhs on both places */
5223 TREE_OPERAND (node, 0) = lvalue;
5224 - TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue;
5225 + TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
5226 + (flag_emit_class_files ? lvalue : save_expr (lvalue));
5228 + /* 15.25.2.a: Left hand is not an array access. FIXME */
5229 /* Now complete the RHS. We write it back later on. */
5230 nn = java_complete_tree (TREE_OPERAND (node, 1));
5232 @@ -10969,6 +11169,8 @@
5233 E1 = (T)(E1 op E2), with T being the type of E1. */
5234 nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
5235 TREE_TYPE (lvalue), nn));
5237 + /* 15.25.2.b: Left hand is an array access. FIXME */
5240 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
5241 @@ -10992,6 +11194,10 @@
5242 if ((nn = patch_string (TREE_OPERAND (node, 1))))
5243 TREE_OPERAND (node, 1) = nn;
5244 node = patch_assignment (node, wfl_op1, wfl_op2);
5245 + /* Reorganize the tree if necessary. */
5246 + if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
5247 + || JSTRING_P (TREE_TYPE (node))))
5248 + node = java_refold (node);
5249 CAN_COMPLETE_NORMALLY (node) = 1;
5252 @@ -12000,6 +12206,81 @@
5253 #undef BUILD_OPERATOR_STRING
5256 +/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
5259 +java_decl_equiv (var_acc1, var_acc2)
5260 + tree var_acc1, var_acc2;
5262 + if (JDECL_P (var_acc1))
5263 + return (var_acc1 == var_acc2);
5265 + return (TREE_CODE (var_acc1) == COMPONENT_REF
5266 + && TREE_CODE (var_acc2) == COMPONENT_REF
5267 + && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
5268 + == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0)
5269 + && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1));
5272 +/* Return a non zero value if CODE is one of the operators that can be
5273 + used in conjunction with the `=' operator in a compound assignment. */
5276 +binop_compound_p (code)
5277 + enum tree_code code;
5280 + for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++)
5281 + if (binop_lookup [i] == code)
5284 + return i < BINOP_COMPOUND_CANDIDATES;
5287 +/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
5293 + tree c, b, ns, decl;
5295 + if (TREE_CODE (t) != MODIFY_EXPR)
5298 + c = TREE_OPERAND (t, 1);
5299 + if (! (c && TREE_CODE (c) == COMPOUND_EXPR
5300 + && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR
5301 + && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1)))))
5304 + /* Now the left branch of the binary operator. */
5305 + b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
5306 + if (! (b && TREE_CODE (b) == NOP_EXPR
5307 + && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
5310 + ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0);
5311 + if (! (ns && TREE_CODE (ns) == NOP_EXPR
5312 + && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR))
5315 + decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0);
5316 + if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF)
5317 + /* It's got to be the an equivalent decl */
5318 + && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0)))
5320 + /* Shorten the NOP_EXPR/SAVE_EXPR path. */
5321 + TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0);
5322 + /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
5323 + TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1);
5324 + /* Change the right part of the BINOP_EXPR */
5325 + TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0);
5331 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
5332 errors but we modify NODE so that it contains the type computed
5333 according to the expression, when it's fixed. Otherwise, we write
5334 @@ -12046,6 +12327,12 @@
5335 if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
5336 TREE_SET_CODE (node, TRUNC_DIV_EXPR);
5338 + if (TREE_CODE (prom_type) == INTEGER_TYPE
5339 + && flag_use_divide_subroutine
5340 + && ! flag_emit_class_files
5341 + && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
5342 + return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
5344 /* This one is more complicated. FLOATs are processed by a
5345 function call to soft_fmod. Duplicate the value of the
5346 COMPOUND_ASSIGN_P flag. */
5347 @@ -12658,7 +12945,7 @@
5348 case PREINCREMENT_EXPR:
5349 /* 15.14.2 Prefix Decrement Operator -- */
5350 case PREDECREMENT_EXPR:
5351 - decl = strip_out_static_field_access_decl (op);
5352 + op = decl = strip_out_static_field_access_decl (op);
5353 /* We really should have a JAVA_ARRAY_EXPR to avoid this */
5355 && TREE_CODE (decl) != COMPONENT_REF
5356 @@ -12697,15 +12984,28 @@
5359 /* Before the addition, binary numeric promotion is performed on
5361 - value = build_int_2 (1, 0);
5362 - TREE_TYPE (node) =
5363 - binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value);
5364 - /* And write the promoted incremented and increment */
5365 + both operands, if really necessary */
5366 + if (JINTEGRAL_TYPE_P (op_type))
5368 + value = build_int_2 (1, 0);
5369 + TREE_TYPE (value) = TREE_TYPE (node) = op_type;
5373 + value = build_int_2 (1, 0);
5374 + TREE_TYPE (node) =
5375 + binary_numeric_promotion (op_type,
5376 + TREE_TYPE (value), &op, &value);
5378 + /* And write back into the node. */
5379 TREE_OPERAND (node, 0) = op;
5380 TREE_OPERAND (node, 1) = value;
5381 - /* Convert the overall back into its original type. */
5382 - return fold (convert (op_type, node));
5383 + /* Convert the overall back into its original type, if
5384 + necessary, and return */
5385 + if (JINTEGRAL_TYPE_P (op_type))
5386 + return fold (node);
5388 + return fold (convert (op_type, node));
5392 @@ -13210,6 +13510,7 @@
5393 new_value = NULL_TREE;
5394 wfl_value = TREE_VALUE (entry);
5396 + push_obstacks (&permanent_obstack, &permanent_obstack);
5397 value = java_complete_tree (TREE_VALUE (entry));
5398 /* patch_string return error_mark_node if arg is error_mark_node */
5399 if ((patched = patch_string (value)))
5400 @@ -13225,7 +13526,8 @@
5401 new_value = try_builtin_assignconv (wfl_operator, type, value);
5402 if (!new_value && (new_value = try_reference_assignconv (type, value)))
5403 type_value = promote_type (type);
5407 /* Check and report errors */
5410 @@ -13564,6 +13866,54 @@
5414 +/* Try to find the loop a block might be related to. This comprises
5415 + the case where the LOOP_EXPR is found as the second operand of a
5416 + COMPOUND_EXPR, because the loop happens to have an initialization
5417 + part, then expressed as the first operand of the COMPOUND_EXPR. If
5418 + the search finds something, 1 is returned. Otherwise, 0 is
5419 + returned. The search is assumed to start from a
5420 + LABELED_BLOCK_EXPR's block. */
5423 +search_loop (statement)
5426 + if (TREE_CODE (statement) == LOOP_EXPR)
5429 + if (TREE_CODE (statement) == BLOCK)
5430 + statement = BLOCK_SUBBLOCKS (statement);
5434 + if (statement && TREE_CODE (statement) == COMPOUND_EXPR)
5435 + while (statement && TREE_CODE (statement) == COMPOUND_EXPR)
5436 + statement = TREE_OPERAND (statement, 1);
5438 + return (TREE_CODE (statement) == LOOP_EXPR
5439 + && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE);
5442 +/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
5443 + returned otherwise. */
5446 +labeled_block_contains_loop_p (block, loop)
5452 + if (LABELED_BLOCK_BODY (block) == loop)
5455 + if (IS_FOR_LOOP_P (loop)
5456 + && search_loop (LABELED_BLOCK_BODY (block)) == loop)
5462 /* If the loop isn't surrounded by a labeled statement, create one and
5463 insert LOOP as its body. */
5465 @@ -13572,33 +13922,17 @@
5469 - tree block = ctxp->current_labeled_block;
5471 TREE_TYPE (loop) = void_type_node;
5472 - if (block != NULL_TREE)
5474 - tree block_body = LABELED_BLOCK_BODY (block);
5475 - if (IS_FOR_LOOP_P (loop))
5477 - if (TREE_CODE (block_body) == BLOCK)
5479 - block_body = BLOCK_EXPR_BODY (block_body);
5480 - if (block_body == loop
5481 - || (TREE_CODE (block_body) == COMPOUND_EXPR
5482 - && TREE_OPERAND (block_body, 1) == loop))
5488 - if (block_body == loop)
5492 + if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop))
5495 loop_label = build_labeled_block (0, NULL_TREE);
5496 + /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
5497 + that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
5498 LABELED_BLOCK_BODY (loop_label) = loop;
5499 PUSH_LABELED_BLOCK (loop_label);
5500 - loop = loop_label;
5502 + return loop_label;
5505 /* 14.13, 14.14: break and continue Statements */
5506 @@ -13690,7 +14024,7 @@
5508 target_stmt = LABELED_BLOCK_BODY (labeled_block);
5509 if (TREE_CODE (target_stmt) == SWITCH_EXPR
5510 - || TREE_CODE (target_stmt) == LOOP_EXPR)
5511 + || search_loop (target_stmt))
5513 bc_label = labeled_block;
5515 @@ -13704,7 +14038,7 @@
5516 /* Our break/continue don't return values. */
5517 TREE_TYPE (node) = void_type_node;
5518 /* Encapsulate the break within a compound statement so that it's
5519 - expanded all the times by expand_expr (and not clobered
5520 + expanded all the times by expand_expr (and not clobbered
5521 sometimes, like after a if statement) */
5522 node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
5523 TREE_SIDE_EFFECTS (node) = 1;
5524 @@ -14099,11 +14433,20 @@
5527 EXPR_WFL_LINECOL (wfl_operator) = location;
5528 - parse_error_context
5529 - (wfl_operator, "Exception `%s' must be caught, or it must be "
5530 - "declared in the `throws' clause of `%s'",
5531 - lang_printable_name (TREE_VALUE (throws), 0),
5532 - IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
5533 + if (DECL_NAME (current_function_decl) == finit_identifier_node)
5534 + parse_error_context
5535 + (wfl_operator, "Exception `%s' can't be thrown in initializer",
5536 + lang_printable_name (TREE_VALUE (throws), 0));
5539 + parse_error_context
5540 + (wfl_operator, "Exception `%s' must be caught, or it must be "
5541 + "declared in the `throws' clause of `%s'",
5542 + lang_printable_name (TREE_VALUE (throws), 0),
5543 + (DECL_NAME (current_function_decl) == init_identifier_node ?
5544 + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
5545 + IDENTIFIER_POINTER (DECL_NAME (current_function_decl))));
5550 Only in gcc-2.95.2/gcc/java: parse.c.orig
5551 Only in gcc-2.95.2/gcc/java: parse.c.rej
5552 diff -u -r gcc-2.95.2-orig/gcc/java/parse.y gcc-2.95.2/gcc/java/parse.y
5553 --- gcc-2.95.2-orig/gcc/java/parse.y Mon Jun 28 15:56:22 1999
5554 +++ gcc-2.95.2/gcc/java/parse.y Sun Oct 31 21:27:43 1999
5556 static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...))
5558 static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list));
5559 +static void parse_ctor_invocation_error PROTO ((void));
5560 static tree parse_jdk1_1_error PROTO ((char *));
5561 static void complete_class_report_errors PROTO ((jdep *));
5562 static int process_imports PROTO ((void));
5564 static tree strip_out_static_field_access_decl PROTO ((tree));
5565 static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *));
5566 static void static_ref_err PROTO ((tree, tree, tree));
5567 +static tree java_refold PROTO ((tree));
5569 /* Number of error found so far. */
5570 int java_error_count;
5571 @@ -274,6 +276,10 @@
5572 binop_lookup [((VALUE) - PLUS_TK)% \
5573 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
5575 +/* This is the end index for binary operators that can also be used
5576 + in compound assignements. */
5577 +#define BINOP_COMPOUND_CANDIDATES 11
5579 /* Fake WFL used to report error message. It is initialized once if
5580 needed and reused with it's location information is overriden. */
5581 tree wfl_operator = NULL_TREE;
5582 @@ -1318,16 +1324,14 @@
5583 {yyerror ("')' expected"); RECOVER;}
5584 | this_or_super OP_TK CP_TK error
5586 - yyerror ("Constructor invocation must be first "
5587 - "thing in a constructor");
5588 + parse_ctor_invocation_error ();
5591 | this_or_super OP_TK argument_list error
5592 {yyerror ("')' expected"); RECOVER;}
5593 | this_or_super OP_TK argument_list CP_TK error
5595 - yyerror ("Constructor invocation must be first "
5596 - "thing in a constructor");
5597 + parse_ctor_invocation_error ();
5600 | name DOT_TK SUPER_TK error
5601 @@ -2409,7 +2413,17 @@
5605 -/* Reporting JDK1.1 features not implemented */
5606 +/* Reporting an constructor invocation error. */
5608 +parse_ctor_invocation_error ()
5610 + if (DECL_CONSTRUCTOR_P (current_function_decl))
5611 + yyerror ("Constructor invocation must be first thing in a constructor");
5613 + yyerror ("Only constructors can invoke constructors");
5616 +/* Reporting JDK1.1 features not implemented. */
5619 parse_jdk1_1_error (msg)
5620 @@ -3318,13 +3332,18 @@
5622 tree meth = TREE_VALUE (mdecl);
5623 tree id = TREE_PURPOSE (mdecl);
5624 - tree this_class = TREE_TYPE (ctxp->current_parsed_class);
5625 tree type_wfl = NULL_TREE;
5626 - tree meth_name = NULL_TREE, current, orig_arg;
5627 + tree meth_name = NULL_TREE;
5628 + tree current, orig_arg, this_class;
5630 int constructor_ok = 0, must_chain;
5632 check_modifiers_consistency (flags);
5634 + if (ctxp->current_parsed_class)
5635 + this_class = TREE_TYPE (ctxp->current_parsed_class);
5639 /* There are some forbidden modifiers for an abstract method and its
5640 class must be abstract as well. */
5641 @@ -3520,7 +3539,12 @@
5642 finish_method_declaration (method_body)
5645 - int flags = get_access_flags_from_decl (current_function_decl);
5648 + if (!current_function_decl)
5651 + flags = get_access_flags_from_decl (current_function_decl);
5653 /* 8.4.5 Method Body */
5654 if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
5655 @@ -4335,7 +4359,9 @@
5657 /* Resolve and layout if necessary */
5658 layout_class_methods (TREE_TYPE (decl));
5659 - if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)))
5660 + /* Check methods, but only once */
5661 + if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl))
5662 + && !CLASS_LOADED_P (TREE_TYPE (decl)))
5663 CHECK_METHODS (decl);
5664 if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
5665 safe_layout_class (TREE_TYPE (decl));
5666 @@ -4516,7 +4542,7 @@
5668 /* Track method being redefined inside the same class. As a side
5669 effect, set DECL_NAME to an IDENTIFIER (prior entering this
5670 - function it's a FWL, so we can track errors more accurately */
5671 + function it's a FWL, so we can track errors more accurately.) */
5674 check_method_redefinition (class, method)
5675 @@ -4552,9 +4578,126 @@
5679 -/* Check all the methods of CLASS. Methods are first completed then
5680 - checked according to regular method existance rules.
5681 - If no constructor were encountered, then build its declaration. */
5683 +check_abstract_method_definitions (do_interface, class_decl, type)
5685 + tree class_decl, type;
5687 + tree class = TREE_TYPE (class_decl);
5688 + tree method, end_type;
5690 + end_type = (do_interface ? object_type_node : type);
5691 + for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
5693 + tree other_super, other_method, method_sig, method_name;
5696 + if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
5699 + /* Now verify that somewhere in between TYPE and CLASS,
5700 + abstract method METHOD gets a non abstract definition
5701 + that is inherited by CLASS. */
5703 + method_sig = build_java_signature (TREE_TYPE (method));
5704 + method_name = DECL_NAME (method);
5705 + if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
5706 + method_name = EXPR_WFL_NODE (method_name);
5708 + for (other_super = class; other_super != end_type;
5709 + other_super = CLASSTYPE_SUPER (other_super))
5711 + for (other_method = TYPE_METHODS (other_super); other_method;
5712 + other_method = TREE_CHAIN (other_method))
5714 + tree s = build_java_signature (TREE_TYPE (other_method));
5715 + tree other_name = DECL_NAME (other_method);
5717 + if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
5718 + other_name = EXPR_WFL_NODE (other_name);
5719 + if (!IS_CLINIT (other_method)
5720 + && !DECL_CONSTRUCTOR_P (other_method)
5721 + && method_name == other_name && method_sig == s)
5729 + /* Report that abstract METHOD didn't find an implementation
5730 + that CLASS can use. */
5733 + char *t = strdup (lang_printable_name
5734 + (TREE_TYPE (TREE_TYPE (method)), 0));
5735 + tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
5736 + tree saved_wfl = NULL_TREE;
5738 + if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION)
5740 + saved_wfl = DECL_NAME (method);
5741 + DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method));
5744 + parse_error_context
5745 + (lookup_cl (class_decl),
5746 + "Class `%s' doesn't define the abstract method `%s %s' from "
5747 + "%s `%s'. This method must be defined or %s `%s' must be "
5748 + "declared abstract",
5749 + IDENTIFIER_POINTER (DECL_NAME (class_decl)),
5750 + t, lang_printable_name (method, 0),
5751 + (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
5752 + "interface" : "class"),
5753 + IDENTIFIER_POINTER (ccn),
5754 + (CLASS_INTERFACE (class_decl) ? "interface" : "class"),
5755 + IDENTIFIER_POINTER (DECL_NAME (class_decl)));
5760 + DECL_NAME (method) = saved_wfl;
5765 +/* Check that CLASS_DECL somehoow implements all inherited abstract
5769 +java_check_abstract_method_definitions (class_decl)
5772 + tree class = TREE_TYPE (class_decl);
5773 + tree super, vector;
5776 + if (CLASS_ABSTRACT (class_decl))
5779 + /* Check for inherited types */
5780 + for (super = CLASSTYPE_SUPER (class); super != object_type_node;
5781 + super = CLASSTYPE_SUPER (super))
5783 + if (!CLASS_ABSTRACT (TYPE_NAME (super)))
5786 + check_abstract_method_definitions (0, class_decl, super);
5789 + /* Check for implemented interfaces. */
5790 + vector = TYPE_BINFO_BASETYPES (class);
5791 + for (i = 1; i < TREE_VEC_LENGTH (vector); i++)
5793 + super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
5794 + check_abstract_method_definitions (1, class_decl, super);
5798 +/* Check all the methods of CLASS_DECL. Methods are first completed
5799 + then checked according to regular method existance rules. If no
5800 + constructor for CLASS_DECL were encountered, then build its
5804 java_check_regular_methods (class_decl)
5805 @@ -4730,7 +4873,7 @@
5807 /* Don't forget eventual pending found and saved_found_wfl. Take
5808 into account that we might have exited because we saw an
5809 - aritifical method as the last entry. */
5810 + artificial method as the last entry. */
5812 if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
5813 DECL_NAME (found) = saved_found_wfl;
5814 @@ -4738,6 +4881,10 @@
5815 if (!TYPE_NVIRTUALS (class))
5816 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
5818 + /* Search for inherited abstract method not yet implemented in this
5820 + java_check_abstract_method_definitions (class_decl);
5822 if (!saw_constructor)
5824 /* No constructor seen, we craft one, at line 0. Since this
5825 @@ -4943,14 +5090,15 @@
5829 -/* Return the line that matches DECL line number. Used during error
5831 +/* Return the line that matches DECL line number, and try its best to
5832 + position the column number. Used during error reports. */
5838 static tree cl = NULL_TREE;
5839 + char *line, *found;
5843 @@ -4961,6 +5109,14 @@
5844 EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
5845 EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
5847 + line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)),
5848 + EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl));
5850 + found = strstr ((const char *)line,
5851 + (const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
5853 + EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line);
5858 @@ -5495,6 +5651,9 @@
5865 current_function_decl = fndecl;
5867 /* New scope for the function */
5868 @@ -5614,6 +5773,9 @@
5869 tree fndecl = current_function_decl;
5870 int flag_asynchronous_exceptions = asynchronous_exceptions;
5875 java_parser_context_save_global ();
5876 lineno = ctxp->last_ccb_indent1;
5878 @@ -5669,6 +5831,8 @@
5879 java_method_add_stmt (fndecl, expr)
5882 + if (!GET_CURRENT_BLOCK (fndecl))
5884 return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
5887 @@ -6067,7 +6231,8 @@
5888 for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
5890 if (DECL_CONSTRUCTOR_P (mdecl)
5891 - && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node)
5892 + && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl)))
5893 + == end_params_node)
5897 @@ -6410,6 +6575,8 @@
5898 == soft_initclass_node)
5899 return TREE_OPERAND (op1, 1);
5901 + else if (JDECL_P (op1))
5906 @@ -6431,6 +6598,8 @@
5907 for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
5909 tree qual_wfl = QUAL_WFL (q);
5910 + tree ret_decl; /* for EH checking */
5911 + int location; /* for EH checking */
5913 /* 15.10.1 Field Access Using a Primary */
5914 switch (TREE_CODE (qual_wfl))
5915 @@ -6449,14 +6618,21 @@
5916 /* And code for the function call */
5917 if (complete_function_arguments (qual_wfl))
5920 if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
5921 CALL_USING_SUPER (qual_wfl) = 1;
5923 - patch_method_invocation (qual_wfl, decl, type, &is_static, NULL);
5924 + location = (TREE_CODE (qual_wfl) == CALL_EXPR ?
5925 + EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0);
5926 + *where_found = patch_method_invocation (qual_wfl, decl, type,
5927 + &is_static, &ret_decl);
5928 if (*where_found == error_mark_node)
5930 *type_found = type = QUAL_DECL_TYPE (*where_found);
5934 + check_thrown_exceptions (location, ret_decl);
5936 /* If the previous call was static and this one is too,
5937 build a compound expression to hold the two (because in
5938 that case, previous function calls aren't transported as
5939 @@ -6491,6 +6667,7 @@
5941 case CONDITIONAL_EXPR:
5944 *where_found = decl = java_complete_tree (qual_wfl);
5945 if (decl == error_mark_node)
5947 @@ -7228,6 +7405,11 @@
5948 if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
5949 TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
5950 TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
5952 + /* Resolve unresolved returned type isses */
5953 + t = TREE_TYPE (TREE_TYPE (method));
5954 + if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t)))
5955 + resolve_and_layout (TREE_TYPE (t), NULL);
5957 if (flag_emit_class_files || flag_emit_xref)
5959 @@ -7388,7 +7570,7 @@
5960 parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s",
5961 (lc ? "constructor" : "method"),
5963 - IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) :
5964 + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))) :
5965 IDENTIFIER_POINTER (name)),
5966 IDENTIFIER_POINTER (signature),
5967 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))),
5968 @@ -7407,7 +7589,8 @@
5969 tree list = NULL_TREE, all_list = NULL_TREE;
5971 /* Search interfaces */
5972 - if (CLASS_INTERFACE (TYPE_NAME (class)))
5973 + if (CLASS_INTERFACE (TYPE_NAME (class))
5974 + || CLASS_ABSTRACT (TYPE_NAME (class)))
5976 static tree searched_interfaces = NULL_TREE;
5977 static int search_not_done = 0;
5978 @@ -7638,7 +7821,7 @@
5980 case NEW_ARRAY_EXPR:
5981 qual = TREE_CHAIN (qual);
5982 - new_array_found = 1;
5983 + again = new_array_found = 1;
5985 case NEW_CLASS_EXPR:
5987 @@ -7666,12 +7849,8 @@
5988 && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
5989 name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
5991 - else if (code == ARRAY_REF &&
5992 - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
5993 - name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
5995 - else if (code == CALL_EXPR &&
5996 - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
5997 + else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) &&
5998 + TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
5999 name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
6001 else if (code == STRING_CST || code == CONDITIONAL_EXPR)
6002 @@ -7681,8 +7860,15 @@
6006 - name = EXPR_WFL_NODE (qual_wfl);
6009 + name = EXPR_WFL_NODE (qual_wfl);
6012 + qual = EXPR_WFL_QUALIFICATION (qual_wfl);
6017 /* If we have a THIS (from a primary), we set the context accordingly */
6018 if (name == this_identifier_node)
6020 @@ -7716,7 +7902,8 @@
6021 declaration or parameter declaration, then it is an expression
6022 name. We don't carry this test out if we're in the context of the
6023 use of SUPER or THIS */
6024 - if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
6025 + if (!this_found && !super_found &&
6026 + TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name)))
6028 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
6029 QUAL_RESOLUTION (qual) = decl;
6030 @@ -7733,15 +7920,17 @@
6031 QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
6034 - /* We reclassify NAME as a type name if:
6035 + /* We reclassify NAME as yielding to a type name resolution if:
6036 - NAME is a class/interface declared within the compilation
6037 unit containing NAME,
6038 - NAME is imported via a single-type-import declaration,
6039 - NAME is declared in an another compilation unit of the package
6040 of the compilation unit containing NAME,
6041 - NAME is declared by exactly on type-import-on-demand declaration
6042 - of the compilation unit containing NAME. */
6043 - else if ((decl = resolve_and_layout (name, NULL_TREE)))
6044 + of the compilation unit containing NAME.
6045 + - NAME is actually a STRING_CST. */
6046 + else if (TREE_CODE (name) == STRING_CST ||
6047 + (decl = resolve_and_layout (name, NULL_TREE)))
6049 RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
6050 QUAL_RESOLUTION (qual) = decl;
6051 @@ -7826,7 +8015,9 @@
6053 tree value = DECL_INITIAL (node);
6054 DECL_INITIAL (node) = NULL_TREE;
6055 + push_obstacks (&permanent_obstack, &permanent_obstack);
6056 value = fold_constant_for_init (value, node);
6058 DECL_INITIAL (node) = value;
6059 if (value != NULL_TREE)
6061 @@ -7846,8 +8037,7 @@
6062 TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
6066 - return stabilize_reference (node);
6067 + return stabilize_reference (node);
6070 /* Patch tree nodes in a function body. When a BLOCK is found, push
6071 @@ -8029,8 +8219,12 @@
6072 && JDECL_P (TREE_OPERAND (cn, 1))
6073 && FIELD_FINAL (TREE_OPERAND (cn, 1))
6074 && DECL_INITIAL (TREE_OPERAND (cn, 1)))
6075 - cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
6076 - TREE_OPERAND (cn, 1));
6078 + push_obstacks (&permanent_obstack, &permanent_obstack);
6079 + cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
6080 + TREE_OPERAND (cn, 1));
6084 if (!TREE_CONSTANT (cn) && !flag_emit_xref)
6086 @@ -8283,7 +8477,11 @@
6087 && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
6088 && DECL_INITIAL (nn) != NULL_TREE)
6090 - tree value = fold_constant_for_init (nn, nn);
6093 + push_obstacks (&permanent_obstack, &permanent_obstack);
6094 + value = fold_constant_for_init (nn, nn);
6096 if (value != NULL_TREE)
6098 tree type = TREE_TYPE (value);
6099 @@ -8297,14 +8495,17 @@
6100 if (TREE_OPERAND (node, 0) == error_mark_node)
6101 return error_mark_node;
6103 - if (COMPOUND_ASSIGN_P (wfl_op2))
6104 + flag = COMPOUND_ASSIGN_P (wfl_op2);
6107 tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
6109 /* Hand stablize the lhs on both places */
6110 TREE_OPERAND (node, 0) = lvalue;
6111 - TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue;
6112 + TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
6113 + (flag_emit_class_files ? lvalue : save_expr (lvalue));
6115 + /* 15.25.2.a: Left hand is not an array access. FIXME */
6116 /* Now complete the RHS. We write it back later on. */
6117 nn = java_complete_tree (TREE_OPERAND (node, 1));
6119 @@ -8315,6 +8516,8 @@
6120 E1 = (T)(E1 op E2), with T being the type of E1. */
6121 nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
6122 TREE_TYPE (lvalue), nn));
6124 + /* 15.25.2.b: Left hand is an array access. FIXME */
6127 /* If we're about to patch a NEW_ARRAY_INIT, we call a special
6128 @@ -8338,6 +8541,10 @@
6129 if ((nn = patch_string (TREE_OPERAND (node, 1))))
6130 TREE_OPERAND (node, 1) = nn;
6131 node = patch_assignment (node, wfl_op1, wfl_op2);
6132 + /* Reorganize the tree if necessary. */
6133 + if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
6134 + || JSTRING_P (TREE_TYPE (node))))
6135 + node = java_refold (node);
6136 CAN_COMPLETE_NORMALLY (node) = 1;
6139 @@ -9346,6 +9553,81 @@
6140 #undef BUILD_OPERATOR_STRING
6143 +/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
6146 +java_decl_equiv (var_acc1, var_acc2)
6147 + tree var_acc1, var_acc2;
6149 + if (JDECL_P (var_acc1))
6150 + return (var_acc1 == var_acc2);
6152 + return (TREE_CODE (var_acc1) == COMPONENT_REF
6153 + && TREE_CODE (var_acc2) == COMPONENT_REF
6154 + && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
6155 + == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0)
6156 + && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1));
6159 +/* Return a non zero value if CODE is one of the operators that can be
6160 + used in conjunction with the `=' operator in a compound assignment. */
6163 +binop_compound_p (code)
6164 + enum tree_code code;
6167 + for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++)
6168 + if (binop_lookup [i] == code)
6171 + return i < BINOP_COMPOUND_CANDIDATES;
6174 +/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
6180 + tree c, b, ns, decl;
6182 + if (TREE_CODE (t) != MODIFY_EXPR)
6185 + c = TREE_OPERAND (t, 1);
6186 + if (! (c && TREE_CODE (c) == COMPOUND_EXPR
6187 + && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR
6188 + && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1)))))
6191 + /* Now the left branch of the binary operator. */
6192 + b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
6193 + if (! (b && TREE_CODE (b) == NOP_EXPR
6194 + && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
6197 + ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0);
6198 + if (! (ns && TREE_CODE (ns) == NOP_EXPR
6199 + && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR))
6202 + decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0);
6203 + if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF)
6204 + /* It's got to be the an equivalent decl */
6205 + && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0)))
6207 + /* Shorten the NOP_EXPR/SAVE_EXPR path. */
6208 + TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0);
6209 + /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
6210 + TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1);
6211 + /* Change the right part of the BINOP_EXPR */
6212 + TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0);
6218 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
6219 errors but we modify NODE so that it contains the type computed
6220 according to the expression, when it's fixed. Otherwise, we write
6221 @@ -9392,6 +9674,12 @@
6222 if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
6223 TREE_SET_CODE (node, TRUNC_DIV_EXPR);
6225 + if (TREE_CODE (prom_type) == INTEGER_TYPE
6226 + && flag_use_divide_subroutine
6227 + && ! flag_emit_class_files
6228 + && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
6229 + return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
6231 /* This one is more complicated. FLOATs are processed by a
6232 function call to soft_fmod. Duplicate the value of the
6233 COMPOUND_ASSIGN_P flag. */
6234 @@ -10004,7 +10292,7 @@
6235 case PREINCREMENT_EXPR:
6236 /* 15.14.2 Prefix Decrement Operator -- */
6237 case PREDECREMENT_EXPR:
6238 - decl = strip_out_static_field_access_decl (op);
6239 + op = decl = strip_out_static_field_access_decl (op);
6240 /* We really should have a JAVA_ARRAY_EXPR to avoid this */
6242 && TREE_CODE (decl) != COMPONENT_REF
6243 @@ -10043,15 +10331,28 @@
6246 /* Before the addition, binary numeric promotion is performed on
6248 - value = build_int_2 (1, 0);
6249 - TREE_TYPE (node) =
6250 - binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value);
6251 - /* And write the promoted incremented and increment */
6252 + both operands, if really necessary */
6253 + if (JINTEGRAL_TYPE_P (op_type))
6255 + value = build_int_2 (1, 0);
6256 + TREE_TYPE (value) = TREE_TYPE (node) = op_type;
6260 + value = build_int_2 (1, 0);
6261 + TREE_TYPE (node) =
6262 + binary_numeric_promotion (op_type,
6263 + TREE_TYPE (value), &op, &value);
6265 + /* And write back into the node. */
6266 TREE_OPERAND (node, 0) = op;
6267 TREE_OPERAND (node, 1) = value;
6268 - /* Convert the overall back into its original type. */
6269 - return fold (convert (op_type, node));
6270 + /* Convert the overall back into its original type, if
6271 + necessary, and return */
6272 + if (JINTEGRAL_TYPE_P (op_type))
6273 + return fold (node);
6275 + return fold (convert (op_type, node));
6279 @@ -10556,6 +10857,7 @@
6280 new_value = NULL_TREE;
6281 wfl_value = TREE_VALUE (entry);
6283 + push_obstacks (&permanent_obstack, &permanent_obstack);
6284 value = java_complete_tree (TREE_VALUE (entry));
6285 /* patch_string return error_mark_node if arg is error_mark_node */
6286 if ((patched = patch_string (value)))
6287 @@ -10571,7 +10873,8 @@
6288 new_value = try_builtin_assignconv (wfl_operator, type, value);
6289 if (!new_value && (new_value = try_reference_assignconv (type, value)))
6290 type_value = promote_type (type);
6294 /* Check and report errors */
6297 @@ -10910,6 +11213,54 @@
6301 +/* Try to find the loop a block might be related to. This comprises
6302 + the case where the LOOP_EXPR is found as the second operand of a
6303 + COMPOUND_EXPR, because the loop happens to have an initialization
6304 + part, then expressed as the first operand of the COMPOUND_EXPR. If
6305 + the search finds something, 1 is returned. Otherwise, 0 is
6306 + returned. The search is assumed to start from a
6307 + LABELED_BLOCK_EXPR's block. */
6310 +search_loop (statement)
6313 + if (TREE_CODE (statement) == LOOP_EXPR)
6316 + if (TREE_CODE (statement) == BLOCK)
6317 + statement = BLOCK_SUBBLOCKS (statement);
6321 + if (statement && TREE_CODE (statement) == COMPOUND_EXPR)
6322 + while (statement && TREE_CODE (statement) == COMPOUND_EXPR)
6323 + statement = TREE_OPERAND (statement, 1);
6325 + return (TREE_CODE (statement) == LOOP_EXPR
6326 + && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE);
6329 +/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
6330 + returned otherwise. */
6333 +labeled_block_contains_loop_p (block, loop)
6339 + if (LABELED_BLOCK_BODY (block) == loop)
6342 + if (IS_FOR_LOOP_P (loop)
6343 + && search_loop (LABELED_BLOCK_BODY (block)) == loop)
6349 /* If the loop isn't surrounded by a labeled statement, create one and
6350 insert LOOP as its body. */
6352 @@ -10918,33 +11269,17 @@
6356 - tree block = ctxp->current_labeled_block;
6358 TREE_TYPE (loop) = void_type_node;
6359 - if (block != NULL_TREE)
6361 - tree block_body = LABELED_BLOCK_BODY (block);
6362 - if (IS_FOR_LOOP_P (loop))
6364 - if (TREE_CODE (block_body) == BLOCK)
6366 - block_body = BLOCK_EXPR_BODY (block_body);
6367 - if (block_body == loop
6368 - || (TREE_CODE (block_body) == COMPOUND_EXPR
6369 - && TREE_OPERAND (block_body, 1) == loop))
6375 - if (block_body == loop)
6379 + if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop))
6382 loop_label = build_labeled_block (0, NULL_TREE);
6383 + /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
6384 + that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
6385 LABELED_BLOCK_BODY (loop_label) = loop;
6386 PUSH_LABELED_BLOCK (loop_label);
6387 - loop = loop_label;
6389 + return loop_label;
6392 /* 14.13, 14.14: break and continue Statements */
6393 @@ -11036,7 +11371,7 @@
6395 target_stmt = LABELED_BLOCK_BODY (labeled_block);
6396 if (TREE_CODE (target_stmt) == SWITCH_EXPR
6397 - || TREE_CODE (target_stmt) == LOOP_EXPR)
6398 + || search_loop (target_stmt))
6400 bc_label = labeled_block;
6402 @@ -11050,7 +11385,7 @@
6403 /* Our break/continue don't return values. */
6404 TREE_TYPE (node) = void_type_node;
6405 /* Encapsulate the break within a compound statement so that it's
6406 - expanded all the times by expand_expr (and not clobered
6407 + expanded all the times by expand_expr (and not clobbered
6408 sometimes, like after a if statement) */
6409 node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
6410 TREE_SIDE_EFFECTS (node) = 1;
6411 @@ -11445,11 +11780,20 @@
6414 EXPR_WFL_LINECOL (wfl_operator) = location;
6415 - parse_error_context
6416 - (wfl_operator, "Exception `%s' must be caught, or it must be "
6417 - "declared in the `throws' clause of `%s'",
6418 - lang_printable_name (TREE_VALUE (throws), 0),
6419 - IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
6420 + if (DECL_NAME (current_function_decl) == finit_identifier_node)
6421 + parse_error_context
6422 + (wfl_operator, "Exception `%s' can't be thrown in initializer",
6423 + lang_printable_name (TREE_VALUE (throws), 0));
6426 + parse_error_context
6427 + (wfl_operator, "Exception `%s' must be caught, or it must be "
6428 + "declared in the `throws' clause of `%s'",
6429 + lang_printable_name (TREE_VALUE (throws), 0),
6430 + (DECL_NAME (current_function_decl) == init_identifier_node ?
6431 + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
6432 + IDENTIFIER_POINTER (DECL_NAME (current_function_decl))));
6437 Only in gcc-2.95.2/gcc/java: parse.y.orig
6438 Only in gcc-2.95.2/gcc/java: parse.y.rej
6439 Only in gcc-2.95.2/gcc/java: super.patch
6440 diff -u -r gcc-2.95.2-orig/gcc/java/typeck.c gcc-2.95.2/gcc/java/typeck.c
6441 --- gcc-2.95.2-orig/gcc/java/typeck.c Fri May 14 02:33:34 1999
6442 +++ gcc-2.95.2/gcc/java/typeck.c Sat Oct 30 19:45:50 1999
6445 /* Convert an IEEE real to an integer type. The result of such a
6446 conversion when the source operand is a NaN isn't defined by
6447 - IEEE754, but by the Java language standard: it must be zero. This
6448 - conversion produces something like:
6450 - ({ double tmp = expr; (tmp != tmp) ? 0 : (int)tmp; })
6453 + IEEE754, but by the Java language standard: it must be zero. Also,
6454 + overflows must be clipped to within range. This conversion
6455 + produces something like:
6457 + ((expr >= (float)MAX_INT)
6459 + : ((expr <= (float)MIN_INT)
6466 convert_ieee_real_to_integer (type, expr)
6470 expr = save_expr (expr);
6472 - return build (COND_EXPR, type,
6473 - build (NE_EXPR, boolean_type_node, expr, expr),
6474 - convert (type, integer_zero_node),
6475 - convert_to_integer (type, expr));
6476 + result = build (COND_EXPR, type,
6477 + build (NE_EXPR, boolean_type_node, expr, expr),
6478 + convert (type, integer_zero_node),
6479 + convert_to_integer (type, expr));
6481 + result = build (COND_EXPR, type,
6482 + build (LE_EXPR, boolean_type_node, expr,
6483 + convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))),
6484 + TYPE_MIN_VALUE (type),
6487 + result = build (COND_EXPR, type,
6488 + build (GE_EXPR, boolean_type_node, expr,
6489 + convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))),
6490 + TYPE_MAX_VALUE (type),
6496 /* Create an expression whose value is that of EXPR,
6497 @@ -100,12 +120,9 @@
6498 return fold (convert_to_boolean (type, expr));
6499 if (code == INTEGER_TYPE)
6501 - if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
6502 -#ifdef TARGET_SOFT_FLOAT
6503 - && !TARGET_SOFT_FLOAT
6505 - && !flag_emit_class_files
6506 - && !flag_fast_math
6507 + if (! flag_fast_math
6508 + && ! flag_emit_class_files
6509 + && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
6510 && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
6511 return fold (convert_ieee_real_to_integer (type, expr));
6513 Only in gcc-2.95.2/gcc/java: typeck.c.orig
6514 diff -u -r gcc-2.95.2-orig/gcc/java/verify.c gcc-2.95.2/gcc/java/verify.c
6515 --- gcc-2.95.2-orig/gcc/java/verify.c Wed Jun 23 11:33:10 1999
6516 +++ gcc-2.95.2/gcc/java/verify.c Sun Oct 31 14:53:38 1999
6518 || handler_pc < 0 || handler_pc >= length
6519 || (handler_pc >= start_pc && handler_pc < end_pc)
6520 || ! (instruction_bits [start_pc] & BCODE_INSTRUCTION_START)
6521 - || ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START)
6522 + || (end_pc < length &&
6523 + ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START))
6524 || ! (instruction_bits [handler_pc] & BCODE_INSTRUCTION_START))
6526 error ("bad pc in exception_table");