]>
Commit | Line | Data |
---|---|---|
d405059b | 1 | # DP: J*va patch set for gcc-2.95.2 |
2 | # DP: taken from http://waitaki.otago.ac.nz/~bryce/gcj/ | |
3 | # DP: | |
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). | |
8 | ||
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 | |
13 | @@ -1,3 +1,286 @@ | |
14 | +Fri Oct 29 14:35:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
15 | + | |
16 | + * class.c (add_method_1): Set DECL_INLINE to 1 for private, static | |
17 | + and final method. | |
18 | + | |
19 | +Fri Oct 29 14:23:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
20 | + | |
21 | + * parse.y (expression_statement:): Call function to report | |
22 | + improper invocation of a constructor. | |
23 | + (parse_ctor_invocation_error): New function. | |
24 | + | |
25 | +1999-10-04 Tom Tromey <tromey@cygnus.com> | |
26 | + | |
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. | |
30 | + | |
31 | +Thu Oct 21 01:27:31 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
32 | + | |
33 | + * parse.y (resolve_qualified_expression_name): Handle MODIFY_EXPR. | |
34 | + (qualify_ambiguous_name): Likewise. | |
35 | + | |
36 | +1999-10-21 Tom Tromey <tromey@cygnus.com> | |
37 | + | |
38 | + * jvgenmain.c (main): _Jv_Compiler_Properties now an extern; set | |
39 | + in generated `main'. | |
40 | + | |
41 | +Tue Oct 12 22:28:10 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
42 | + | |
43 | + * jcf-write.c (RELOCATION_VALUE_1): Fixed integer value from 0 to 1. | |
44 | + | |
45 | +1999-10-07 Anthony Green <green@cygnus.com> | |
46 | + | |
47 | + * jcf-write.c (generate_classfile): Use UNSAFE_PUTx in cases | |
48 | + where CHECK_PUT may fail for valid reasons. | |
49 | + | |
50 | + * jcf-write.c (UNSAFE_PUT1, UNSAFE_PUT2, UNSAFE_PUT3, | |
51 | + UNSAFE_PUTN): New macros. | |
52 | + | |
53 | +Tue Sep 14 16:24:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
54 | + | |
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 | |
63 | + `jword'. | |
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. | |
73 | + | |
74 | +Thu Sep 16 15:42:39 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
75 | + | |
76 | + * parse.y (java_method_add_stmt): Test against GET_CURRENT_BLOCK | |
77 | + instead of fndecl. | |
78 | + | |
79 | +Sat Sep 11 16:46:44 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
80 | + | |
81 | + * parse.y (find_applicable_accessible_methods_list): Search | |
82 | + abstract classes as interfaces. | |
83 | + | |
84 | +Thu Sep 9 17:33:28 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
85 | + | |
86 | + * class.c (finish_class): We're now outside a valid method | |
87 | + declaration. Tell the rest of gcc so. | |
88 | + | |
89 | +1999-09-07 Tom Tromey <tromey@cygnus.com> | |
90 | + | |
91 | + * gjavah.c (add_class_decl): Generate include for gcj/array.h, not | |
92 | + java-array.h. | |
93 | + (decode_signature_piece): Don't emit "::" in JArray<>. | |
94 | + (print_namelet): Only print trailing `;' when printing a class. | |
95 | + | |
96 | +1999-09-03 Tom Tromey <tromey@cygnus.com> | |
97 | + | |
98 | + * parse.y (strip_out_static_field_access_decl): Return operand if | |
99 | + it satisfies JDECL_P. | |
100 | + | |
101 | +1999-09-02 Tom Tromey <tromey@cygnus.com> | |
102 | + | |
103 | + * gjavah.c (decode_signature_piece): Emit "::" in JArray<>. | |
104 | + Handle nested arrays, like `[[I'. | |
105 | + | |
106 | +1999-08-26 Tom Tromey <tromey@cygnus.com> | |
107 | + | |
108 | + * gjavah.c (print_cxx_classname): Print "::" before qualified | |
109 | + name. | |
110 | + | |
111 | +1999-10-19 Tom Tromey <tromey@cygnus.com> | |
112 | + | |
113 | + * jcf-parse.c (parse_source_file): Call jcf_dependency_add_file. | |
114 | + From Mike Moreton <mike@pillim.demon.co.uk>. | |
115 | + | |
116 | +1999-09-23 Tom Tromey <tromey@cygnus.com> | |
117 | + | |
118 | + * jvspec.c (lang_specific_driver): Don't read spec file if | |
119 | + -fsyntax-only given. | |
120 | + | |
121 | +1999-09-22 Tom Tromey <tromey@cygnus.com> | |
122 | + | |
123 | + * lang-specs.h: Added `%(jc1)' to the jc1 spec. | |
124 | + | |
125 | +1999-08-25 Tom Tromey <tromey@cygnus.com> | |
126 | + | |
127 | + * jvspec.c (lang_specific_driver): Correctly handle --help again. | |
128 | + | |
129 | +1999-10-14 Tom Tromey <tromey@cygnus.com> | |
130 | + | |
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. | |
135 | + | |
136 | +Thu Aug 26 09:10:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
137 | + | |
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. | |
141 | + | |
142 | +Wed Aug 25 15:37:15 1999 Gregg Townsend <gmt@cs.arizona.edu> | |
143 | + | |
144 | + * verify.c (verify_jvm_instructions): Don't check instruction | |
145 | + validity beyond end of method. | |
146 | + | |
147 | +Sun Aug 22 11:07:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
148 | + | |
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. | |
155 | + | |
156 | +Thu Aug 19 10:26:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
157 | + | |
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 | |
161 | + is null. | |
162 | + (source_start_java_method): Likewise. | |
163 | + (java_method_add_stmt): Likewise. | |
164 | + | |
165 | +Wed Aug 18 13:17:15 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
166 | + | |
167 | + * class.c (emit_register_class): Removed unnecessary call to | |
168 | + start_sequence. | |
169 | + * parse.y (labeled_block_contains_loop_p): Removed unused local | |
170 | + variable. | |
171 | + | |
172 | +Tue Aug 17 22:51:44 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
173 | + | |
174 | + * parse.y (java_refold): Added prototype. | |
175 | + | |
176 | +Tue Aug 17 21:48:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
177 | + | |
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 | |
190 | + comment. | |
191 | + (patch_bc_statement): Call search_loop. Fixed comment. | |
192 | + | |
193 | +1999-08-15 Anthony Green <green@cygnus.com> | |
194 | + | |
195 | + * expr.c (java_lang_expand_expr): Mark static array data as | |
196 | + referenced. | |
197 | + | |
198 | +1999-07-25 Anthony Green <green@cygnus.com> | |
199 | + | |
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 | |
206 | + generation. | |
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. | |
216 | + | |
217 | +Thu Jul 22 12:41:12 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
218 | + | |
219 | + * check-init.c (check_init): Handle MAX_EXPR. | |
220 | + | |
221 | +1999-07-15 Andrew Haley <aph@cygnus.com> | |
222 | + | |
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 | |
227 | + is not set. | |
228 | + | |
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. | |
241 | + | |
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 | |
246 | + | |
247 | +Tue Jul 20 13:20:05 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
248 | + | |
249 | + * parse.y (resolve_and_layout): Check methods only once. | |
250 | + (resolve_qualified_expression_name): Verify thrown exceptions | |
251 | + compatibility. | |
252 | + (check_thrown_exceptions): Reject exceptions thrown in | |
253 | + initializer. Error message tuned. | |
254 | + | |
255 | +1999-07-14 Andrew Haley <aph@cygnus.com> | |
256 | + | |
257 | + * expr.c (expand_expr): Do not return the last statement in a | |
258 | + block as the block's value. | |
259 | + | |
260 | +Sat Jul 3 22:26:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
261 | + | |
262 | + * expr.c (force_evaluation_order): Save the COMPOUND_EXPR'ed | |
263 | + CALL_EXPR, to avoid order of evaluation changes. | |
264 | + | |
265 | +Fri Jul 2 17:44:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
266 | + | |
267 | + * parse.y (qualify_ambiguous_name): Do not use | |
268 | + IDENTIFIER_LOCAL_VALUE when name is a STRING_CST. | |
269 | + | |
270 | +Thu Jul 1 23:31:16 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
271 | + | |
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. | |
277 | + | |
278 | +Wed Jun 30 17:27:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
279 | + | |
280 | + * parse.y (patch_invoke): Resolve unresolved invoked method | |
281 | + returned type. | |
282 | + (qualify_ambiguous_name): STRING_CST to qualify expression for | |
283 | + type name resolution. | |
284 | + | |
285 | +1999-06-24 Andrew Haley <aph@cygnus.com> | |
286 | + | |
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. | |
290 | + | |
291 | + | |
292 | +====================================================================== | |
293 | + | |
294 | + | |
295 | + | |
296 | + | |
297 | Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) | |
298 | ||
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 | |
303 | @@ -643,6 +643,8 @@ | |
304 | case GE_EXPR: | |
305 | case LT_EXPR: | |
306 | case LE_EXPR: | |
307 | + case MAX_EXPR: | |
308 | + case MIN_EXPR: | |
309 | case ARRAY_REF: | |
310 | binop: | |
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 @@ | |
316 | ||
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 @@ | |
333 | tree cl; | |
334 | { | |
335 | tree method; | |
336 | + tree type_methods = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class)); | |
337 | ||
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; ) | |
343 | { | |
344 | if (! TREE_ASM_WRITTEN (method) && DECL_SAVED_INSNS (method) != 0) | |
345 | { | |
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; | |
353 | + continue; | |
354 | } | |
355 | } | |
356 | + method = TREE_CHAIN (method); | |
357 | } | |
358 | ||
359 | + current_function_decl = NULL_TREE; | |
360 | make_class_data (current_class); | |
361 | register_class (); | |
362 | rest_of_decl_compilation (TYPE_NAME (current_class), (char*) 0, 1, 0); | |
363 | @@ -1721,7 +1730,6 @@ | |
364 | tree init_decl; | |
365 | tree t; | |
366 | ||
367 | - start_sequence (); | |
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 | |
375 | @@ -365,6 +365,11 @@ | |
376 | tree soft_lookupinterfacemethod_node; | |
377 | tree soft_fmod_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; | |
383 | + | |
384 | ||
385 | /* Build (and pushdecl) a "promoted type" for all standard | |
386 | types shorter than int. */ | |
387 | @@ -812,6 +817,26 @@ | |
388 | BUILT_IN_FMOD, "fmodf"); | |
389 | #endif | |
390 | ||
391 | + soft_idiv_node | |
392 | + = builtin_function ("_Jv_divI", | |
393 | + build_function_type (int_type_node, t), | |
394 | + NOT_BUILT_IN, NULL_PTR); | |
395 | + | |
396 | + soft_irem_node | |
397 | + = builtin_function ("_Jv_remI", | |
398 | + build_function_type (int_type_node, t), | |
399 | + NOT_BUILT_IN, NULL_PTR); | |
400 | + | |
401 | + soft_ldiv_node | |
402 | + = builtin_function ("_Jv_divJ", | |
403 | + build_function_type (long_type_node, t), | |
404 | + NOT_BUILT_IN, NULL_PTR); | |
405 | + | |
406 | + soft_lrem_node | |
407 | + = builtin_function ("_Jv_remJ", | |
408 | + build_function_type (long_type_node, t), | |
409 | + NOT_BUILT_IN, NULL_PTR); | |
410 | + | |
411 | init_class_processing (); | |
412 | } | |
413 | ||
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); | |
420 | } | |
421 | ||
422 | + | |
423 | +tree | |
424 | +build_java_soft_divmod (op, type, op1, op2) | |
425 | + enum tree_code op; | |
426 | + tree type, op1, op2; | |
427 | +{ | |
428 | + tree call = NULL; | |
429 | + tree arg1 = convert (type, op1); | |
430 | + tree arg2 = convert (type, op2); | |
431 | + | |
432 | + if (type == int_type_node) | |
433 | + { | |
434 | + switch (op) | |
435 | + { | |
436 | + case TRUNC_DIV_EXPR: | |
437 | + call = soft_idiv_node; | |
438 | + break; | |
439 | + case TRUNC_MOD_EXPR: | |
440 | + call = soft_irem_node; | |
441 | + break; | |
442 | + } | |
443 | + } | |
444 | + else if (type == long_type_node) | |
445 | + { | |
446 | + switch (op) | |
447 | + { | |
448 | + case TRUNC_DIV_EXPR: | |
449 | + call = soft_ldiv_node; | |
450 | + break; | |
451 | + case TRUNC_MOD_EXPR: | |
452 | + call = soft_lrem_node; | |
453 | + break; | |
454 | + } | |
455 | + } | |
456 | + | |
457 | + if (! call) | |
458 | + fatal ("Internal compiler error in build_java_soft_divmod"); | |
459 | + | |
460 | + call = build (CALL_EXPR, type, | |
461 | + build_address_of (call), | |
462 | + tree_cons (NULL_TREE, arg1, | |
463 | + build_tree_list (NULL_TREE, arg2)), | |
464 | + NULL_TREE); | |
465 | + | |
466 | + return call; | |
467 | +} | |
468 | + | |
469 | tree | |
470 | build_java_binop (op, type, arg1, arg2) | |
471 | enum tree_code op; | |
472 | @@ -1100,10 +1147,11 @@ | |
473 | integer_zero_node)); | |
474 | return fold (build (COND_EXPR, int_type_node, | |
475 | ifexp1, integer_negative_one_node, second_compare)); | |
476 | - } | |
477 | - | |
478 | + } | |
479 | + case TRUNC_DIV_EXPR: | |
480 | case TRUNC_MOD_EXPR: | |
481 | - if (TREE_CODE (type) == REAL_TYPE) | |
482 | + if (TREE_CODE (type) == REAL_TYPE | |
483 | + && op == TRUNC_MOD_EXPR) | |
484 | { | |
485 | tree call; | |
486 | if (type != double_type_node) | |
487 | @@ -1120,6 +1168,12 @@ | |
488 | call = convert (type, call); | |
489 | return call; | |
490 | } | |
491 | + | |
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); | |
496 | + | |
497 | break; | |
498 | default: ; | |
499 | } | |
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); | |
506 | init = init_decl; | |
507 | } | |
508 | @@ -1895,7 +1950,6 @@ | |
509 | { | |
510 | tree local; | |
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 @@ | |
517 | emit_queue (); | |
518 | body = TREE_OPERAND (body, 1); | |
519 | } | |
520 | - to_return = expand_expr (body, target, tmode, modifier); | |
521 | + expand_expr (body, const0_rtx, VOIDmode, 0); | |
522 | + emit_queue (); | |
523 | poplevel (1, 1, 0); | |
524 | expand_end_bindings (getdecls (), 1, 0); | |
525 | - return to_return; | |
526 | + return const0_rtx; | |
527 | } | |
528 | break; | |
529 | ||
530 | @@ -2578,6 +2633,10 @@ | |
531 | ||
532 | We fix this by using save_expr. This forces the sub-operand to be | |
533 | copied into a fresh virtual register, | |
534 | + | |
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. | |
538 | */ | |
539 | ||
540 | tree | |
541 | @@ -2593,19 +2652,30 @@ | |
542 | } | |
543 | else if (TREE_CODE (node) == CALL_EXPR || TREE_CODE (node) == NEW_CLASS_EXPR) | |
544 | { | |
545 | - tree last_side_effecting_arg = NULL_TREE; | |
546 | - tree arg = TREE_OPERAND (node, 1); | |
547 | - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg)) | |
548 | + tree arg, cmp; | |
549 | + | |
550 | + if (!TREE_OPERAND (node, 1)) | |
551 | + return node; | |
552 | + | |
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)) | |
556 | { | |
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; | |
563 | } | |
564 | - arg = TREE_OPERAND (node, 1); | |
565 | - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg)) | |
566 | + | |
567 | + if (cmp && TREE_CODE (cmp) == COMPOUND_EXPR) | |
568 | + TREE_SIDE_EFFECTS (cmp) = 1; | |
569 | + | |
570 | + if (cmp) | |
571 | { | |
572 | - if (arg == last_side_effecting_arg) | |
573 | - break; | |
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; | |
578 | + node = cmp; | |
579 | } | |
580 | } | |
581 | return node; | |
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 | |
587 | @@ -33,6 +33,8 @@ | |
588 | #include "java-tree.h" | |
589 | #include "java-opcodes.h" | |
590 | ||
591 | +#include "version.c" | |
592 | + | |
593 | /* The output file. */ | |
594 | FILE *out = NULL; | |
595 | ||
596 | @@ -88,6 +90,11 @@ | |
597 | #define METHOD_IS_FINAL(Class, Method) \ | |
598 | (((Class) & ACC_FINAL) || ((Method) & (ACC_FINAL | ACC_PRIVATE))) | |
599 | ||
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) | |
604 | + | |
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. */ | |
607 | struct method_name | |
608 | @@ -100,11 +107,15 @@ | |
609 | /* List of method names we've seen. */ | |
610 | static struct method_name *method_name_list; | |
611 | ||
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)); | |
625 | ||
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() \ | |
630 | if (field_pass) \ | |
631 | { \ | |
632 | - if (out) \ | |
633 | + if (out && ! stubs) \ | |
634 | print_field_info (out, jcf, current_field_name, \ | |
635 | current_field_signature, \ | |
636 | current_field_flags); \ | |
637 | } \ | |
638 | else \ | |
639 | - add_class_decl (out, jcf, current_field_signature); | |
640 | + if (! stubs) add_class_decl (out, jcf, current_field_signature); | |
641 | ||
642 | #define HANDLE_CONSTANTVALUE(VALUEINDEX) current_field_value = (VALUEINDEX) | |
643 | ||
644 | @@ -151,14 +162,14 @@ | |
645 | print_method_info (out, jcf, NAME, SIGNATURE, ACCESS_FLAGS); \ | |
646 | } \ | |
647 | else \ | |
648 | - add_class_decl (out, jcf, SIGNATURE); | |
649 | + if (! stubs) add_class_decl (out, jcf, SIGNATURE); | |
650 | ||
651 | #define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \ | |
652 | if (out && method_declared) decompile_method (out, jcf, CODE_LENGTH); | |
653 | ||
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); | |
658 | ||
659 | #include "jcf-reader.c" | |
660 | ||
661 | @@ -562,24 +573,36 @@ | |
662 | return; | |
663 | } | |
664 | ||
665 | - method_printed = 1; | |
666 | - generate_access (stream, flags); | |
667 | - | |
668 | - fputs (" ", out); | |
669 | - if ((flags & ACC_STATIC)) | |
670 | - fputs ("static ", out); | |
671 | - else if (! METHOD_IS_FINAL (jcf->access_flags, flags)) | |
672 | + if (! stubs) | |
673 | { | |
674 | - /* Don't print `virtual' if we have a constructor. */ | |
675 | - if (! is_init) | |
676 | - fputs ("virtual ", out); | |
677 | - } | |
678 | - print_c_decl (out, jcf, name_index, sig_index, is_init, override); | |
679 | + method_printed = 1; | |
680 | ||
681 | - if ((flags & ACC_ABSTRACT)) | |
682 | - fputs (" = 0", out); | |
683 | + generate_access (stream, flags); | |
684 | + | |
685 | + fputs (" ", out); | |
686 | + if ((flags & ACC_STATIC)) | |
687 | + fputs ("static ", out); | |
688 | + else if (! METHOD_IS_FINAL (jcf->access_flags, flags)) | |
689 | + { | |
690 | + /* Don't print `virtual' if we have a constructor. */ | |
691 | + if (! is_init) | |
692 | + fputs ("virtual ", out); | |
693 | + } | |
694 | + print_c_decl (out, jcf, name_index, sig_index, is_init, override); | |
695 | + | |
696 | + if ((flags & ACC_ABSTRACT)) | |
697 | + fputs (" = 0", out); | |
698 | + else | |
699 | + method_declared = 1; | |
700 | + } | |
701 | else | |
702 | - method_declared = 1; | |
703 | + { | |
704 | + if (METHOD_IS_NATIVE(flags)) | |
705 | + { | |
706 | + method_printed = 1; | |
707 | + print_stub (out, jcf, name_index, sig_index, is_init, override); | |
708 | + } | |
709 | + } | |
710 | } | |
711 | ||
712 | /* Try to decompile a method body. Right now we just try to handle a | |
713 | @@ -653,10 +676,13 @@ | |
714 | int *need_space; | |
715 | { | |
716 | const char *ctype; | |
717 | + int array_depth = 0; | |
718 | ||
719 | switch (signature[0]) | |
720 | { | |
721 | case '[': | |
722 | + /* More spaghetti. */ | |
723 | + array_loop: | |
724 | for (signature++; (signature < limit | |
725 | && *signature >= '0' | |
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; | |
732 | + case '[': | |
733 | + /* We have a nested array. */ | |
734 | + ++array_depth; | |
735 | + fputs ("JArray<", stream); | |
736 | + goto array_loop; | |
737 | + | |
738 | case 'L': | |
739 | - /* We have to generate a reference to JArray here, | |
740 | - so that our output matches what the compiler | |
741 | - does. */ | |
742 | + /* We have to generate a reference to JArray here, so that | |
743 | + our output matches what the compiler does. */ | |
744 | ++signature; | |
745 | - fputs ("JArray<", stream); | |
746 | + fputs ("JArray<", stream); | |
747 | while (signature < limit && *signature != ';') | |
748 | { | |
749 | int ch = UTF8_GET (signature, limit); | |
750 | @@ -711,6 +741,8 @@ | |
751 | case 'Z': ctype = "jboolean"; goto printit; | |
752 | case 'V': ctype = "void"; goto printit; | |
753 | case 'L': | |
754 | + /* Print a leading "::" so we look in the right namespace. */ | |
755 | + fputs ("::", stream); | |
756 | ++signature; | |
757 | while (*signature && *signature != ';') | |
758 | { | |
759 | @@ -737,6 +769,9 @@ | |
760 | break; | |
761 | } | |
762 | ||
763 | + while (array_depth-- > 0) | |
764 | + fputs ("> *", stream); | |
765 | + | |
766 | return signature; | |
767 | } | |
768 | ||
769 | @@ -791,40 +826,121 @@ | |
770 | /* Now print the name of the thing. */ | |
771 | if (need_space) | |
772 | fputs (" ", stream); | |
773 | - if (name_override) | |
774 | - fputs (name_override, stream); | |
775 | - else if (name_index) | |
776 | - { | |
777 | - /* Declare constructors specially. */ | |
778 | - if (is_init) | |
779 | - print_base_classname (stream, jcf, jcf->this_class); | |
780 | - else | |
781 | - print_name (stream, jcf, name_index); | |
782 | - } | |
783 | + print_full_cxx_name (stream, jcf, name_index, | |
784 | + signature_index, is_init, name_override); | |
785 | + } | |
786 | +} | |
787 | ||
788 | - if (is_method) | |
789 | +// Print the unqualified method name followed by the signature. | |
790 | +static void | |
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) | |
795 | +{ | |
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; | |
803 | + | |
804 | + if (name_override) | |
805 | + fputs (name_override, stream); | |
806 | + else if (name_index) | |
807 | + { | |
808 | + /* Declare constructors specially. */ | |
809 | + if (is_init) | |
810 | + print_base_classname (stream, jcf, jcf->this_class); | |
811 | + else | |
812 | + print_name (stream, jcf, name_index); | |
813 | + } | |
814 | + | |
815 | + if (is_method) | |
816 | + { | |
817 | + /* Have a method or a constructor. Print signature pieces | |
818 | + until done. */ | |
819 | + fputs (" (", stream); | |
820 | + str = str0 + 1; | |
821 | + while (str < limit && *str != ')') | |
822 | { | |
823 | - /* Have a method or a constructor. Print signature pieces | |
824 | - until done. */ | |
825 | - fputs (" (", stream); | |
826 | - str = str0 + 1; | |
827 | - while (str < limit && *str != ')') | |
828 | + next = decode_signature_piece (stream, str, limit, &need_space); | |
829 | + if (! next) | |
830 | { | |
831 | - next = decode_signature_piece (stream, str, limit, &need_space); | |
832 | - if (! next) | |
833 | - { | |
834 | - fprintf (stderr, "unparseable signature: `%s'\n", str0); | |
835 | - found_error = 1; | |
836 | - return; | |
837 | - } | |
838 | + fprintf (stderr, "unparseable signature: `%s'\n", str0); | |
839 | + found_error = 1; | |
840 | + return; | |
841 | + } | |
842 | + | |
843 | + if (next < limit && *next != ')') | |
844 | + fputs (", ", stream); | |
845 | + str = next; | |
846 | + } | |
847 | + | |
848 | + fputs (")", stream); | |
849 | + } | |
850 | +} | |
851 | + | |
852 | +static void | |
853 | +DEFUN(print_stub, (stream, jcf, name_index, signature_index, is_init, | |
854 | + name_override), | |
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) | |
858 | +{ | |
859 | + if (JPOOL_TAG (jcf, signature_index) != CONSTANT_Utf8) | |
860 | + { | |
861 | + fprintf (stream, "<not a UTF8 constant>"); | |
862 | + found_error = 1; | |
863 | + } | |
864 | + else | |
865 | + { | |
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; | |
873 | ||
874 | - if (next < limit && *next != ')') | |
875 | - fputs (", ", stream); | |
876 | - str = next; | |
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 | |
879 | + constructor. */ | |
880 | + if (is_method && ! is_init) | |
881 | + { | |
882 | + while (str < limit) | |
883 | + { | |
884 | + int ch = *str++; | |
885 | + if (ch == ')') | |
886 | + break; | |
887 | } | |
888 | + } | |
889 | ||
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) | |
894 | + { | |
895 | + next = decode_signature_piece (stream, str, limit, &need_space); | |
896 | + if (! next) | |
897 | + { | |
898 | + fprintf (stderr, "unparseable signature: `%s'\n", str0); | |
899 | + found_error = 1; | |
900 | + return; | |
901 | + } | |
902 | } | |
903 | + | |
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); | |
915 | } | |
916 | } | |
917 | ||
918 | @@ -846,7 +962,7 @@ | |
919 | static int | |
920 | print_cxx_classname (stream, prefix, jcf, index) | |
921 | FILE *stream; | |
922 | - char *prefix; | |
923 | + const char *prefix; | |
924 | JCF *jcf; | |
925 | int index; | |
926 | { | |
927 | @@ -865,6 +981,10 @@ | |
928 | return 0; | |
929 | ||
930 | fputs (prefix, stream); | |
931 | + | |
932 | + /* Print a leading "::" so we look in the right namespace. */ | |
933 | + fputs ("::", stream); | |
934 | + | |
935 | while (s < limit) | |
936 | { | |
937 | c = UTF8_GET (s, limit); | |
938 | @@ -1071,7 +1191,10 @@ | |
939 | { | |
940 | for (i = 0; i < depth; ++i) | |
941 | fputc (' ', out); | |
942 | - fputs ("};\n", out); | |
943 | + fputs ("}\n", out); | |
944 | + /* Only print a `;' when printing a class. C++ is evil. */ | |
945 | + if (name->is_class) | |
946 | + fputs (";", out); | |
947 | } | |
948 | ||
949 | free (name->name); | |
950 | @@ -1103,7 +1226,7 @@ | |
951 | /* If we see an array, then we include the array header. */ | |
952 | if (s[i] == '[') | |
953 | { | |
954 | - print_include (out, "java-array", -1); | |
955 | + print_include (out, "gcj/array", -1); | |
956 | continue; | |
957 | } | |
958 | ||
959 | @@ -1204,30 +1327,49 @@ | |
960 | jcf_parse_class (jcf); | |
961 | ||
962 | if (written_class_count++ == 0 && out) | |
963 | - fputs ("// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-\n\n", | |
964 | - out); | |
965 | + if (! stubs) | |
966 | + fputs ("// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-\n\n", | |
967 | + out); | |
968 | + else | |
969 | + { | |
970 | + fputs ("// This file was created by `gcjh -stubs'. It is -*- c++ -*-. | |
971 | +// | |
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); | |
976 | + } | |
977 | ||
978 | if (out) | |
979 | { | |
980 | - print_mangled_classname (out, jcf, "#ifndef __", jcf->this_class); | |
981 | - fprintf (out, "__\n"); | |
982 | - | |
983 | - print_mangled_classname (out, jcf, "#define __", jcf->this_class); | |
984 | - fprintf (out, "__\n\n"); | |
985 | - | |
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"); | |
990 | - } | |
991 | - | |
992 | - if (jcf->super_class && out) | |
993 | - { | |
994 | - int super_length; | |
995 | - unsigned char *supername = super_class_name (jcf, &super_length); | |
996 | - | |
997 | - fputs ("\n", out); | |
998 | - print_include (out, supername, super_length); | |
999 | + if (! stubs) | |
1000 | + { | |
1001 | + print_mangled_classname (out, jcf, "#ifndef __", jcf->this_class); | |
1002 | + fprintf (out, "__\n"); | |
1003 | + | |
1004 | + print_mangled_classname (out, jcf, "#define __", jcf->this_class); | |
1005 | + fprintf (out, "__\n\n"); | |
1006 | + | |
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"); | |
1011 | + | |
1012 | + if (jcf->super_class) | |
1013 | + { | |
1014 | + int super_length; | |
1015 | + unsigned char *supername = super_class_name (jcf, &super_length); | |
1016 | + | |
1017 | + fputs ("\n", out); | |
1018 | + print_include (out, supername, super_length); | |
1019 | + } | |
1020 | + } | |
1021 | + else | |
1022 | + { | |
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); | |
1026 | + } | |
1027 | } | |
1028 | ||
1029 | /* We want to parse the methods first. But we need to find where | |
1030 | @@ -1246,31 +1388,37 @@ | |
1031 | if (out) | |
1032 | { | |
1033 | fputs ("\n", out); | |
1034 | - print_class_decls (out, jcf, jcf->this_class); | |
1035 | + | |
1036 | + if (! stubs) | |
1037 | + print_class_decls (out, jcf, jcf->this_class); | |
1038 | ||
1039 | for (i = 0; i < prepend_count; ++i) | |
1040 | fprintf (out, "%s\n", prepend_specs[i]); | |
1041 | if (prepend_count > 0) | |
1042 | fputc ('\n', out); | |
1043 | - } | |
1044 | - | |
1045 | - if (out && ! print_cxx_classname (out, "class ", jcf, jcf->this_class)) | |
1046 | - { | |
1047 | - fprintf (stderr, "class is of array type\n"); | |
1048 | - found_error = 1; | |
1049 | - return; | |
1050 | - } | |
1051 | - if (out && jcf->super_class) | |
1052 | - { | |
1053 | - if (! print_cxx_classname (out, " : public ", jcf, jcf->super_class)) | |
1054 | + | |
1055 | + if (! stubs) | |
1056 | { | |
1057 | - fprintf (stderr, "base class is of array type\n"); | |
1058 | - found_error = 1; | |
1059 | - return; | |
1060 | + if (! print_cxx_classname (out, "class ", jcf, jcf->this_class)) | |
1061 | + { | |
1062 | + fprintf (stderr, "class is of array type\n"); | |
1063 | + found_error = 1; | |
1064 | + return; | |
1065 | + } | |
1066 | + if (jcf->super_class) | |
1067 | + { | |
1068 | + if (! print_cxx_classname (out, " : public ", | |
1069 | + jcf, jcf->super_class)) | |
1070 | + { | |
1071 | + fprintf (stderr, "base class is of array type\n"); | |
1072 | + found_error = 1; | |
1073 | + return; | |
1074 | + } | |
1075 | + } | |
1076 | + | |
1077 | + fputs ("\n{\n", out); | |
1078 | } | |
1079 | } | |
1080 | - if (out) | |
1081 | - fputs ("\n{\n", out); | |
1082 | ||
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]); | |
1088 | ||
1089 | - fputs ("};\n", out); | |
1090 | + if (! stubs) | |
1091 | + fputs ("};\n", out); | |
1092 | ||
1093 | if (append_count > 0) | |
1094 | fputc ('\n', out); | |
1095 | for (i = 0; i < append_count; ++i) | |
1096 | fprintf (out, "%s\n", append_specs[i]); | |
1097 | ||
1098 | - print_mangled_classname (out, jcf, "\n#endif /* __", jcf->this_class); | |
1099 | - fprintf (out, "__ */\n"); | |
1100 | + if (!stubs) | |
1101 | + { | |
1102 | + print_mangled_classname (out, jcf, | |
1103 | + "\n#endif /* __", jcf->this_class); | |
1104 | + fprintf (out, "__ */\n"); | |
1105 | + } | |
1106 | } | |
1107 | } | |
1108 | ||
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 @@ | |
1118 | version () | |
1119 | { | |
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"); | |
1127 | exit (0); | |
1128 | @@ -1548,7 +1702,7 @@ | |
1129 | { | |
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); | |
1139 | } | |
1140 | } | |
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) | |
1146 | { | |
1147 | @@ -1601,10 +1756,9 @@ | |
1148 | ||
1149 | /* TODO: | |
1150 | ||
1151 | - * Do whatever the javah -stubs flag does. | |
1152 | - | |
1153 | * Emit "structure forward declarations" when needed. | |
1154 | ||
1155 | * Generate C headers, like javah | |
1156 | ||
1157 | */ | |
1158 | + | |
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 | |
1164 | @@ -141,6 +141,9 @@ | |
1165 | extern int flag_not_overriding; | |
1166 | extern int flag_static_local_jdk1_1; | |
1167 | ||
1168 | +/* When non zero, call a library routine to do integer divisions. */ | |
1169 | +extern int flag_use_divide_subroutine; | |
1170 | + | |
1171 | /* The Java .class file that provides main_class; the main input file. */ | |
1172 | extern struct JCF *current_jcf; | |
1173 | ||
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; | |
1182 | ||
1183 | extern tree access_flags_type_node; | |
1184 | ||
1185 | @@ -544,6 +551,7 @@ | |
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 | |
1197 | @@ -748,6 +748,8 @@ | |
1198 | /* Mark the file as parsed */ | |
1199 | HAS_BEEN_ALREADY_PARSED_P (file) = 1; | |
1200 | ||
1201 | + jcf_dependency_add_file (input_filename, 0); | |
1202 | + | |
1203 | lang_init_source (1); /* Error msgs have no method prototypes */ | |
1204 | ||
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 | |
1209 | @@ -186,6 +186,9 @@ | |
1210 | struct jcf_block *label; | |
1211 | }; | |
1212 | ||
1213 | +#define RELOCATION_VALUE_0 ((HOST_WIDE_INT)0) | |
1214 | +#define RELOCATION_VALUE_1 ((HOST_WIDE_INT)1) | |
1215 | + | |
1216 | /* State for single catch clause. */ | |
1217 | ||
1218 | struct jcf_handler | |
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 *)); | |
1228 | ||
1229 | - | |
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)) | |
1238 | ||
1239 | -\f | |
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)) | |
1246 | + | |
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. */ | |
1250 | @@ -665,7 +680,7 @@ | |
1251 | ||
1252 | static void | |
1253 | push_constant1 (index, state) | |
1254 | - int index; | |
1255 | + HOST_WIDE_INT index; | |
1256 | struct jcf_partial *state; | |
1257 | { | |
1258 | RESERVE (3); | |
1259 | @@ -686,7 +701,7 @@ | |
1260 | ||
1261 | static void | |
1262 | push_constant2 (index, state) | |
1263 | - int index; | |
1264 | + HOST_WIDE_INT index; | |
1265 | struct jcf_partial *state; | |
1266 | { | |
1267 | RESERVE (3); | |
1268 | @@ -717,7 +732,8 @@ | |
1269 | } | |
1270 | else | |
1271 | { | |
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); | |
1276 | } | |
1277 | } | |
1278 | @@ -730,7 +746,7 @@ | |
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)); | |
1284 | } | |
1285 | ||
1286 | /* Find or allocate a constant pool entry for the given VALUE. | |
1287 | @@ -745,7 +761,7 @@ | |
1288 | { | |
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)); | |
1293 | else | |
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) | |
1298 | { | |
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, | |
1302 | + (jword)words[0]); | |
1303 | } | |
1304 | else | |
1305 | { | |
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] & | |
1311 | + 0xFFFFFFFF), | |
1312 | + (jword)(words[FLOAT_WORDS_BIG_ENDIAN] & | |
1313 | + 0xFFFFFFFF)); | |
1314 | } | |
1315 | } | |
1316 | else if (TREE_CODE (value) == STRING_CST) | |
1317 | @@ -906,7 +925,7 @@ | |
1318 | static void | |
1319 | emit_iinc (var, value, state) | |
1320 | tree var; | |
1321 | - int value; | |
1322 | + HOST_WIDE_INT value; | |
1323 | struct jcf_partial *state; | |
1324 | { | |
1325 | int slot = DECL_LOCAL_INDEX (var); | |
1326 | @@ -1012,7 +1031,7 @@ | |
1327 | struct jcf_block *label; | |
1328 | struct jcf_partial *state; | |
1329 | { | |
1330 | - emit_reloc (0, BLOCK_START_RELOC, label, state); | |
1331 | + emit_reloc (RELOCATION_VALUE_0, BLOCK_START_RELOC, label, state); | |
1332 | } | |
1333 | ||
1334 | /* Similar to emit_switch_reloc, | |
1335 | @@ -1041,8 +1060,8 @@ | |
1336 | struct jcf_partial *state; | |
1337 | { | |
1338 | OP1 (opcode); | |
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); | |
1343 | } | |
1344 | ||
1345 | static void | |
1346 | @@ -1051,8 +1070,8 @@ | |
1347 | struct jcf_partial *state; | |
1348 | { | |
1349 | OP1 (OPCODE_goto); | |
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); | |
1354 | } | |
1355 | ||
1356 | static void | |
1357 | @@ -1061,8 +1080,8 @@ | |
1358 | struct jcf_partial *state; | |
1359 | { | |
1360 | OP1 (OPCODE_jsr); | |
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); | |
1365 | } | |
1366 | ||
1367 | /* Generate code to evaluate EXP. If the result is true, | |
1368 | @@ -1690,7 +1709,8 @@ | |
1369 | int index = 0; | |
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 @@ | |
1389 | if (size == 1) | |
1390 | push_int_const (value, state); | |
1391 | else | |
1392 | - push_long_const (value, value >= 0 ? 0 : -1, state); | |
1393 | + push_long_const (value, (HOST_WIDE_INT)(value >= 0 ? 0 : -1), state); | |
1394 | NOTE_PUSH (size); | |
1395 | emit_binop (OPCODE_iadd + adjust_typed_op (type, 3), type, state); | |
1396 | if (target != IGNORE_TARGET && ! post_op) | |
1397 | @@ -2775,7 +2796,7 @@ | |
1398 | } | |
1399 | fields_count++; | |
1400 | } | |
1401 | - ptr = fields_count_ptr; PUT2 (fields_count); | |
1402 | + ptr = fields_count_ptr; UNSAFE_PUT2 (fields_count); | |
1403 | ||
1404 | ptr = methods_count_ptr = append_chunk (NULL, 2, state); | |
1405 | PUT2 (0); | |
1406 | @@ -2841,10 +2862,10 @@ | |
1407 | code_attributes_count++; | |
1408 | i += 8 + 10 * state->lvar_count; | |
1409 | } | |
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); | |
1418 | ||
1419 | /* Emit the exception table. */ | |
1420 | ptr = append_chunk (NULL, 2 + 8 * state->num_handlers, state); | |
1421 | @@ -2934,7 +2955,7 @@ | |
1422 | methods_count++; | |
1423 | current_function_decl = save_function; | |
1424 | } | |
1425 | - ptr = methods_count_ptr; PUT2 (methods_count); | |
1426 | + ptr = methods_count_ptr; UNSAFE_PUT2 (methods_count); | |
1427 | ||
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 | |
1435 | @@ -1,5 +1,5 @@ | |
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. | |
1439 | ||
1440 | This file is part of GNU CC. | |
1441 | ||
1442 | @@ -79,19 +79,37 @@ | |
1443 | (void (*) ()) OBSTACK_CHUNK_FREE); | |
1444 | } | |
1445 | ||
1446 | +static void | |
1447 | +usage (const char *name) | |
1448 | +{ | |
1449 | + fprintf (stderr, "Usage: %s [OPTIONS]... CLASSNAME [OUTFILE]\n", name); | |
1450 | + exit (1); | |
1451 | +} | |
1452 | + | |
1453 | int | |
1454 | main (int argc, const char **argv) | |
1455 | { | |
1456 | const char *classname; | |
1457 | FILE *stream; | |
1458 | char *mangled_classname; | |
1459 | + int i, last_arg; | |
1460 | ||
1461 | - if (argc < 2 || argc > 3) | |
1462 | + if (argc < 2) | |
1463 | + usage (argv[0]); | |
1464 | + for (i = 1; i < argc; ++i) | |
1465 | { | |
1466 | - fprintf (stderr, "Usage: %s CLASSNAME [OUTFILE]\n", argv[0]); | |
1467 | - exit(-1); | |
1468 | + if (! strncmp (argv[i], "-D", 2)) | |
1469 | + { | |
1470 | + /* Handled later. */ | |
1471 | + } | |
1472 | + else | |
1473 | + break; | |
1474 | } | |
1475 | ||
1476 | + if (i < argc - 2 || i == argc) | |
1477 | + usage (argv[0]); | |
1478 | + last_arg = i; | |
1479 | + | |
1480 | classname = argv[1]; | |
1481 | ||
1482 | gcc_obstack_init (&name_obstack); | |
1483 | @@ -99,23 +117,46 @@ | |
1484 | obstack_1grow (&name_obstack, '\0'); | |
1485 | mangled_classname = obstack_finish (&name_obstack); | |
1486 | ||
1487 | - if (argc > 2 && strcmp (argv[2], "-") != 0) | |
1488 | + if (i < argc - 1 && strcmp (argv[i + 1], "-") != 0) | |
1489 | { | |
1490 | - const char *outfile = argv[2]; | |
1491 | + const char *outfile = argv[i + 1]; | |
1492 | stream = fopen (outfile, "w"); | |
1493 | if (stream == NULL) | |
1494 | { | |
1495 | fprintf (stderr, "%s: Cannot open output file: %s\n", | |
1496 | argv[0], outfile); | |
1497 | - exit (-1); | |
1498 | + exit (1); | |
1499 | } | |
1500 | } | |
1501 | else | |
1502 | stream = stdout; | |
1503 | + | |
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) | |
1509 | + { | |
1510 | + const char *p; | |
1511 | + fprintf (stream, " \""); | |
1512 | + for (p = &argv[i][2]; *p; ++p) | |
1513 | + { | |
1514 | + if (! isascii (*p)) | |
1515 | + fprintf (stream, "\\%o", *p); | |
1516 | + else if (*p == '\\' || *p == '"') | |
1517 | + fprintf (stream, "\\%c", *p); | |
1518 | + else | |
1519 | + putc (*p, stream); | |
1520 | + } | |
1521 | + fprintf (stream, "\",\n"); | |
1522 | + } | |
1523 | + fprintf (stream, " 0\n};\n\n"); | |
1524 | + | |
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"); | |
1533 | @@ -123,7 +164,7 @@ | |
1534 | { | |
1535 | fprintf (stderr, "%s: Failed to close output file %s\n", | |
1536 | argv[0], argv[2]); | |
1537 | - exit (-1); | |
1538 | + exit (1); | |
1539 | } | |
1540 | return 0; | |
1541 | } | |
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 | |
1546 | @@ -54,7 +54,7 @@ | |
1547 | #define COMBINE_INPUTS 0 | |
1548 | ||
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*}\ | |
1554 | %{g*} %{O*} \ | |
1555 | @@ -167,6 +167,9 @@ | |
1556 | int saw_O = 0; | |
1557 | int saw_g = 0; | |
1558 | ||
1559 | + /* Saw a `-D' option. */ | |
1560 | + int saw_D = 0; | |
1561 | + | |
1562 | /* An array used to flag each argument that needs a bit set for | |
1563 | LANGSPEC, MATHLIB, WITHLIBC, or GCLIB. */ | |
1564 | int *args; | |
1565 | @@ -186,6 +189,9 @@ | |
1566 | /* Non-zero if linking is supposed to happen. */ | |
1567 | int will_link = 1; | |
1568 | ||
1569 | + /* Non-zero if we want to find the spec file. */ | |
1570 | + int want_spec_file = 1; | |
1571 | + | |
1572 | /* The argument we use to specify the spec file. */ | |
1573 | char *spec_file = NULL; | |
1574 | ||
1575 | @@ -224,7 +230,7 @@ | |
1576 | added--; | |
1577 | } | |
1578 | else if (strcmp (argv[i], "-fhelp") == 0) | |
1579 | - will_link = 0; | |
1580 | + want_spec_file = 0; | |
1581 | else if (strcmp (argv[i], "-v") == 0) | |
1582 | { | |
1583 | saw_verbose_flag = 1; | |
1584 | @@ -240,6 +246,7 @@ | |
1585 | else if (strcmp (argv[i], "-C") == 0) | |
1586 | { | |
1587 | saw_C = 1; | |
1588 | + want_spec_file = 0; | |
1589 | #if COMBINE_INPUTS | |
1590 | combine_inputs = 1; | |
1591 | #endif | |
1592 | @@ -248,6 +255,8 @@ | |
1593 | library = 0; | |
1594 | will_link = 0; | |
1595 | } | |
1596 | + else if (argv[i][1] == 'D') | |
1597 | + saw_D = 1; | |
1598 | else if (argv[i][1] == 'g') | |
1599 | saw_g = 1; | |
1600 | else if (argv[i][1] == 'O') | |
1601 | @@ -288,6 +297,7 @@ | |
1602 | else if (strcmp (argv[i], "-fsyntax-only") == 0 | |
1603 | || strcmp (argv[i], "--syntax-only") == 0) | |
1604 | { | |
1605 | + want_spec_file = 0; | |
1606 | library = 0; | |
1607 | will_link = 0; | |
1608 | continue; | |
1609 | @@ -331,6 +341,9 @@ | |
1610 | if (quote) | |
1611 | (*fn) ("argument to `%s' missing\n", quote); | |
1612 | ||
1613 | + if (saw_D && ! main_class_name) | |
1614 | + fatal ("can't specify `-D' without `--main'\n"); | |
1615 | + | |
1616 | num_args = argc + added; | |
1617 | if (saw_C) | |
1618 | { | |
1619 | @@ -376,8 +389,7 @@ | |
1620 | } | |
1621 | if (saw_g + saw_O == 0) | |
1622 | num_args++; | |
1623 | - if (will_link) | |
1624 | - num_args++; | |
1625 | + num_args++; | |
1626 | arglist = (char **) xmalloc ((num_args + 1) * sizeof (char *)); | |
1627 | ||
1628 | for (i = 0, j = 0; i < argc; i++, j++) | |
1629 | @@ -408,7 +420,7 @@ | |
1630 | continue; | |
1631 | } | |
1632 | ||
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); | |
1636 | ||
1637 | if (strncmp (argv[i], "-fmain=", 7) == 0) | |
1638 | @@ -453,10 +465,10 @@ | |
1639 | if (saw_g + saw_O == 0) | |
1640 | arglist[j++] = "-g1"; | |
1641 | ||
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. */ | |
1646 | - if (will_link) | |
1647 | + if (want_spec_file) | |
1648 | arglist[j++] = spec_file == NULL ? "-specs=libgcj.spec" : spec_file; | |
1649 | ||
1650 | if (saw_C) | |
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 | |
1656 | @@ -43,6 +43,8 @@ | |
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 | |
1670 | @@ -30,7 +30,7 @@ | |
1671 | {".zip", {"@java"} }, | |
1672 | {".jar", {"@java"} }, | |
1673 | {"@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 | |
1684 | @@ -105,6 +105,9 @@ | |
1685 | /* When non zero, warns that final local are treated as non final. */ | |
1686 | int flag_static_local_jdk1_1 = 0; | |
1687 | ||
1688 | +/* When non zero, call a library routine to do integer divisions. */ | |
1689 | +int flag_use_divide_subroutine = 1; | |
1690 | + | |
1691 | /* From gcc/flags.h, and indicates if exceptions are turned on or not. */ | |
1692 | ||
1693 | extern int flag_new_exceptions; | |
1694 | @@ -123,6 +126,7 @@ | |
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}, | |
1699 | }; | |
1700 | ||
1701 | JCF *current_jcf; | |
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 | |
1706 | @@ -123,7 +123,7 @@ | |
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 | |
1718 | @@ -1,117 +1,116 @@ | |
1719 | ||
1720 | /* A Bison parser, made from ./parse-scan.y | |
1721 | - by GNU Bison version 1.25 | |
1722 | - */ | |
1723 | + by GNU Bison version 1.28 */ | |
1724 | ||
1725 | #define YYBISON 1 /* Identify Bison output. */ | |
1726 | ||
1727 | -#define PLUS_TK 258 | |
1728 | -#define MINUS_TK 259 | |
1729 | -#define MULT_TK 260 | |
1730 | -#define DIV_TK 261 | |
1731 | -#define REM_TK 262 | |
1732 | -#define LS_TK 263 | |
1733 | -#define SRS_TK 264 | |
1734 | -#define ZRS_TK 265 | |
1735 | -#define AND_TK 266 | |
1736 | -#define XOR_TK 267 | |
1737 | -#define OR_TK 268 | |
1738 | -#define BOOL_AND_TK 269 | |
1739 | -#define BOOL_OR_TK 270 | |
1740 | -#define EQ_TK 271 | |
1741 | -#define NEQ_TK 272 | |
1742 | -#define GT_TK 273 | |
1743 | -#define GTE_TK 274 | |
1744 | -#define LT_TK 275 | |
1745 | -#define LTE_TK 276 | |
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 | |
1766 | -#define PAD_TK 297 | |
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 | |
1772 | -#define IF_TK 303 | |
1773 | -#define THROW_TK 304 | |
1774 | -#define BOOLEAN_TK 305 | |
1775 | -#define DO_TK 306 | |
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 | |
1794 | -#define TRY_TK 325 | |
1795 | -#define FOR_TK 326 | |
1796 | -#define NEW_TK 327 | |
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 | |
1803 | -#define INT_TK 334 | |
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 | |
1809 | -#define FP_TK 340 | |
1810 | -#define ID_TK 341 | |
1811 | -#define REL_QM_TK 342 | |
1812 | -#define REL_CL_TK 343 | |
1813 | -#define NOT_TK 344 | |
1814 | -#define NEG_TK 345 | |
1815 | -#define ASSIGN_ANY_TK 346 | |
1816 | -#define ASSIGN_TK 347 | |
1817 | -#define OP_TK 348 | |
1818 | -#define CP_TK 349 | |
1819 | -#define OCB_TK 350 | |
1820 | -#define CCB_TK 351 | |
1821 | -#define OSB_TK 352 | |
1822 | -#define CSB_TK 353 | |
1823 | -#define SC_TK 354 | |
1824 | -#define C_TK 355 | |
1825 | -#define DOT_TK 356 | |
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 | |
1837 | +#define DIV_TK 260 | |
1838 | +#define REM_TK 261 | |
1839 | +#define LS_TK 262 | |
1840 | +#define SRS_TK 263 | |
1841 | +#define ZRS_TK 264 | |
1842 | +#define AND_TK 265 | |
1843 | +#define XOR_TK 266 | |
1844 | +#define OR_TK 267 | |
1845 | +#define BOOL_AND_TK 268 | |
1846 | +#define BOOL_OR_TK 269 | |
1847 | +#define EQ_TK 270 | |
1848 | +#define NEQ_TK 271 | |
1849 | +#define GT_TK 272 | |
1850 | +#define GTE_TK 273 | |
1851 | +#define LT_TK 274 | |
1852 | +#define LTE_TK 275 | |
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 | |
1873 | +#define PAD_TK 296 | |
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 | |
1879 | +#define IF_TK 302 | |
1880 | +#define THROW_TK 303 | |
1881 | +#define BOOLEAN_TK 304 | |
1882 | +#define DO_TK 305 | |
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 | |
1901 | +#define TRY_TK 324 | |
1902 | +#define FOR_TK 325 | |
1903 | +#define NEW_TK 326 | |
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 | |
1910 | +#define INT_TK 333 | |
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 | |
1916 | +#define FP_TK 339 | |
1917 | +#define ID_TK 340 | |
1918 | +#define REL_QM_TK 341 | |
1919 | +#define REL_CL_TK 342 | |
1920 | +#define NOT_TK 343 | |
1921 | +#define NEG_TK 344 | |
1922 | +#define ASSIGN_ANY_TK 345 | |
1923 | +#define ASSIGN_TK 346 | |
1924 | +#define OP_TK 347 | |
1925 | +#define CP_TK 348 | |
1926 | +#define OCB_TK 349 | |
1927 | +#define CCB_TK 350 | |
1928 | +#define OSB_TK 351 | |
1929 | +#define CSB_TK 352 | |
1930 | +#define SC_TK 353 | |
1931 | +#define C_TK 354 | |
1932 | +#define DOT_TK 355 | |
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 | |
1941 | ||
1942 | #line 37 "./parse-scan.y" | |
1943 | ||
1944 | @@ -200,7 +199,7 @@ | |
1945 | #define YYFLAG -32768 | |
1946 | #define YYNTBASE 110 | |
1947 | ||
1948 | -#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 253) | |
1949 | +#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 253) | |
1950 | ||
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, | |
1980 | + 107, 108, 109 | |
1981 | }; | |
1982 | ||
1983 | #if YYDEBUG != 0 | |
1984 | @@ -1375,7 +1374,8 @@ | |
1985 | #define YYPURE 1 | |
1986 | ||
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. */ | |
1991 | ||
1992 | /* Skeleton output parser for bison, | |
1993 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | |
1994 | @@ -1392,46 +1392,66 @@ | |
1995 | ||
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. */ | |
2001 | ||
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. */ | |
2006 | ||
2007 | -#ifndef alloca | |
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. */ | |
2012 | + | |
2013 | +#ifndef YYSTACK_USE_ALLOCA | |
2014 | +#ifdef alloca | |
2015 | +#define YYSTACK_USE_ALLOCA | |
2016 | +#else /* alloca not defined */ | |
2017 | #ifdef __GNUC__ | |
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 | |
2024 | #include <alloca.h> | |
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. */ | |
2033 | #include <malloc.h> | |
2034 | +#endif | |
2035 | #else /* not MSDOS, or __TURBOC__ */ | |
2036 | #if defined(_AIX) | |
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> */ | |
2041 | #pragma alloca | |
2042 | -#else /* not MSDOS, __TURBOC__, or _AIX */ | |
2043 | -#ifdef __hpux | |
2044 | -#ifdef __cplusplus | |
2045 | -extern "C" { | |
2046 | -void *alloca (unsigned int); | |
2047 | -}; | |
2048 | -#else /* not __cplusplus */ | |
2049 | -void *alloca (); | |
2050 | -#endif /* not __cplusplus */ | |
2051 | +#define YYSTACK_USE_ALLOCA | |
2052 | +#else /* not MSDOS, or __TURBOC__, or _AIX */ | |
2053 | +#if 0 | |
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 | |
2058 | #endif /* __hpux */ | |
2059 | +#endif | |
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 */ | |
2069 | ||
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 | |
2076 | +#else | |
2077 | +#define YYSTACK_ALLOC malloc | |
2078 | +#endif | |
2079 | ||
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) | |
2084 | #define YYEMPTY -2 | |
2085 | #define YYEOF 0 | |
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 @@ | |
2094 | #ifndef YYMAXDEPTH | |
2095 | #define YYMAXDEPTH 10000 | |
2096 | #endif | |
2097 | - | |
2098 | -/* Prevent warning if -Wstrict-prototypes. */ | |
2099 | -#ifdef __GNUC__ | |
2100 | -int yyparse (void); | |
2101 | -#endif | |
2102 | \f | |
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. */ | |
2107 | + | |
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) | |
2113 | char *to; | |
2114 | char *from; | |
2115 | - int count; | |
2116 | + unsigned int count; | |
2117 | { | |
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. */ | |
2123 | static void | |
2124 | -__yy_memcpy (char *to, char *from, int count) | |
2125 | +__yy_memcpy (char *to, char *from, unsigned int count) | |
2126 | { | |
2127 | - register char *f = from; | |
2128 | register char *t = to; | |
2129 | + register char *f = from; | |
2130 | register int i = count; | |
2131 | ||
2132 | while (i-- > 0) | |
2133 | @@ -1568,7 +1588,7 @@ | |
2134 | #endif | |
2135 | #endif | |
2136 | \f | |
2137 | -#line 196 "/usr/cygnus/gnupro-98r2/share/bison.simple" | |
2138 | +#line 217 "/usr/lib/bison.simple" | |
2139 | ||
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 */ | |
2145 | ||
2146 | +/* Prevent warning if -Wstrict-prototypes. */ | |
2147 | +#ifdef __GNUC__ | |
2148 | +#ifdef YYPARSE_PARAM | |
2149 | +int yyparse (void *); | |
2150 | +#else | |
2151 | +int yyparse (void); | |
2152 | +#endif | |
2153 | +#endif | |
2154 | + | |
2155 | int | |
2156 | yyparse(YYPARSE_PARAM_ARG) | |
2157 | YYPARSE_PARAM_DECL | |
2158 | @@ -1617,6 +1646,7 @@ | |
2159 | #endif | |
2160 | ||
2161 | int yystacksize = YYINITDEPTH; | |
2162 | + int yyfree_stacks = 0; | |
2163 | ||
2164 | #ifdef YYPURE | |
2165 | int yychar; | |
2166 | @@ -1701,18 +1731,32 @@ | |
2167 | if (yystacksize >= YYMAXDEPTH) | |
2168 | { | |
2169 | yyerror("parser stack overflow"); | |
2170 | + if (yyfree_stacks) | |
2171 | + { | |
2172 | + free (yyss); | |
2173 | + free (yyvs); | |
2174 | +#ifdef YYLSP_NEEDED | |
2175 | + free (yyls); | |
2176 | +#endif | |
2177 | + } | |
2178 | return 2; | |
2179 | } | |
2180 | yystacksize *= 2; | |
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; | |
2189 | +#endif | |
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)); | |
2196 | #ifdef YYLSP_NEEDED | |
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)); | |
2202 | #endif | |
2203 | #endif /* no yyoverflow */ | |
2204 | ||
2205 | @@ -2156,7 +2200,7 @@ | |
2206 | break;} | |
2207 | } | |
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" | |
2211 | \f | |
2212 | yyvsp -= yylen; | |
2213 | yyssp -= yylen; | |
2214 | @@ -2351,6 +2395,30 @@ | |
2215 | ||
2216 | yystate = yyn; | |
2217 | goto yynewstate; | |
2218 | + | |
2219 | + yyacceptlab: | |
2220 | + /* YYACCEPT comes here. */ | |
2221 | + if (yyfree_stacks) | |
2222 | + { | |
2223 | + free (yyss); | |
2224 | + free (yyvs); | |
2225 | +#ifdef YYLSP_NEEDED | |
2226 | + free (yyls); | |
2227 | +#endif | |
2228 | + } | |
2229 | + return 0; | |
2230 | + | |
2231 | + yyabortlab: | |
2232 | + /* YYABORT comes here. */ | |
2233 | + if (yyfree_stacks) | |
2234 | + { | |
2235 | + free (yyss); | |
2236 | + free (yyvs); | |
2237 | +#ifdef YYLSP_NEEDED | |
2238 | + free (yyls); | |
2239 | +#endif | |
2240 | + } | |
2241 | + return 1; | |
2242 | } | |
2243 | #line 1105 "./parse-scan.y" | |
2244 | ||
2245 | @@ -2434,6 +2502,8 @@ | |
2246 | yyerror (msg) | |
2247 | char *msg ATTRIBUTE_UNUSED; | |
2248 | { | |
2249 | + fprintf (stderr, "%s: %d: %s\n", input_filename, lineno, msg); | |
2250 | + exit (1); | |
2251 | } | |
2252 | ||
2253 | char * | |
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 @@ | |
2258 | yyerror (msg) | |
2259 | char *msg ATTRIBUTE_UNUSED; | |
2260 | { | |
2261 | + fprintf (stderr, "%s: %d: %s\n", input_filename, lineno, msg); | |
2262 | + exit (1); | |
2263 | } | |
2264 | ||
2265 | char * | |
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 | |
2270 | @@ -1,7 +1,6 @@ | |
2271 | ||
2272 | /* A Bison parser, made from ./parse.y | |
2273 | - by GNU Bison version 1.27 | |
2274 | - */ | |
2275 | + by GNU Bison version 1.28 */ | |
2276 | ||
2277 | #define YYBISON 1 /* Identify Bison output. */ | |
2278 | ||
2279 | @@ -167,6 +166,7 @@ | |
2280 | static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...)) | |
2281 | ATTRIBUTE_PRINTF_2; | |
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)); | |
2287 | @@ -319,6 +319,7 @@ | |
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)); | |
2292 | ||
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]))] | |
2298 | ||
2299 | +/* This is the end index for binary operators that can also be used | |
2300 | + in compound assignements. */ | |
2301 | +#define BINOP_COMPOUND_CANDIDATES 11 | |
2302 | + | |
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; | |
2306 | @@ -376,7 +381,7 @@ | |
2307 | static tree current_static_block = NULL_TREE; | |
2308 | ||
2309 | ||
2310 | -#line 304 "./parse.y" | |
2311 | +#line 310 "./parse.y" | |
2312 | typedef union { | |
2313 | tree node; | |
2314 | int sub_token; | |
2315 | @@ -386,7 +391,7 @@ | |
2316 | } operator; | |
2317 | int value; | |
2318 | } YYSTYPE; | |
2319 | -#line 314 "./parse.y" | |
2320 | +#line 320 "./parse.y" | |
2321 | ||
2322 | #include "lex.c" | |
2323 | #ifndef YYDEBUG | |
2324 | @@ -684,57 +689,57 @@ | |
2325 | ||
2326 | #if YYDEBUG != 0 | |
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, | |
2378 | - 2301, 2305 | |
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, | |
2429 | + 2305, 2309 | |
2430 | }; | |
2431 | #endif | |
2432 | ||
2433 | @@ -2213,7 +2218,7 @@ | |
2434 | ||
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. */ | |
2439 | ||
2440 | /* Skeleton output parser for bison, | |
2441 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | |
2442 | @@ -2426,7 +2431,7 @@ | |
2443 | #endif | |
2444 | #endif | |
2445 | \f | |
2446 | -#line 216 "/usr/lib/bison.simple" | |
2447 | +#line 217 "/usr/lib/bison.simple" | |
2448 | ||
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 @@ | |
2452 | switch (yyn) { | |
2453 | ||
2454 | case 1: | |
2455 | -#line 460 "./parse.y" | |
2456 | +#line 466 "./parse.y" | |
2457 | {; | |
2458 | break;} | |
2459 | case 18: | |
2460 | -#line 504 "./parse.y" | |
2461 | +#line 510 "./parse.y" | |
2462 | { | |
2463 | yyval.node = build_java_array_type (yyvsp[-2].node, -1); | |
2464 | CLASS_LOADED_P (yyval.node) = 1; | |
2465 | ; | |
2466 | break;} | |
2467 | case 19: | |
2468 | -#line 509 "./parse.y" | |
2469 | +#line 515 "./parse.y" | |
2470 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; | |
2471 | break;} | |
2472 | case 20: | |
2473 | -#line 511 "./parse.y" | |
2474 | +#line 517 "./parse.y" | |
2475 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; | |
2476 | break;} | |
2477 | case 21: | |
2478 | -#line 513 "./parse.y" | |
2479 | +#line 519 "./parse.y" | |
2480 | {RULE ("']' expected"); RECOVER;; | |
2481 | break;} | |
2482 | case 22: | |
2483 | -#line 515 "./parse.y" | |
2484 | +#line 521 "./parse.y" | |
2485 | {RULE ("']' expected"); RECOVER;; | |
2486 | break;} | |
2487 | case 26: | |
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); ; | |
2491 | break;} | |
2492 | case 28: | |
2493 | -#line 539 "./parse.y" | |
2494 | +#line 545 "./parse.y" | |
2495 | {yyval.node = NULL;; | |
2496 | break;} | |
2497 | case 36: | |
2498 | -#line 551 "./parse.y" | |
2499 | +#line 557 "./parse.y" | |
2500 | { | |
2501 | yyval.node = NULL; | |
2502 | ; | |
2503 | break;} | |
2504 | case 37: | |
2505 | -#line 555 "./parse.y" | |
2506 | +#line 561 "./parse.y" | |
2507 | { | |
2508 | yyval.node = NULL; | |
2509 | ; | |
2510 | break;} | |
2511 | case 40: | |
2512 | -#line 567 "./parse.y" | |
2513 | +#line 573 "./parse.y" | |
2514 | { ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ; | |
2515 | break;} | |
2516 | case 41: | |
2517 | -#line 569 "./parse.y" | |
2518 | +#line 575 "./parse.y" | |
2519 | {yyerror ("Missing name"); RECOVER;; | |
2520 | break;} | |
2521 | case 42: | |
2522 | -#line 571 "./parse.y" | |
2523 | +#line 577 "./parse.y" | |
2524 | {yyerror ("';' expected"); RECOVER;; | |
2525 | break;} | |
2526 | case 45: | |
2527 | -#line 581 "./parse.y" | |
2528 | +#line 587 "./parse.y" | |
2529 | { | |
2530 | tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name; | |
2531 | int i = IDENTIFIER_LENGTH (name)-1; | |
2532 | @@ -2842,15 +2847,15 @@ | |
2533 | ; | |
2534 | break;} | |
2535 | case 46: | |
2536 | -#line 607 "./parse.y" | |
2537 | +#line 613 "./parse.y" | |
2538 | {yyerror ("Missing name"); RECOVER;; | |
2539 | break;} | |
2540 | case 47: | |
2541 | -#line 609 "./parse.y" | |
2542 | +#line 615 "./parse.y" | |
2543 | {yyerror ("';' expected"); RECOVER;; | |
2544 | break;} | |
2545 | case 48: | |
2546 | -#line 614 "./parse.y" | |
2547 | +#line 620 "./parse.y" | |
2548 | { | |
2549 | tree name = EXPR_WFL_NODE (yyvsp[-3].node); | |
2550 | /* Don't import java.lang.* twice. */ | |
2551 | @@ -2864,15 +2869,15 @@ | |
2552 | ; | |
2553 | break;} | |
2554 | case 49: | |
2555 | -#line 626 "./parse.y" | |
2556 | +#line 632 "./parse.y" | |
2557 | {yyerror ("'*' expected"); RECOVER;; | |
2558 | break;} | |
2559 | case 50: | |
2560 | -#line 628 "./parse.y" | |
2561 | +#line 634 "./parse.y" | |
2562 | {yyerror ("';' expected"); RECOVER;; | |
2563 | break;} | |
2564 | case 51: | |
2565 | -#line 633 "./parse.y" | |
2566 | +#line 639 "./parse.y" | |
2567 | { | |
2568 | maybe_generate_finit (); | |
2569 | maybe_generate_clinit (); | |
2570 | @@ -2880,31 +2885,31 @@ | |
2571 | ; | |
2572 | break;} | |
2573 | case 52: | |
2574 | -#line 639 "./parse.y" | |
2575 | +#line 645 "./parse.y" | |
2576 | { | |
2577 | maybe_generate_clinit (); | |
2578 | yyval.node = yyvsp[0].node; | |
2579 | ; | |
2580 | break;} | |
2581 | case 53: | |
2582 | -#line 644 "./parse.y" | |
2583 | +#line 650 "./parse.y" | |
2584 | { yyval.node = NULL; ; | |
2585 | break;} | |
2586 | case 54: | |
2587 | -#line 646 "./parse.y" | |
2588 | +#line 652 "./parse.y" | |
2589 | { | |
2590 | YYERROR_NOW; | |
2591 | yyerror ("Class or interface declaration expected"); | |
2592 | ; | |
2593 | break;} | |
2594 | case 55: | |
2595 | -#line 657 "./parse.y" | |
2596 | +#line 663 "./parse.y" | |
2597 | { | |
2598 | yyval.value = (1 << yyvsp[0].value); | |
2599 | ; | |
2600 | break;} | |
2601 | case 56: | |
2602 | -#line 661 "./parse.y" | |
2603 | +#line 667 "./parse.y" | |
2604 | { | |
2605 | int acc = (1 << yyvsp[0].value); | |
2606 | if (yyval.value & acc) | |
2607 | @@ -2918,95 +2923,95 @@ | |
2608 | ; | |
2609 | break;} | |
2610 | case 57: | |
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); ; | |
2614 | break;} | |
2615 | case 58: | |
2616 | -#line 679 "./parse.y" | |
2617 | +#line 685 "./parse.y" | |
2618 | { | |
2619 | yyval.node = yyvsp[0].node; | |
2620 | ; | |
2621 | break;} | |
2622 | case 59: | |
2623 | -#line 683 "./parse.y" | |
2624 | +#line 689 "./parse.y" | |
2625 | { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; | |
2626 | break;} | |
2627 | case 60: | |
2628 | -#line 685 "./parse.y" | |
2629 | +#line 691 "./parse.y" | |
2630 | { | |
2631 | yyval.node = yyvsp[0].node; | |
2632 | ; | |
2633 | break;} | |
2634 | case 61: | |
2635 | -#line 689 "./parse.y" | |
2636 | +#line 695 "./parse.y" | |
2637 | {yyerror ("Missing class name"); RECOVER;; | |
2638 | break;} | |
2639 | case 62: | |
2640 | -#line 691 "./parse.y" | |
2641 | +#line 697 "./parse.y" | |
2642 | {yyerror ("Missing class name"); RECOVER;; | |
2643 | break;} | |
2644 | case 63: | |
2645 | -#line 693 "./parse.y" | |
2646 | +#line 699 "./parse.y" | |
2647 | { | |
2648 | if (!ctxp->class_err) yyerror ("'{' expected"); | |
2649 | DRECOVER(class1); | |
2650 | ; | |
2651 | break;} | |
2652 | case 64: | |
2653 | -#line 698 "./parse.y" | |
2654 | +#line 704 "./parse.y" | |
2655 | {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;; | |
2656 | break;} | |
2657 | case 65: | |
2658 | -#line 702 "./parse.y" | |
2659 | +#line 708 "./parse.y" | |
2660 | { yyval.node = NULL; ; | |
2661 | break;} | |
2662 | case 66: | |
2663 | -#line 704 "./parse.y" | |
2664 | +#line 710 "./parse.y" | |
2665 | { yyval.node = yyvsp[0].node; ; | |
2666 | break;} | |
2667 | case 67: | |
2668 | -#line 706 "./parse.y" | |
2669 | +#line 712 "./parse.y" | |
2670 | {yyerror ("'{' expected"); ctxp->class_err=1;; | |
2671 | break;} | |
2672 | case 68: | |
2673 | -#line 708 "./parse.y" | |
2674 | +#line 714 "./parse.y" | |
2675 | {yyerror ("Missing super class name"); ctxp->class_err=1;; | |
2676 | break;} | |
2677 | case 69: | |
2678 | -#line 712 "./parse.y" | |
2679 | +#line 718 "./parse.y" | |
2680 | { yyval.node = NULL_TREE; ; | |
2681 | break;} | |
2682 | case 70: | |
2683 | -#line 714 "./parse.y" | |
2684 | +#line 720 "./parse.y" | |
2685 | { yyval.node = yyvsp[0].node; ; | |
2686 | break;} | |
2687 | case 71: | |
2688 | -#line 716 "./parse.y" | |
2689 | +#line 722 "./parse.y" | |
2690 | { | |
2691 | ctxp->class_err=1; | |
2692 | yyerror ("Missing interface name"); | |
2693 | ; | |
2694 | break;} | |
2695 | case 72: | |
2696 | -#line 724 "./parse.y" | |
2697 | +#line 730 "./parse.y" | |
2698 | { | |
2699 | ctxp->interface_number = 1; | |
2700 | yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); | |
2701 | ; | |
2702 | break;} | |
2703 | case 73: | |
2704 | -#line 729 "./parse.y" | |
2705 | +#line 735 "./parse.y" | |
2706 | { | |
2707 | ctxp->interface_number++; | |
2708 | yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); | |
2709 | ; | |
2710 | break;} | |
2711 | case 74: | |
2712 | -#line 734 "./parse.y" | |
2713 | +#line 740 "./parse.y" | |
2714 | {yyerror ("Missing interface name"); RECOVER;; | |
2715 | break;} | |
2716 | case 75: | |
2717 | -#line 739 "./parse.y" | |
2718 | +#line 745 "./parse.y" | |
2719 | { | |
2720 | /* Store the location of the `}' when doing xrefs */ | |
2721 | if (flag_emit_xref) | |
2722 | @@ -3016,7 +3021,7 @@ | |
2723 | ; | |
2724 | break;} | |
2725 | case 76: | |
2726 | -#line 747 "./parse.y" | |
2727 | +#line 753 "./parse.y" | |
2728 | { | |
2729 | /* Store the location of the `}' when doing xrefs */ | |
2730 | if (flag_emit_xref) | |
2731 | @@ -3026,27 +3031,27 @@ | |
2732 | ; | |
2733 | break;} | |
2734 | case 82: | |
2735 | -#line 766 "./parse.y" | |
2736 | +#line 772 "./parse.y" | |
2737 | { yyval.node = parse_jdk1_1_error ("instance initializer"); ; | |
2738 | break;} | |
2739 | case 84: | |
2740 | -#line 772 "./parse.y" | |
2741 | +#line 778 "./parse.y" | |
2742 | { yyval.node = yyvsp[-1].node; ; | |
2743 | break;} | |
2744 | case 86: | |
2745 | -#line 775 "./parse.y" | |
2746 | +#line 781 "./parse.y" | |
2747 | { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ; | |
2748 | break;} | |
2749 | case 87: | |
2750 | -#line 777 "./parse.y" | |
2751 | +#line 783 "./parse.y" | |
2752 | { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; | |
2753 | break;} | |
2754 | case 88: | |
2755 | -#line 783 "./parse.y" | |
2756 | +#line 789 "./parse.y" | |
2757 | { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ; | |
2758 | break;} | |
2759 | case 89: | |
2760 | -#line 785 "./parse.y" | |
2761 | +#line 791 "./parse.y" | |
2762 | { | |
2763 | check_modifiers | |
2764 | ("Illegal modifier `%s' for field declaration", | |
2765 | @@ -3056,19 +3061,19 @@ | |
2766 | ; | |
2767 | break;} | |
2768 | case 91: | |
2769 | -#line 798 "./parse.y" | |
2770 | +#line 804 "./parse.y" | |
2771 | { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ; | |
2772 | break;} | |
2773 | case 92: | |
2774 | -#line 800 "./parse.y" | |
2775 | +#line 806 "./parse.y" | |
2776 | {yyerror ("Missing term"); RECOVER;; | |
2777 | break;} | |
2778 | case 93: | |
2779 | -#line 805 "./parse.y" | |
2780 | +#line 811 "./parse.y" | |
2781 | { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ; | |
2782 | break;} | |
2783 | case 94: | |
2784 | -#line 807 "./parse.y" | |
2785 | +#line 813 "./parse.y" | |
2786 | { | |
2787 | if (java_error_count) | |
2788 | yyvsp[0].node = NULL_TREE; | |
2789 | @@ -3077,7 +3082,7 @@ | |
2790 | ; | |
2791 | break;} | |
2792 | case 95: | |
2793 | -#line 814 "./parse.y" | |
2794 | +#line 820 "./parse.y" | |
2795 | { | |
2796 | yyerror ("Missing variable initializer"); | |
2797 | yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE); | |
2798 | @@ -3085,7 +3090,7 @@ | |
2799 | ; | |
2800 | break;} | |
2801 | case 96: | |
2802 | -#line 820 "./parse.y" | |
2803 | +#line 826 "./parse.y" | |
2804 | { | |
2805 | yyerror ("';' expected"); | |
2806 | yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE); | |
2807 | @@ -3093,85 +3098,85 @@ | |
2808 | ; | |
2809 | break;} | |
2810 | case 98: | |
2811 | -#line 830 "./parse.y" | |
2812 | +#line 836 "./parse.y" | |
2813 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; | |
2814 | break;} | |
2815 | case 99: | |
2816 | -#line 832 "./parse.y" | |
2817 | +#line 838 "./parse.y" | |
2818 | {yyerror ("Invalid declaration"); DRECOVER(vdi);; | |
2819 | break;} | |
2820 | case 100: | |
2821 | -#line 834 "./parse.y" | |
2822 | +#line 840 "./parse.y" | |
2823 | {yyerror ("']' expected"); DRECOVER(vdi);; | |
2824 | break;} | |
2825 | case 101: | |
2826 | -#line 836 "./parse.y" | |
2827 | +#line 842 "./parse.y" | |
2828 | {yyerror ("Unbalanced ']'"); DRECOVER(vdi);; | |
2829 | break;} | |
2830 | case 104: | |
2831 | -#line 847 "./parse.y" | |
2832 | +#line 853 "./parse.y" | |
2833 | { | |
2834 | current_function_decl = yyvsp[0].node; | |
2835 | source_start_java_method (current_function_decl); | |
2836 | ; | |
2837 | break;} | |
2838 | case 105: | |
2839 | -#line 852 "./parse.y" | |
2840 | +#line 858 "./parse.y" | |
2841 | { finish_method_declaration (yyvsp[0].node); ; | |
2842 | break;} | |
2843 | case 106: | |
2844 | -#line 854 "./parse.y" | |
2845 | +#line 860 "./parse.y" | |
2846 | {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;; | |
2847 | break;} | |
2848 | case 107: | |
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); ; | |
2852 | break;} | |
2853 | case 108: | |
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); ; | |
2857 | break;} | |
2858 | case 109: | |
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); ; | |
2862 | break;} | |
2863 | case 110: | |
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); ; | |
2867 | break;} | |
2868 | case 111: | |
2869 | -#line 867 "./parse.y" | |
2870 | +#line 873 "./parse.y" | |
2871 | {RECOVER;; | |
2872 | break;} | |
2873 | case 112: | |
2874 | -#line 869 "./parse.y" | |
2875 | +#line 875 "./parse.y" | |
2876 | {RECOVER;; | |
2877 | break;} | |
2878 | case 113: | |
2879 | -#line 871 "./parse.y" | |
2880 | +#line 877 "./parse.y" | |
2881 | {yyerror ("Identifier expected"); RECOVER;; | |
2882 | break;} | |
2883 | case 114: | |
2884 | -#line 873 "./parse.y" | |
2885 | +#line 879 "./parse.y" | |
2886 | {yyerror ("Identifier expected"); RECOVER;; | |
2887 | break;} | |
2888 | case 115: | |
2889 | -#line 875 "./parse.y" | |
2890 | +#line 881 "./parse.y" | |
2891 | { | |
2892 | yyerror ("Invalid method declaration, return type required"); | |
2893 | RECOVER; | |
2894 | ; | |
2895 | break;} | |
2896 | case 116: | |
2897 | -#line 883 "./parse.y" | |
2898 | +#line 889 "./parse.y" | |
2899 | { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; | |
2900 | break;} | |
2901 | case 117: | |
2902 | -#line 885 "./parse.y" | |
2903 | +#line 891 "./parse.y" | |
2904 | { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; | |
2905 | break;} | |
2906 | case 118: | |
2907 | -#line 887 "./parse.y" | |
2908 | +#line 893 "./parse.y" | |
2909 | { | |
2910 | EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location; | |
2911 | TREE_PURPOSE (yyvsp[-2].node) = | |
2912 | @@ -3182,150 +3187,150 @@ | |
2913 | ; | |
2914 | break;} | |
2915 | case 119: | |
2916 | -#line 896 "./parse.y" | |
2917 | +#line 902 "./parse.y" | |
2918 | {yyerror ("')' expected"); DRECOVER(method_declarator);; | |
2919 | break;} | |
2920 | case 120: | |
2921 | -#line 898 "./parse.y" | |
2922 | +#line 904 "./parse.y" | |
2923 | {yyerror ("']' expected"); RECOVER;; | |
2924 | break;} | |
2925 | case 121: | |
2926 | -#line 903 "./parse.y" | |
2927 | +#line 909 "./parse.y" | |
2928 | { | |
2929 | ctxp->formal_parameter_number = 1; | |
2930 | ; | |
2931 | break;} | |
2932 | case 122: | |
2933 | -#line 907 "./parse.y" | |
2934 | +#line 913 "./parse.y" | |
2935 | { | |
2936 | ctxp->formal_parameter_number += 1; | |
2937 | yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); | |
2938 | ; | |
2939 | break;} | |
2940 | case 123: | |
2941 | -#line 912 "./parse.y" | |
2942 | +#line 918 "./parse.y" | |
2943 | {yyerror ("Missing formal parameter term"); RECOVER;; | |
2944 | break;} | |
2945 | case 124: | |
2946 | -#line 917 "./parse.y" | |
2947 | +#line 923 "./parse.y" | |
2948 | { | |
2949 | yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node); | |
2950 | ; | |
2951 | break;} | |
2952 | case 125: | |
2953 | -#line 921 "./parse.y" | |
2954 | +#line 927 "./parse.y" | |
2955 | { | |
2956 | parse_jdk1_1_error ("final parameters"); | |
2957 | yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node); | |
2958 | ; | |
2959 | break;} | |
2960 | case 126: | |
2961 | -#line 926 "./parse.y" | |
2962 | +#line 932 "./parse.y" | |
2963 | {yyerror ("Missing identifier"); RECOVER;; | |
2964 | break;} | |
2965 | case 127: | |
2966 | -#line 928 "./parse.y" | |
2967 | +#line 934 "./parse.y" | |
2968 | { | |
2969 | SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value)); | |
2970 | yyerror ("Missing identifier"); RECOVER; | |
2971 | ; | |
2972 | break;} | |
2973 | case 128: | |
2974 | -#line 935 "./parse.y" | |
2975 | +#line 941 "./parse.y" | |
2976 | { yyval.node = NULL_TREE; ; | |
2977 | break;} | |
2978 | case 129: | |
2979 | -#line 937 "./parse.y" | |
2980 | +#line 943 "./parse.y" | |
2981 | { yyval.node = yyvsp[0].node; ; | |
2982 | break;} | |
2983 | case 130: | |
2984 | -#line 939 "./parse.y" | |
2985 | +#line 945 "./parse.y" | |
2986 | {yyerror ("Missing class type term"); RECOVER;; | |
2987 | break;} | |
2988 | case 131: | |
2989 | -#line 944 "./parse.y" | |
2990 | +#line 950 "./parse.y" | |
2991 | { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ; | |
2992 | break;} | |
2993 | case 132: | |
2994 | -#line 946 "./parse.y" | |
2995 | +#line 952 "./parse.y" | |
2996 | { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ; | |
2997 | break;} | |
2998 | case 133: | |
2999 | -#line 948 "./parse.y" | |
3000 | +#line 954 "./parse.y" | |
3001 | {yyerror ("Missing class type term"); RECOVER;; | |
3002 | break;} | |
3003 | case 136: | |
3004 | -#line 955 "./parse.y" | |
3005 | +#line 961 "./parse.y" | |
3006 | { yyval.node = NULL_TREE; ; | |
3007 | break;} | |
3008 | case 137: | |
3009 | -#line 961 "./parse.y" | |
3010 | +#line 967 "./parse.y" | |
3011 | { | |
3012 | TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized; | |
3013 | ctxp->static_initialized = yyvsp[0].node; | |
3014 | ; | |
3015 | break;} | |
3016 | case 138: | |
3017 | -#line 966 "./parse.y" | |
3018 | +#line 972 "./parse.y" | |
3019 | { | |
3020 | TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized; | |
3021 | ctxp->static_initialized = yyvsp[-1].node; | |
3022 | ; | |
3023 | break;} | |
3024 | case 139: | |
3025 | -#line 974 "./parse.y" | |
3026 | +#line 980 "./parse.y" | |
3027 | { | |
3028 | SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value)); | |
3029 | ; | |
3030 | break;} | |
3031 | case 140: | |
3032 | -#line 982 "./parse.y" | |
3033 | +#line 988 "./parse.y" | |
3034 | { | |
3035 | current_function_decl = yyvsp[0].node; | |
3036 | source_start_java_method (current_function_decl); | |
3037 | ; | |
3038 | break;} | |
3039 | case 141: | |
3040 | -#line 987 "./parse.y" | |
3041 | +#line 993 "./parse.y" | |
3042 | { finish_method_declaration (yyvsp[0].node); ; | |
3043 | break;} | |
3044 | case 142: | |
3045 | -#line 992 "./parse.y" | |
3046 | +#line 998 "./parse.y" | |
3047 | { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ; | |
3048 | break;} | |
3049 | case 143: | |
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); ; | |
3053 | break;} | |
3054 | case 144: | |
3055 | -#line 999 "./parse.y" | |
3056 | +#line 1005 "./parse.y" | |
3057 | { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; | |
3058 | break;} | |
3059 | case 145: | |
3060 | -#line 1001 "./parse.y" | |
3061 | +#line 1007 "./parse.y" | |
3062 | { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; | |
3063 | break;} | |
3064 | case 146: | |
3065 | -#line 1009 "./parse.y" | |
3066 | +#line 1015 "./parse.y" | |
3067 | { | |
3068 | BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node; | |
3069 | yyval.node = yyvsp[0].node; | |
3070 | ; | |
3071 | break;} | |
3072 | case 147: | |
3073 | -#line 1014 "./parse.y" | |
3074 | +#line 1020 "./parse.y" | |
3075 | { yyval.node = yyvsp[0].node; ; | |
3076 | break;} | |
3077 | case 148: | |
3078 | -#line 1016 "./parse.y" | |
3079 | +#line 1022 "./parse.y" | |
3080 | { yyval.node = yyvsp[0].node; ; | |
3081 | break;} | |
3082 | case 149: | |
3083 | -#line 1018 "./parse.y" | |
3084 | +#line 1024 "./parse.y" | |
3085 | { yyval.node = yyvsp[0].node; ; | |
3086 | break;} | |
3087 | case 152: | |
3088 | -#line 1028 "./parse.y" | |
3089 | +#line 1034 "./parse.y" | |
3090 | { | |
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 @@ | |
3094 | ; | |
3095 | break;} | |
3096 | case 153: | |
3097 | -#line 1034 "./parse.y" | |
3098 | +#line 1040 "./parse.y" | |
3099 | { | |
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 @@ | |
3103 | ; | |
3104 | break;} | |
3105 | case 154: | |
3106 | -#line 1042 "./parse.y" | |
3107 | +#line 1048 "./parse.y" | |
3108 | {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; | |
3109 | break;} | |
3110 | case 155: | |
3111 | -#line 1044 "./parse.y" | |
3112 | +#line 1050 "./parse.y" | |
3113 | {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; | |
3114 | break;} | |
3115 | case 156: | |
3116 | -#line 1049 "./parse.y" | |
3117 | +#line 1055 "./parse.y" | |
3118 | { | |
3119 | tree wfl = build_wfl_node (this_identifier_node); | |
3120 | EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; | |
3121 | @@ -3357,7 +3362,7 @@ | |
3122 | ; | |
3123 | break;} | |
3124 | case 157: | |
3125 | -#line 1055 "./parse.y" | |
3126 | +#line 1061 "./parse.y" | |
3127 | { | |
3128 | tree wfl = build_wfl_node (super_identifier_node); | |
3129 | EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; | |
3130 | @@ -3365,133 +3370,133 @@ | |
3131 | ; | |
3132 | break;} | |
3133 | case 158: | |
3134 | -#line 1066 "./parse.y" | |
3135 | +#line 1072 "./parse.y" | |
3136 | { create_interface (0, yyvsp[0].node, NULL_TREE); ; | |
3137 | break;} | |
3138 | case 159: | |
3139 | -#line 1068 "./parse.y" | |
3140 | +#line 1074 "./parse.y" | |
3141 | { | |
3142 | yyval.node = yyvsp[0].node; | |
3143 | ; | |
3144 | break;} | |
3145 | case 160: | |
3146 | -#line 1072 "./parse.y" | |
3147 | +#line 1078 "./parse.y" | |
3148 | { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ; | |
3149 | break;} | |
3150 | case 161: | |
3151 | -#line 1074 "./parse.y" | |
3152 | +#line 1080 "./parse.y" | |
3153 | { | |
3154 | yyval.node = yyvsp[0].node; | |
3155 | ; | |
3156 | break;} | |
3157 | case 162: | |
3158 | -#line 1078 "./parse.y" | |
3159 | +#line 1084 "./parse.y" | |
3160 | { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ; | |
3161 | break;} | |
3162 | case 163: | |
3163 | -#line 1080 "./parse.y" | |
3164 | +#line 1086 "./parse.y" | |
3165 | { | |
3166 | yyval.node = yyvsp[0].node; | |
3167 | ; | |
3168 | break;} | |
3169 | case 164: | |
3170 | -#line 1084 "./parse.y" | |
3171 | +#line 1090 "./parse.y" | |
3172 | { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ; | |
3173 | break;} | |
3174 | case 165: | |
3175 | -#line 1086 "./parse.y" | |
3176 | +#line 1092 "./parse.y" | |
3177 | { | |
3178 | yyval.node = yyvsp[0].node; | |
3179 | ; | |
3180 | break;} | |
3181 | case 166: | |
3182 | -#line 1090 "./parse.y" | |
3183 | +#line 1096 "./parse.y" | |
3184 | {yyerror ("'{' expected"); RECOVER;; | |
3185 | break;} | |
3186 | case 167: | |
3187 | -#line 1092 "./parse.y" | |
3188 | +#line 1098 "./parse.y" | |
3189 | {yyerror ("'{' expected"); RECOVER;; | |
3190 | break;} | |
3191 | case 168: | |
3192 | -#line 1097 "./parse.y" | |
3193 | +#line 1103 "./parse.y" | |
3194 | { | |
3195 | ctxp->interface_number = 1; | |
3196 | yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); | |
3197 | ; | |
3198 | break;} | |
3199 | case 169: | |
3200 | -#line 1102 "./parse.y" | |
3201 | +#line 1108 "./parse.y" | |
3202 | { | |
3203 | ctxp->interface_number++; | |
3204 | yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); | |
3205 | ; | |
3206 | break;} | |
3207 | case 170: | |
3208 | -#line 1107 "./parse.y" | |
3209 | +#line 1113 "./parse.y" | |
3210 | {yyerror ("Invalid interface type"); RECOVER;; | |
3211 | break;} | |
3212 | case 171: | |
3213 | -#line 1109 "./parse.y" | |
3214 | +#line 1115 "./parse.y" | |
3215 | {yyerror ("Missing term"); RECOVER;; | |
3216 | break;} | |
3217 | case 172: | |
3218 | -#line 1114 "./parse.y" | |
3219 | +#line 1120 "./parse.y" | |
3220 | { yyval.node = NULL_TREE; ; | |
3221 | break;} | |
3222 | case 173: | |
3223 | -#line 1116 "./parse.y" | |
3224 | +#line 1122 "./parse.y" | |
3225 | { yyval.node = NULL_TREE; ; | |
3226 | break;} | |
3227 | case 178: | |
3228 | -#line 1128 "./parse.y" | |
3229 | +#line 1134 "./parse.y" | |
3230 | { yyval.node = parse_jdk1_1_error ("inner class declaration"); ; | |
3231 | break;} | |
3232 | case 179: | |
3233 | -#line 1130 "./parse.y" | |
3234 | +#line 1136 "./parse.y" | |
3235 | { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; | |
3236 | break;} | |
3237 | case 181: | |
3238 | -#line 1139 "./parse.y" | |
3239 | +#line 1145 "./parse.y" | |
3240 | { | |
3241 | check_abstract_method_header (yyvsp[-1].node); | |
3242 | current_function_decl = NULL_TREE; /* FIXME ? */ | |
3243 | ; | |
3244 | break;} | |
3245 | case 182: | |
3246 | -#line 1144 "./parse.y" | |
3247 | +#line 1150 "./parse.y" | |
3248 | {yyerror ("';' expected"); RECOVER;; | |
3249 | break;} | |
3250 | case 183: | |
3251 | -#line 1150 "./parse.y" | |
3252 | +#line 1156 "./parse.y" | |
3253 | { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ; | |
3254 | break;} | |
3255 | case 184: | |
3256 | -#line 1152 "./parse.y" | |
3257 | +#line 1158 "./parse.y" | |
3258 | { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ; | |
3259 | break;} | |
3260 | case 185: | |
3261 | -#line 1154 "./parse.y" | |
3262 | +#line 1160 "./parse.y" | |
3263 | { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ; | |
3264 | break;} | |
3265 | case 186: | |
3266 | -#line 1159 "./parse.y" | |
3267 | +#line 1165 "./parse.y" | |
3268 | { | |
3269 | yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), | |
3270 | yyvsp[0].node, NULL_TREE); | |
3271 | ; | |
3272 | break;} | |
3273 | case 187: | |
3274 | -#line 1164 "./parse.y" | |
3275 | +#line 1170 "./parse.y" | |
3276 | { | |
3277 | yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node); | |
3278 | ; | |
3279 | break;} | |
3280 | case 188: | |
3281 | -#line 1168 "./parse.y" | |
3282 | +#line 1174 "./parse.y" | |
3283 | {yyerror ("Missing term"); RECOVER;; | |
3284 | break;} | |
3285 | case 189: | |
3286 | -#line 1174 "./parse.y" | |
3287 | +#line 1180 "./parse.y" | |
3288 | { | |
3289 | /* Store the location of the `}' when doing xrefs */ | |
3290 | if (current_function_decl && flag_emit_xref) | |
3291 | @@ -3501,15 +3506,15 @@ | |
3292 | ; | |
3293 | break;} | |
3294 | case 190: | |
3295 | -#line 1182 "./parse.y" | |
3296 | +#line 1188 "./parse.y" | |
3297 | { yyval.node = yyvsp[0].node; ; | |
3298 | break;} | |
3299 | case 191: | |
3300 | -#line 1187 "./parse.y" | |
3301 | +#line 1193 "./parse.y" | |
3302 | { enter_block (); ; | |
3303 | break;} | |
3304 | case 192: | |
3305 | -#line 1192 "./parse.y" | |
3306 | +#line 1198 "./parse.y" | |
3307 | { | |
3308 | maybe_absorb_scoping_blocks (); | |
3309 | /* Store the location of the `}' when doing xrefs */ | |
3310 | @@ -3520,35 +3525,35 @@ | |
3311 | ; | |
3312 | break;} | |
3313 | case 196: | |
3314 | -#line 1210 "./parse.y" | |
3315 | +#line 1216 "./parse.y" | |
3316 | { java_method_add_stmt (current_function_decl, yyvsp[0].node); ; | |
3317 | break;} | |
3318 | case 197: | |
3319 | -#line 1212 "./parse.y" | |
3320 | +#line 1218 "./parse.y" | |
3321 | { parse_jdk1_1_error ("inner class declaration"); ; | |
3322 | break;} | |
3323 | case 199: | |
3324 | -#line 1221 "./parse.y" | |
3325 | +#line 1227 "./parse.y" | |
3326 | { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ; | |
3327 | break;} | |
3328 | case 200: | |
3329 | -#line 1223 "./parse.y" | |
3330 | +#line 1229 "./parse.y" | |
3331 | { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ; | |
3332 | break;} | |
3333 | case 206: | |
3334 | -#line 1233 "./parse.y" | |
3335 | +#line 1239 "./parse.y" | |
3336 | { yyval.node = exit_block (); ; | |
3337 | break;} | |
3338 | case 211: | |
3339 | -#line 1242 "./parse.y" | |
3340 | +#line 1248 "./parse.y" | |
3341 | { yyval.node = exit_block (); ; | |
3342 | break;} | |
3343 | case 223: | |
3344 | -#line 1261 "./parse.y" | |
3345 | +#line 1267 "./parse.y" | |
3346 | { yyval.node = empty_stmt_node; ; | |
3347 | break;} | |
3348 | case 224: | |
3349 | -#line 1266 "./parse.y" | |
3350 | +#line 1272 "./parse.y" | |
3351 | { | |
3352 | yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node), | |
3353 | EXPR_WFL_NODE (yyvsp[-1].node)); | |
3354 | @@ -3558,19 +3563,19 @@ | |
3355 | ; | |
3356 | break;} | |
3357 | case 225: | |
3358 | -#line 1277 "./parse.y" | |
3359 | +#line 1283 "./parse.y" | |
3360 | { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ; | |
3361 | break;} | |
3362 | case 226: | |
3363 | -#line 1279 "./parse.y" | |
3364 | +#line 1285 "./parse.y" | |
3365 | {yyerror ("':' expected"); RECOVER;; | |
3366 | break;} | |
3367 | case 227: | |
3368 | -#line 1284 "./parse.y" | |
3369 | +#line 1290 "./parse.y" | |
3370 | { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ; | |
3371 | break;} | |
3372 | case 228: | |
3373 | -#line 1291 "./parse.y" | |
3374 | +#line 1297 "./parse.y" | |
3375 | { | |
3376 | /* We have a statement. Generate a WFL around it so | |
3377 | we can debug it */ | |
3378 | @@ -3581,7 +3586,7 @@ | |
3379 | ; | |
3380 | break;} | |
3381 | case 229: | |
3382 | -#line 1300 "./parse.y" | |
3383 | +#line 1306 "./parse.y" | |
3384 | { | |
3385 | if (ctxp->prevent_ese != lineno) | |
3386 | yyerror ("Invalid expression statement"); | |
3387 | @@ -3589,7 +3594,7 @@ | |
3388 | ; | |
3389 | break;} | |
3390 | case 230: | |
3391 | -#line 1306 "./parse.y" | |
3392 | +#line 1312 "./parse.y" | |
3393 | { | |
3394 | if (ctxp->prevent_ese != lineno) | |
3395 | yyerror ("Invalid expression statement"); | |
3396 | @@ -3597,7 +3602,7 @@ | |
3397 | ; | |
3398 | break;} | |
3399 | case 231: | |
3400 | -#line 1312 "./parse.y" | |
3401 | +#line 1318 "./parse.y" | |
3402 | { | |
3403 | if (ctxp->prevent_ese != lineno) | |
3404 | yyerror ("Invalid expression statement"); | |
3405 | @@ -3605,84 +3610,82 @@ | |
3406 | ; | |
3407 | break;} | |
3408 | case 232: | |
3409 | -#line 1318 "./parse.y" | |
3410 | +#line 1324 "./parse.y" | |
3411 | {yyerror ("')' expected"); RECOVER;; | |
3412 | break;} | |
3413 | case 233: | |
3414 | -#line 1320 "./parse.y" | |
3415 | +#line 1326 "./parse.y" | |
3416 | { | |
3417 | - yyerror ("Constructor invocation must be first " | |
3418 | - "thing in a constructor"); | |
3419 | + parse_ctor_invocation_error (); | |
3420 | RECOVER; | |
3421 | ; | |
3422 | break;} | |
3423 | case 234: | |
3424 | -#line 1326 "./parse.y" | |
3425 | +#line 1331 "./parse.y" | |
3426 | {yyerror ("')' expected"); RECOVER;; | |
3427 | break;} | |
3428 | case 235: | |
3429 | -#line 1328 "./parse.y" | |
3430 | +#line 1333 "./parse.y" | |
3431 | { | |
3432 | - yyerror ("Constructor invocation must be first " | |
3433 | - "thing in a constructor"); | |
3434 | + parse_ctor_invocation_error (); | |
3435 | RECOVER; | |
3436 | ; | |
3437 | break;} | |
3438 | case 236: | |
3439 | -#line 1334 "./parse.y" | |
3440 | +#line 1338 "./parse.y" | |
3441 | {yyerror ("'(' expected"); RECOVER;; | |
3442 | break;} | |
3443 | case 237: | |
3444 | -#line 1336 "./parse.y" | |
3445 | +#line 1340 "./parse.y" | |
3446 | {yyerror ("')' expected"); RECOVER;; | |
3447 | break;} | |
3448 | case 238: | |
3449 | -#line 1338 "./parse.y" | |
3450 | +#line 1342 "./parse.y" | |
3451 | {yyerror ("')' expected"); RECOVER;; | |
3452 | break;} | |
3453 | case 239: | |
3454 | -#line 1340 "./parse.y" | |
3455 | +#line 1344 "./parse.y" | |
3456 | {yyerror ("';' expected"); RECOVER;; | |
3457 | break;} | |
3458 | case 240: | |
3459 | -#line 1342 "./parse.y" | |
3460 | +#line 1346 "./parse.y" | |
3461 | {yyerror ("';' expected"); RECOVER;; | |
3462 | break;} | |
3463 | case 248: | |
3464 | -#line 1357 "./parse.y" | |
3465 | +#line 1361 "./parse.y" | |
3466 | { | |
3467 | yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node, | |
3468 | yyvsp[0].node, NULL_TREE); | |
3469 | ; | |
3470 | break;} | |
3471 | case 249: | |
3472 | -#line 1362 "./parse.y" | |
3473 | +#line 1366 "./parse.y" | |
3474 | {yyerror ("'(' expected"); RECOVER;; | |
3475 | break;} | |
3476 | case 250: | |
3477 | -#line 1364 "./parse.y" | |
3478 | +#line 1368 "./parse.y" | |
3479 | {yyerror ("Missing term"); RECOVER;; | |
3480 | break;} | |
3481 | case 251: | |
3482 | -#line 1366 "./parse.y" | |
3483 | +#line 1370 "./parse.y" | |
3484 | {yyerror ("')' expected"); RECOVER;; | |
3485 | break;} | |
3486 | case 252: | |
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); ; | |
3490 | break;} | |
3491 | case 253: | |
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); ; | |
3495 | break;} | |
3496 | case 254: | |
3497 | -#line 1381 "./parse.y" | |
3498 | +#line 1385 "./parse.y" | |
3499 | { | |
3500 | enter_block (); | |
3501 | ; | |
3502 | break;} | |
3503 | case 255: | |
3504 | -#line 1385 "./parse.y" | |
3505 | +#line 1389 "./parse.y" | |
3506 | { | |
3507 | /* Make into "proper list" of COMPOUND_EXPRs. | |
3508 | I.e. make the last statment also have its own | |
3509 | @@ -3693,42 +3696,42 @@ | |
3510 | ; | |
3511 | break;} | |
3512 | case 256: | |
3513 | -#line 1397 "./parse.y" | |
3514 | +#line 1401 "./parse.y" | |
3515 | { | |
3516 | yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE); | |
3517 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; | |
3518 | ; | |
3519 | break;} | |
3520 | case 257: | |
3521 | -#line 1402 "./parse.y" | |
3522 | +#line 1406 "./parse.y" | |
3523 | {yyerror ("'(' expected"); RECOVER;; | |
3524 | break;} | |
3525 | case 258: | |
3526 | -#line 1404 "./parse.y" | |
3527 | +#line 1408 "./parse.y" | |
3528 | {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);; | |
3529 | break;} | |
3530 | case 259: | |
3531 | -#line 1406 "./parse.y" | |
3532 | +#line 1410 "./parse.y" | |
3533 | {yyerror ("'{' expected"); RECOVER;; | |
3534 | break;} | |
3535 | case 260: | |
3536 | -#line 1414 "./parse.y" | |
3537 | +#line 1418 "./parse.y" | |
3538 | { yyval.node = NULL_TREE; ; | |
3539 | break;} | |
3540 | case 261: | |
3541 | -#line 1416 "./parse.y" | |
3542 | +#line 1420 "./parse.y" | |
3543 | { yyval.node = NULL_TREE; ; | |
3544 | break;} | |
3545 | case 262: | |
3546 | -#line 1418 "./parse.y" | |
3547 | +#line 1422 "./parse.y" | |
3548 | { yyval.node = NULL_TREE; ; | |
3549 | break;} | |
3550 | case 263: | |
3551 | -#line 1420 "./parse.y" | |
3552 | +#line 1424 "./parse.y" | |
3553 | { yyval.node = NULL_TREE; ; | |
3554 | break;} | |
3555 | case 269: | |
3556 | -#line 1439 "./parse.y" | |
3557 | +#line 1443 "./parse.y" | |
3558 | { | |
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 @@ | |
3562 | ; | |
3563 | break;} | |
3564 | case 270: | |
3565 | -#line 1445 "./parse.y" | |
3566 | +#line 1449 "./parse.y" | |
3567 | { | |
3568 | tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE); | |
3569 | EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location; | |
3570 | @@ -3744,61 +3747,61 @@ | |
3571 | ; | |
3572 | break;} | |
3573 | case 271: | |
3574 | -#line 1451 "./parse.y" | |
3575 | +#line 1455 "./parse.y" | |
3576 | {yyerror ("Missing or invalid constant expression"); RECOVER;; | |
3577 | break;} | |
3578 | case 272: | |
3579 | -#line 1453 "./parse.y" | |
3580 | +#line 1457 "./parse.y" | |
3581 | {yyerror ("':' expected"); RECOVER;; | |
3582 | break;} | |
3583 | case 273: | |
3584 | -#line 1455 "./parse.y" | |
3585 | +#line 1459 "./parse.y" | |
3586 | {yyerror ("':' expected"); RECOVER;; | |
3587 | break;} | |
3588 | case 274: | |
3589 | -#line 1460 "./parse.y" | |
3590 | +#line 1464 "./parse.y" | |
3591 | { | |
3592 | tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0); | |
3593 | yyval.node = build_new_loop (body); | |
3594 | ; | |
3595 | break;} | |
3596 | case 275: | |
3597 | -#line 1468 "./parse.y" | |
3598 | +#line 1472 "./parse.y" | |
3599 | { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; | |
3600 | break;} | |
3601 | case 276: | |
3602 | -#line 1470 "./parse.y" | |
3603 | +#line 1474 "./parse.y" | |
3604 | {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;; | |
3605 | break;} | |
3606 | case 277: | |
3607 | -#line 1472 "./parse.y" | |
3608 | +#line 1476 "./parse.y" | |
3609 | {yyerror ("Missing term and ')' expected"); RECOVER;; | |
3610 | break;} | |
3611 | case 278: | |
3612 | -#line 1474 "./parse.y" | |
3613 | +#line 1478 "./parse.y" | |
3614 | {yyerror ("')' expected"); RECOVER;; | |
3615 | break;} | |
3616 | case 279: | |
3617 | -#line 1479 "./parse.y" | |
3618 | +#line 1483 "./parse.y" | |
3619 | { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; | |
3620 | break;} | |
3621 | case 280: | |
3622 | -#line 1484 "./parse.y" | |
3623 | +#line 1488 "./parse.y" | |
3624 | { | |
3625 | tree body = build_loop_body (0, NULL_TREE, 1); | |
3626 | yyval.node = build_new_loop (body); | |
3627 | ; | |
3628 | break;} | |
3629 | case 281: | |
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); ; | |
3633 | break;} | |
3634 | case 282: | |
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); ; | |
3638 | break;} | |
3639 | case 283: | |
3640 | -#line 1500 "./parse.y" | |
3641 | +#line 1504 "./parse.y" | |
3642 | { | |
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 @@ | |
3646 | ; | |
3647 | break;} | |
3648 | case 284: | |
3649 | -#line 1507 "./parse.y" | |
3650 | +#line 1511 "./parse.y" | |
3651 | {yyerror ("Invalid control expression"); RECOVER;; | |
3652 | break;} | |
3653 | case 285: | |
3654 | -#line 1509 "./parse.y" | |
3655 | +#line 1513 "./parse.y" | |
3656 | {yyerror ("Invalid update expression"); RECOVER;; | |
3657 | break;} | |
3658 | case 286: | |
3659 | -#line 1511 "./parse.y" | |
3660 | +#line 1515 "./parse.y" | |
3661 | {yyerror ("Invalid update expression"); RECOVER;; | |
3662 | break;} | |
3663 | case 287: | |
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);; | |
3667 | break;} | |
3668 | case 288: | |
3669 | -#line 1518 "./parse.y" | |
3670 | +#line 1522 "./parse.y" | |
3671 | { | |
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 @@ | |
3675 | ; | |
3676 | break;} | |
3677 | case 289: | |
3678 | -#line 1528 "./parse.y" | |
3679 | +#line 1532 "./parse.y" | |
3680 | { | |
3681 | /* This scope defined for local variable that may be | |
3682 | defined within the scope of the for loop */ | |
3683 | @@ -3840,15 +3843,15 @@ | |
3684 | ; | |
3685 | break;} | |
3686 | case 290: | |
3687 | -#line 1534 "./parse.y" | |
3688 | +#line 1538 "./parse.y" | |
3689 | {yyerror ("'(' expected"); DRECOVER(for_1);; | |
3690 | break;} | |
3691 | case 291: | |
3692 | -#line 1536 "./parse.y" | |
3693 | +#line 1540 "./parse.y" | |
3694 | {yyerror ("Invalid init statement"); RECOVER;; | |
3695 | break;} | |
3696 | case 292: | |
3697 | -#line 1541 "./parse.y" | |
3698 | +#line 1545 "./parse.y" | |
3699 | { | |
3700 | /* We now declare the loop body. The loop is | |
3701 | declared as a for loop. */ | |
3702 | @@ -3861,11 +3864,11 @@ | |
3703 | ; | |
3704 | break;} | |
3705 | case 293: | |
3706 | -#line 1553 "./parse.y" | |
3707 | +#line 1557 "./parse.y" | |
3708 | { yyval.node = empty_stmt_node; ; | |
3709 | break;} | |
3710 | case 294: | |
3711 | -#line 1555 "./parse.y" | |
3712 | +#line 1559 "./parse.y" | |
3713 | { | |
3714 | /* Init statement recorded within the previously | |
3715 | defined block scope */ | |
3716 | @@ -3873,7 +3876,7 @@ | |
3717 | ; | |
3718 | break;} | |
3719 | case 295: | |
3720 | -#line 1561 "./parse.y" | |
3721 | +#line 1565 "./parse.y" | |
3722 | { | |
3723 | /* Local variable are recorded within the previously | |
3724 | defined block scope */ | |
3725 | @@ -3881,94 +3884,94 @@ | |
3726 | ; | |
3727 | break;} | |
3728 | case 296: | |
3729 | -#line 1567 "./parse.y" | |
3730 | +#line 1571 "./parse.y" | |
3731 | {yyerror ("';' expected"); DRECOVER(for_init_1);; | |
3732 | break;} | |
3733 | case 297: | |
3734 | -#line 1571 "./parse.y" | |
3735 | +#line 1575 "./parse.y" | |
3736 | {yyval.node = empty_stmt_node;; | |
3737 | break;} | |
3738 | case 298: | |
3739 | -#line 1573 "./parse.y" | |
3740 | +#line 1577 "./parse.y" | |
3741 | { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ; | |
3742 | break;} | |
3743 | case 299: | |
3744 | -#line 1578 "./parse.y" | |
3745 | +#line 1582 "./parse.y" | |
3746 | { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ; | |
3747 | break;} | |
3748 | case 300: | |
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); ; | |
3752 | break;} | |
3753 | case 301: | |
3754 | -#line 1582 "./parse.y" | |
3755 | +#line 1586 "./parse.y" | |
3756 | {yyerror ("Missing term"); RECOVER;; | |
3757 | break;} | |
3758 | case 302: | |
3759 | -#line 1587 "./parse.y" | |
3760 | +#line 1591 "./parse.y" | |
3761 | { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ; | |
3762 | break;} | |
3763 | case 303: | |
3764 | -#line 1589 "./parse.y" | |
3765 | +#line 1593 "./parse.y" | |
3766 | { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ; | |
3767 | break;} | |
3768 | case 304: | |
3769 | -#line 1591 "./parse.y" | |
3770 | +#line 1595 "./parse.y" | |
3771 | {yyerror ("Missing term"); RECOVER;; | |
3772 | break;} | |
3773 | case 305: | |
3774 | -#line 1593 "./parse.y" | |
3775 | +#line 1597 "./parse.y" | |
3776 | {yyerror ("';' expected"); RECOVER;; | |
3777 | break;} | |
3778 | case 306: | |
3779 | -#line 1598 "./parse.y" | |
3780 | +#line 1602 "./parse.y" | |
3781 | { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ; | |
3782 | break;} | |
3783 | case 307: | |
3784 | -#line 1600 "./parse.y" | |
3785 | +#line 1604 "./parse.y" | |
3786 | { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ; | |
3787 | break;} | |
3788 | case 308: | |
3789 | -#line 1602 "./parse.y" | |
3790 | +#line 1606 "./parse.y" | |
3791 | {yyerror ("Missing term"); RECOVER;; | |
3792 | break;} | |
3793 | case 309: | |
3794 | -#line 1604 "./parse.y" | |
3795 | +#line 1608 "./parse.y" | |
3796 | {yyerror ("';' expected"); RECOVER;; | |
3797 | break;} | |
3798 | case 310: | |
3799 | -#line 1609 "./parse.y" | |
3800 | +#line 1613 "./parse.y" | |
3801 | { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ; | |
3802 | break;} | |
3803 | case 311: | |
3804 | -#line 1611 "./parse.y" | |
3805 | +#line 1615 "./parse.y" | |
3806 | { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ; | |
3807 | break;} | |
3808 | case 312: | |
3809 | -#line 1613 "./parse.y" | |
3810 | +#line 1617 "./parse.y" | |
3811 | {yyerror ("Missing term"); RECOVER;; | |
3812 | break;} | |
3813 | case 313: | |
3814 | -#line 1615 "./parse.y" | |
3815 | +#line 1619 "./parse.y" | |
3816 | {yyerror ("';' expected"); RECOVER;; | |
3817 | break;} | |
3818 | case 314: | |
3819 | -#line 1620 "./parse.y" | |
3820 | +#line 1624 "./parse.y" | |
3821 | { | |
3822 | yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node); | |
3823 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; | |
3824 | ; | |
3825 | break;} | |
3826 | case 315: | |
3827 | -#line 1625 "./parse.y" | |
3828 | +#line 1629 "./parse.y" | |
3829 | {yyerror ("Missing term"); RECOVER;; | |
3830 | break;} | |
3831 | case 316: | |
3832 | -#line 1627 "./parse.y" | |
3833 | +#line 1631 "./parse.y" | |
3834 | {yyerror ("';' expected"); RECOVER;; | |
3835 | break;} | |
3836 | case 317: | |
3837 | -#line 1632 "./parse.y" | |
3838 | +#line 1636 "./parse.y" | |
3839 | { | |
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 @@ | |
3843 | ; | |
3844 | break;} | |
3845 | case 318: | |
3846 | -#line 1638 "./parse.y" | |
3847 | +#line 1642 "./parse.y" | |
3848 | {yyerror ("'{' expected"); RECOVER;; | |
3849 | break;} | |
3850 | case 319: | |
3851 | -#line 1640 "./parse.y" | |
3852 | +#line 1644 "./parse.y" | |
3853 | {yyerror ("'(' expected"); RECOVER;; | |
3854 | break;} | |
3855 | case 320: | |
3856 | -#line 1642 "./parse.y" | |
3857 | +#line 1646 "./parse.y" | |
3858 | {yyerror ("Missing term"); RECOVER;; | |
3859 | break;} | |
3860 | case 321: | |
3861 | -#line 1644 "./parse.y" | |
3862 | +#line 1648 "./parse.y" | |
3863 | {yyerror ("Missing term"); RECOVER;; | |
3864 | break;} | |
3865 | case 322: | |
3866 | -#line 1649 "./parse.y" | |
3867 | +#line 1653 "./parse.y" | |
3868 | { | |
3869 | if ((1 << yyvsp[0].value) != ACC_SYNCHRONIZED) | |
3870 | fatal ("synchronized was '%d' - yyparse", (1 << yyvsp[0].value)); | |
3871 | ; | |
3872 | break;} | |
3873 | case 323: | |
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); ; | |
3877 | break;} | |
3878 | case 324: | |
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); ; | |
3882 | break;} | |
3883 | case 325: | |
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); | |
3889 | ; | |
3890 | break;} | |
3891 | case 326: | |
3892 | -#line 1666 "./parse.y" | |
3893 | +#line 1670 "./parse.y" | |
3894 | {yyerror ("'{' expected"); DRECOVER (try_statement);; | |
3895 | break;} | |
3896 | case 328: | |
3897 | -#line 1672 "./parse.y" | |
3898 | +#line 1676 "./parse.y" | |
3899 | { | |
3900 | TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node; | |
3901 | yyval.node = yyvsp[0].node; | |
3902 | ; | |
3903 | break;} | |
3904 | case 329: | |
3905 | -#line 1680 "./parse.y" | |
3906 | +#line 1684 "./parse.y" | |
3907 | { | |
3908 | java_method_add_stmt (current_function_decl, yyvsp[0].node); | |
3909 | exit_block (); | |
3910 | @@ -4033,7 +4036,7 @@ | |
3911 | ; | |
3912 | break;} | |
3913 | case 330: | |
3914 | -#line 1688 "./parse.y" | |
3915 | +#line 1692 "./parse.y" | |
3916 | { | |
3917 | /* We add a block to define a scope for | |
3918 | formal_parameter (CCBP). The formal parameter is | |
3919 | @@ -4051,176 +4054,176 @@ | |
3920 | ; | |
3921 | break;} | |
3922 | case 331: | |
3923 | -#line 1704 "./parse.y" | |
3924 | +#line 1708 "./parse.y" | |
3925 | {yyerror ("'(' expected"); RECOVER;; | |
3926 | break;} | |
3927 | case 332: | |
3928 | -#line 1706 "./parse.y" | |
3929 | +#line 1710 "./parse.y" | |
3930 | {yyerror ("Missing term or ')' expected"); DRECOVER (2);; | |
3931 | break;} | |
3932 | case 333: | |
3933 | -#line 1708 "./parse.y" | |
3934 | +#line 1712 "./parse.y" | |
3935 | {yyerror ("')' expected"); DRECOVER (1);; | |
3936 | break;} | |
3937 | case 334: | |
3938 | -#line 1713 "./parse.y" | |
3939 | +#line 1717 "./parse.y" | |
3940 | { yyval.node = yyvsp[0].node; ; | |
3941 | break;} | |
3942 | case 335: | |
3943 | -#line 1715 "./parse.y" | |
3944 | +#line 1719 "./parse.y" | |
3945 | {yyerror ("'{' expected"); RECOVER; ; | |
3946 | break;} | |
3947 | case 339: | |
3948 | -#line 1727 "./parse.y" | |
3949 | +#line 1731 "./parse.y" | |
3950 | { yyval.node = build_this (yyvsp[0].operator.location); ; | |
3951 | break;} | |
3952 | case 340: | |
3953 | -#line 1729 "./parse.y" | |
3954 | +#line 1733 "./parse.y" | |
3955 | {yyval.node = yyvsp[-1].node;; | |
3956 | break;} | |
3957 | case 345: | |
3958 | -#line 1738 "./parse.y" | |
3959 | +#line 1742 "./parse.y" | |
3960 | { yyval.node = parse_jdk1_1_error ("named class literals"); ; | |
3961 | break;} | |
3962 | case 346: | |
3963 | -#line 1740 "./parse.y" | |
3964 | +#line 1744 "./parse.y" | |
3965 | { yyval.node = build_class_ref (yyvsp[-2].node); ; | |
3966 | break;} | |
3967 | case 347: | |
3968 | -#line 1742 "./parse.y" | |
3969 | +#line 1746 "./parse.y" | |
3970 | { yyval.node = build_class_ref (void_type_node); ; | |
3971 | break;} | |
3972 | case 348: | |
3973 | -#line 1747 "./parse.y" | |
3974 | +#line 1751 "./parse.y" | |
3975 | { yyval.node = parse_jdk1_1_error ("class literals"); ; | |
3976 | break;} | |
3977 | case 349: | |
3978 | -#line 1749 "./parse.y" | |
3979 | +#line 1753 "./parse.y" | |
3980 | {yyerror ("')' expected"); RECOVER;; | |
3981 | break;} | |
3982 | case 350: | |
3983 | -#line 1751 "./parse.y" | |
3984 | +#line 1755 "./parse.y" | |
3985 | {yyerror ("'class' or 'this' expected" ); RECOVER;; | |
3986 | break;} | |
3987 | case 351: | |
3988 | -#line 1753 "./parse.y" | |
3989 | +#line 1757 "./parse.y" | |
3990 | {yyerror ("'class' expected" ); RECOVER;; | |
3991 | break;} | |
3992 | case 352: | |
3993 | -#line 1755 "./parse.y" | |
3994 | +#line 1759 "./parse.y" | |
3995 | {yyerror ("'class' expected" ); RECOVER;; | |
3996 | break;} | |
3997 | case 353: | |
3998 | -#line 1760 "./parse.y" | |
3999 | +#line 1764 "./parse.y" | |
4000 | { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ; | |
4001 | break;} | |
4002 | case 354: | |
4003 | -#line 1762 "./parse.y" | |
4004 | +#line 1766 "./parse.y" | |
4005 | { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ; | |
4006 | break;} | |
4007 | case 355: | |
4008 | -#line 1767 "./parse.y" | |
4009 | +#line 1771 "./parse.y" | |
4010 | { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; | |
4011 | break;} | |
4012 | case 356: | |
4013 | -#line 1769 "./parse.y" | |
4014 | +#line 1773 "./parse.y" | |
4015 | { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; | |
4016 | break;} | |
4017 | case 361: | |
4018 | -#line 1778 "./parse.y" | |
4019 | +#line 1782 "./parse.y" | |
4020 | {yyerror ("'(' expected"); DRECOVER(new_1);; | |
4021 | break;} | |
4022 | case 362: | |
4023 | -#line 1780 "./parse.y" | |
4024 | +#line 1784 "./parse.y" | |
4025 | {yyerror ("'(' expected"); RECOVER;; | |
4026 | break;} | |
4027 | case 363: | |
4028 | -#line 1782 "./parse.y" | |
4029 | +#line 1786 "./parse.y" | |
4030 | {yyerror ("')' or term expected"); RECOVER;; | |
4031 | break;} | |
4032 | case 364: | |
4033 | -#line 1784 "./parse.y" | |
4034 | +#line 1788 "./parse.y" | |
4035 | {yyerror ("')' expected"); RECOVER;; | |
4036 | break;} | |
4037 | case 365: | |
4038 | -#line 1786 "./parse.y" | |
4039 | +#line 1790 "./parse.y" | |
4040 | {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;; | |
4041 | break;} | |
4042 | case 366: | |
4043 | -#line 1788 "./parse.y" | |
4044 | +#line 1792 "./parse.y" | |
4045 | {yyerror ("'(' expected"); RECOVER;; | |
4046 | break;} | |
4047 | case 369: | |
4048 | -#line 1798 "./parse.y" | |
4049 | +#line 1802 "./parse.y" | |
4050 | { | |
4051 | yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE); | |
4052 | ctxp->formal_parameter_number = 1; | |
4053 | ; | |
4054 | break;} | |
4055 | case 370: | |
4056 | -#line 1803 "./parse.y" | |
4057 | +#line 1807 "./parse.y" | |
4058 | { | |
4059 | ctxp->formal_parameter_number += 1; | |
4060 | yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node); | |
4061 | ; | |
4062 | break;} | |
4063 | case 371: | |
4064 | -#line 1808 "./parse.y" | |
4065 | +#line 1812 "./parse.y" | |
4066 | {yyerror ("Missing term"); RECOVER;; | |
4067 | break;} | |
4068 | case 372: | |
4069 | -#line 1813 "./parse.y" | |
4070 | +#line 1817 "./parse.y" | |
4071 | { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; | |
4072 | break;} | |
4073 | case 373: | |
4074 | -#line 1815 "./parse.y" | |
4075 | +#line 1819 "./parse.y" | |
4076 | { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; | |
4077 | break;} | |
4078 | case 374: | |
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));; | |
4082 | break;} | |
4083 | case 375: | |
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));; | |
4087 | break;} | |
4088 | case 376: | |
4089 | -#line 1823 "./parse.y" | |
4090 | +#line 1827 "./parse.y" | |
4091 | { yyval.node = parse_jdk1_1_error ("anonymous array"); ; | |
4092 | break;} | |
4093 | case 377: | |
4094 | -#line 1825 "./parse.y" | |
4095 | +#line 1829 "./parse.y" | |
4096 | { yyval.node = parse_jdk1_1_error ("anonymous array"); ; | |
4097 | break;} | |
4098 | case 378: | |
4099 | -#line 1827 "./parse.y" | |
4100 | +#line 1831 "./parse.y" | |
4101 | {yyerror ("'[' expected"); DRECOVER ("]");; | |
4102 | break;} | |
4103 | case 379: | |
4104 | -#line 1829 "./parse.y" | |
4105 | +#line 1833 "./parse.y" | |
4106 | {yyerror ("']' expected"); RECOVER;; | |
4107 | break;} | |
4108 | case 380: | |
4109 | -#line 1834 "./parse.y" | |
4110 | +#line 1838 "./parse.y" | |
4111 | { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ; | |
4112 | break;} | |
4113 | case 381: | |
4114 | -#line 1836 "./parse.y" | |
4115 | +#line 1840 "./parse.y" | |
4116 | { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ; | |
4117 | break;} | |
4118 | case 382: | |
4119 | -#line 1841 "./parse.y" | |
4120 | +#line 1845 "./parse.y" | |
4121 | { | |
4122 | EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location; | |
4123 | yyval.node = yyvsp[-1].node; | |
4124 | ; | |
4125 | break;} | |
4126 | case 383: | |
4127 | -#line 1846 "./parse.y" | |
4128 | +#line 1850 "./parse.y" | |
4129 | {yyerror ("']' expected"); RECOVER;; | |
4130 | break;} | |
4131 | case 384: | |
4132 | -#line 1848 "./parse.y" | |
4133 | +#line 1852 "./parse.y" | |
4134 | { | |
4135 | yyerror ("Missing term"); | |
4136 | yyerror ("']' expected"); | |
4137 | @@ -4228,7 +4231,7 @@ | |
4138 | ; | |
4139 | break;} | |
4140 | case 385: | |
4141 | -#line 1857 "./parse.y" | |
4142 | +#line 1861 "./parse.y" | |
4143 | { | |
4144 | int allocate = 0; | |
4145 | /* If not initialized, allocate memory for the osb | |
4146 | @@ -4256,19 +4259,19 @@ | |
4147 | ; | |
4148 | break;} | |
4149 | case 386: | |
4150 | -#line 1883 "./parse.y" | |
4151 | +#line 1887 "./parse.y" | |
4152 | { CURRENT_OSB (ctxp)++; ; | |
4153 | break;} | |
4154 | case 387: | |
4155 | -#line 1885 "./parse.y" | |
4156 | +#line 1889 "./parse.y" | |
4157 | { yyerror ("']' expected"); RECOVER;; | |
4158 | break;} | |
4159 | case 388: | |
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); ; | |
4163 | break;} | |
4164 | case 389: | |
4165 | -#line 1894 "./parse.y" | |
4166 | +#line 1898 "./parse.y" | |
4167 | { | |
4168 | tree super_wfl = | |
4169 | build_wfl_node (super_identifier_node); | |
4170 | @@ -4277,19 +4280,19 @@ | |
4171 | ; | |
4172 | break;} | |
4173 | case 390: | |
4174 | -#line 1901 "./parse.y" | |
4175 | +#line 1905 "./parse.y" | |
4176 | {yyerror ("Field expected"); DRECOVER (super_field_acces);; | |
4177 | break;} | |
4178 | case 391: | |
4179 | -#line 1906 "./parse.y" | |
4180 | +#line 1910 "./parse.y" | |
4181 | { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ; | |
4182 | break;} | |
4183 | case 392: | |
4184 | -#line 1908 "./parse.y" | |
4185 | +#line 1912 "./parse.y" | |
4186 | { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ; | |
4187 | break;} | |
4188 | case 393: | |
4189 | -#line 1910 "./parse.y" | |
4190 | +#line 1914 "./parse.y" | |
4191 | { | |
4192 | if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR) | |
4193 | yyval.node = build_this_super_qualified_invocation | |
4194 | @@ -4302,7 +4305,7 @@ | |
4195 | ; | |
4196 | break;} | |
4197 | case 394: | |
4198 | -#line 1921 "./parse.y" | |
4199 | +#line 1925 "./parse.y" | |
4200 | { | |
4201 | if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR) | |
4202 | yyval.node = build_this_super_qualified_invocation | |
4203 | @@ -4315,121 +4318,121 @@ | |
4204 | ; | |
4205 | break;} | |
4206 | case 395: | |
4207 | -#line 1932 "./parse.y" | |
4208 | +#line 1936 "./parse.y" | |
4209 | { | |
4210 | yyval.node = build_this_super_qualified_invocation | |
4211 | (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location); | |
4212 | ; | |
4213 | break;} | |
4214 | case 396: | |
4215 | -#line 1937 "./parse.y" | |
4216 | +#line 1941 "./parse.y" | |
4217 | { | |
4218 | yyval.node = build_this_super_qualified_invocation | |
4219 | (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location); | |
4220 | ; | |
4221 | break;} | |
4222 | case 397: | |
4223 | -#line 1946 "./parse.y" | |
4224 | +#line 1950 "./parse.y" | |
4225 | { yyerror ("'(' expected"); DRECOVER (method_invocation); ; | |
4226 | break;} | |
4227 | case 398: | |
4228 | -#line 1948 "./parse.y" | |
4229 | +#line 1952 "./parse.y" | |
4230 | { yyerror ("'(' expected"); DRECOVER (method_invocation); ; | |
4231 | break;} | |
4232 | case 399: | |
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); ; | |
4236 | break;} | |
4237 | case 400: | |
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); ; | |
4241 | break;} | |
4242 | case 401: | |
4243 | -#line 1957 "./parse.y" | |
4244 | +#line 1961 "./parse.y" | |
4245 | { | |
4246 | yyerror ("Missing term and ']' expected"); | |
4247 | DRECOVER(array_access); | |
4248 | ; | |
4249 | break;} | |
4250 | case 402: | |
4251 | -#line 1962 "./parse.y" | |
4252 | +#line 1966 "./parse.y" | |
4253 | { | |
4254 | yyerror ("']' expected"); | |
4255 | DRECOVER(array_access); | |
4256 | ; | |
4257 | break;} | |
4258 | case 403: | |
4259 | -#line 1967 "./parse.y" | |
4260 | +#line 1971 "./parse.y" | |
4261 | { | |
4262 | yyerror ("Missing term and ']' expected"); | |
4263 | DRECOVER(array_access); | |
4264 | ; | |
4265 | break;} | |
4266 | case 404: | |
4267 | -#line 1972 "./parse.y" | |
4268 | +#line 1976 "./parse.y" | |
4269 | { | |
4270 | yyerror ("']' expected"); | |
4271 | DRECOVER(array_access); | |
4272 | ; | |
4273 | break;} | |
4274 | case 409: | |
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); ; | |
4278 | break;} | |
4279 | case 410: | |
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); ; | |
4283 | break;} | |
4284 | case 413: | |
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); ; | |
4288 | break;} | |
4289 | case 414: | |
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); ; | |
4293 | break;} | |
4294 | case 416: | |
4295 | -#line 2004 "./parse.y" | |
4296 | +#line 2008 "./parse.y" | |
4297 | {yyerror ("Missing term"); RECOVER; | |
4298 | break;} | |
4299 | case 417: | |
4300 | -#line 2006 "./parse.y" | |
4301 | +#line 2010 "./parse.y" | |
4302 | {yyerror ("Missing term"); RECOVER; | |
4303 | break;} | |
4304 | case 418: | |
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); ; | |
4308 | break;} | |
4309 | case 419: | |
4310 | -#line 2013 "./parse.y" | |
4311 | +#line 2017 "./parse.y" | |
4312 | {yyerror ("Missing term"); RECOVER; | |
4313 | break;} | |
4314 | case 420: | |
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); ; | |
4318 | break;} | |
4319 | case 421: | |
4320 | -#line 2020 "./parse.y" | |
4321 | +#line 2024 "./parse.y" | |
4322 | {yyerror ("Missing term"); RECOVER; | |
4323 | break;} | |
4324 | case 423: | |
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); ; | |
4328 | break;} | |
4329 | case 424: | |
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); ; | |
4333 | break;} | |
4334 | case 426: | |
4335 | -#line 2031 "./parse.y" | |
4336 | +#line 2035 "./parse.y" | |
4337 | {yyerror ("Missing term"); RECOVER; | |
4338 | break;} | |
4339 | case 427: | |
4340 | -#line 2033 "./parse.y" | |
4341 | +#line 2037 "./parse.y" | |
4342 | {yyerror ("Missing term"); RECOVER; | |
4343 | break;} | |
4344 | case 428: | |
4345 | -#line 2038 "./parse.y" | |
4346 | +#line 2042 "./parse.y" | |
4347 | { | |
4348 | tree type = yyvsp[-3].node; | |
4349 | while (CURRENT_OSB (ctxp)--) | |
4350 | @@ -4439,15 +4442,15 @@ | |
4351 | ; | |
4352 | break;} | |
4353 | case 429: | |
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); ; | |
4357 | break;} | |
4358 | case 430: | |
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); ; | |
4362 | break;} | |
4363 | case 431: | |
4364 | -#line 2050 "./parse.y" | |
4365 | +#line 2054 "./parse.y" | |
4366 | { | |
4367 | char *ptr; | |
4368 | while (CURRENT_OSB (ctxp)--) | |
4369 | @@ -4462,11 +4465,11 @@ | |
4370 | ; | |
4371 | break;} | |
4372 | case 432: | |
4373 | -#line 2063 "./parse.y" | |
4374 | +#line 2067 "./parse.y" | |
4375 | {yyerror ("']' expected, invalid type expression");; | |
4376 | break;} | |
4377 | case 433: | |
4378 | -#line 2065 "./parse.y" | |
4379 | +#line 2069 "./parse.y" | |
4380 | { | |
4381 | if (ctxp->prevent_ese != lineno) | |
4382 | yyerror ("Invalid type expression"); RECOVER; | |
4383 | @@ -4474,243 +4477,243 @@ | |
4384 | ; | |
4385 | break;} | |
4386 | case 434: | |
4387 | -#line 2071 "./parse.y" | |
4388 | +#line 2075 "./parse.y" | |
4389 | {yyerror ("Missing term"); RECOVER;; | |
4390 | break;} | |
4391 | case 435: | |
4392 | -#line 2073 "./parse.y" | |
4393 | +#line 2077 "./parse.y" | |
4394 | {yyerror ("Missing term"); RECOVER;; | |
4395 | break;} | |
4396 | case 436: | |
4397 | -#line 2075 "./parse.y" | |
4398 | +#line 2079 "./parse.y" | |
4399 | {yyerror ("Missing term"); RECOVER;; | |
4400 | break;} | |
4401 | case 438: | |
4402 | -#line 2081 "./parse.y" | |
4403 | +#line 2085 "./parse.y" | |
4404 | { | |
4405 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), | |
4406 | yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); | |
4407 | ; | |
4408 | break;} | |
4409 | case 439: | |
4410 | -#line 2086 "./parse.y" | |
4411 | +#line 2090 "./parse.y" | |
4412 | { | |
4413 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4414 | yyvsp[-2].node, yyvsp[0].node); | |
4415 | ; | |
4416 | break;} | |
4417 | case 440: | |
4418 | -#line 2091 "./parse.y" | |
4419 | +#line 2095 "./parse.y" | |
4420 | { | |
4421 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4422 | yyvsp[-2].node, yyvsp[0].node); | |
4423 | ; | |
4424 | break;} | |
4425 | case 441: | |
4426 | -#line 2096 "./parse.y" | |
4427 | +#line 2100 "./parse.y" | |
4428 | {yyerror ("Missing term"); RECOVER;; | |
4429 | break;} | |
4430 | case 442: | |
4431 | -#line 2098 "./parse.y" | |
4432 | +#line 2102 "./parse.y" | |
4433 | {yyerror ("Missing term"); RECOVER;; | |
4434 | break;} | |
4435 | case 443: | |
4436 | -#line 2100 "./parse.y" | |
4437 | +#line 2104 "./parse.y" | |
4438 | {yyerror ("Missing term"); RECOVER;; | |
4439 | break;} | |
4440 | case 445: | |
4441 | -#line 2106 "./parse.y" | |
4442 | +#line 2110 "./parse.y" | |
4443 | { | |
4444 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4445 | yyvsp[-2].node, yyvsp[0].node); | |
4446 | ; | |
4447 | break;} | |
4448 | case 446: | |
4449 | -#line 2111 "./parse.y" | |
4450 | +#line 2115 "./parse.y" | |
4451 | { | |
4452 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4453 | yyvsp[-2].node, yyvsp[0].node); | |
4454 | ; | |
4455 | break;} | |
4456 | case 447: | |
4457 | -#line 2116 "./parse.y" | |
4458 | +#line 2120 "./parse.y" | |
4459 | {yyerror ("Missing term"); RECOVER;; | |
4460 | break;} | |
4461 | case 448: | |
4462 | -#line 2118 "./parse.y" | |
4463 | +#line 2122 "./parse.y" | |
4464 | {yyerror ("Missing term"); RECOVER;; | |
4465 | break;} | |
4466 | case 450: | |
4467 | -#line 2124 "./parse.y" | |
4468 | +#line 2128 "./parse.y" | |
4469 | { | |
4470 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4471 | yyvsp[-2].node, yyvsp[0].node); | |
4472 | ; | |
4473 | break;} | |
4474 | case 451: | |
4475 | -#line 2129 "./parse.y" | |
4476 | +#line 2133 "./parse.y" | |
4477 | { | |
4478 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4479 | yyvsp[-2].node, yyvsp[0].node); | |
4480 | ; | |
4481 | break;} | |
4482 | case 452: | |
4483 | -#line 2134 "./parse.y" | |
4484 | +#line 2138 "./parse.y" | |
4485 | { | |
4486 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4487 | yyvsp[-2].node, yyvsp[0].node); | |
4488 | ; | |
4489 | break;} | |
4490 | case 453: | |
4491 | -#line 2139 "./parse.y" | |
4492 | +#line 2143 "./parse.y" | |
4493 | {yyerror ("Missing term"); RECOVER;; | |
4494 | break;} | |
4495 | case 454: | |
4496 | -#line 2141 "./parse.y" | |
4497 | +#line 2145 "./parse.y" | |
4498 | {yyerror ("Missing term"); RECOVER;; | |
4499 | break;} | |
4500 | case 455: | |
4501 | -#line 2143 "./parse.y" | |
4502 | +#line 2147 "./parse.y" | |
4503 | {yyerror ("Missing term"); RECOVER;; | |
4504 | break;} | |
4505 | case 457: | |
4506 | -#line 2149 "./parse.y" | |
4507 | +#line 2153 "./parse.y" | |
4508 | { | |
4509 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4510 | yyvsp[-2].node, yyvsp[0].node); | |
4511 | ; | |
4512 | break;} | |
4513 | case 458: | |
4514 | -#line 2154 "./parse.y" | |
4515 | +#line 2158 "./parse.y" | |
4516 | { | |
4517 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4518 | yyvsp[-2].node, yyvsp[0].node); | |
4519 | ; | |
4520 | break;} | |
4521 | case 459: | |
4522 | -#line 2159 "./parse.y" | |
4523 | +#line 2163 "./parse.y" | |
4524 | { | |
4525 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4526 | yyvsp[-2].node, yyvsp[0].node); | |
4527 | ; | |
4528 | break;} | |
4529 | case 460: | |
4530 | -#line 2164 "./parse.y" | |
4531 | +#line 2168 "./parse.y" | |
4532 | { | |
4533 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4534 | yyvsp[-2].node, yyvsp[0].node); | |
4535 | ; | |
4536 | break;} | |
4537 | case 461: | |
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); ; | |
4541 | break;} | |
4542 | case 462: | |
4543 | -#line 2171 "./parse.y" | |
4544 | +#line 2175 "./parse.y" | |
4545 | {yyerror ("Missing term"); RECOVER;; | |
4546 | break;} | |
4547 | case 463: | |
4548 | -#line 2173 "./parse.y" | |
4549 | +#line 2177 "./parse.y" | |
4550 | {yyerror ("Missing term"); RECOVER;; | |
4551 | break;} | |
4552 | case 464: | |
4553 | -#line 2175 "./parse.y" | |
4554 | +#line 2179 "./parse.y" | |
4555 | {yyerror ("Missing term"); RECOVER;; | |
4556 | break;} | |
4557 | case 465: | |
4558 | -#line 2177 "./parse.y" | |
4559 | +#line 2181 "./parse.y" | |
4560 | {yyerror ("Missing term"); RECOVER;; | |
4561 | break;} | |
4562 | case 466: | |
4563 | -#line 2179 "./parse.y" | |
4564 | +#line 2183 "./parse.y" | |
4565 | {yyerror ("Invalid reference type"); RECOVER;; | |
4566 | break;} | |
4567 | case 468: | |
4568 | -#line 2185 "./parse.y" | |
4569 | +#line 2189 "./parse.y" | |
4570 | { | |
4571 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4572 | yyvsp[-2].node, yyvsp[0].node); | |
4573 | ; | |
4574 | break;} | |
4575 | case 469: | |
4576 | -#line 2190 "./parse.y" | |
4577 | +#line 2194 "./parse.y" | |
4578 | { | |
4579 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4580 | yyvsp[-2].node, yyvsp[0].node); | |
4581 | ; | |
4582 | break;} | |
4583 | case 470: | |
4584 | -#line 2195 "./parse.y" | |
4585 | +#line 2199 "./parse.y" | |
4586 | {yyerror ("Missing term"); RECOVER;; | |
4587 | break;} | |
4588 | case 471: | |
4589 | -#line 2197 "./parse.y" | |
4590 | +#line 2201 "./parse.y" | |
4591 | {yyerror ("Missing term"); RECOVER;; | |
4592 | break;} | |
4593 | case 473: | |
4594 | -#line 2203 "./parse.y" | |
4595 | +#line 2207 "./parse.y" | |
4596 | { | |
4597 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4598 | yyvsp[-2].node, yyvsp[0].node); | |
4599 | ; | |
4600 | break;} | |
4601 | case 474: | |
4602 | -#line 2208 "./parse.y" | |
4603 | +#line 2212 "./parse.y" | |
4604 | {yyerror ("Missing term"); RECOVER;; | |
4605 | break;} | |
4606 | case 476: | |
4607 | -#line 2214 "./parse.y" | |
4608 | +#line 2218 "./parse.y" | |
4609 | { | |
4610 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4611 | yyvsp[-2].node, yyvsp[0].node); | |
4612 | ; | |
4613 | break;} | |
4614 | case 477: | |
4615 | -#line 2219 "./parse.y" | |
4616 | +#line 2223 "./parse.y" | |
4617 | {yyerror ("Missing term"); RECOVER;; | |
4618 | break;} | |
4619 | case 479: | |
4620 | -#line 2225 "./parse.y" | |
4621 | +#line 2229 "./parse.y" | |
4622 | { | |
4623 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4624 | yyvsp[-2].node, yyvsp[0].node); | |
4625 | ; | |
4626 | break;} | |
4627 | case 480: | |
4628 | -#line 2230 "./parse.y" | |
4629 | +#line 2234 "./parse.y" | |
4630 | {yyerror ("Missing term"); RECOVER;; | |
4631 | break;} | |
4632 | case 482: | |
4633 | -#line 2236 "./parse.y" | |
4634 | +#line 2240 "./parse.y" | |
4635 | { | |
4636 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4637 | yyvsp[-2].node, yyvsp[0].node); | |
4638 | ; | |
4639 | break;} | |
4640 | case 483: | |
4641 | -#line 2241 "./parse.y" | |
4642 | +#line 2245 "./parse.y" | |
4643 | {yyerror ("Missing term"); RECOVER;; | |
4644 | break;} | |
4645 | case 485: | |
4646 | -#line 2247 "./parse.y" | |
4647 | +#line 2251 "./parse.y" | |
4648 | { | |
4649 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4650 | yyvsp[-2].node, yyvsp[0].node); | |
4651 | ; | |
4652 | break;} | |
4653 | case 486: | |
4654 | -#line 2252 "./parse.y" | |
4655 | +#line 2256 "./parse.y" | |
4656 | {yyerror ("Missing term"); RECOVER;; | |
4657 | break;} | |
4658 | case 488: | |
4659 | -#line 2258 "./parse.y" | |
4660 | +#line 2262 "./parse.y" | |
4661 | { | |
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; | |
4664 | ; | |
4665 | break;} | |
4666 | case 489: | |
4667 | -#line 2263 "./parse.y" | |
4668 | +#line 2267 "./parse.y" | |
4669 | { | |
4670 | YYERROR_NOW; | |
4671 | yyerror ("Missing term"); | |
4672 | @@ -4718,19 +4721,19 @@ | |
4673 | ; | |
4674 | break;} | |
4675 | case 490: | |
4676 | -#line 2269 "./parse.y" | |
4677 | +#line 2273 "./parse.y" | |
4678 | {yyerror ("Missing term"); DRECOVER (2);; | |
4679 | break;} | |
4680 | case 491: | |
4681 | -#line 2271 "./parse.y" | |
4682 | +#line 2275 "./parse.y" | |
4683 | {yyerror ("Missing term"); DRECOVER (3);; | |
4684 | break;} | |
4685 | case 494: | |
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); ; | |
4689 | break;} | |
4690 | case 495: | |
4691 | -#line 2283 "./parse.y" | |
4692 | +#line 2287 "./parse.y" | |
4693 | { | |
4694 | if (ctxp->prevent_ese != lineno) | |
4695 | yyerror ("Missing term"); | |
4696 | @@ -4739,7 +4742,7 @@ | |
4697 | break;} | |
4698 | } | |
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" | |
4702 | \f | |
4703 | yyvsp -= yylen; | |
4704 | yyssp -= yylen; | |
4705 | @@ -4959,7 +4962,7 @@ | |
4706 | } | |
4707 | return 1; | |
4708 | } | |
4709 | -#line 2309 "./parse.y" | |
4710 | +#line 2313 "./parse.y" | |
4711 | ||
4712 | \f | |
4713 | ||
4714 | @@ -5063,7 +5066,17 @@ | |
4715 | free (toFree); | |
4716 | } | |
4717 | ||
4718 | -/* Reporting JDK1.1 features not implemented */ | |
4719 | +/* Reporting an constructor invocation error. */ | |
4720 | +static void | |
4721 | +parse_ctor_invocation_error () | |
4722 | +{ | |
4723 | + if (DECL_CONSTRUCTOR_P (current_function_decl)) | |
4724 | + yyerror ("Constructor invocation must be first thing in a constructor"); | |
4725 | + else | |
4726 | + yyerror ("Only constructors can invoke constructors"); | |
4727 | +} | |
4728 | + | |
4729 | +/* Reporting JDK1.1 features not implemented. */ | |
4730 | ||
4731 | static tree | |
4732 | parse_jdk1_1_error (msg) | |
4733 | @@ -5972,13 +5985,18 @@ | |
4734 | { | |
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; | |
4742 | int saved_lineno; | |
4743 | int constructor_ok = 0, must_chain; | |
4744 | ||
4745 | check_modifiers_consistency (flags); | |
4746 | + | |
4747 | + if (ctxp->current_parsed_class) | |
4748 | + this_class = TREE_TYPE (ctxp->current_parsed_class); | |
4749 | + else | |
4750 | + return NULL_TREE; | |
4751 | ||
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) | |
4756 | tree method_body; | |
4757 | { | |
4758 | - int flags = get_access_flags_from_decl (current_function_decl); | |
4759 | + int flags; | |
4760 | + | |
4761 | + if (!current_function_decl) | |
4762 | + return; | |
4763 | + | |
4764 | + flags = get_access_flags_from_decl (current_function_decl); | |
4765 | ||
4766 | /* 8.4.5 Method Body */ | |
4767 | if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body) | |
4768 | @@ -6989,7 +7012,9 @@ | |
4769 | ||
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 @@ | |
4780 | ||
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.) */ | |
4785 | ||
4786 | static int | |
4787 | check_method_redefinition (class, method) | |
4788 | @@ -7206,9 +7231,126 @@ | |
4789 | return 0; | |
4790 | } | |
4791 | ||
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. */ | |
4795 | +static void | |
4796 | +check_abstract_method_definitions (do_interface, class_decl, type) | |
4797 | + int do_interface; | |
4798 | + tree class_decl, type; | |
4799 | +{ | |
4800 | + tree class = TREE_TYPE (class_decl); | |
4801 | + tree method, end_type; | |
4802 | + | |
4803 | + end_type = (do_interface ? object_type_node : type); | |
4804 | + for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method)) | |
4805 | + { | |
4806 | + tree other_super, other_method, method_sig, method_name; | |
4807 | + int found = 0; | |
4808 | + | |
4809 | + if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method)) | |
4810 | + continue; | |
4811 | + | |
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. */ | |
4815 | + | |
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); | |
4820 | + | |
4821 | + for (other_super = class; other_super != end_type; | |
4822 | + other_super = CLASSTYPE_SUPER (other_super)) | |
4823 | + { | |
4824 | + for (other_method = TYPE_METHODS (other_super); other_method; | |
4825 | + other_method = TREE_CHAIN (other_method)) | |
4826 | + { | |
4827 | + tree s = build_java_signature (TREE_TYPE (other_method)); | |
4828 | + tree other_name = DECL_NAME (other_method); | |
4829 | + | |
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) | |
4835 | + { | |
4836 | + found = 1; | |
4837 | + break; | |
4838 | + } | |
4839 | + } | |
4840 | + } | |
4841 | + | |
4842 | + /* Report that abstract METHOD didn't find an implementation | |
4843 | + that CLASS can use. */ | |
4844 | + if (!found) | |
4845 | + { | |
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; | |
4850 | + | |
4851 | + if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION) | |
4852 | + { | |
4853 | + saved_wfl = DECL_NAME (method); | |
4854 | + DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method)); | |
4855 | + } | |
4856 | + | |
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))); | |
4869 | + | |
4870 | + free (t); | |
4871 | + | |
4872 | + if (saved_wfl) | |
4873 | + DECL_NAME (method) = saved_wfl; | |
4874 | + } | |
4875 | + } | |
4876 | +} | |
4877 | + | |
4878 | +/* Check that CLASS_DECL somehoow implements all inherited abstract | |
4879 | + methods. */ | |
4880 | + | |
4881 | +static void | |
4882 | +java_check_abstract_method_definitions (class_decl) | |
4883 | + tree class_decl; | |
4884 | +{ | |
4885 | + tree class = TREE_TYPE (class_decl); | |
4886 | + tree super, vector; | |
4887 | + int i; | |
4888 | + | |
4889 | + if (CLASS_ABSTRACT (class_decl)) | |
4890 | + return; | |
4891 | + | |
4892 | + /* Check for inherited types */ | |
4893 | + for (super = CLASSTYPE_SUPER (class); super != object_type_node; | |
4894 | + super = CLASSTYPE_SUPER (super)) | |
4895 | + { | |
4896 | + if (!CLASS_ABSTRACT (TYPE_NAME (super))) | |
4897 | + continue; | |
4898 | + | |
4899 | + check_abstract_method_definitions (0, class_decl, super); | |
4900 | + } | |
4901 | + | |
4902 | + /* Check for implemented interfaces. */ | |
4903 | + vector = TYPE_BINFO_BASETYPES (class); | |
4904 | + for (i = 1; i < TREE_VEC_LENGTH (vector); i++) | |
4905 | + { | |
4906 | + super = BINFO_TYPE (TREE_VEC_ELT (vector, i)); | |
4907 | + check_abstract_method_definitions (1, class_decl, super); | |
4908 | + } | |
4909 | +} | |
4910 | + | |
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 | |
4914 | + declaration. */ | |
4915 | ||
4916 | static void | |
4917 | java_check_regular_methods (class_decl) | |
4918 | @@ -7384,7 +7526,7 @@ | |
4919 | ||
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. */ | |
4924 | ||
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)); | |
4930 | ||
4931 | + /* Search for inherited abstract method not yet implemented in this | |
4932 | + class. */ | |
4933 | + java_check_abstract_method_definitions (class_decl); | |
4934 | + | |
4935 | if (!saw_constructor) | |
4936 | { | |
4937 | /* No constructor seen, we craft one, at line 0. Since this | |
4938 | @@ -7597,14 +7743,15 @@ | |
4939 | return NULL_TREE; | |
4940 | } | |
4941 | ||
4942 | -/* Return the line that matches DECL line number. Used during error | |
4943 | - report */ | |
4944 | +/* Return the line that matches DECL line number, and try its best to | |
4945 | + position the column number. Used during error reports. */ | |
4946 | ||
4947 | static tree | |
4948 | lookup_cl (decl) | |
4949 | tree decl; | |
4950 | { | |
4951 | static tree cl = NULL_TREE; | |
4952 | + char *line, *found; | |
4953 | ||
4954 | if (!decl) | |
4955 | return NULL_TREE; | |
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); | |
4959 | ||
4960 | + line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)), | |
4961 | + EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl)); | |
4962 | + | |
4963 | + found = strstr ((const char *)line, | |
4964 | + (const char *)IDENTIFIER_POINTER (DECL_NAME (decl))); | |
4965 | + if (found) | |
4966 | + EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line); | |
4967 | + | |
4968 | return cl; | |
4969 | } | |
4970 | ||
4971 | @@ -8149,6 +8304,9 @@ | |
4972 | tree parm_decl; | |
4973 | int i; | |
4974 | ||
4975 | + if (!fndecl) | |
4976 | + return; | |
4977 | + | |
4978 | current_function_decl = fndecl; | |
4979 | ||
4980 | /* New scope for the function */ | |
4981 | @@ -8268,6 +8426,9 @@ | |
4982 | tree fndecl = current_function_decl; | |
4983 | int flag_asynchronous_exceptions = asynchronous_exceptions; | |
4984 | ||
4985 | + if (!fndecl) | |
4986 | + return; | |
4987 | + | |
4988 | java_parser_context_save_global (); | |
4989 | lineno = ctxp->last_ccb_indent1; | |
4990 | ||
4991 | @@ -8323,6 +8484,8 @@ | |
4992 | java_method_add_stmt (fndecl, expr) | |
4993 | tree fndecl, expr; | |
4994 | { | |
4995 | + if (!GET_CURRENT_BLOCK (fndecl)) | |
4996 | + return NULL_TREE; | |
4997 | return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr); | |
4998 | } | |
4999 | ||
5000 | @@ -8721,7 +8884,8 @@ | |
5001 | for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl)) | |
5002 | { | |
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) | |
5007 | return 0; | |
5008 | } | |
5009 | } | |
5010 | @@ -9064,6 +9228,8 @@ | |
5011 | == soft_initclass_node) | |
5012 | return TREE_OPERAND (op1, 1); | |
5013 | } | |
5014 | + else if (JDECL_P (op1)) | |
5015 | + return op1; | |
5016 | } | |
5017 | return node; | |
5018 | } | |
5019 | @@ -9085,6 +9251,8 @@ | |
5020 | for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q)) | |
5021 | { | |
5022 | tree qual_wfl = QUAL_WFL (q); | |
5023 | + tree ret_decl; /* for EH checking */ | |
5024 | + int location; /* for EH checking */ | |
5025 | ||
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)) | |
5031 | return 1; | |
5032 | + | |
5033 | if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR) | |
5034 | CALL_USING_SUPER (qual_wfl) = 1; | |
5035 | - *where_found = | |
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) | |
5042 | return 1; | |
5043 | *type_found = type = QUAL_DECL_TYPE (*where_found); | |
5044 | ||
5045 | + /* EH check */ | |
5046 | + if (location) | |
5047 | + check_thrown_exceptions (location, ret_decl); | |
5048 | + | |
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 @@ | |
5053 | ||
5054 | case CONDITIONAL_EXPR: | |
5055 | case STRING_CST: | |
5056 | + case MODIFY_EXPR: | |
5057 | *where_found = decl = java_complete_tree (qual_wfl); | |
5058 | if (decl == error_mark_node) | |
5059 | return 1; | |
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)); | |
5064 | + | |
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); | |
5069 | ||
5070 | if (flag_emit_class_files || flag_emit_xref) | |
5071 | func = method; | |
5072 | @@ -10042,7 +10223,7 @@ | |
5073 | parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s", | |
5074 | (lc ? "constructor" : "method"), | |
5075 | (lc ? | |
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; | |
5083 | ||
5084 | /* Search interfaces */ | |
5085 | - if (CLASS_INTERFACE (TYPE_NAME (class))) | |
5086 | + if (CLASS_INTERFACE (TYPE_NAME (class)) | |
5087 | + || CLASS_ABSTRACT (TYPE_NAME (class))) | |
5088 | { | |
5089 | static tree searched_interfaces = NULL_TREE; | |
5090 | static int search_not_done = 0; | |
5091 | @@ -10292,7 +10474,7 @@ | |
5092 | break; | |
5093 | case NEW_ARRAY_EXPR: | |
5094 | qual = TREE_CHAIN (qual); | |
5095 | - new_array_found = 1; | |
5096 | + again = new_array_found = 1; | |
5097 | continue; | |
5098 | case NEW_CLASS_EXPR: | |
5099 | case CONVERT_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)); | |
5103 | ||
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)); | |
5107 | - | |
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)); | |
5113 | ||
5114 | else if (code == STRING_CST || code == CONDITIONAL_EXPR) | |
5115 | @@ -10335,8 +10513,15 @@ | |
5116 | again = 1; | |
5117 | } | |
5118 | else | |
5119 | - name = EXPR_WFL_NODE (qual_wfl); | |
5120 | - | |
5121 | + { | |
5122 | + name = EXPR_WFL_NODE (qual_wfl); | |
5123 | + if (!name) | |
5124 | + { | |
5125 | + qual = EXPR_WFL_QUALIFICATION (qual_wfl); | |
5126 | + again = 1; | |
5127 | + } | |
5128 | + } | |
5129 | + | |
5130 | /* If we have a THIS (from a primary), we set the context accordingly */ | |
5131 | if (name == this_identifier_node) | |
5132 | { | |
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))) | |
5140 | { | |
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); | |
5145 | } | |
5146 | ||
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))) | |
5161 | { | |
5162 | RESOLVE_TYPE_NAME_P (qual_wfl) = 1; | |
5163 | QUAL_RESOLUTION (qual) = decl; | |
5164 | @@ -10480,7 +10668,9 @@ | |
5165 | { | |
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); | |
5170 | + pop_obstacks (); | |
5171 | DECL_INITIAL (node) = value; | |
5172 | if (value != NULL_TREE) | |
5173 | return value; | |
5174 | @@ -10500,8 +10690,7 @@ | |
5175 | TREE_OPERAND (node, 1) = java_stabilize_reference (op1); | |
5176 | return node; | |
5177 | } | |
5178 | - else | |
5179 | - return stabilize_reference (node); | |
5180 | + return stabilize_reference (node); | |
5181 | } | |
5182 | ||
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)); | |
5190 | + { | |
5191 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
5192 | + cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)), | |
5193 | + TREE_OPERAND (cn, 1)); | |
5194 | + pop_obstacks (); | |
5195 | + } | |
5196 | ||
5197 | if (!TREE_CONSTANT (cn) && !flag_emit_xref) | |
5198 | { | |
5199 | @@ -10937,7 +11130,11 @@ | |
5200 | && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn) | |
5201 | && DECL_INITIAL (nn) != NULL_TREE) | |
5202 | { | |
5203 | - tree value = fold_constant_for_init (nn, nn); | |
5204 | + tree value; | |
5205 | + | |
5206 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
5207 | + value = fold_constant_for_init (nn, nn); | |
5208 | + pop_obstacks (); | |
5209 | if (value != NULL_TREE) | |
5210 | { | |
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; | |
5215 | ||
5216 | - if (COMPOUND_ASSIGN_P (wfl_op2)) | |
5217 | + flag = COMPOUND_ASSIGN_P (wfl_op2); | |
5218 | + if (flag) | |
5219 | { | |
5220 | tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0)); | |
5221 | ||
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)); | |
5227 | ||
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)); | |
5231 | ||
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)); | |
5236 | + | |
5237 | + /* 15.25.2.b: Left hand is an array access. FIXME */ | |
5238 | } | |
5239 | ||
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; | |
5250 | return node; | |
5251 | ||
5252 | @@ -12000,6 +12206,81 @@ | |
5253 | #undef BUILD_OPERATOR_STRING | |
5254 | } | |
5255 | ||
5256 | +/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */ | |
5257 | + | |
5258 | +static int | |
5259 | +java_decl_equiv (var_acc1, var_acc2) | |
5260 | + tree var_acc1, var_acc2; | |
5261 | +{ | |
5262 | + if (JDECL_P (var_acc1)) | |
5263 | + return (var_acc1 == var_acc2); | |
5264 | + | |
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)); | |
5270 | +} | |
5271 | + | |
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. */ | |
5274 | + | |
5275 | +static int | |
5276 | +binop_compound_p (code) | |
5277 | + enum tree_code code; | |
5278 | +{ | |
5279 | + int i; | |
5280 | + for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++) | |
5281 | + if (binop_lookup [i] == code) | |
5282 | + break; | |
5283 | + | |
5284 | + return i < BINOP_COMPOUND_CANDIDATES; | |
5285 | +} | |
5286 | + | |
5287 | +/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */ | |
5288 | + | |
5289 | +static tree | |
5290 | +java_refold (t) | |
5291 | + tree t; | |
5292 | +{ | |
5293 | + tree c, b, ns, decl; | |
5294 | + | |
5295 | + if (TREE_CODE (t) != MODIFY_EXPR) | |
5296 | + return t; | |
5297 | + | |
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))))) | |
5302 | + return t; | |
5303 | + | |
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)) | |
5308 | + return t; | |
5309 | + | |
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)) | |
5313 | + return t; | |
5314 | + | |
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))) | |
5319 | + { | |
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); | |
5326 | + } | |
5327 | + | |
5328 | + return t; | |
5329 | +} | |
5330 | + | |
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); | |
5337 | ||
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); | |
5343 | + | |
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 */ | |
5354 | if (!JDECL_P (decl) | |
5355 | && TREE_CODE (decl) != COMPONENT_REF | |
5356 | @@ -12697,15 +12984,28 @@ | |
5357 | else | |
5358 | { | |
5359 | /* Before the addition, binary numeric promotion is performed on | |
5360 | - both operands */ | |
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)) | |
5367 | + { | |
5368 | + value = build_int_2 (1, 0); | |
5369 | + TREE_TYPE (value) = TREE_TYPE (node) = op_type; | |
5370 | + } | |
5371 | + else | |
5372 | + { | |
5373 | + value = build_int_2 (1, 0); | |
5374 | + TREE_TYPE (node) = | |
5375 | + binary_numeric_promotion (op_type, | |
5376 | + TREE_TYPE (value), &op, &value); | |
5377 | + } | |
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); | |
5387 | + else | |
5388 | + return fold (convert (op_type, node)); | |
5389 | } | |
5390 | break; | |
5391 | ||
5392 | @@ -13210,6 +13510,7 @@ | |
5393 | new_value = NULL_TREE; | |
5394 | wfl_value = TREE_VALUE (entry); | |
5395 | ||
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); | |
5404 | - | |
5405 | + | |
5406 | + pop_obstacks (); | |
5407 | /* Check and report errors */ | |
5408 | if (!new_value) | |
5409 | { | |
5410 | @@ -13564,6 +13866,54 @@ | |
5411 | return loop; | |
5412 | } | |
5413 | ||
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. */ | |
5421 | + | |
5422 | +static tree | |
5423 | +search_loop (statement) | |
5424 | + tree statement; | |
5425 | +{ | |
5426 | + if (TREE_CODE (statement) == LOOP_EXPR) | |
5427 | + return statement; | |
5428 | + | |
5429 | + if (TREE_CODE (statement) == BLOCK) | |
5430 | + statement = BLOCK_SUBBLOCKS (statement); | |
5431 | + else | |
5432 | + return NULL_TREE; | |
5433 | + | |
5434 | + if (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
5435 | + while (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
5436 | + statement = TREE_OPERAND (statement, 1); | |
5437 | + | |
5438 | + return (TREE_CODE (statement) == LOOP_EXPR | |
5439 | + && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE); | |
5440 | +} | |
5441 | + | |
5442 | +/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is | |
5443 | + returned otherwise. */ | |
5444 | + | |
5445 | +static int | |
5446 | +labeled_block_contains_loop_p (block, loop) | |
5447 | + tree block, loop; | |
5448 | +{ | |
5449 | + if (!block) | |
5450 | + return 0; | |
5451 | + | |
5452 | + if (LABELED_BLOCK_BODY (block) == loop) | |
5453 | + return 1; | |
5454 | + | |
5455 | + if (IS_FOR_LOOP_P (loop) | |
5456 | + && search_loop (LABELED_BLOCK_BODY (block)) == loop) | |
5457 | + return 1; | |
5458 | + | |
5459 | + return 0; | |
5460 | +} | |
5461 | + | |
5462 | /* If the loop isn't surrounded by a labeled statement, create one and | |
5463 | insert LOOP as its body. */ | |
5464 | ||
5465 | @@ -13572,33 +13922,17 @@ | |
5466 | tree loop; | |
5467 | { | |
5468 | tree loop_label; | |
5469 | - tree block = ctxp->current_labeled_block; | |
5470 | + | |
5471 | TREE_TYPE (loop) = void_type_node; | |
5472 | - if (block != NULL_TREE) | |
5473 | - { | |
5474 | - tree block_body = LABELED_BLOCK_BODY (block); | |
5475 | - if (IS_FOR_LOOP_P (loop)) | |
5476 | - { | |
5477 | - if (TREE_CODE (block_body) == BLOCK) | |
5478 | - { | |
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)) | |
5483 | - return loop; | |
5484 | - } | |
5485 | - } | |
5486 | - else | |
5487 | - { | |
5488 | - if (block_body == loop) | |
5489 | - return loop; | |
5490 | - } | |
5491 | - } | |
5492 | + if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop)) | |
5493 | + return loop; | |
5494 | + | |
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; | |
5501 | - return loop; | |
5502 | + return loop_label; | |
5503 | } | |
5504 | ||
5505 | /* 14.13, 14.14: break and continue Statements */ | |
5506 | @@ -13690,7 +14024,7 @@ | |
5507 | } | |
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)) | |
5512 | { | |
5513 | bc_label = labeled_block; | |
5514 | break; | |
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 @@ | |
5525 | continue; | |
5526 | #endif | |
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)); | |
5537 | + else | |
5538 | + { | |
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)))); | |
5546 | + } | |
5547 | } | |
5548 | } | |
5549 | ||
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 | |
5555 | @@ -91,6 +91,7 @@ | |
5556 | static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...)) | |
5557 | ATTRIBUTE_PRINTF_2; | |
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)); | |
5563 | @@ -243,6 +244,7 @@ | |
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)); | |
5568 | ||
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]))] | |
5574 | ||
5575 | +/* This is the end index for binary operators that can also be used | |
5576 | + in compound assignements. */ | |
5577 | +#define BINOP_COMPOUND_CANDIDATES 11 | |
5578 | + | |
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 | |
5585 | { | |
5586 | - yyerror ("Constructor invocation must be first " | |
5587 | - "thing in a constructor"); | |
5588 | + parse_ctor_invocation_error (); | |
5589 | RECOVER; | |
5590 | } | |
5591 | | this_or_super OP_TK argument_list error | |
5592 | {yyerror ("')' expected"); RECOVER;} | |
5593 | | this_or_super OP_TK argument_list CP_TK error | |
5594 | { | |
5595 | - yyerror ("Constructor invocation must be first " | |
5596 | - "thing in a constructor"); | |
5597 | + parse_ctor_invocation_error (); | |
5598 | RECOVER; | |
5599 | } | |
5600 | | name DOT_TK SUPER_TK error | |
5601 | @@ -2409,7 +2413,17 @@ | |
5602 | free (toFree); | |
5603 | } | |
5604 | ||
5605 | -/* Reporting JDK1.1 features not implemented */ | |
5606 | +/* Reporting an constructor invocation error. */ | |
5607 | +static void | |
5608 | +parse_ctor_invocation_error () | |
5609 | +{ | |
5610 | + if (DECL_CONSTRUCTOR_P (current_function_decl)) | |
5611 | + yyerror ("Constructor invocation must be first thing in a constructor"); | |
5612 | + else | |
5613 | + yyerror ("Only constructors can invoke constructors"); | |
5614 | +} | |
5615 | + | |
5616 | +/* Reporting JDK1.1 features not implemented. */ | |
5617 | ||
5618 | static tree | |
5619 | parse_jdk1_1_error (msg) | |
5620 | @@ -3318,13 +3332,18 @@ | |
5621 | { | |
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; | |
5629 | int saved_lineno; | |
5630 | int constructor_ok = 0, must_chain; | |
5631 | ||
5632 | check_modifiers_consistency (flags); | |
5633 | + | |
5634 | + if (ctxp->current_parsed_class) | |
5635 | + this_class = TREE_TYPE (ctxp->current_parsed_class); | |
5636 | + else | |
5637 | + return NULL_TREE; | |
5638 | ||
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) | |
5643 | tree method_body; | |
5644 | { | |
5645 | - int flags = get_access_flags_from_decl (current_function_decl); | |
5646 | + int flags; | |
5647 | + | |
5648 | + if (!current_function_decl) | |
5649 | + return; | |
5650 | + | |
5651 | + flags = get_access_flags_from_decl (current_function_decl); | |
5652 | ||
5653 | /* 8.4.5 Method Body */ | |
5654 | if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body) | |
5655 | @@ -4335,7 +4359,9 @@ | |
5656 | ||
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 @@ | |
5667 | ||
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.) */ | |
5672 | ||
5673 | static int | |
5674 | check_method_redefinition (class, method) | |
5675 | @@ -4552,9 +4578,126 @@ | |
5676 | return 0; | |
5677 | } | |
5678 | ||
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. */ | |
5682 | +static void | |
5683 | +check_abstract_method_definitions (do_interface, class_decl, type) | |
5684 | + int do_interface; | |
5685 | + tree class_decl, type; | |
5686 | +{ | |
5687 | + tree class = TREE_TYPE (class_decl); | |
5688 | + tree method, end_type; | |
5689 | + | |
5690 | + end_type = (do_interface ? object_type_node : type); | |
5691 | + for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method)) | |
5692 | + { | |
5693 | + tree other_super, other_method, method_sig, method_name; | |
5694 | + int found = 0; | |
5695 | + | |
5696 | + if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method)) | |
5697 | + continue; | |
5698 | + | |
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. */ | |
5702 | + | |
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); | |
5707 | + | |
5708 | + for (other_super = class; other_super != end_type; | |
5709 | + other_super = CLASSTYPE_SUPER (other_super)) | |
5710 | + { | |
5711 | + for (other_method = TYPE_METHODS (other_super); other_method; | |
5712 | + other_method = TREE_CHAIN (other_method)) | |
5713 | + { | |
5714 | + tree s = build_java_signature (TREE_TYPE (other_method)); | |
5715 | + tree other_name = DECL_NAME (other_method); | |
5716 | + | |
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) | |
5722 | + { | |
5723 | + found = 1; | |
5724 | + break; | |
5725 | + } | |
5726 | + } | |
5727 | + } | |
5728 | + | |
5729 | + /* Report that abstract METHOD didn't find an implementation | |
5730 | + that CLASS can use. */ | |
5731 | + if (!found) | |
5732 | + { | |
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; | |
5737 | + | |
5738 | + if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION) | |
5739 | + { | |
5740 | + saved_wfl = DECL_NAME (method); | |
5741 | + DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method)); | |
5742 | + } | |
5743 | + | |
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))); | |
5756 | + | |
5757 | + free (t); | |
5758 | + | |
5759 | + if (saved_wfl) | |
5760 | + DECL_NAME (method) = saved_wfl; | |
5761 | + } | |
5762 | + } | |
5763 | +} | |
5764 | + | |
5765 | +/* Check that CLASS_DECL somehoow implements all inherited abstract | |
5766 | + methods. */ | |
5767 | + | |
5768 | +static void | |
5769 | +java_check_abstract_method_definitions (class_decl) | |
5770 | + tree class_decl; | |
5771 | +{ | |
5772 | + tree class = TREE_TYPE (class_decl); | |
5773 | + tree super, vector; | |
5774 | + int i; | |
5775 | + | |
5776 | + if (CLASS_ABSTRACT (class_decl)) | |
5777 | + return; | |
5778 | + | |
5779 | + /* Check for inherited types */ | |
5780 | + for (super = CLASSTYPE_SUPER (class); super != object_type_node; | |
5781 | + super = CLASSTYPE_SUPER (super)) | |
5782 | + { | |
5783 | + if (!CLASS_ABSTRACT (TYPE_NAME (super))) | |
5784 | + continue; | |
5785 | + | |
5786 | + check_abstract_method_definitions (0, class_decl, super); | |
5787 | + } | |
5788 | + | |
5789 | + /* Check for implemented interfaces. */ | |
5790 | + vector = TYPE_BINFO_BASETYPES (class); | |
5791 | + for (i = 1; i < TREE_VEC_LENGTH (vector); i++) | |
5792 | + { | |
5793 | + super = BINFO_TYPE (TREE_VEC_ELT (vector, i)); | |
5794 | + check_abstract_method_definitions (1, class_decl, super); | |
5795 | + } | |
5796 | +} | |
5797 | + | |
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 | |
5801 | + declaration. */ | |
5802 | ||
5803 | static void | |
5804 | java_check_regular_methods (class_decl) | |
5805 | @@ -4730,7 +4873,7 @@ | |
5806 | ||
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. */ | |
5811 | ||
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)); | |
5817 | ||
5818 | + /* Search for inherited abstract method not yet implemented in this | |
5819 | + class. */ | |
5820 | + java_check_abstract_method_definitions (class_decl); | |
5821 | + | |
5822 | if (!saw_constructor) | |
5823 | { | |
5824 | /* No constructor seen, we craft one, at line 0. Since this | |
5825 | @@ -4943,14 +5090,15 @@ | |
5826 | return NULL_TREE; | |
5827 | } | |
5828 | ||
5829 | -/* Return the line that matches DECL line number. Used during error | |
5830 | - report */ | |
5831 | +/* Return the line that matches DECL line number, and try its best to | |
5832 | + position the column number. Used during error reports. */ | |
5833 | ||
5834 | static tree | |
5835 | lookup_cl (decl) | |
5836 | tree decl; | |
5837 | { | |
5838 | static tree cl = NULL_TREE; | |
5839 | + char *line, *found; | |
5840 | ||
5841 | if (!decl) | |
5842 | return NULL_TREE; | |
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); | |
5846 | ||
5847 | + line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)), | |
5848 | + EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl)); | |
5849 | + | |
5850 | + found = strstr ((const char *)line, | |
5851 | + (const char *)IDENTIFIER_POINTER (DECL_NAME (decl))); | |
5852 | + if (found) | |
5853 | + EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line); | |
5854 | + | |
5855 | return cl; | |
5856 | } | |
5857 | ||
5858 | @@ -5495,6 +5651,9 @@ | |
5859 | tree parm_decl; | |
5860 | int i; | |
5861 | ||
5862 | + if (!fndecl) | |
5863 | + return; | |
5864 | + | |
5865 | current_function_decl = fndecl; | |
5866 | ||
5867 | /* New scope for the function */ | |
5868 | @@ -5614,6 +5773,9 @@ | |
5869 | tree fndecl = current_function_decl; | |
5870 | int flag_asynchronous_exceptions = asynchronous_exceptions; | |
5871 | ||
5872 | + if (!fndecl) | |
5873 | + return; | |
5874 | + | |
5875 | java_parser_context_save_global (); | |
5876 | lineno = ctxp->last_ccb_indent1; | |
5877 | ||
5878 | @@ -5669,6 +5831,8 @@ | |
5879 | java_method_add_stmt (fndecl, expr) | |
5880 | tree fndecl, expr; | |
5881 | { | |
5882 | + if (!GET_CURRENT_BLOCK (fndecl)) | |
5883 | + return NULL_TREE; | |
5884 | return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr); | |
5885 | } | |
5886 | ||
5887 | @@ -6067,7 +6231,8 @@ | |
5888 | for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl)) | |
5889 | { | |
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) | |
5894 | return 0; | |
5895 | } | |
5896 | } | |
5897 | @@ -6410,6 +6575,8 @@ | |
5898 | == soft_initclass_node) | |
5899 | return TREE_OPERAND (op1, 1); | |
5900 | } | |
5901 | + else if (JDECL_P (op1)) | |
5902 | + return op1; | |
5903 | } | |
5904 | return node; | |
5905 | } | |
5906 | @@ -6431,6 +6598,8 @@ | |
5907 | for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q)) | |
5908 | { | |
5909 | tree qual_wfl = QUAL_WFL (q); | |
5910 | + tree ret_decl; /* for EH checking */ | |
5911 | + int location; /* for EH checking */ | |
5912 | ||
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)) | |
5918 | return 1; | |
5919 | + | |
5920 | if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR) | |
5921 | CALL_USING_SUPER (qual_wfl) = 1; | |
5922 | - *where_found = | |
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) | |
5929 | return 1; | |
5930 | *type_found = type = QUAL_DECL_TYPE (*where_found); | |
5931 | ||
5932 | + /* EH check */ | |
5933 | + if (location) | |
5934 | + check_thrown_exceptions (location, ret_decl); | |
5935 | + | |
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 @@ | |
5940 | ||
5941 | case CONDITIONAL_EXPR: | |
5942 | case STRING_CST: | |
5943 | + case MODIFY_EXPR: | |
5944 | *where_found = decl = java_complete_tree (qual_wfl); | |
5945 | if (decl == error_mark_node) | |
5946 | return 1; | |
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)); | |
5951 | + | |
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); | |
5956 | ||
5957 | if (flag_emit_class_files || flag_emit_xref) | |
5958 | func = method; | |
5959 | @@ -7388,7 +7570,7 @@ | |
5960 | parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s", | |
5961 | (lc ? "constructor" : "method"), | |
5962 | (lc ? | |
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; | |
5970 | ||
5971 | /* Search interfaces */ | |
5972 | - if (CLASS_INTERFACE (TYPE_NAME (class))) | |
5973 | + if (CLASS_INTERFACE (TYPE_NAME (class)) | |
5974 | + || CLASS_ABSTRACT (TYPE_NAME (class))) | |
5975 | { | |
5976 | static tree searched_interfaces = NULL_TREE; | |
5977 | static int search_not_done = 0; | |
5978 | @@ -7638,7 +7821,7 @@ | |
5979 | break; | |
5980 | case NEW_ARRAY_EXPR: | |
5981 | qual = TREE_CHAIN (qual); | |
5982 | - new_array_found = 1; | |
5983 | + again = new_array_found = 1; | |
5984 | continue; | |
5985 | case NEW_CLASS_EXPR: | |
5986 | case CONVERT_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)); | |
5990 | ||
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)); | |
5994 | - | |
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)); | |
6000 | ||
6001 | else if (code == STRING_CST || code == CONDITIONAL_EXPR) | |
6002 | @@ -7681,8 +7860,15 @@ | |
6003 | again = 1; | |
6004 | } | |
6005 | else | |
6006 | - name = EXPR_WFL_NODE (qual_wfl); | |
6007 | - | |
6008 | + { | |
6009 | + name = EXPR_WFL_NODE (qual_wfl); | |
6010 | + if (!name) | |
6011 | + { | |
6012 | + qual = EXPR_WFL_QUALIFICATION (qual_wfl); | |
6013 | + again = 1; | |
6014 | + } | |
6015 | + } | |
6016 | + | |
6017 | /* If we have a THIS (from a primary), we set the context accordingly */ | |
6018 | if (name == this_identifier_node) | |
6019 | { | |
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))) | |
6027 | { | |
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); | |
6032 | } | |
6033 | ||
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))) | |
6048 | { | |
6049 | RESOLVE_TYPE_NAME_P (qual_wfl) = 1; | |
6050 | QUAL_RESOLUTION (qual) = decl; | |
6051 | @@ -7826,7 +8015,9 @@ | |
6052 | { | |
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); | |
6057 | + pop_obstacks (); | |
6058 | DECL_INITIAL (node) = value; | |
6059 | if (value != NULL_TREE) | |
6060 | return value; | |
6061 | @@ -7846,8 +8037,7 @@ | |
6062 | TREE_OPERAND (node, 1) = java_stabilize_reference (op1); | |
6063 | return node; | |
6064 | } | |
6065 | - else | |
6066 | - return stabilize_reference (node); | |
6067 | + return stabilize_reference (node); | |
6068 | } | |
6069 | ||
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)); | |
6077 | + { | |
6078 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
6079 | + cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)), | |
6080 | + TREE_OPERAND (cn, 1)); | |
6081 | + pop_obstacks (); | |
6082 | + } | |
6083 | ||
6084 | if (!TREE_CONSTANT (cn) && !flag_emit_xref) | |
6085 | { | |
6086 | @@ -8283,7 +8477,11 @@ | |
6087 | && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn) | |
6088 | && DECL_INITIAL (nn) != NULL_TREE) | |
6089 | { | |
6090 | - tree value = fold_constant_for_init (nn, nn); | |
6091 | + tree value; | |
6092 | + | |
6093 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
6094 | + value = fold_constant_for_init (nn, nn); | |
6095 | + pop_obstacks (); | |
6096 | if (value != NULL_TREE) | |
6097 | { | |
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; | |
6102 | ||
6103 | - if (COMPOUND_ASSIGN_P (wfl_op2)) | |
6104 | + flag = COMPOUND_ASSIGN_P (wfl_op2); | |
6105 | + if (flag) | |
6106 | { | |
6107 | tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0)); | |
6108 | ||
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)); | |
6114 | ||
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)); | |
6118 | ||
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)); | |
6123 | + | |
6124 | + /* 15.25.2.b: Left hand is an array access. FIXME */ | |
6125 | } | |
6126 | ||
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; | |
6137 | return node; | |
6138 | ||
6139 | @@ -9346,6 +9553,81 @@ | |
6140 | #undef BUILD_OPERATOR_STRING | |
6141 | } | |
6142 | ||
6143 | +/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */ | |
6144 | + | |
6145 | +static int | |
6146 | +java_decl_equiv (var_acc1, var_acc2) | |
6147 | + tree var_acc1, var_acc2; | |
6148 | +{ | |
6149 | + if (JDECL_P (var_acc1)) | |
6150 | + return (var_acc1 == var_acc2); | |
6151 | + | |
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)); | |
6157 | +} | |
6158 | + | |
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. */ | |
6161 | + | |
6162 | +static int | |
6163 | +binop_compound_p (code) | |
6164 | + enum tree_code code; | |
6165 | +{ | |
6166 | + int i; | |
6167 | + for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++) | |
6168 | + if (binop_lookup [i] == code) | |
6169 | + break; | |
6170 | + | |
6171 | + return i < BINOP_COMPOUND_CANDIDATES; | |
6172 | +} | |
6173 | + | |
6174 | +/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */ | |
6175 | + | |
6176 | +static tree | |
6177 | +java_refold (t) | |
6178 | + tree t; | |
6179 | +{ | |
6180 | + tree c, b, ns, decl; | |
6181 | + | |
6182 | + if (TREE_CODE (t) != MODIFY_EXPR) | |
6183 | + return t; | |
6184 | + | |
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))))) | |
6189 | + return t; | |
6190 | + | |
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)) | |
6195 | + return t; | |
6196 | + | |
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)) | |
6200 | + return t; | |
6201 | + | |
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))) | |
6206 | + { | |
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); | |
6213 | + } | |
6214 | + | |
6215 | + return t; | |
6216 | +} | |
6217 | + | |
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); | |
6224 | ||
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); | |
6230 | + | |
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 */ | |
6241 | if (!JDECL_P (decl) | |
6242 | && TREE_CODE (decl) != COMPONENT_REF | |
6243 | @@ -10043,15 +10331,28 @@ | |
6244 | else | |
6245 | { | |
6246 | /* Before the addition, binary numeric promotion is performed on | |
6247 | - both operands */ | |
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)) | |
6254 | + { | |
6255 | + value = build_int_2 (1, 0); | |
6256 | + TREE_TYPE (value) = TREE_TYPE (node) = op_type; | |
6257 | + } | |
6258 | + else | |
6259 | + { | |
6260 | + value = build_int_2 (1, 0); | |
6261 | + TREE_TYPE (node) = | |
6262 | + binary_numeric_promotion (op_type, | |
6263 | + TREE_TYPE (value), &op, &value); | |
6264 | + } | |
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); | |
6274 | + else | |
6275 | + return fold (convert (op_type, node)); | |
6276 | } | |
6277 | break; | |
6278 | ||
6279 | @@ -10556,6 +10857,7 @@ | |
6280 | new_value = NULL_TREE; | |
6281 | wfl_value = TREE_VALUE (entry); | |
6282 | ||
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); | |
6291 | - | |
6292 | + | |
6293 | + pop_obstacks (); | |
6294 | /* Check and report errors */ | |
6295 | if (!new_value) | |
6296 | { | |
6297 | @@ -10910,6 +11213,54 @@ | |
6298 | return loop; | |
6299 | } | |
6300 | ||
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. */ | |
6308 | + | |
6309 | +static tree | |
6310 | +search_loop (statement) | |
6311 | + tree statement; | |
6312 | +{ | |
6313 | + if (TREE_CODE (statement) == LOOP_EXPR) | |
6314 | + return statement; | |
6315 | + | |
6316 | + if (TREE_CODE (statement) == BLOCK) | |
6317 | + statement = BLOCK_SUBBLOCKS (statement); | |
6318 | + else | |
6319 | + return NULL_TREE; | |
6320 | + | |
6321 | + if (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
6322 | + while (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
6323 | + statement = TREE_OPERAND (statement, 1); | |
6324 | + | |
6325 | + return (TREE_CODE (statement) == LOOP_EXPR | |
6326 | + && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE); | |
6327 | +} | |
6328 | + | |
6329 | +/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is | |
6330 | + returned otherwise. */ | |
6331 | + | |
6332 | +static int | |
6333 | +labeled_block_contains_loop_p (block, loop) | |
6334 | + tree block, loop; | |
6335 | +{ | |
6336 | + if (!block) | |
6337 | + return 0; | |
6338 | + | |
6339 | + if (LABELED_BLOCK_BODY (block) == loop) | |
6340 | + return 1; | |
6341 | + | |
6342 | + if (IS_FOR_LOOP_P (loop) | |
6343 | + && search_loop (LABELED_BLOCK_BODY (block)) == loop) | |
6344 | + return 1; | |
6345 | + | |
6346 | + return 0; | |
6347 | +} | |
6348 | + | |
6349 | /* If the loop isn't surrounded by a labeled statement, create one and | |
6350 | insert LOOP as its body. */ | |
6351 | ||
6352 | @@ -10918,33 +11269,17 @@ | |
6353 | tree loop; | |
6354 | { | |
6355 | tree loop_label; | |
6356 | - tree block = ctxp->current_labeled_block; | |
6357 | + | |
6358 | TREE_TYPE (loop) = void_type_node; | |
6359 | - if (block != NULL_TREE) | |
6360 | - { | |
6361 | - tree block_body = LABELED_BLOCK_BODY (block); | |
6362 | - if (IS_FOR_LOOP_P (loop)) | |
6363 | - { | |
6364 | - if (TREE_CODE (block_body) == BLOCK) | |
6365 | - { | |
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)) | |
6370 | - return loop; | |
6371 | - } | |
6372 | - } | |
6373 | - else | |
6374 | - { | |
6375 | - if (block_body == loop) | |
6376 | - return loop; | |
6377 | - } | |
6378 | - } | |
6379 | + if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop)) | |
6380 | + return loop; | |
6381 | + | |
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; | |
6388 | - return loop; | |
6389 | + return loop_label; | |
6390 | } | |
6391 | ||
6392 | /* 14.13, 14.14: break and continue Statements */ | |
6393 | @@ -11036,7 +11371,7 @@ | |
6394 | } | |
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)) | |
6399 | { | |
6400 | bc_label = labeled_block; | |
6401 | break; | |
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 @@ | |
6412 | continue; | |
6413 | #endif | |
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)); | |
6424 | + else | |
6425 | + { | |
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)))); | |
6433 | + } | |
6434 | } | |
6435 | } | |
6436 | ||
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 | |
6443 | @@ -55,23 +55,43 @@ | |
6444 | ||
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: | |
6449 | - | |
6450 | - ({ double tmp = expr; (tmp != tmp) ? 0 : (int)tmp; }) | |
6451 | - | |
6452 | - */ | |
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: | |
6456 | + | |
6457 | + ((expr >= (float)MAX_INT) | |
6458 | + ? MAX_INT | |
6459 | + : ((expr <= (float)MIN_INT) | |
6460 | + ? MIN_INT | |
6461 | + : ((expr != expr) | |
6462 | + ? 0 | |
6463 | + : (int)expr))) */ | |
6464 | ||
6465 | static tree | |
6466 | convert_ieee_real_to_integer (type, expr) | |
6467 | tree type, expr; | |
6468 | { | |
6469 | + tree result; | |
6470 | expr = save_expr (expr); | |
6471 | ||
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)); | |
6480 | + | |
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), | |
6485 | + result); | |
6486 | + | |
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), | |
6491 | + result); | |
6492 | + | |
6493 | + return result; | |
6494 | } | |
6495 | ||
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) | |
6500 | { | |
6501 | - if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE | |
6502 | -#ifdef TARGET_SOFT_FLOAT | |
6503 | - && !TARGET_SOFT_FLOAT | |
6504 | -#endif | |
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)); | |
6512 | else | |
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 | |
6517 | @@ -397,7 +397,8 @@ | |
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)) | |
6525 | { | |
6526 | error ("bad pc in exception_table"); |