]>
Commit | Line | Data |
---|---|---|
64f9f7bb JR |
1 | #! /bin/sh -e |
2 | ||
3 | # DP: J*va patch set for gcc-2.95.2 | |
4 | # DP: taken from http://waitaki.otago.ac.nz/~bryce/gcj/ | |
5 | # DP: | |
6 | # DP: This patch consists of new J*va features and fixes extracted | |
7 | # DP: from cvs and back-ported to gcc-2.95.2. It allows compilation of the | |
8 | # DP: latest libgcj snapshots and cvs tree without the problems of the | |
9 | # DP: current unstable cvs gcc tree (last update 1999-10-31). | |
10 | ||
11 | if [ $# -eq 3 -a "$2" = '-d' ]; then | |
12 | pdir="-d $3" | |
13 | elif [ $# -ne 1 ]; then | |
14 | echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" | |
15 | exit 1 | |
16 | fi | |
17 | case "$1" in | |
18 | -patch) patch $pdir -f --no-backup-if-mismatch -p1 < $0;; | |
19 | -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p1 < $0;; | |
20 | *) | |
21 | echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" | |
22 | exit 1 | |
23 | esac | |
24 | exit 0 | |
25 | ||
26 | Only in gcc-2.95.2/: build | |
27 | diff -u -r gcc-2.95.2-orig/gcc/java/ChangeLog gcc-2.95.2/gcc/java/ChangeLog | |
28 | --- gcc-2.95.2-orig/gcc/java/ChangeLog Mon Oct 25 19:59:13 1999 | |
29 | +++ gcc-2.95.2/gcc/java/ChangeLog Sun Oct 31 19:09:00 1999 | |
30 | @@ -1,3 +1,286 @@ | |
31 | +Fri Oct 29 14:35:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
32 | + | |
33 | + * class.c (add_method_1): Set DECL_INLINE to 1 for private, static | |
34 | + and final method. | |
35 | + | |
36 | +Fri Oct 29 14:23:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
37 | + | |
38 | + * parse.y (expression_statement:): Call function to report | |
39 | + improper invocation of a constructor. | |
40 | + (parse_ctor_invocation_error): New function. | |
41 | + | |
42 | +1999-10-04 Tom Tromey <tromey@cygnus.com> | |
43 | + | |
44 | + * lex.h (BUILD_OPERATOR2): Return ASSIGN_ANY_TK in `lite' case as | |
45 | + well. Fixes Java PR gcj/59. | |
46 | + * parse-scan.y (yyerror): Report errors. | |
47 | + | |
48 | +Thu Oct 21 01:27:31 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
49 | + | |
50 | + * parse.y (resolve_qualified_expression_name): Handle MODIFY_EXPR. | |
51 | + (qualify_ambiguous_name): Likewise. | |
52 | + | |
53 | +1999-10-21 Tom Tromey <tromey@cygnus.com> | |
54 | + | |
55 | + * jvgenmain.c (main): _Jv_Compiler_Properties now an extern; set | |
56 | + in generated `main'. | |
57 | + | |
58 | +Tue Oct 12 22:28:10 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
59 | + | |
60 | + * jcf-write.c (RELOCATION_VALUE_1): Fixed integer value from 0 to 1. | |
61 | + | |
62 | +1999-10-07 Anthony Green <green@cygnus.com> | |
63 | + | |
64 | + * jcf-write.c (generate_classfile): Use UNSAFE_PUTx in cases | |
65 | + where CHECK_PUT may fail for valid reasons. | |
66 | + | |
67 | + * jcf-write.c (UNSAFE_PUT1, UNSAFE_PUT2, UNSAFE_PUT3, | |
68 | + UNSAFE_PUTN): New macros. | |
69 | + | |
70 | +Tue Sep 14 16:24:19 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
71 | + | |
72 | + * jcf-write.c: (RELOCATION_VALUE_0): New macro. | |
73 | + (RELOCATION_VALUE_1): Likewise. | |
74 | + (emit_iinc, emit_reloc, push_constant1, push_constant2, | |
75 | + push_in_const, push_long_const): Prototyped. | |
76 | + (push_constant1): Argument `index' is of type HOST_WIDE_INT. | |
77 | + (push_constant2): Likewise. | |
78 | + (push_int_const): Cast find_constant1's integer arguments to `jword'. | |
79 | + (find_constant_wide): Cast find_constant2's integer arguments to | |
80 | + `jword'. | |
81 | + (find_constant_index): Cast find_constant2's and find_constant2's | |
82 | + integer arguments to `jword'. | |
83 | + (emit_pop): Argument `value' is of type HOST_WIDE_INT. | |
84 | + (emit_switch_reloc): Use RELOCATION_VALUE_0. | |
85 | + (emit_if): Use RELOCATION_VALUE_1. | |
86 | + (emit_goto): Likewise. | |
87 | + (emit_jsr): Likewise. | |
88 | + (generate_bytecode_insns): Use RELOCATION_VALUE_0. Cast second | |
89 | + argument to push_long_const to HOST_WIDE_INT. | |
90 | + | |
91 | +Thu Sep 16 15:42:39 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
92 | + | |
93 | + * parse.y (java_method_add_stmt): Test against GET_CURRENT_BLOCK | |
94 | + instead of fndecl. | |
95 | + | |
96 | +Sat Sep 11 16:46:44 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
97 | + | |
98 | + * parse.y (find_applicable_accessible_methods_list): Search | |
99 | + abstract classes as interfaces. | |
100 | + | |
101 | +Thu Sep 9 17:33:28 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
102 | + | |
103 | + * class.c (finish_class): We're now outside a valid method | |
104 | + declaration. Tell the rest of gcc so. | |
105 | + | |
106 | +1999-09-07 Tom Tromey <tromey@cygnus.com> | |
107 | + | |
108 | + * gjavah.c (add_class_decl): Generate include for gcj/array.h, not | |
109 | + java-array.h. | |
110 | + (decode_signature_piece): Don't emit "::" in JArray<>. | |
111 | + (print_namelet): Only print trailing `;' when printing a class. | |
112 | + | |
113 | +1999-09-03 Tom Tromey <tromey@cygnus.com> | |
114 | + | |
115 | + * parse.y (strip_out_static_field_access_decl): Return operand if | |
116 | + it satisfies JDECL_P. | |
117 | + | |
118 | +1999-09-02 Tom Tromey <tromey@cygnus.com> | |
119 | + | |
120 | + * gjavah.c (decode_signature_piece): Emit "::" in JArray<>. | |
121 | + Handle nested arrays, like `[[I'. | |
122 | + | |
123 | +1999-08-26 Tom Tromey <tromey@cygnus.com> | |
124 | + | |
125 | + * gjavah.c (print_cxx_classname): Print "::" before qualified | |
126 | + name. | |
127 | + | |
128 | +1999-10-19 Tom Tromey <tromey@cygnus.com> | |
129 | + | |
130 | + * jcf-parse.c (parse_source_file): Call jcf_dependency_add_file. | |
131 | + From Mike Moreton <mike@pillim.demon.co.uk>. | |
132 | + | |
133 | +1999-09-23 Tom Tromey <tromey@cygnus.com> | |
134 | + | |
135 | + * jvspec.c (lang_specific_driver): Don't read spec file if | |
136 | + -fsyntax-only given. | |
137 | + | |
138 | +1999-09-22 Tom Tromey <tromey@cygnus.com> | |
139 | + | |
140 | + * lang-specs.h: Added `%(jc1)' to the jc1 spec. | |
141 | + | |
142 | +1999-08-25 Tom Tromey <tromey@cygnus.com> | |
143 | + | |
144 | + * jvspec.c (lang_specific_driver): Correctly handle --help again. | |
145 | + | |
146 | +1999-10-14 Tom Tromey <tromey@cygnus.com> | |
147 | + | |
148 | + * jvgenmain.c (usage): New function. | |
149 | + (main): Use it. Also, handle `-D' options. | |
150 | + * jvspec.c (lang_specific_driver): Recognize -D. | |
151 | + (jvgenmain_spec): Added `%{D*}' to jvgenmain invocation. | |
152 | + | |
153 | +Thu Aug 26 09:10:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
154 | + | |
155 | + * parse.y (lookup_cl): Changed leading comment. Now does its best | |
156 | + to set the column number. | |
157 | + (qualify_ambiguous_name): Take WFL wrappers into account. | |
158 | + | |
159 | +Wed Aug 25 15:37:15 1999 Gregg Townsend <gmt@cs.arizona.edu> | |
160 | + | |
161 | + * verify.c (verify_jvm_instructions): Don't check instruction | |
162 | + validity beyond end of method. | |
163 | + | |
164 | +Sun Aug 22 11:07:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
165 | + | |
166 | + * parse.y (check_method_redefinition): Changed leading comment. | |
167 | + (check_abstract_method_definitions): New function. | |
168 | + (java_check_abstract_method_definitions): New function. | |
169 | + (java_check_regular_methods): Call it. | |
170 | + (verify_constructor_super): Fixed indentation. | |
171 | + (lookup_method_invoke): Likewise. | |
172 | + | |
173 | +Thu Aug 19 10:26:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
174 | + | |
175 | + * parse.y (method_header): Return a null pointer if the current | |
176 | + class node is null. | |
177 | + (finish_method_declaration): Return if the current function decl | |
178 | + is null. | |
179 | + (source_start_java_method): Likewise. | |
180 | + (java_method_add_stmt): Likewise. | |
181 | + | |
182 | +Wed Aug 18 13:17:15 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
183 | + | |
184 | + * class.c (emit_register_class): Removed unnecessary call to | |
185 | + start_sequence. | |
186 | + * parse.y (labeled_block_contains_loop_p): Removed unused local | |
187 | + variable. | |
188 | + | |
189 | +Tue Aug 17 22:51:44 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
190 | + | |
191 | + * parse.y (java_refold): Added prototype. | |
192 | + | |
193 | +Tue Aug 17 21:48:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
194 | + | |
195 | + * parse.y (BINOP_COMPOUND_CANDIDATES): New macro. | |
196 | + (java_stabilize_reference): Removed unnecessary `else'. | |
197 | + (java_complete_lhs): Set flag to remember boolean. Call | |
198 | + java_refold. Added comments. | |
199 | + (java_decl_equiv): New function. | |
200 | + (binop_compound_p): Likewise. | |
201 | + (java_refold): Likewise. | |
202 | + (patch_unaryop): Striped static field access assigned to decl and | |
203 | + op. Changed promotion scheme for ++/-- operators. | |
204 | + (search_loop): New function. | |
205 | + (labeled_block_contains_loop_p): Likewise. | |
206 | + (patch_loop_statement): Call labeled_block_contains_loop_p. Added | |
207 | + comment. | |
208 | + (patch_bc_statement): Call search_loop. Fixed comment. | |
209 | + | |
210 | +1999-08-15 Anthony Green <green@cygnus.com> | |
211 | + | |
212 | + * expr.c (java_lang_expand_expr): Mark static array data as | |
213 | + referenced. | |
214 | + | |
215 | +1999-07-25 Anthony Green <green@cygnus.com> | |
216 | + | |
217 | + * gjavah.c (print_stub): New function. | |
218 | + (METHOD_IS_NATIVE): New macro. | |
219 | + (print_mangled_classname): Make static. | |
220 | + (HANDLE_END_FIELD): Don't emit fields during stub generation. | |
221 | + (process_file): Perform stub generation. | |
222 | + (HANDLE_METHOD): Don't emit class decls during stub | |
223 | + generation. | |
224 | + (HANDLE_END_METHOD): Take into account stub generation. | |
225 | + (print_method_info): Handle stub generation. | |
226 | + (print_stub): New function. | |
227 | + (print_cxx_classname): Make signature consistant with others. | |
228 | + (help): Describe -stubs option. | |
229 | + (main): Create stub file. | |
230 | + (version): Use version.c. | |
231 | + (print_full_cxx_name): New function. | |
232 | + (print_c_decl): Use print_full_cxx_name. | |
233 | + | |
234 | +Thu Jul 22 12:41:12 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
235 | + | |
236 | + * check-init.c (check_init): Handle MAX_EXPR. | |
237 | + | |
238 | +1999-07-15 Andrew Haley <aph@cygnus.com> | |
239 | + | |
240 | + * lang.c (flag_use_divide_subroutine): New variable. | |
241 | + * typeck.c: (convert_ieee_real_to_integer): Bounds check | |
242 | + fp-to-integer conversion. | |
243 | + (convert): Call convert_ieee_real_to_integer when flag_fast_math | |
244 | + is not set. | |
245 | + | |
246 | + * expr.c (build_java_soft_divmod): New function. | |
247 | + (build_java_binop): Call build_java_soft_divmod if | |
248 | + flag_use_divide_subroutine is set. | |
249 | + * decl.c: soft_idiv_node, soft_irem_node, soft_ldiv_node, tree | |
250 | + soft_lrem_node: new builtin functions. | |
251 | + (init_decl_processing) Initialize the new builtins. | |
252 | + * java-tree.h soft_idiv_node, soft_irem_node, soft_ldiv_node, tree | |
253 | + soft_lrem_node: new builtin functions. | |
254 | + (build_java_soft_divmod): New function. | |
255 | + * parse.y: Call build_java_soft_divmod if | |
256 | + flag_use_divide_subroutine is set. | |
257 | + * parse.c: Rebuilt. | |
258 | + | |
259 | + * jvspec.c (lang_specific_driver): Always allow an extra arg (for | |
260 | + a --specs= arg) even if not linking. | |
261 | + * lang-options.h (DEFINE_LANG_NAME ("Java")): Add | |
262 | + -fuse-divide-subroutine | |
263 | + | |
264 | +Tue Jul 20 13:20:05 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
265 | + | |
266 | + * parse.y (resolve_and_layout): Check methods only once. | |
267 | + (resolve_qualified_expression_name): Verify thrown exceptions | |
268 | + compatibility. | |
269 | + (check_thrown_exceptions): Reject exceptions thrown in | |
270 | + initializer. Error message tuned. | |
271 | + | |
272 | +1999-07-14 Andrew Haley <aph@cygnus.com> | |
273 | + | |
274 | + * expr.c (expand_expr): Do not return the last statement in a | |
275 | + block as the block's value. | |
276 | + | |
277 | +Sat Jul 3 22:26:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
278 | + | |
279 | + * expr.c (force_evaluation_order): Save the COMPOUND_EXPR'ed | |
280 | + CALL_EXPR, to avoid order of evaluation changes. | |
281 | + | |
282 | +Fri Jul 2 17:44:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
283 | + | |
284 | + * parse.y (qualify_ambiguous_name): Do not use | |
285 | + IDENTIFIER_LOCAL_VALUE when name is a STRING_CST. | |
286 | + | |
287 | +Thu Jul 1 23:31:16 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
288 | + | |
289 | + * check-init.c (check_init): Handle MAX_EXPR. | |
290 | + * expr.c (force_evaluation_order): Force method call arguments to | |
291 | + be evaluated in left-to-right order. | |
292 | + * parse.y (qualify_ambiguous_name): Loop again to qualify | |
293 | + NEW_ARRAY_EXPR properly. | |
294 | + | |
295 | +Wed Jun 30 17:27:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> | |
296 | + | |
297 | + * parse.y (patch_invoke): Resolve unresolved invoked method | |
298 | + returned type. | |
299 | + (qualify_ambiguous_name): STRING_CST to qualify expression for | |
300 | + type name resolution. | |
301 | + | |
302 | +1999-06-24 Andrew Haley <aph@cygnus.com> | |
303 | + | |
304 | + * java/class.c (finish_class): Whenever a deferred method is | |
305 | + output, rescan the list of methods to see if a new candidate for | |
306 | + output can be found. | |
307 | + | |
308 | + | |
309 | +====================================================================== | |
310 | + | |
311 | + | |
312 | + | |
313 | + | |
314 | Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) | |
315 | ||
316 | * gcc-2.95.2 Released. | |
317 | diff -u -r gcc-2.95.2-orig/gcc/java/check-init.c gcc-2.95.2/gcc/java/check-init.c | |
318 | --- gcc-2.95.2-orig/gcc/java/check-init.c Sat May 15 01:44:08 1999 | |
319 | +++ gcc-2.95.2/gcc/java/check-init.c Sun Oct 31 12:32:14 1999 | |
320 | @@ -643,6 +643,8 @@ | |
321 | case GE_EXPR: | |
322 | case LT_EXPR: | |
323 | case LE_EXPR: | |
324 | + case MAX_EXPR: | |
325 | + case MIN_EXPR: | |
326 | case ARRAY_REF: | |
327 | binop: | |
328 | check_init (TREE_OPERAND (exp, 0), before); | |
329 | diff -u -r gcc-2.95.2-orig/gcc/java/class.c gcc-2.95.2/gcc/java/class.c | |
330 | --- gcc-2.95.2-orig/gcc/java/class.c Fri Jun 25 15:27:08 1999 | |
331 | +++ gcc-2.95.2/gcc/java/class.c Sun Oct 31 19:08:09 1999 | |
332 | @@ -425,10 +425,13 @@ | |
333 | ||
334 | if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1; | |
335 | if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1; | |
336 | - if (access_flags & ACC_PRIVATE) METHOD_PRIVATE (fndecl) = 1; | |
337 | + if (access_flags & ACC_PRIVATE) | |
338 | + METHOD_PRIVATE (fndecl) = DECL_INLINE (fndecl) = 1; | |
339 | if (access_flags & ACC_NATIVE) METHOD_NATIVE (fndecl) = 1; | |
340 | - if (access_flags & ACC_STATIC) METHOD_STATIC (fndecl) = 1; | |
341 | - if (access_flags & ACC_FINAL) METHOD_FINAL (fndecl) = 1; | |
342 | + if (access_flags & ACC_STATIC) | |
343 | + METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1; | |
344 | + if (access_flags & ACC_FINAL) | |
345 | + METHOD_FINAL (fndecl) = DECL_INLINE (fndecl) = 1; | |
346 | if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1; | |
347 | if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1; | |
348 | if (access_flags & ACC_TRANSIENT) METHOD_TRANSIENT (fndecl) = 1; | |
349 | @@ -1200,10 +1203,10 @@ | |
350 | tree cl; | |
351 | { | |
352 | tree method; | |
353 | + tree type_methods = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class)); | |
354 | ||
355 | - /* Emit deferred inline methods. */ | |
356 | - for ( method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class)); | |
357 | - method != NULL_TREE; method = TREE_CHAIN (method)) | |
358 | + /* Emit deferred inline methods. */ | |
359 | + for (method = type_methods; method != NULL_TREE; ) | |
360 | { | |
361 | if (! TREE_ASM_WRITTEN (method) && DECL_SAVED_INSNS (method) != 0) | |
362 | { | |
363 | @@ -1215,10 +1218,16 @@ | |
364 | temporary_allocation (); | |
365 | output_inline_function (method); | |
366 | permanent_allocation (1); | |
367 | + /* Scan the list again to see if there are any earlier | |
368 | + methods to emit. */ | |
369 | + method = type_methods; | |
370 | + continue; | |
371 | } | |
372 | } | |
373 | + method = TREE_CHAIN (method); | |
374 | } | |
375 | ||
376 | + current_function_decl = NULL_TREE; | |
377 | make_class_data (current_class); | |
378 | register_class (); | |
379 | rest_of_decl_compilation (TYPE_NAME (current_class), (char*) 0, 1, 0); | |
380 | @@ -1721,7 +1730,6 @@ | |
381 | tree init_decl; | |
382 | tree t; | |
383 | ||
384 | - start_sequence (); | |
385 | init_decl = build_decl (FUNCTION_DECL, init_name, init_type); | |
386 | DECL_ASSEMBLER_NAME (init_decl) = init_name; | |
387 | TREE_STATIC (init_decl) = 1; | |
388 | Only in gcc-2.95.2/gcc/java: class.c.orig | |
389 | diff -u -r gcc-2.95.2-orig/gcc/java/decl.c gcc-2.95.2/gcc/java/decl.c | |
390 | --- gcc-2.95.2-orig/gcc/java/decl.c Sat Jun 5 20:18:17 1999 | |
391 | +++ gcc-2.95.2/gcc/java/decl.c Sat Oct 30 19:53:18 1999 | |
392 | @@ -365,6 +365,11 @@ | |
393 | tree soft_lookupinterfacemethod_node; | |
394 | tree soft_fmod_node; | |
395 | tree soft_exceptioninfo_call_node; | |
396 | +tree soft_idiv_node; | |
397 | +tree soft_irem_node; | |
398 | +tree soft_ldiv_node; | |
399 | +tree soft_lrem_node; | |
400 | + | |
401 | ||
402 | /* Build (and pushdecl) a "promoted type" for all standard | |
403 | types shorter than int. */ | |
404 | @@ -812,6 +817,26 @@ | |
405 | BUILT_IN_FMOD, "fmodf"); | |
406 | #endif | |
407 | ||
408 | + soft_idiv_node | |
409 | + = builtin_function ("_Jv_divI", | |
410 | + build_function_type (int_type_node, t), | |
411 | + NOT_BUILT_IN, NULL_PTR); | |
412 | + | |
413 | + soft_irem_node | |
414 | + = builtin_function ("_Jv_remI", | |
415 | + build_function_type (int_type_node, t), | |
416 | + NOT_BUILT_IN, NULL_PTR); | |
417 | + | |
418 | + soft_ldiv_node | |
419 | + = builtin_function ("_Jv_divJ", | |
420 | + build_function_type (long_type_node, t), | |
421 | + NOT_BUILT_IN, NULL_PTR); | |
422 | + | |
423 | + soft_lrem_node | |
424 | + = builtin_function ("_Jv_remJ", | |
425 | + build_function_type (long_type_node, t), | |
426 | + NOT_BUILT_IN, NULL_PTR); | |
427 | + | |
428 | init_class_processing (); | |
429 | } | |
430 | ||
431 | Only in gcc-2.95.2/gcc/java: decl.c.orig | |
432 | diff -u -r gcc-2.95.2-orig/gcc/java/expr.c gcc-2.95.2/gcc/java/expr.c | |
433 | --- gcc-2.95.2-orig/gcc/java/expr.c Sat Jun 5 20:18:19 1999 | |
434 | +++ gcc-2.95.2/gcc/java/expr.c Sun Oct 31 13:00:28 1999 | |
435 | @@ -1052,6 +1052,53 @@ | |
436 | expand_assignment (local_var, res, 0, 0); | |
437 | } | |
438 | ||
439 | + | |
440 | +tree | |
441 | +build_java_soft_divmod (op, type, op1, op2) | |
442 | + enum tree_code op; | |
443 | + tree type, op1, op2; | |
444 | +{ | |
445 | + tree call = NULL; | |
446 | + tree arg1 = convert (type, op1); | |
447 | + tree arg2 = convert (type, op2); | |
448 | + | |
449 | + if (type == int_type_node) | |
450 | + { | |
451 | + switch (op) | |
452 | + { | |
453 | + case TRUNC_DIV_EXPR: | |
454 | + call = soft_idiv_node; | |
455 | + break; | |
456 | + case TRUNC_MOD_EXPR: | |
457 | + call = soft_irem_node; | |
458 | + break; | |
459 | + } | |
460 | + } | |
461 | + else if (type == long_type_node) | |
462 | + { | |
463 | + switch (op) | |
464 | + { | |
465 | + case TRUNC_DIV_EXPR: | |
466 | + call = soft_ldiv_node; | |
467 | + break; | |
468 | + case TRUNC_MOD_EXPR: | |
469 | + call = soft_lrem_node; | |
470 | + break; | |
471 | + } | |
472 | + } | |
473 | + | |
474 | + if (! call) | |
475 | + fatal ("Internal compiler error in build_java_soft_divmod"); | |
476 | + | |
477 | + call = build (CALL_EXPR, type, | |
478 | + build_address_of (call), | |
479 | + tree_cons (NULL_TREE, arg1, | |
480 | + build_tree_list (NULL_TREE, arg2)), | |
481 | + NULL_TREE); | |
482 | + | |
483 | + return call; | |
484 | +} | |
485 | + | |
486 | tree | |
487 | build_java_binop (op, type, arg1, arg2) | |
488 | enum tree_code op; | |
489 | @@ -1100,10 +1147,11 @@ | |
490 | integer_zero_node)); | |
491 | return fold (build (COND_EXPR, int_type_node, | |
492 | ifexp1, integer_negative_one_node, second_compare)); | |
493 | - } | |
494 | - | |
495 | + } | |
496 | + case TRUNC_DIV_EXPR: | |
497 | case TRUNC_MOD_EXPR: | |
498 | - if (TREE_CODE (type) == REAL_TYPE) | |
499 | + if (TREE_CODE (type) == REAL_TYPE | |
500 | + && op == TRUNC_MOD_EXPR) | |
501 | { | |
502 | tree call; | |
503 | if (type != double_type_node) | |
504 | @@ -1120,6 +1168,12 @@ | |
505 | call = convert (type, call); | |
506 | return call; | |
507 | } | |
508 | + | |
509 | + if (TREE_CODE (type) == INTEGER_TYPE | |
510 | + && flag_use_divide_subroutine | |
511 | + && ! flag_syntax_only) | |
512 | + return build_java_soft_divmod (op, type, arg1, arg2); | |
513 | + | |
514 | break; | |
515 | default: ; | |
516 | } | |
517 | @@ -1881,6 +1935,7 @@ | |
518 | DECL_INITIAL (init_decl) = init; | |
519 | DECL_IGNORED_P (init_decl) = 1; | |
520 | TREE_READONLY (init_decl) = 1; | |
521 | + TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1; | |
522 | make_decl_rtl (init_decl, NULL, 1); | |
523 | init = init_decl; | |
524 | } | |
525 | @@ -1895,7 +1950,6 @@ | |
526 | { | |
527 | tree local; | |
528 | tree body = BLOCK_EXPR_BODY (exp); | |
529 | - struct rtx_def *to_return; | |
530 | pushlevel (2); /* 2 and above */ | |
531 | expand_start_bindings (0); | |
532 | local = BLOCK_EXPR_DECLS (exp); | |
533 | @@ -1913,10 +1967,11 @@ | |
534 | emit_queue (); | |
535 | body = TREE_OPERAND (body, 1); | |
536 | } | |
537 | - to_return = expand_expr (body, target, tmode, modifier); | |
538 | + expand_expr (body, const0_rtx, VOIDmode, 0); | |
539 | + emit_queue (); | |
540 | poplevel (1, 1, 0); | |
541 | expand_end_bindings (getdecls (), 1, 0); | |
542 | - return to_return; | |
543 | + return const0_rtx; | |
544 | } | |
545 | break; | |
546 | ||
547 | @@ -2578,6 +2633,10 @@ | |
548 | ||
549 | We fix this by using save_expr. This forces the sub-operand to be | |
550 | copied into a fresh virtual register, | |
551 | + | |
552 | + For method invocation, we modify the arguments so that a | |
553 | + left-to-right order evaluation is performed. Saved expressions | |
554 | + will, in CALL_EXPR order, be reused when the call will be expanded. | |
555 | */ | |
556 | ||
557 | tree | |
558 | @@ -2593,19 +2652,30 @@ | |
559 | } | |
560 | else if (TREE_CODE (node) == CALL_EXPR || TREE_CODE (node) == NEW_CLASS_EXPR) | |
561 | { | |
562 | - tree last_side_effecting_arg = NULL_TREE; | |
563 | - tree arg = TREE_OPERAND (node, 1); | |
564 | - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg)) | |
565 | + tree arg, cmp; | |
566 | + | |
567 | + if (!TREE_OPERAND (node, 1)) | |
568 | + return node; | |
569 | + | |
570 | + /* This reverses the evaluation order. This is a desired effect. */ | |
571 | + for (cmp = NULL_TREE, arg = TREE_OPERAND (node, 1); | |
572 | + arg; arg = TREE_CHAIN (arg)) | |
573 | { | |
574 | - if (TREE_SIDE_EFFECTS (TREE_VALUE (arg))) | |
575 | - last_side_effecting_arg = arg; | |
576 | + tree saved = save_expr (TREE_VALUE (arg)); | |
577 | + cmp = (cmp == NULL_TREE ? saved : | |
578 | + build (COMPOUND_EXPR, void_type_node, cmp, saved)); | |
579 | + TREE_VALUE (arg) = saved; | |
580 | } | |
581 | - arg = TREE_OPERAND (node, 1); | |
582 | - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg)) | |
583 | + | |
584 | + if (cmp && TREE_CODE (cmp) == COMPOUND_EXPR) | |
585 | + TREE_SIDE_EFFECTS (cmp) = 1; | |
586 | + | |
587 | + if (cmp) | |
588 | { | |
589 | - if (arg == last_side_effecting_arg) | |
590 | - break; | |
591 | - TREE_VALUE (arg) = save_expr (TREE_VALUE (arg)); | |
592 | + cmp = save_expr (build (COMPOUND_EXPR, TREE_TYPE (node), cmp, node)); | |
593 | + CAN_COMPLETE_NORMALLY (cmp) = CAN_COMPLETE_NORMALLY (node); | |
594 | + TREE_SIDE_EFFECTS (cmp) = 1; | |
595 | + node = cmp; | |
596 | } | |
597 | } | |
598 | return node; | |
599 | Only in gcc-2.95.2/gcc/java: expr.c.orig | |
600 | Only in gcc-2.95.2/gcc/java: expr.c.rej | |
601 | diff -u -r gcc-2.95.2-orig/gcc/java/gjavah.c gcc-2.95.2/gcc/java/gjavah.c | |
602 | --- gcc-2.95.2-orig/gcc/java/gjavah.c Fri May 14 00:05:02 1999 | |
603 | +++ gcc-2.95.2/gcc/java/gjavah.c Sat Oct 30 15:06:45 1999 | |
604 | @@ -33,6 +33,8 @@ | |
605 | #include "java-tree.h" | |
606 | #include "java-opcodes.h" | |
607 | ||
608 | +#include "version.c" | |
609 | + | |
610 | /* The output file. */ | |
611 | FILE *out = NULL; | |
612 | ||
613 | @@ -88,6 +90,11 @@ | |
614 | #define METHOD_IS_FINAL(Class, Method) \ | |
615 | (((Class) & ACC_FINAL) || ((Method) & (ACC_FINAL | ACC_PRIVATE))) | |
616 | ||
617 | +/* Pass this macro the flags for a method. It will return true if the | |
618 | + method is native. */ | |
619 | +#define METHOD_IS_NATIVE(Method) \ | |
620 | + ((Method) & ACC_NATIVE) | |
621 | + | |
622 | /* We keep a linked list of all method names we have seen. This lets | |
623 | us determine if a method name and a field name are in conflict. */ | |
624 | struct method_name | |
625 | @@ -100,11 +107,15 @@ | |
626 | /* List of method names we've seen. */ | |
627 | static struct method_name *method_name_list; | |
628 | ||
629 | -static void print_field_info PROTO ((FILE *, JCF*, int, int, JCF_u2)); | |
630 | -static void print_method_info PROTO ((FILE *, JCF*, int, int, JCF_u2)); | |
631 | +static void print_field_info PROTO ((FILE*, JCF*, int, int, JCF_u2)); | |
632 | +static void print_mangled_classname PROTO ((FILE*, JCF*, const char*, int)); | |
633 | +static int print_cxx_classname PROTO ((FILE*, const char*, JCF*, int)); | |
634 | +static void print_method_info PROTO ((FILE*, JCF*, int, int, JCF_u2)); | |
635 | static void print_c_decl PROTO ((FILE*, JCF*, int, int, int, const char *)); | |
636 | -static void decompile_method PROTO ((FILE *, JCF *, int)); | |
637 | -static void add_class_decl PROTO ((FILE *, JCF *, JCF_u2)); | |
638 | +static void print_stub PROTO ((FILE*, JCF*, int, int, int, const char *)); | |
639 | +static void print_full_cxx_name PROTO ((FILE*, JCF*, int, int, int, const char *)); | |
640 | +static void decompile_method PROTO ((FILE*, JCF*, int)); | |
641 | +static void add_class_decl PROTO ((FILE*, JCF*, JCF_u2)); | |
642 | ||
643 | static int java_float_finite PROTO ((jfloat)); | |
644 | static int java_double_finite PROTO ((jdouble)); | |
645 | @@ -130,13 +141,13 @@ | |
646 | #define HANDLE_END_FIELD() \ | |
647 | if (field_pass) \ | |
648 | { \ | |
649 | - if (out) \ | |
650 | + if (out && ! stubs) \ | |
651 | print_field_info (out, jcf, current_field_name, \ | |
652 | current_field_signature, \ | |
653 | current_field_flags); \ | |
654 | } \ | |
655 | else \ | |
656 | - add_class_decl (out, jcf, current_field_signature); | |
657 | + if (! stubs) add_class_decl (out, jcf, current_field_signature); | |
658 | ||
659 | #define HANDLE_CONSTANTVALUE(VALUEINDEX) current_field_value = (VALUEINDEX) | |
660 | ||
661 | @@ -151,14 +162,14 @@ | |
662 | print_method_info (out, jcf, NAME, SIGNATURE, ACCESS_FLAGS); \ | |
663 | } \ | |
664 | else \ | |
665 | - add_class_decl (out, jcf, SIGNATURE); | |
666 | + if (! stubs) add_class_decl (out, jcf, SIGNATURE); | |
667 | ||
668 | #define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \ | |
669 | if (out && method_declared) decompile_method (out, jcf, CODE_LENGTH); | |
670 | ||
671 | static int decompiled = 0; | |
672 | #define HANDLE_END_METHOD() \ | |
673 | - if (out && method_printed) fputs (decompiled ? "\n" : ";\n", out); | |
674 | + if (out && method_printed) fputs (decompiled || stubs ? "\n" : ";\n", out); | |
675 | ||
676 | #include "jcf-reader.c" | |
677 | ||
678 | @@ -562,24 +573,36 @@ | |
679 | return; | |
680 | } | |
681 | ||
682 | - method_printed = 1; | |
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 | + if (! stubs) | |
690 | { | |
691 | - /* Don't print `virtual' if we have a constructor. */ | |
692 | - if (! is_init) | |
693 | - fputs ("virtual ", out); | |
694 | - } | |
695 | - print_c_decl (out, jcf, name_index, sig_index, is_init, override); | |
696 | + method_printed = 1; | |
697 | ||
698 | - if ((flags & ACC_ABSTRACT)) | |
699 | - fputs (" = 0", out); | |
700 | + generate_access (stream, flags); | |
701 | + | |
702 | + fputs (" ", out); | |
703 | + if ((flags & ACC_STATIC)) | |
704 | + fputs ("static ", out); | |
705 | + else if (! METHOD_IS_FINAL (jcf->access_flags, flags)) | |
706 | + { | |
707 | + /* Don't print `virtual' if we have a constructor. */ | |
708 | + if (! is_init) | |
709 | + fputs ("virtual ", out); | |
710 | + } | |
711 | + print_c_decl (out, jcf, name_index, sig_index, is_init, override); | |
712 | + | |
713 | + if ((flags & ACC_ABSTRACT)) | |
714 | + fputs (" = 0", out); | |
715 | + else | |
716 | + method_declared = 1; | |
717 | + } | |
718 | else | |
719 | - method_declared = 1; | |
720 | + { | |
721 | + if (METHOD_IS_NATIVE(flags)) | |
722 | + { | |
723 | + method_printed = 1; | |
724 | + print_stub (out, jcf, name_index, sig_index, is_init, override); | |
725 | + } | |
726 | + } | |
727 | } | |
728 | ||
729 | /* Try to decompile a method body. Right now we just try to handle a | |
730 | @@ -653,10 +676,13 @@ | |
731 | int *need_space; | |
732 | { | |
733 | const char *ctype; | |
734 | + int array_depth = 0; | |
735 | ||
736 | switch (signature[0]) | |
737 | { | |
738 | case '[': | |
739 | + /* More spaghetti. */ | |
740 | + array_loop: | |
741 | for (signature++; (signature < limit | |
742 | && *signature >= '0' | |
743 | && *signature <= '9'); signature++) | |
744 | @@ -671,13 +697,17 @@ | |
745 | case 'S': ctype = "jshortArray"; goto printit; | |
746 | case 'J': ctype = "jlongArray"; goto printit; | |
747 | case 'Z': ctype = "jbooleanArray"; goto printit; | |
748 | - case '[': ctype = "jobjectArray"; goto printit; | |
749 | + case '[': | |
750 | + /* We have a nested array. */ | |
751 | + ++array_depth; | |
752 | + fputs ("JArray<", stream); | |
753 | + goto array_loop; | |
754 | + | |
755 | case 'L': | |
756 | - /* We have to generate a reference to JArray here, | |
757 | - so that our output matches what the compiler | |
758 | - does. */ | |
759 | + /* We have to generate a reference to JArray here, so that | |
760 | + our output matches what the compiler does. */ | |
761 | ++signature; | |
762 | - fputs ("JArray<", stream); | |
763 | + fputs ("JArray<", stream); | |
764 | while (signature < limit && *signature != ';') | |
765 | { | |
766 | int ch = UTF8_GET (signature, limit); | |
767 | @@ -711,6 +741,8 @@ | |
768 | case 'Z': ctype = "jboolean"; goto printit; | |
769 | case 'V': ctype = "void"; goto printit; | |
770 | case 'L': | |
771 | + /* Print a leading "::" so we look in the right namespace. */ | |
772 | + fputs ("::", stream); | |
773 | ++signature; | |
774 | while (*signature && *signature != ';') | |
775 | { | |
776 | @@ -737,6 +769,9 @@ | |
777 | break; | |
778 | } | |
779 | ||
780 | + while (array_depth-- > 0) | |
781 | + fputs ("> *", stream); | |
782 | + | |
783 | return signature; | |
784 | } | |
785 | ||
786 | @@ -791,40 +826,121 @@ | |
787 | /* Now print the name of the thing. */ | |
788 | if (need_space) | |
789 | fputs (" ", stream); | |
790 | - if (name_override) | |
791 | - fputs (name_override, stream); | |
792 | - else if (name_index) | |
793 | - { | |
794 | - /* Declare constructors specially. */ | |
795 | - if (is_init) | |
796 | - print_base_classname (stream, jcf, jcf->this_class); | |
797 | - else | |
798 | - print_name (stream, jcf, name_index); | |
799 | - } | |
800 | + print_full_cxx_name (stream, jcf, name_index, | |
801 | + signature_index, is_init, name_override); | |
802 | + } | |
803 | +} | |
804 | ||
805 | - if (is_method) | |
806 | +// Print the unqualified method name followed by the signature. | |
807 | +static void | |
808 | +DEFUN(print_full_cxx_name, (stream, jcf, name_index, signature_index, is_init, name_override), | |
809 | + FILE* stream AND JCF* jcf | |
810 | + AND int name_index AND int signature_index AND int is_init | |
811 | + AND const char *name_override) | |
812 | +{ | |
813 | + int length = JPOOL_UTF_LENGTH (jcf, signature_index); | |
814 | + unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index); | |
815 | + register unsigned char *str = str0; | |
816 | + unsigned char *limit = str + length; | |
817 | + int need_space = 0; | |
818 | + int is_method = str[0] == '('; | |
819 | + unsigned char *next; | |
820 | + | |
821 | + if (name_override) | |
822 | + fputs (name_override, stream); | |
823 | + else if (name_index) | |
824 | + { | |
825 | + /* Declare constructors specially. */ | |
826 | + if (is_init) | |
827 | + print_base_classname (stream, jcf, jcf->this_class); | |
828 | + else | |
829 | + print_name (stream, jcf, name_index); | |
830 | + } | |
831 | + | |
832 | + if (is_method) | |
833 | + { | |
834 | + /* Have a method or a constructor. Print signature pieces | |
835 | + until done. */ | |
836 | + fputs (" (", stream); | |
837 | + str = str0 + 1; | |
838 | + while (str < limit && *str != ')') | |
839 | { | |
840 | - /* Have a method or a constructor. Print signature pieces | |
841 | - until done. */ | |
842 | - fputs (" (", stream); | |
843 | - str = str0 + 1; | |
844 | - while (str < limit && *str != ')') | |
845 | + next = decode_signature_piece (stream, str, limit, &need_space); | |
846 | + if (! next) | |
847 | { | |
848 | - next = decode_signature_piece (stream, str, limit, &need_space); | |
849 | - if (! next) | |
850 | - { | |
851 | - fprintf (stderr, "unparseable signature: `%s'\n", str0); | |
852 | - found_error = 1; | |
853 | - return; | |
854 | - } | |
855 | + fprintf (stderr, "unparseable signature: `%s'\n", str0); | |
856 | + found_error = 1; | |
857 | + return; | |
858 | + } | |
859 | + | |
860 | + if (next < limit && *next != ')') | |
861 | + fputs (", ", stream); | |
862 | + str = next; | |
863 | + } | |
864 | + | |
865 | + fputs (")", stream); | |
866 | + } | |
867 | +} | |
868 | + | |
869 | +static void | |
870 | +DEFUN(print_stub, (stream, jcf, name_index, signature_index, is_init, | |
871 | + name_override), | |
872 | + FILE* stream AND JCF* jcf | |
873 | + AND int name_index AND int signature_index | |
874 | + AND int is_init AND const char *name_override) | |
875 | +{ | |
876 | + if (JPOOL_TAG (jcf, signature_index) != CONSTANT_Utf8) | |
877 | + { | |
878 | + fprintf (stream, "<not a UTF8 constant>"); | |
879 | + found_error = 1; | |
880 | + } | |
881 | + else | |
882 | + { | |
883 | + int length = JPOOL_UTF_LENGTH (jcf, signature_index); | |
884 | + unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index); | |
885 | + register unsigned char *str = str0; | |
886 | + unsigned char *limit = str + length; | |
887 | + int need_space = 0; | |
888 | + int is_method = str[0] == '('; | |
889 | + unsigned char *next; | |
890 | ||
891 | - if (next < limit && *next != ')') | |
892 | - fputs (", ", stream); | |
893 | - str = next; | |
894 | + /* If printing a method, skip to the return signature and print | |
895 | + that first. However, there is no return value if this is a | |
896 | + constructor. */ | |
897 | + if (is_method && ! is_init) | |
898 | + { | |
899 | + while (str < limit) | |
900 | + { | |
901 | + int ch = *str++; | |
902 | + if (ch == ')') | |
903 | + break; | |
904 | } | |
905 | + } | |
906 | ||
907 | - fputs (")", stream); | |
908 | + /* If printing a field or an ordinary method, then print the | |
909 | + "return value" now. */ | |
910 | + if (! is_method || ! is_init) | |
911 | + { | |
912 | + next = decode_signature_piece (stream, str, limit, &need_space); | |
913 | + if (! next) | |
914 | + { | |
915 | + fprintf (stderr, "unparseable signature: `%s'\n", str0); | |
916 | + found_error = 1; | |
917 | + return; | |
918 | + } | |
919 | } | |
920 | + | |
921 | + /* Now print the name of the thing. */ | |
922 | + print_cxx_classname (stream, "\n", jcf, jcf->this_class); | |
923 | + fputs ("::", stream); | |
924 | + print_full_cxx_name (stream, jcf, name_index, | |
925 | + signature_index, is_init, name_override); | |
926 | + fputs ("\n{\n JvFail (\"", stream); | |
927 | + print_cxx_classname (stream, "", jcf, jcf->this_class); | |
928 | + fputs ("::", stream); | |
929 | + print_full_cxx_name (stream, jcf, name_index, | |
930 | + signature_index, is_init, name_override); | |
931 | + fputs (" not implemented\");\n}\n\n", stream); | |
932 | } | |
933 | } | |
934 | ||
935 | @@ -846,7 +962,7 @@ | |
936 | static int | |
937 | print_cxx_classname (stream, prefix, jcf, index) | |
938 | FILE *stream; | |
939 | - char *prefix; | |
940 | + const char *prefix; | |
941 | JCF *jcf; | |
942 | int index; | |
943 | { | |
944 | @@ -865,6 +981,10 @@ | |
945 | return 0; | |
946 | ||
947 | fputs (prefix, stream); | |
948 | + | |
949 | + /* Print a leading "::" so we look in the right namespace. */ | |
950 | + fputs ("::", stream); | |
951 | + | |
952 | while (s < limit) | |
953 | { | |
954 | c = UTF8_GET (s, limit); | |
955 | @@ -1071,7 +1191,10 @@ | |
956 | { | |
957 | for (i = 0; i < depth; ++i) | |
958 | fputc (' ', out); | |
959 | - fputs ("};\n", out); | |
960 | + fputs ("}\n", out); | |
961 | + /* Only print a `;' when printing a class. C++ is evil. */ | |
962 | + if (name->is_class) | |
963 | + fputs (";", out); | |
964 | } | |
965 | ||
966 | free (name->name); | |
967 | @@ -1103,7 +1226,7 @@ | |
968 | /* If we see an array, then we include the array header. */ | |
969 | if (s[i] == '[') | |
970 | { | |
971 | - print_include (out, "java-array", -1); | |
972 | + print_include (out, "gcj/array", -1); | |
973 | continue; | |
974 | } | |
975 | ||
976 | @@ -1204,30 +1327,49 @@ | |
977 | jcf_parse_class (jcf); | |
978 | ||
979 | if (written_class_count++ == 0 && out) | |
980 | - fputs ("// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-\n\n", | |
981 | - out); | |
982 | + if (! stubs) | |
983 | + fputs ("// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-\n\n", | |
984 | + out); | |
985 | + else | |
986 | + { | |
987 | + fputs ("// This file was created by `gcjh -stubs'. It is -*- c++ -*-. | |
988 | +// | |
989 | +// This file is intended to give you a head start on implementing native | |
990 | +// methods using CNI. | |
991 | +// Be aware: running `gcjh -stubs' once more for this class may overwrite any | |
992 | +// edits you have made to this file.\n\n", out); | |
993 | + } | |
994 | ||
995 | if (out) | |
996 | { | |
997 | - print_mangled_classname (out, jcf, "#ifndef __", jcf->this_class); | |
998 | - fprintf (out, "__\n"); | |
999 | - | |
1000 | - print_mangled_classname (out, jcf, "#define __", jcf->this_class); | |
1001 | - fprintf (out, "__\n\n"); | |
1002 | - | |
1003 | - /* We do this to ensure that inline methods won't be `outlined' | |
1004 | - by g++. This works as long as method and fields are not | |
1005 | - added by the user. */ | |
1006 | - fprintf (out, "#pragma interface\n"); | |
1007 | - } | |
1008 | - | |
1009 | - if (jcf->super_class && out) | |
1010 | - { | |
1011 | - int super_length; | |
1012 | - unsigned char *supername = super_class_name (jcf, &super_length); | |
1013 | - | |
1014 | - fputs ("\n", out); | |
1015 | - print_include (out, supername, super_length); | |
1016 | + if (! stubs) | |
1017 | + { | |
1018 | + print_mangled_classname (out, jcf, "#ifndef __", jcf->this_class); | |
1019 | + fprintf (out, "__\n"); | |
1020 | + | |
1021 | + print_mangled_classname (out, jcf, "#define __", jcf->this_class); | |
1022 | + fprintf (out, "__\n\n"); | |
1023 | + | |
1024 | + /* We do this to ensure that inline methods won't be `outlined' | |
1025 | + by g++. This works as long as method and fields are not | |
1026 | + added by the user. */ | |
1027 | + fprintf (out, "#pragma interface\n"); | |
1028 | + | |
1029 | + if (jcf->super_class) | |
1030 | + { | |
1031 | + int super_length; | |
1032 | + unsigned char *supername = super_class_name (jcf, &super_length); | |
1033 | + | |
1034 | + fputs ("\n", out); | |
1035 | + print_include (out, supername, super_length); | |
1036 | + } | |
1037 | + } | |
1038 | + else | |
1039 | + { | |
1040 | + /* Strip off the ".class" portion of the name when printing | |
1041 | + the include file name. */ | |
1042 | + print_include (out, jcf->classname, strlen (jcf->classname) - 6); | |
1043 | + } | |
1044 | } | |
1045 | ||
1046 | /* We want to parse the methods first. But we need to find where | |
1047 | @@ -1246,31 +1388,37 @@ | |
1048 | if (out) | |
1049 | { | |
1050 | fputs ("\n", out); | |
1051 | - print_class_decls (out, jcf, jcf->this_class); | |
1052 | + | |
1053 | + if (! stubs) | |
1054 | + print_class_decls (out, jcf, jcf->this_class); | |
1055 | ||
1056 | for (i = 0; i < prepend_count; ++i) | |
1057 | fprintf (out, "%s\n", prepend_specs[i]); | |
1058 | if (prepend_count > 0) | |
1059 | fputc ('\n', out); | |
1060 | - } | |
1061 | - | |
1062 | - if (out && ! print_cxx_classname (out, "class ", jcf, jcf->this_class)) | |
1063 | - { | |
1064 | - fprintf (stderr, "class is of array type\n"); | |
1065 | - found_error = 1; | |
1066 | - return; | |
1067 | - } | |
1068 | - if (out && jcf->super_class) | |
1069 | - { | |
1070 | - if (! print_cxx_classname (out, " : public ", jcf, jcf->super_class)) | |
1071 | + | |
1072 | + if (! stubs) | |
1073 | { | |
1074 | - fprintf (stderr, "base class is of array type\n"); | |
1075 | - found_error = 1; | |
1076 | - return; | |
1077 | + if (! print_cxx_classname (out, "class ", jcf, jcf->this_class)) | |
1078 | + { | |
1079 | + fprintf (stderr, "class is of array type\n"); | |
1080 | + found_error = 1; | |
1081 | + return; | |
1082 | + } | |
1083 | + if (jcf->super_class) | |
1084 | + { | |
1085 | + if (! print_cxx_classname (out, " : public ", | |
1086 | + jcf, jcf->super_class)) | |
1087 | + { | |
1088 | + fprintf (stderr, "base class is of array type\n"); | |
1089 | + found_error = 1; | |
1090 | + return; | |
1091 | + } | |
1092 | + } | |
1093 | + | |
1094 | + fputs ("\n{\n", out); | |
1095 | } | |
1096 | } | |
1097 | - if (out) | |
1098 | - fputs ("\n{\n", out); | |
1099 | ||
1100 | /* Now go back for second pass over methods and fields. */ | |
1101 | JCF_SEEK (jcf, method_start); | |
1102 | @@ -1297,15 +1445,20 @@ | |
1103 | for (i = 0; i < add_count; ++i) | |
1104 | fprintf (out, " %s\n", add_specs[i]); | |
1105 | ||
1106 | - fputs ("};\n", out); | |
1107 | + if (! stubs) | |
1108 | + fputs ("};\n", out); | |
1109 | ||
1110 | if (append_count > 0) | |
1111 | fputc ('\n', out); | |
1112 | for (i = 0; i < append_count; ++i) | |
1113 | fprintf (out, "%s\n", append_specs[i]); | |
1114 | ||
1115 | - print_mangled_classname (out, jcf, "\n#endif /* __", jcf->this_class); | |
1116 | - fprintf (out, "__ */\n"); | |
1117 | + if (!stubs) | |
1118 | + { | |
1119 | + print_mangled_classname (out, jcf, | |
1120 | + "\n#endif /* __", jcf->this_class); | |
1121 | + fprintf (out, "__ */\n"); | |
1122 | + } | |
1123 | } | |
1124 | } | |
1125 | ||
1126 | @@ -1327,6 +1480,7 @@ | |
1127 | printf (" -d DIRECTORY Set output directory name\n"); | |
1128 | printf (" --help Print this help, then exit\n"); | |
1129 | printf (" -o FILE Set output file name\n"); | |
1130 | + printf (" -stubs Generate a C++ implementation stub file\n"); | |
1131 | printf (" -td DIRECTORY Set temporary directory name\n"); | |
1132 | printf (" -v, --verbose Print extra information while running\n"); | |
1133 | printf (" --version Print version number, then exit\n"); | |
1134 | @@ -1346,8 +1500,8 @@ | |
1135 | version () | |
1136 | { | |
1137 | /* FIXME: use version.c? */ | |
1138 | - printf ("gcjh (GNU gcc) 0.0\n\n"); | |
1139 | - printf ("Copyright (C) 1998 Free Software Foundation, Inc.\n"); | |
1140 | + printf ("gcjh (%s)\n\n", version_string); | |
1141 | + printf ("Copyright (C) 1998, 1999 Free Software Foundation, Inc.\n"); | |
1142 | printf ("This is free software; see the source for copying conditions. There is NO\n"); | |
1143 | printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); | |
1144 | exit (0); | |
1145 | @@ -1548,7 +1702,7 @@ | |
1146 | { | |
1147 | int dir_len = strlen (output_directory); | |
1148 | int i, classname_length = strlen (classname); | |
1149 | - current_output_file = (char*) ALLOC (dir_len + classname_length + 4); | |
1150 | + current_output_file = (char*) ALLOC (dir_len + classname_length + 5); | |
1151 | strcpy (current_output_file, output_directory); | |
1152 | if (dir_len > 0 && output_directory[dir_len-1] != '/') | |
1153 | current_output_file[dir_len++] = '/'; | |
1154 | @@ -1574,7 +1728,8 @@ | |
1155 | jcf_dependency_set_dep_file (current_output_file); | |
1156 | } | |
1157 | } | |
1158 | - strcpy (current_output_file + dir_len, ".h"); | |
1159 | + strcpy (current_output_file + dir_len, | |
1160 | + stubs ? ".cc" : ".h"); | |
1161 | jcf_dependency_set_target (current_output_file); | |
1162 | if (! suppress_output) | |
1163 | { | |
1164 | @@ -1601,10 +1756,9 @@ | |
1165 | ||
1166 | /* TODO: | |
1167 | ||
1168 | - * Do whatever the javah -stubs flag does. | |
1169 | - | |
1170 | * Emit "structure forward declarations" when needed. | |
1171 | ||
1172 | * Generate C headers, like javah | |
1173 | ||
1174 | */ | |
1175 | + | |
1176 | Only in gcc-2.95.2/gcc/java: gjavah.c.orig | |
1177 | Only in gcc-2.95.2/gcc/java: gjavah.c.rej | |
1178 | diff -u -r gcc-2.95.2-orig/gcc/java/java-tree.h gcc-2.95.2/gcc/java/java-tree.h | |
1179 | --- gcc-2.95.2-orig/gcc/java/java-tree.h Fri May 14 02:33:28 1999 | |
1180 | +++ gcc-2.95.2/gcc/java/java-tree.h Sat Oct 30 19:45:50 1999 | |
1181 | @@ -141,6 +141,9 @@ | |
1182 | extern int flag_not_overriding; | |
1183 | extern int flag_static_local_jdk1_1; | |
1184 | ||
1185 | +/* When non zero, call a library routine to do integer divisions. */ | |
1186 | +extern int flag_use_divide_subroutine; | |
1187 | + | |
1188 | /* The Java .class file that provides main_class; the main input file. */ | |
1189 | extern struct JCF *current_jcf; | |
1190 | ||
1191 | @@ -283,6 +286,10 @@ | |
1192 | extern tree soft_lookupinterfacemethod_node; | |
1193 | extern tree soft_fmod_node; | |
1194 | extern tree soft_exceptioninfo_call_node; | |
1195 | +extern tree soft_idiv_node; | |
1196 | +extern tree soft_irem_node; | |
1197 | +extern tree soft_ldiv_node; | |
1198 | +extern tree soft_lrem_node; | |
1199 | ||
1200 | extern tree access_flags_type_node; | |
1201 | ||
1202 | @@ -544,6 +551,7 @@ | |
1203 | extern tree build_field_ref PROTO ((tree, tree, tree)); | |
1204 | extern void pushdecl_force_head PROTO ((tree)); | |
1205 | extern tree build_java_binop PROTO ((enum tree_code, tree, tree, tree)); | |
1206 | +extern tree build_java_soft_divmod PROTO ((enum tree_code, tree, tree, tree)); | |
1207 | extern tree binary_numeric_promotion PROTO ((tree, tree, tree *, tree *)); | |
1208 | extern tree build_java_arrayaccess PROTO ((tree, tree, tree)); | |
1209 | extern tree build_newarray PROTO ((int, tree)); | |
1210 | Only in gcc-2.95.2/gcc/java: java-tree.h.orig | |
1211 | diff -u -r gcc-2.95.2-orig/gcc/java/jcf-parse.c gcc-2.95.2/gcc/java/jcf-parse.c | |
1212 | --- gcc-2.95.2-orig/gcc/java/jcf-parse.c Thu Apr 22 01:49:42 1999 | |
1213 | +++ gcc-2.95.2/gcc/java/jcf-parse.c Sat Oct 30 14:02:11 1999 | |
1214 | @@ -748,6 +748,8 @@ | |
1215 | /* Mark the file as parsed */ | |
1216 | HAS_BEEN_ALREADY_PARSED_P (file) = 1; | |
1217 | ||
1218 | + jcf_dependency_add_file (input_filename, 0); | |
1219 | + | |
1220 | lang_init_source (1); /* Error msgs have no method prototypes */ | |
1221 | ||
1222 | java_init_lex (); /* Initialize the parser */ | |
1223 | diff -u -r gcc-2.95.2-orig/gcc/java/jcf-write.c gcc-2.95.2/gcc/java/jcf-write.c | |
1224 | --- gcc-2.95.2-orig/gcc/java/jcf-write.c Sun Mar 21 18:09:14 1999 | |
1225 | +++ gcc-2.95.2/gcc/java/jcf-write.c Sun Oct 31 18:54:12 1999 | |
1226 | @@ -186,6 +186,9 @@ | |
1227 | struct jcf_block *label; | |
1228 | }; | |
1229 | ||
1230 | +#define RELOCATION_VALUE_0 ((HOST_WIDE_INT)0) | |
1231 | +#define RELOCATION_VALUE_1 ((HOST_WIDE_INT)1) | |
1232 | + | |
1233 | /* State for single catch clause. */ | |
1234 | ||
1235 | struct jcf_handler | |
1236 | @@ -299,8 +302,14 @@ | |
1237 | static void init_jcf_method PROTO ((struct jcf_partial *, tree)); | |
1238 | static void release_jcf_state PROTO ((struct jcf_partial *)); | |
1239 | static struct chunk * generate_classfile PROTO ((tree, struct jcf_partial *)); | |
1240 | +static void emit_iinc PROTO ((tree, HOST_WIDE_INT, struct jcf_partial *)); | |
1241 | +static void emit_reloc PROTO ((HOST_WIDE_INT, int, struct jcf_block *, | |
1242 | + struct jcf_partial *)); | |
1243 | +static void push_constant1 PROTO ((HOST_WIDE_INT, struct jcf_partial *)); | |
1244 | +static void push_constant2 PROTO ((HOST_WIDE_INT, struct jcf_partial *)); | |
1245 | ||
1246 | - | |
1247 | +static void push_long_const PROTO ((HOST_WIDE_INT, HOST_WIDE_INT, | |
1248 | + struct jcf_partial *)); | |
1249 | /* Utility macros for appending (big-endian) data to a buffer. | |
1250 | We assume a local variable 'ptr' points into where we want to | |
1251 | write next, and we assume enoygh space has been allocated. */ | |
1252 | @@ -326,7 +335,13 @@ | |
1253 | #define PUT4(X) (PUT2((X) >> 16), PUT2((X) & 0xFFFF)) | |
1254 | #define PUTN(P, N) (CHECK_PUT(ptr, state, N), memcpy(ptr, P, N), ptr += (N)) | |
1255 | ||
1256 | -\f | |
1257 | +/* There are some cases below where CHECK_PUT is guaranteed to fail. | |
1258 | + Use the following macros in those specific cases. */ | |
1259 | +#define UNSAFE_PUT1(X) (*ptr++ = (X)) | |
1260 | +#define UNSAFE_PUT2(X) (UNSAFE_PUT1((X) >> 8), UNSAFE_PUT1((X) & 0xFF)) | |
1261 | +#define UNSAFE_PUT4(X) (UNSAFE_PUT2((X) >> 16), UNSAFE_PUT2((X) & 0xFFFF)) | |
1262 | +#define UNSAFE_PUTN(P, N) (memcpy(ptr, P, N), ptr += (N)) | |
1263 | + | |
1264 | /* Allocate a new chunk on obstack WORK, and link it in after LAST. | |
1265 | Set the data and size fields to DATA and SIZE, respectively. | |
1266 | However, if DATA is NULL and SIZE>0, allocate a buffer as well. */ | |
1267 | @@ -665,7 +680,7 @@ | |
1268 | ||
1269 | static void | |
1270 | push_constant1 (index, state) | |
1271 | - int index; | |
1272 | + HOST_WIDE_INT index; | |
1273 | struct jcf_partial *state; | |
1274 | { | |
1275 | RESERVE (3); | |
1276 | @@ -686,7 +701,7 @@ | |
1277 | ||
1278 | static void | |
1279 | push_constant2 (index, state) | |
1280 | - int index; | |
1281 | + HOST_WIDE_INT index; | |
1282 | struct jcf_partial *state; | |
1283 | { | |
1284 | RESERVE (3); | |
1285 | @@ -717,7 +732,8 @@ | |
1286 | } | |
1287 | else | |
1288 | { | |
1289 | - i = find_constant1 (&state->cpool, CONSTANT_Integer, i & 0xFFFFFFFF); | |
1290 | + i = find_constant1 (&state->cpool, CONSTANT_Integer, | |
1291 | + (jword)(i & 0xFFFFFFFF)); | |
1292 | push_constant1 (i, state); | |
1293 | } | |
1294 | } | |
1295 | @@ -730,7 +746,7 @@ | |
1296 | HOST_WIDE_INT w1, w2; | |
1297 | lshift_double (lo, hi, -32, 64, &w1, &w2, 1); | |
1298 | return find_constant2 (&state->cpool, CONSTANT_Long, | |
1299 | - w1 & 0xFFFFFFFF, lo & 0xFFFFFFFF); | |
1300 | + (jword)(w1 & 0xFFFFFFFF), (jword)(lo & 0xFFFFFFFF)); | |
1301 | } | |
1302 | ||
1303 | /* Find or allocate a constant pool entry for the given VALUE. | |
1304 | @@ -745,7 +761,7 @@ | |
1305 | { | |
1306 | if (TYPE_PRECISION (TREE_TYPE (value)) <= 32) | |
1307 | return find_constant1 (&state->cpool, CONSTANT_Integer, | |
1308 | - TREE_INT_CST_LOW (value) & 0xFFFFFFFF); | |
1309 | + (jword)(TREE_INT_CST_LOW (value) & 0xFFFFFFFF)); | |
1310 | else | |
1311 | return find_constant_wide (TREE_INT_CST_LOW (value), | |
1312 | TREE_INT_CST_HIGH (value), state); | |
1313 | @@ -756,14 +772,17 @@ | |
1314 | if (TYPE_PRECISION (TREE_TYPE (value)) == 32) | |
1315 | { | |
1316 | words[0] = etarsingle (TREE_REAL_CST (value)) & 0xFFFFFFFF; | |
1317 | - return find_constant1 (&state->cpool, CONSTANT_Float, words[0]); | |
1318 | + return find_constant1 (&state->cpool, CONSTANT_Float, | |
1319 | + (jword)words[0]); | |
1320 | } | |
1321 | else | |
1322 | { | |
1323 | etardouble (TREE_REAL_CST (value), words); | |
1324 | return find_constant2 (&state->cpool, CONSTANT_Double, | |
1325 | - words[1-FLOAT_WORDS_BIG_ENDIAN] & 0xFFFFFFFF, | |
1326 | - words[FLOAT_WORDS_BIG_ENDIAN] & 0xFFFFFFFF); | |
1327 | + (jword)(words[1-FLOAT_WORDS_BIG_ENDIAN] & | |
1328 | + 0xFFFFFFFF), | |
1329 | + (jword)(words[FLOAT_WORDS_BIG_ENDIAN] & | |
1330 | + 0xFFFFFFFF)); | |
1331 | } | |
1332 | } | |
1333 | else if (TREE_CODE (value) == STRING_CST) | |
1334 | @@ -906,7 +925,7 @@ | |
1335 | static void | |
1336 | emit_iinc (var, value, state) | |
1337 | tree var; | |
1338 | - int value; | |
1339 | + HOST_WIDE_INT value; | |
1340 | struct jcf_partial *state; | |
1341 | { | |
1342 | int slot = DECL_LOCAL_INDEX (var); | |
1343 | @@ -1012,7 +1031,7 @@ | |
1344 | struct jcf_block *label; | |
1345 | struct jcf_partial *state; | |
1346 | { | |
1347 | - emit_reloc (0, BLOCK_START_RELOC, label, state); | |
1348 | + emit_reloc (RELOCATION_VALUE_0, BLOCK_START_RELOC, label, state); | |
1349 | } | |
1350 | ||
1351 | /* Similar to emit_switch_reloc, | |
1352 | @@ -1041,8 +1060,8 @@ | |
1353 | struct jcf_partial *state; | |
1354 | { | |
1355 | OP1 (opcode); | |
1356 | - // value is 1 byte from reloc back to start of instruction. | |
1357 | - emit_reloc (1, - inv_opcode, target, state); | |
1358 | + /* value is 1 byte from reloc back to start of instruction. */ | |
1359 | + emit_reloc (RELOCATION_VALUE_1, - inv_opcode, target, state); | |
1360 | } | |
1361 | ||
1362 | static void | |
1363 | @@ -1051,8 +1070,8 @@ | |
1364 | struct jcf_partial *state; | |
1365 | { | |
1366 | OP1 (OPCODE_goto); | |
1367 | - // Value is 1 byte from reloc back to start of instruction. | |
1368 | - emit_reloc (1, OPCODE_goto_w, target, state); | |
1369 | + /* Value is 1 byte from reloc back to start of instruction. */ | |
1370 | + emit_reloc (RELOCATION_VALUE_1, OPCODE_goto_w, target, state); | |
1371 | } | |
1372 | ||
1373 | static void | |
1374 | @@ -1061,8 +1080,8 @@ | |
1375 | struct jcf_partial *state; | |
1376 | { | |
1377 | OP1 (OPCODE_jsr); | |
1378 | - // Value is 1 byte from reloc back to start of instruction. | |
1379 | - emit_reloc (1, OPCODE_jsr_w, target, state); | |
1380 | + /* Value is 1 byte from reloc back to start of instruction. */ | |
1381 | + emit_reloc (RELOCATION_VALUE_1, OPCODE_jsr_w, target, state); | |
1382 | } | |
1383 | ||
1384 | /* Generate code to evaluate EXP. If the result is true, | |
1385 | @@ -1690,7 +1709,8 @@ | |
1386 | int index = 0; | |
1387 | RESERVE (13 + 4 * (sw_state.max_case - sw_state.min_case + 1)); | |
1388 | OP1 (OPCODE_tableswitch); | |
1389 | - emit_reloc (0, SWITCH_ALIGN_RELOC, NULL, state); | |
1390 | + emit_reloc (RELOCATION_VALUE_0, | |
1391 | + SWITCH_ALIGN_RELOC, NULL, state); | |
1392 | emit_switch_reloc (sw_state.default_label, state); | |
1393 | OP4 (sw_state.min_case); | |
1394 | OP4 (sw_state.max_case); | |
1395 | @@ -1713,7 +1733,8 @@ | |
1396 | { /* Use lookupswitch. */ | |
1397 | RESERVE(9 + 8 * sw_state.num_cases); | |
1398 | OP1 (OPCODE_lookupswitch); | |
1399 | - emit_reloc (0, SWITCH_ALIGN_RELOC, NULL, state); | |
1400 | + emit_reloc (RELOCATION_VALUE_0, | |
1401 | + SWITCH_ALIGN_RELOC, NULL, state); | |
1402 | emit_switch_reloc (sw_state.default_label, state); | |
1403 | OP4 (sw_state.num_cases); | |
1404 | for (i = 0; i < sw_state.num_cases; i++) | |
1405 | @@ -1886,7 +1907,7 @@ | |
1406 | if (size == 1) | |
1407 | push_int_const (value, state); | |
1408 | else | |
1409 | - push_long_const (value, value >= 0 ? 0 : -1, state); | |
1410 | + push_long_const (value, (HOST_WIDE_INT)(value >= 0 ? 0 : -1), state); | |
1411 | NOTE_PUSH (size); | |
1412 | emit_binop (OPCODE_iadd + adjust_typed_op (type, 3), type, state); | |
1413 | if (target != IGNORE_TARGET && ! post_op) | |
1414 | @@ -2775,7 +2796,7 @@ | |
1415 | } | |
1416 | fields_count++; | |
1417 | } | |
1418 | - ptr = fields_count_ptr; PUT2 (fields_count); | |
1419 | + ptr = fields_count_ptr; UNSAFE_PUT2 (fields_count); | |
1420 | ||
1421 | ptr = methods_count_ptr = append_chunk (NULL, 2, state); | |
1422 | PUT2 (0); | |
1423 | @@ -2841,10 +2862,10 @@ | |
1424 | code_attributes_count++; | |
1425 | i += 8 + 10 * state->lvar_count; | |
1426 | } | |
1427 | - PUT4 (i); /* attribute_length */ | |
1428 | - PUT2 (state->code_SP_max); /* max_stack */ | |
1429 | - PUT2 (localvar_max); /* max_locals */ | |
1430 | - PUT4 (state->code_length); | |
1431 | + UNSAFE_PUT4 (i); /* attribute_length */ | |
1432 | + UNSAFE_PUT2 (state->code_SP_max); /* max_stack */ | |
1433 | + UNSAFE_PUT2 (localvar_max); /* max_locals */ | |
1434 | + UNSAFE_PUT4 (state->code_length); | |
1435 | ||
1436 | /* Emit the exception table. */ | |
1437 | ptr = append_chunk (NULL, 2 + 8 * state->num_handlers, state); | |
1438 | @@ -2934,7 +2955,7 @@ | |
1439 | methods_count++; | |
1440 | current_function_decl = save_function; | |
1441 | } | |
1442 | - ptr = methods_count_ptr; PUT2 (methods_count); | |
1443 | + ptr = methods_count_ptr; UNSAFE_PUT2 (methods_count); | |
1444 | ||
1445 | source_file = DECL_SOURCE_FILE (TYPE_NAME (clas)); | |
1446 | for (ptr = source_file; ; ptr++) | |
1447 | Only in gcc-2.95.2/gcc/java: jcf-write.c.orig | |
1448 | Only in gcc-2.95.2/gcc/java: jcf-write.c.rej | |
1449 | diff -u -r gcc-2.95.2-orig/gcc/java/jvgenmain.c gcc-2.95.2/gcc/java/jvgenmain.c | |
1450 | --- gcc-2.95.2-orig/gcc/java/jvgenmain.c Wed Aug 11 17:08:32 1999 | |
1451 | +++ gcc-2.95.2/gcc/java/jvgenmain.c Sat Oct 30 14:02:48 1999 | |
1452 | @@ -1,5 +1,5 @@ | |
1453 | /* Program to generate "main" a Java(TM) class containing a main method. | |
1454 | - Copyright (C) 1998 Free Software Foundation, Inc. | |
1455 | + Copyright (C) 1998, 1999 Free Software Foundation, Inc. | |
1456 | ||
1457 | This file is part of GNU CC. | |
1458 | ||
1459 | @@ -79,19 +79,37 @@ | |
1460 | (void (*) ()) OBSTACK_CHUNK_FREE); | |
1461 | } | |
1462 | ||
1463 | +static void | |
1464 | +usage (const char *name) | |
1465 | +{ | |
1466 | + fprintf (stderr, "Usage: %s [OPTIONS]... CLASSNAME [OUTFILE]\n", name); | |
1467 | + exit (1); | |
1468 | +} | |
1469 | + | |
1470 | int | |
1471 | main (int argc, const char **argv) | |
1472 | { | |
1473 | const char *classname; | |
1474 | FILE *stream; | |
1475 | char *mangled_classname; | |
1476 | + int i, last_arg; | |
1477 | ||
1478 | - if (argc < 2 || argc > 3) | |
1479 | + if (argc < 2) | |
1480 | + usage (argv[0]); | |
1481 | + for (i = 1; i < argc; ++i) | |
1482 | { | |
1483 | - fprintf (stderr, "Usage: %s CLASSNAME [OUTFILE]\n", argv[0]); | |
1484 | - exit(-1); | |
1485 | + if (! strncmp (argv[i], "-D", 2)) | |
1486 | + { | |
1487 | + /* Handled later. */ | |
1488 | + } | |
1489 | + else | |
1490 | + break; | |
1491 | } | |
1492 | ||
1493 | + if (i < argc - 2 || i == argc) | |
1494 | + usage (argv[0]); | |
1495 | + last_arg = i; | |
1496 | + | |
1497 | classname = argv[1]; | |
1498 | ||
1499 | gcc_obstack_init (&name_obstack); | |
1500 | @@ -99,23 +117,46 @@ | |
1501 | obstack_1grow (&name_obstack, '\0'); | |
1502 | mangled_classname = obstack_finish (&name_obstack); | |
1503 | ||
1504 | - if (argc > 2 && strcmp (argv[2], "-") != 0) | |
1505 | + if (i < argc - 1 && strcmp (argv[i + 1], "-") != 0) | |
1506 | { | |
1507 | - const char *outfile = argv[2]; | |
1508 | + const char *outfile = argv[i + 1]; | |
1509 | stream = fopen (outfile, "w"); | |
1510 | if (stream == NULL) | |
1511 | { | |
1512 | fprintf (stderr, "%s: Cannot open output file: %s\n", | |
1513 | argv[0], outfile); | |
1514 | - exit (-1); | |
1515 | + exit (1); | |
1516 | } | |
1517 | } | |
1518 | else | |
1519 | stream = stdout; | |
1520 | + | |
1521 | + /* At this point every element of ARGV from 1 to LAST_ARG is a `-D' | |
1522 | + option. Process them appropriately. */ | |
1523 | + fprintf (stream, "extern const char **_Jv_Compiler_Properties;\n"); | |
1524 | + fprintf (stream, "static const char *props[] =\n{\n"); | |
1525 | + for (i = 1; i < last_arg; ++i) | |
1526 | + { | |
1527 | + const char *p; | |
1528 | + fprintf (stream, " \""); | |
1529 | + for (p = &argv[i][2]; *p; ++p) | |
1530 | + { | |
1531 | + if (! isascii (*p)) | |
1532 | + fprintf (stream, "\\%o", *p); | |
1533 | + else if (*p == '\\' || *p == '"') | |
1534 | + fprintf (stream, "\\%c", *p); | |
1535 | + else | |
1536 | + putc (*p, stream); | |
1537 | + } | |
1538 | + fprintf (stream, "\",\n"); | |
1539 | + } | |
1540 | + fprintf (stream, " 0\n};\n\n"); | |
1541 | + | |
1542 | fprintf (stream, "extern struct Class %s%s;\n", | |
1543 | class_mangling_prefix, mangled_classname); | |
1544 | fprintf (stream, "int main (int argc, const char **argv)\n"); | |
1545 | fprintf (stream, "{\n"); | |
1546 | + fprintf (stream, " _Jv_Compiler_Properties = props;\n"); | |
1547 | fprintf (stream, " JvRunMain (&%s%s, argc, argv);\n", | |
1548 | class_mangling_prefix, mangled_classname); | |
1549 | fprintf (stream, "}\n"); | |
1550 | @@ -123,7 +164,7 @@ | |
1551 | { | |
1552 | fprintf (stderr, "%s: Failed to close output file %s\n", | |
1553 | argv[0], argv[2]); | |
1554 | - exit (-1); | |
1555 | + exit (1); | |
1556 | } | |
1557 | return 0; | |
1558 | } | |
1559 | Only in gcc-2.95.2/gcc/java: jvgenmain.c.orig | |
1560 | diff -u -r gcc-2.95.2-orig/gcc/java/jvspec.c gcc-2.95.2/gcc/java/jvspec.c | |
1561 | --- gcc-2.95.2-orig/gcc/java/jvspec.c Sun Oct 17 10:18:28 1999 | |
1562 | +++ gcc-2.95.2/gcc/java/jvspec.c Sat Oct 30 20:09:50 1999 | |
1563 | @@ -54,7 +54,7 @@ | |
1564 | #define COMBINE_INPUTS 0 | |
1565 | ||
1566 | char jvgenmain_spec[] = | |
1567 | - "jvgenmain %i %{!pipe:%umain.i} |\n\ | |
1568 | + "jvgenmain %{D*} %i %{!pipe:%umain.i} |\n\ | |
1569 | cc1 %{!pipe:%Umain.i} %1 \ | |
1570 | %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\ | |
1571 | %{g*} %{O*} \ | |
1572 | @@ -167,6 +167,9 @@ | |
1573 | int saw_O = 0; | |
1574 | int saw_g = 0; | |
1575 | ||
1576 | + /* Saw a `-D' option. */ | |
1577 | + int saw_D = 0; | |
1578 | + | |
1579 | /* An array used to flag each argument that needs a bit set for | |
1580 | LANGSPEC, MATHLIB, WITHLIBC, or GCLIB. */ | |
1581 | int *args; | |
1582 | @@ -186,6 +189,9 @@ | |
1583 | /* Non-zero if linking is supposed to happen. */ | |
1584 | int will_link = 1; | |
1585 | ||
1586 | + /* Non-zero if we want to find the spec file. */ | |
1587 | + int want_spec_file = 1; | |
1588 | + | |
1589 | /* The argument we use to specify the spec file. */ | |
1590 | char *spec_file = NULL; | |
1591 | ||
1592 | @@ -224,7 +230,7 @@ | |
1593 | added--; | |
1594 | } | |
1595 | else if (strcmp (argv[i], "-fhelp") == 0) | |
1596 | - will_link = 0; | |
1597 | + want_spec_file = 0; | |
1598 | else if (strcmp (argv[i], "-v") == 0) | |
1599 | { | |
1600 | saw_verbose_flag = 1; | |
1601 | @@ -240,6 +246,7 @@ | |
1602 | else if (strcmp (argv[i], "-C") == 0) | |
1603 | { | |
1604 | saw_C = 1; | |
1605 | + want_spec_file = 0; | |
1606 | #if COMBINE_INPUTS | |
1607 | combine_inputs = 1; | |
1608 | #endif | |
1609 | @@ -248,6 +255,8 @@ | |
1610 | library = 0; | |
1611 | will_link = 0; | |
1612 | } | |
1613 | + else if (argv[i][1] == 'D') | |
1614 | + saw_D = 1; | |
1615 | else if (argv[i][1] == 'g') | |
1616 | saw_g = 1; | |
1617 | else if (argv[i][1] == 'O') | |
1618 | @@ -288,6 +297,7 @@ | |
1619 | else if (strcmp (argv[i], "-fsyntax-only") == 0 | |
1620 | || strcmp (argv[i], "--syntax-only") == 0) | |
1621 | { | |
1622 | + want_spec_file = 0; | |
1623 | library = 0; | |
1624 | will_link = 0; | |
1625 | continue; | |
1626 | @@ -331,6 +341,9 @@ | |
1627 | if (quote) | |
1628 | (*fn) ("argument to `%s' missing\n", quote); | |
1629 | ||
1630 | + if (saw_D && ! main_class_name) | |
1631 | + fatal ("can't specify `-D' without `--main'\n"); | |
1632 | + | |
1633 | num_args = argc + added; | |
1634 | if (saw_C) | |
1635 | { | |
1636 | @@ -376,8 +389,7 @@ | |
1637 | } | |
1638 | if (saw_g + saw_O == 0) | |
1639 | num_args++; | |
1640 | - if (will_link) | |
1641 | - num_args++; | |
1642 | + num_args++; | |
1643 | arglist = (char **) xmalloc ((num_args + 1) * sizeof (char *)); | |
1644 | ||
1645 | for (i = 0, j = 0; i < argc; i++, j++) | |
1646 | @@ -408,7 +420,7 @@ | |
1647 | continue; | |
1648 | } | |
1649 | ||
1650 | - if (will_link && spec_file == NULL && strncmp (argv[i], "-L", 2) == 0) | |
1651 | + if (spec_file == NULL && strncmp (argv[i], "-L", 2) == 0) | |
1652 | spec_file = find_spec_file (argv[i] + 2); | |
1653 | ||
1654 | if (strncmp (argv[i], "-fmain=", 7) == 0) | |
1655 | @@ -453,10 +465,10 @@ | |
1656 | if (saw_g + saw_O == 0) | |
1657 | arglist[j++] = "-g1"; | |
1658 | ||
1659 | - /* Read the specs file corresponding to libgcj, but only if linking. | |
1660 | + /* Read the specs file corresponding to libgcj. | |
1661 | If we didn't find the spec file on the -L path, then we hope it | |
1662 | is somewhere in the standard install areas. */ | |
1663 | - if (will_link) | |
1664 | + if (want_spec_file) | |
1665 | arglist[j++] = spec_file == NULL ? "-specs=libgcj.spec" : spec_file; | |
1666 | ||
1667 | if (saw_C) | |
1668 | Only in gcc-2.95.2/gcc/java: jvspec.c.orig | |
1669 | Only in gcc-2.95.2/gcc/java: jvspec.c.rej | |
1670 | diff -u -r gcc-2.95.2-orig/gcc/java/lang-options.h gcc-2.95.2/gcc/java/lang-options.h | |
1671 | --- gcc-2.95.2-orig/gcc/java/lang-options.h Tue May 11 20:50:13 1999 | |
1672 | +++ gcc-2.95.2/gcc/java/lang-options.h Sat Oct 30 19:45:50 1999 | |
1673 | @@ -43,6 +43,8 @@ | |
1674 | { "-fCLASSPATH", "Set class path" }, | |
1675 | { "-I", "Add directory to class path" }, | |
1676 | { "-foutput-class-dir", "Directory where class files should be written" }, | |
1677 | + { "-fuse-divide-subroutine", "" }, | |
1678 | + { "-fno-use-divide-subroutine", "Use built-in instructions for division" }, | |
1679 | { "-Wredundant-modifiers", | |
1680 | "Warn if modifiers are specified when not necessary"}, | |
1681 | - { "-Wunsupported-jdk11", "Warn if `final' local variables are specified"}, | |
1682 | + { "-Wunsupported-jdk11", "Warn if `final' local variables are specified"}, | |
1683 | Only in gcc-2.95.2/gcc/java: lang-options.h.orig | |
1684 | diff -u -r gcc-2.95.2-orig/gcc/java/lang-specs.h gcc-2.95.2/gcc/java/lang-specs.h | |
1685 | --- gcc-2.95.2-orig/gcc/java/lang-specs.h Mon Feb 1 06:46:51 1999 | |
1686 | +++ gcc-2.95.2/gcc/java/lang-specs.h Sat Oct 30 20:07:34 1999 | |
1687 | @@ -30,7 +30,7 @@ | |
1688 | {".zip", {"@java"} }, | |
1689 | {".jar", {"@java"} }, | |
1690 | {"@java", | |
1691 | - {"%{!E:jc1 %i %1 %{!Q:-quiet} %{d*} %{m*} %{a}\ | |
1692 | + {"%{!E:jc1 %i %1 %(jc1) %{!Q:-quiet} %{d*} %{m*} %{a}\ | |
1693 | %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\ | |
1694 | %{traditional} %{v:-version} %{pg:-p} %{p}\ | |
1695 | %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\ | |
1696 | Only in gcc-2.95.2/gcc/java: lang-specs.h.orig | |
1697 | Only in gcc-2.95.2/gcc/java: lang-specs.h.rej | |
1698 | diff -u -r gcc-2.95.2-orig/gcc/java/lang.c gcc-2.95.2/gcc/java/lang.c | |
1699 | --- gcc-2.95.2-orig/gcc/java/lang.c Sat May 15 01:44:09 1999 | |
1700 | +++ gcc-2.95.2/gcc/java/lang.c Sat Oct 30 19:45:50 1999 | |
1701 | @@ -105,6 +105,9 @@ | |
1702 | /* When non zero, warns that final local are treated as non final. */ | |
1703 | int flag_static_local_jdk1_1 = 0; | |
1704 | ||
1705 | +/* When non zero, call a library routine to do integer divisions. */ | |
1706 | +int flag_use_divide_subroutine = 1; | |
1707 | + | |
1708 | /* From gcc/flags.h, and indicates if exceptions are turned on or not. */ | |
1709 | ||
1710 | extern int flag_new_exceptions; | |
1711 | @@ -123,6 +126,7 @@ | |
1712 | {"assume-compiled", &flag_assume_compiled, 1}, | |
1713 | {"emit-class-file", &flag_emit_class_files, 1}, | |
1714 | {"emit-class-files", &flag_emit_class_files, 1}, | |
1715 | + {"use-divide-subroutine", &flag_use_divide_subroutine, 1}, | |
1716 | }; | |
1717 | ||
1718 | JCF *current_jcf; | |
1719 | Only in gcc-2.95.2/gcc/java: lang.c.orig | |
1720 | diff -u -r gcc-2.95.2-orig/gcc/java/lex.h gcc-2.95.2/gcc/java/lex.h | |
1721 | --- gcc-2.95.2-orig/gcc/java/lex.h Thu May 13 04:52:35 1999 | |
1722 | +++ gcc-2.95.2/gcc/java/lex.h Sun Oct 31 18:48:35 1999 | |
1723 | @@ -123,7 +123,7 @@ | |
1724 | #define SET_MODIFIER_CTX(TOKEN) java_lval->value = (TOKEN) | |
1725 | #define GET_TYPE_PRECISION(NODE) 4 | |
1726 | #define BUILD_OPERATOR(TOKEN) return TOKEN | |
1727 | -#define BUILD_OPERATOR2(TOKEN) return TOKEN | |
1728 | +#define BUILD_OPERATOR2(TOKEN) return ASSIGN_ANY_TK | |
1729 | #define SET_LVAL_NODE(NODE) | |
1730 | #define SET_LVAL_NODE_TYPE(NODE, TYPE) | |
1731 | #define BUILD_ID_WFL(EXP) (EXP) | |
1732 | diff -u -r gcc-2.95.2-orig/gcc/java/parse-scan.c gcc-2.95.2/gcc/java/parse-scan.c | |
1733 | --- gcc-2.95.2-orig/gcc/java/parse-scan.c Mon Oct 25 21:02:09 1999 | |
1734 | +++ gcc-2.95.2/gcc/java/parse-scan.c Sun Oct 31 19:10:26 1999 | |
1735 | @@ -1,117 +1,116 @@ | |
1736 | ||
1737 | /* A Bison parser, made from ./parse-scan.y | |
1738 | - by GNU Bison version 1.25 | |
1739 | - */ | |
1740 | + by GNU Bison version 1.28 */ | |
1741 | ||
1742 | #define YYBISON 1 /* Identify Bison output. */ | |
1743 | ||
1744 | -#define PLUS_TK 258 | |
1745 | -#define MINUS_TK 259 | |
1746 | -#define MULT_TK 260 | |
1747 | -#define DIV_TK 261 | |
1748 | -#define REM_TK 262 | |
1749 | -#define LS_TK 263 | |
1750 | -#define SRS_TK 264 | |
1751 | -#define ZRS_TK 265 | |
1752 | -#define AND_TK 266 | |
1753 | -#define XOR_TK 267 | |
1754 | -#define OR_TK 268 | |
1755 | -#define BOOL_AND_TK 269 | |
1756 | -#define BOOL_OR_TK 270 | |
1757 | -#define EQ_TK 271 | |
1758 | -#define NEQ_TK 272 | |
1759 | -#define GT_TK 273 | |
1760 | -#define GTE_TK 274 | |
1761 | -#define LT_TK 275 | |
1762 | -#define LTE_TK 276 | |
1763 | -#define PLUS_ASSIGN_TK 277 | |
1764 | -#define MINUS_ASSIGN_TK 278 | |
1765 | -#define MULT_ASSIGN_TK 279 | |
1766 | -#define DIV_ASSIGN_TK 280 | |
1767 | -#define REM_ASSIGN_TK 281 | |
1768 | -#define LS_ASSIGN_TK 282 | |
1769 | -#define SRS_ASSIGN_TK 283 | |
1770 | -#define ZRS_ASSIGN_TK 284 | |
1771 | -#define AND_ASSIGN_TK 285 | |
1772 | -#define XOR_ASSIGN_TK 286 | |
1773 | -#define OR_ASSIGN_TK 287 | |
1774 | -#define PUBLIC_TK 288 | |
1775 | -#define PRIVATE_TK 289 | |
1776 | -#define PROTECTED_TK 290 | |
1777 | -#define STATIC_TK 291 | |
1778 | -#define FINAL_TK 292 | |
1779 | -#define SYNCHRONIZED_TK 293 | |
1780 | -#define VOLATILE_TK 294 | |
1781 | -#define TRANSIENT_TK 295 | |
1782 | -#define NATIVE_TK 296 | |
1783 | -#define PAD_TK 297 | |
1784 | -#define ABSTRACT_TK 298 | |
1785 | -#define MODIFIER_TK 299 | |
1786 | -#define DECR_TK 300 | |
1787 | -#define INCR_TK 301 | |
1788 | -#define DEFAULT_TK 302 | |
1789 | -#define IF_TK 303 | |
1790 | -#define THROW_TK 304 | |
1791 | -#define BOOLEAN_TK 305 | |
1792 | -#define DO_TK 306 | |
1793 | -#define IMPLEMENTS_TK 307 | |
1794 | -#define THROWS_TK 308 | |
1795 | -#define BREAK_TK 309 | |
1796 | -#define IMPORT_TK 310 | |
1797 | -#define ELSE_TK 311 | |
1798 | -#define INSTANCEOF_TK 312 | |
1799 | -#define RETURN_TK 313 | |
1800 | -#define VOID_TK 314 | |
1801 | -#define CATCH_TK 315 | |
1802 | -#define INTERFACE_TK 316 | |
1803 | -#define CASE_TK 317 | |
1804 | -#define EXTENDS_TK 318 | |
1805 | -#define FINALLY_TK 319 | |
1806 | -#define SUPER_TK 320 | |
1807 | -#define WHILE_TK 321 | |
1808 | -#define CLASS_TK 322 | |
1809 | -#define SWITCH_TK 323 | |
1810 | -#define CONST_TK 324 | |
1811 | -#define TRY_TK 325 | |
1812 | -#define FOR_TK 326 | |
1813 | -#define NEW_TK 327 | |
1814 | -#define CONTINUE_TK 328 | |
1815 | -#define GOTO_TK 329 | |
1816 | -#define PACKAGE_TK 330 | |
1817 | -#define THIS_TK 331 | |
1818 | -#define BYTE_TK 332 | |
1819 | -#define SHORT_TK 333 | |
1820 | -#define INT_TK 334 | |
1821 | -#define LONG_TK 335 | |
1822 | -#define CHAR_TK 336 | |
1823 | -#define INTEGRAL_TK 337 | |
1824 | -#define FLOAT_TK 338 | |
1825 | -#define DOUBLE_TK 339 | |
1826 | -#define FP_TK 340 | |
1827 | -#define ID_TK 341 | |
1828 | -#define REL_QM_TK 342 | |
1829 | -#define REL_CL_TK 343 | |
1830 | -#define NOT_TK 344 | |
1831 | -#define NEG_TK 345 | |
1832 | -#define ASSIGN_ANY_TK 346 | |
1833 | -#define ASSIGN_TK 347 | |
1834 | -#define OP_TK 348 | |
1835 | -#define CP_TK 349 | |
1836 | -#define OCB_TK 350 | |
1837 | -#define CCB_TK 351 | |
1838 | -#define OSB_TK 352 | |
1839 | -#define CSB_TK 353 | |
1840 | -#define SC_TK 354 | |
1841 | -#define C_TK 355 | |
1842 | -#define DOT_TK 356 | |
1843 | -#define STRING_LIT_TK 357 | |
1844 | -#define CHAR_LIT_TK 358 | |
1845 | -#define INT_LIT_TK 359 | |
1846 | -#define FP_LIT_TK 360 | |
1847 | -#define TRUE_TK 361 | |
1848 | -#define FALSE_TK 362 | |
1849 | -#define BOOL_LIT_TK 363 | |
1850 | -#define NULL_TK 364 | |
1851 | +#define PLUS_TK 257 | |
1852 | +#define MINUS_TK 258 | |
1853 | +#define MULT_TK 259 | |
1854 | +#define DIV_TK 260 | |
1855 | +#define REM_TK 261 | |
1856 | +#define LS_TK 262 | |
1857 | +#define SRS_TK 263 | |
1858 | +#define ZRS_TK 264 | |
1859 | +#define AND_TK 265 | |
1860 | +#define XOR_TK 266 | |
1861 | +#define OR_TK 267 | |
1862 | +#define BOOL_AND_TK 268 | |
1863 | +#define BOOL_OR_TK 269 | |
1864 | +#define EQ_TK 270 | |
1865 | +#define NEQ_TK 271 | |
1866 | +#define GT_TK 272 | |
1867 | +#define GTE_TK 273 | |
1868 | +#define LT_TK 274 | |
1869 | +#define LTE_TK 275 | |
1870 | +#define PLUS_ASSIGN_TK 276 | |
1871 | +#define MINUS_ASSIGN_TK 277 | |
1872 | +#define MULT_ASSIGN_TK 278 | |
1873 | +#define DIV_ASSIGN_TK 279 | |
1874 | +#define REM_ASSIGN_TK 280 | |
1875 | +#define LS_ASSIGN_TK 281 | |
1876 | +#define SRS_ASSIGN_TK 282 | |
1877 | +#define ZRS_ASSIGN_TK 283 | |
1878 | +#define AND_ASSIGN_TK 284 | |
1879 | +#define XOR_ASSIGN_TK 285 | |
1880 | +#define OR_ASSIGN_TK 286 | |
1881 | +#define PUBLIC_TK 287 | |
1882 | +#define PRIVATE_TK 288 | |
1883 | +#define PROTECTED_TK 289 | |
1884 | +#define STATIC_TK 290 | |
1885 | +#define FINAL_TK 291 | |
1886 | +#define SYNCHRONIZED_TK 292 | |
1887 | +#define VOLATILE_TK 293 | |
1888 | +#define TRANSIENT_TK 294 | |
1889 | +#define NATIVE_TK 295 | |
1890 | +#define PAD_TK 296 | |
1891 | +#define ABSTRACT_TK 297 | |
1892 | +#define MODIFIER_TK 298 | |
1893 | +#define DECR_TK 299 | |
1894 | +#define INCR_TK 300 | |
1895 | +#define DEFAULT_TK 301 | |
1896 | +#define IF_TK 302 | |
1897 | +#define THROW_TK 303 | |
1898 | +#define BOOLEAN_TK 304 | |
1899 | +#define DO_TK 305 | |
1900 | +#define IMPLEMENTS_TK 306 | |
1901 | +#define THROWS_TK 307 | |
1902 | +#define BREAK_TK 308 | |
1903 | +#define IMPORT_TK 309 | |
1904 | +#define ELSE_TK 310 | |
1905 | +#define INSTANCEOF_TK 311 | |
1906 | +#define RETURN_TK 312 | |
1907 | +#define VOID_TK 313 | |
1908 | +#define CATCH_TK 314 | |
1909 | +#define INTERFACE_TK 315 | |
1910 | +#define CASE_TK 316 | |
1911 | +#define EXTENDS_TK 317 | |
1912 | +#define FINALLY_TK 318 | |
1913 | +#define SUPER_TK 319 | |
1914 | +#define WHILE_TK 320 | |
1915 | +#define CLASS_TK 321 | |
1916 | +#define SWITCH_TK 322 | |
1917 | +#define CONST_TK 323 | |
1918 | +#define TRY_TK 324 | |
1919 | +#define FOR_TK 325 | |
1920 | +#define NEW_TK 326 | |
1921 | +#define CONTINUE_TK 327 | |
1922 | +#define GOTO_TK 328 | |
1923 | +#define PACKAGE_TK 329 | |
1924 | +#define THIS_TK 330 | |
1925 | +#define BYTE_TK 331 | |
1926 | +#define SHORT_TK 332 | |
1927 | +#define INT_TK 333 | |
1928 | +#define LONG_TK 334 | |
1929 | +#define CHAR_TK 335 | |
1930 | +#define INTEGRAL_TK 336 | |
1931 | +#define FLOAT_TK 337 | |
1932 | +#define DOUBLE_TK 338 | |
1933 | +#define FP_TK 339 | |
1934 | +#define ID_TK 340 | |
1935 | +#define REL_QM_TK 341 | |
1936 | +#define REL_CL_TK 342 | |
1937 | +#define NOT_TK 343 | |
1938 | +#define NEG_TK 344 | |
1939 | +#define ASSIGN_ANY_TK 345 | |
1940 | +#define ASSIGN_TK 346 | |
1941 | +#define OP_TK 347 | |
1942 | +#define CP_TK 348 | |
1943 | +#define OCB_TK 349 | |
1944 | +#define CCB_TK 350 | |
1945 | +#define OSB_TK 351 | |
1946 | +#define CSB_TK 352 | |
1947 | +#define SC_TK 353 | |
1948 | +#define C_TK 354 | |
1949 | +#define DOT_TK 355 | |
1950 | +#define STRING_LIT_TK 356 | |
1951 | +#define CHAR_LIT_TK 357 | |
1952 | +#define INT_LIT_TK 358 | |
1953 | +#define FP_LIT_TK 359 | |
1954 | +#define TRUE_TK 360 | |
1955 | +#define FALSE_TK 361 | |
1956 | +#define BOOL_LIT_TK 362 | |
1957 | +#define NULL_TK 363 | |
1958 | ||
1959 | #line 37 "./parse-scan.y" | |
1960 | ||
1961 | @@ -200,7 +199,7 @@ | |
1962 | #define YYFLAG -32768 | |
1963 | #define YYNTBASE 110 | |
1964 | ||
1965 | -#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 253) | |
1966 | +#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 253) | |
1967 | ||
1968 | static const char yytranslate[] = { 0, | |
1969 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1970 | @@ -228,18 +227,18 @@ | |
1971 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1972 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1973 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
1974 | - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, | |
1975 | - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | |
1976 | - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, | |
1977 | - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, | |
1978 | - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, | |
1979 | - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, | |
1980 | - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, | |
1981 | - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, | |
1982 | - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, | |
1983 | - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, | |
1984 | - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, | |
1985 | - 106, 107, 108, 109 | |
1986 | + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, | |
1987 | + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | |
1988 | + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, | |
1989 | + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, | |
1990 | + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, | |
1991 | + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, | |
1992 | + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, | |
1993 | + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, | |
1994 | + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, | |
1995 | + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, | |
1996 | + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, | |
1997 | + 107, 108, 109 | |
1998 | }; | |
1999 | ||
2000 | #if YYDEBUG != 0 | |
2001 | @@ -1375,7 +1374,8 @@ | |
2002 | #define YYPURE 1 | |
2003 | ||
2004 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | |
2005 | -#line 3 "/usr/cygnus/gnupro-98r2/share/bison.simple" | |
2006 | +#line 3 "/usr/lib/bison.simple" | |
2007 | +/* This file comes from bison-1.28. */ | |
2008 | ||
2009 | /* Skeleton output parser for bison, | |
2010 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | |
2011 | @@ -1392,46 +1392,66 @@ | |
2012 | ||
2013 | You should have received a copy of the GNU General Public License | |
2014 | along with this program; if not, write to the Free Software | |
2015 | - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
2016 | + Foundation, Inc., 59 Temple Place - Suite 330, | |
2017 | + Boston, MA 02111-1307, USA. */ | |
2018 | ||
2019 | /* As a special exception, when this file is copied by Bison into a | |
2020 | Bison output file, you may use that output file without restriction. | |
2021 | This special exception was added by the Free Software Foundation | |
2022 | in version 1.24 of Bison. */ | |
2023 | ||
2024 | -#ifndef alloca | |
2025 | +/* This is the parser code that is written into each bison parser | |
2026 | + when the %semantic_parser declaration is not specified in the grammar. | |
2027 | + It was written by Richard Stallman by simplifying the hairy parser | |
2028 | + used when %semantic_parser is specified. */ | |
2029 | + | |
2030 | +#ifndef YYSTACK_USE_ALLOCA | |
2031 | +#ifdef alloca | |
2032 | +#define YYSTACK_USE_ALLOCA | |
2033 | +#else /* alloca not defined */ | |
2034 | #ifdef __GNUC__ | |
2035 | +#define YYSTACK_USE_ALLOCA | |
2036 | #define alloca __builtin_alloca | |
2037 | #else /* not GNU C. */ | |
2038 | -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) | |
2039 | +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) | |
2040 | +#define YYSTACK_USE_ALLOCA | |
2041 | #include <alloca.h> | |
2042 | #else /* not sparc */ | |
2043 | -#if defined (MSDOS) && !defined (__TURBOC__) | |
2044 | +/* We think this test detects Watcom and Microsoft C. */ | |
2045 | +/* This used to test MSDOS, but that is a bad idea | |
2046 | + since that symbol is in the user namespace. */ | |
2047 | +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) | |
2048 | +#if 0 /* No need for malloc.h, which pollutes the namespace; | |
2049 | + instead, just don't use alloca. */ | |
2050 | #include <malloc.h> | |
2051 | +#endif | |
2052 | #else /* not MSDOS, or __TURBOC__ */ | |
2053 | #if defined(_AIX) | |
2054 | -#include <malloc.h> | |
2055 | +/* I don't know what this was needed for, but it pollutes the namespace. | |
2056 | + So I turned it off. rms, 2 May 1997. */ | |
2057 | +/* #include <malloc.h> */ | |
2058 | #pragma alloca | |
2059 | -#else /* not MSDOS, __TURBOC__, or _AIX */ | |
2060 | -#ifdef __hpux | |
2061 | -#ifdef __cplusplus | |
2062 | -extern "C" { | |
2063 | -void *alloca (unsigned int); | |
2064 | -}; | |
2065 | -#else /* not __cplusplus */ | |
2066 | -void *alloca (); | |
2067 | -#endif /* not __cplusplus */ | |
2068 | +#define YYSTACK_USE_ALLOCA | |
2069 | +#else /* not MSDOS, or __TURBOC__, or _AIX */ | |
2070 | +#if 0 | |
2071 | +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, | |
2072 | + and on HPUX 10. Eventually we can turn this on. */ | |
2073 | +#define YYSTACK_USE_ALLOCA | |
2074 | +#define alloca __builtin_alloca | |
2075 | #endif /* __hpux */ | |
2076 | +#endif | |
2077 | #endif /* not _AIX */ | |
2078 | #endif /* not MSDOS, or __TURBOC__ */ | |
2079 | -#endif /* not sparc. */ | |
2080 | -#endif /* not GNU C. */ | |
2081 | -#endif /* alloca not defined. */ | |
2082 | +#endif /* not sparc */ | |
2083 | +#endif /* not GNU C */ | |
2084 | +#endif /* alloca not defined */ | |
2085 | +#endif /* YYSTACK_USE_ALLOCA not defined */ | |
2086 | ||
2087 | -/* This is the parser code that is written into each bison parser | |
2088 | - when the %semantic_parser declaration is not specified in the grammar. | |
2089 | - It was written by Richard Stallman by simplifying the hairy parser | |
2090 | - used when %semantic_parser is specified. */ | |
2091 | +#ifdef YYSTACK_USE_ALLOCA | |
2092 | +#define YYSTACK_ALLOC alloca | |
2093 | +#else | |
2094 | +#define YYSTACK_ALLOC malloc | |
2095 | +#endif | |
2096 | ||
2097 | /* Note: there must be only one dollar sign in this file. | |
2098 | It is replaced by the list of actions, each action | |
2099 | @@ -1441,8 +1461,8 @@ | |
2100 | #define yyclearin (yychar = YYEMPTY) | |
2101 | #define YYEMPTY -2 | |
2102 | #define YYEOF 0 | |
2103 | -#define YYACCEPT return(0) | |
2104 | -#define YYABORT return(1) | |
2105 | +#define YYACCEPT goto yyacceptlab | |
2106 | +#define YYABORT goto yyabortlab | |
2107 | #define YYERROR goto yyerrlab1 | |
2108 | /* Like YYERROR except do call yyerror. | |
2109 | This remains here temporarily to ease the | |
2110 | @@ -1523,12 +1543,12 @@ | |
2111 | #ifndef YYMAXDEPTH | |
2112 | #define YYMAXDEPTH 10000 | |
2113 | #endif | |
2114 | - | |
2115 | -/* Prevent warning if -Wstrict-prototypes. */ | |
2116 | -#ifdef __GNUC__ | |
2117 | -int yyparse (void); | |
2118 | -#endif | |
2119 | \f | |
2120 | +/* Define __yy_memcpy. Note that the size argument | |
2121 | + should be passed with type unsigned int, because that is what the non-GCC | |
2122 | + definitions require. With GCC, __builtin_memcpy takes an arg | |
2123 | + of type size_t, but it can handle unsigned int. */ | |
2124 | + | |
2125 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ | |
2126 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) | |
2127 | #else /* not GNU C or C++ */ | |
2128 | @@ -1540,7 +1560,7 @@ | |
2129 | __yy_memcpy (to, from, count) | |
2130 | char *to; | |
2131 | char *from; | |
2132 | - int count; | |
2133 | + unsigned int count; | |
2134 | { | |
2135 | register char *f = from; | |
2136 | register char *t = to; | |
2137 | @@ -1555,10 +1575,10 @@ | |
2138 | /* This is the most reliable way to avoid incompatibilities | |
2139 | in available built-in functions on various systems. */ | |
2140 | static void | |
2141 | -__yy_memcpy (char *to, char *from, int count) | |
2142 | +__yy_memcpy (char *to, char *from, unsigned int count) | |
2143 | { | |
2144 | - register char *f = from; | |
2145 | register char *t = to; | |
2146 | + register char *f = from; | |
2147 | register int i = count; | |
2148 | ||
2149 | while (i-- > 0) | |
2150 | @@ -1568,7 +1588,7 @@ | |
2151 | #endif | |
2152 | #endif | |
2153 | \f | |
2154 | -#line 196 "/usr/cygnus/gnupro-98r2/share/bison.simple" | |
2155 | +#line 217 "/usr/lib/bison.simple" | |
2156 | ||
2157 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
2158 | into yyparse. The argument should have type void *. | |
2159 | @@ -1589,6 +1609,15 @@ | |
2160 | #define YYPARSE_PARAM_DECL | |
2161 | #endif /* not YYPARSE_PARAM */ | |
2162 | ||
2163 | +/* Prevent warning if -Wstrict-prototypes. */ | |
2164 | +#ifdef __GNUC__ | |
2165 | +#ifdef YYPARSE_PARAM | |
2166 | +int yyparse (void *); | |
2167 | +#else | |
2168 | +int yyparse (void); | |
2169 | +#endif | |
2170 | +#endif | |
2171 | + | |
2172 | int | |
2173 | yyparse(YYPARSE_PARAM_ARG) | |
2174 | YYPARSE_PARAM_DECL | |
2175 | @@ -1617,6 +1646,7 @@ | |
2176 | #endif | |
2177 | ||
2178 | int yystacksize = YYINITDEPTH; | |
2179 | + int yyfree_stacks = 0; | |
2180 | ||
2181 | #ifdef YYPURE | |
2182 | int yychar; | |
2183 | @@ -1701,18 +1731,32 @@ | |
2184 | if (yystacksize >= YYMAXDEPTH) | |
2185 | { | |
2186 | yyerror("parser stack overflow"); | |
2187 | + if (yyfree_stacks) | |
2188 | + { | |
2189 | + free (yyss); | |
2190 | + free (yyvs); | |
2191 | +#ifdef YYLSP_NEEDED | |
2192 | + free (yyls); | |
2193 | +#endif | |
2194 | + } | |
2195 | return 2; | |
2196 | } | |
2197 | yystacksize *= 2; | |
2198 | if (yystacksize > YYMAXDEPTH) | |
2199 | yystacksize = YYMAXDEPTH; | |
2200 | - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); | |
2201 | - __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); | |
2202 | - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); | |
2203 | - __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); | |
2204 | +#ifndef YYSTACK_USE_ALLOCA | |
2205 | + yyfree_stacks = 1; | |
2206 | +#endif | |
2207 | + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); | |
2208 | + __yy_memcpy ((char *)yyss, (char *)yyss1, | |
2209 | + size * (unsigned int) sizeof (*yyssp)); | |
2210 | + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); | |
2211 | + __yy_memcpy ((char *)yyvs, (char *)yyvs1, | |
2212 | + size * (unsigned int) sizeof (*yyvsp)); | |
2213 | #ifdef YYLSP_NEEDED | |
2214 | - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); | |
2215 | - __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); | |
2216 | + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); | |
2217 | + __yy_memcpy ((char *)yyls, (char *)yyls1, | |
2218 | + size * (unsigned int) sizeof (*yylsp)); | |
2219 | #endif | |
2220 | #endif /* no yyoverflow */ | |
2221 | ||
2222 | @@ -2156,7 +2200,7 @@ | |
2223 | break;} | |
2224 | } | |
2225 | /* the action file gets copied in in place of this dollarsign */ | |
2226 | -#line 498 "/usr/cygnus/gnupro-98r2/share/bison.simple" | |
2227 | +#line 543 "/usr/lib/bison.simple" | |
2228 | \f | |
2229 | yyvsp -= yylen; | |
2230 | yyssp -= yylen; | |
2231 | @@ -2351,6 +2395,30 @@ | |
2232 | ||
2233 | yystate = yyn; | |
2234 | goto yynewstate; | |
2235 | + | |
2236 | + yyacceptlab: | |
2237 | + /* YYACCEPT comes here. */ | |
2238 | + if (yyfree_stacks) | |
2239 | + { | |
2240 | + free (yyss); | |
2241 | + free (yyvs); | |
2242 | +#ifdef YYLSP_NEEDED | |
2243 | + free (yyls); | |
2244 | +#endif | |
2245 | + } | |
2246 | + return 0; | |
2247 | + | |
2248 | + yyabortlab: | |
2249 | + /* YYABORT comes here. */ | |
2250 | + if (yyfree_stacks) | |
2251 | + { | |
2252 | + free (yyss); | |
2253 | + free (yyvs); | |
2254 | +#ifdef YYLSP_NEEDED | |
2255 | + free (yyls); | |
2256 | +#endif | |
2257 | + } | |
2258 | + return 1; | |
2259 | } | |
2260 | #line 1105 "./parse-scan.y" | |
2261 | ||
2262 | @@ -2434,6 +2502,8 @@ | |
2263 | yyerror (msg) | |
2264 | char *msg ATTRIBUTE_UNUSED; | |
2265 | { | |
2266 | + fprintf (stderr, "%s: %d: %s\n", input_filename, lineno, msg); | |
2267 | + exit (1); | |
2268 | } | |
2269 | ||
2270 | char * | |
2271 | diff -u -r gcc-2.95.2-orig/gcc/java/parse-scan.y gcc-2.95.2/gcc/java/parse-scan.y | |
2272 | --- gcc-2.95.2-orig/gcc/java/parse-scan.y Tue May 4 04:59:16 1999 | |
2273 | +++ gcc-2.95.2/gcc/java/parse-scan.y Sun Oct 31 18:48:35 1999 | |
2274 | @@ -1183,6 +1183,8 @@ | |
2275 | yyerror (msg) | |
2276 | char *msg ATTRIBUTE_UNUSED; | |
2277 | { | |
2278 | + fprintf (stderr, "%s: %d: %s\n", input_filename, lineno, msg); | |
2279 | + exit (1); | |
2280 | } | |
2281 | ||
2282 | char * | |
2283 | Only in gcc-2.95.2/gcc/java: parse-scan.y.orig | |
2284 | diff -u -r gcc-2.95.2-orig/gcc/java/parse.c gcc-2.95.2/gcc/java/parse.c | |
2285 | --- gcc-2.95.2-orig/gcc/java/parse.c Mon Oct 25 21:02:09 1999 | |
2286 | +++ gcc-2.95.2/gcc/java/parse.c Sun Oct 31 21:39:17 1999 | |
2287 | @@ -1,7 +1,6 @@ | |
2288 | ||
2289 | /* A Bison parser, made from ./parse.y | |
2290 | - by GNU Bison version 1.27 | |
2291 | - */ | |
2292 | + by GNU Bison version 1.28 */ | |
2293 | ||
2294 | #define YYBISON 1 /* Identify Bison output. */ | |
2295 | ||
2296 | @@ -167,6 +166,7 @@ | |
2297 | static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...)) | |
2298 | ATTRIBUTE_PRINTF_2; | |
2299 | static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list)); | |
2300 | +static void parse_ctor_invocation_error PROTO ((void)); | |
2301 | static tree parse_jdk1_1_error PROTO ((char *)); | |
2302 | static void complete_class_report_errors PROTO ((jdep *)); | |
2303 | static int process_imports PROTO ((void)); | |
2304 | @@ -319,6 +319,7 @@ | |
2305 | static tree strip_out_static_field_access_decl PROTO ((tree)); | |
2306 | static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *)); | |
2307 | static void static_ref_err PROTO ((tree, tree, tree)); | |
2308 | +static tree java_refold PROTO ((tree)); | |
2309 | ||
2310 | /* Number of error found so far. */ | |
2311 | int java_error_count; | |
2312 | @@ -350,6 +351,10 @@ | |
2313 | binop_lookup [((VALUE) - PLUS_TK)% \ | |
2314 | (sizeof (binop_lookup) / sizeof (binop_lookup[0]))] | |
2315 | ||
2316 | +/* This is the end index for binary operators that can also be used | |
2317 | + in compound assignements. */ | |
2318 | +#define BINOP_COMPOUND_CANDIDATES 11 | |
2319 | + | |
2320 | /* Fake WFL used to report error message. It is initialized once if | |
2321 | needed and reused with it's location information is overriden. */ | |
2322 | tree wfl_operator = NULL_TREE; | |
2323 | @@ -376,7 +381,7 @@ | |
2324 | static tree current_static_block = NULL_TREE; | |
2325 | ||
2326 | ||
2327 | -#line 304 "./parse.y" | |
2328 | +#line 310 "./parse.y" | |
2329 | typedef union { | |
2330 | tree node; | |
2331 | int sub_token; | |
2332 | @@ -386,7 +391,7 @@ | |
2333 | } operator; | |
2334 | int value; | |
2335 | } YYSTYPE; | |
2336 | -#line 314 "./parse.y" | |
2337 | +#line 320 "./parse.y" | |
2338 | ||
2339 | #include "lex.c" | |
2340 | #ifndef YYDEBUG | |
2341 | @@ -684,57 +689,57 @@ | |
2342 | ||
2343 | #if YYDEBUG != 0 | |
2344 | static const short yyrline[] = { 0, | |
2345 | - 458, 464, 466, 467, 468, 469, 470, 474, 476, 479, | |
2346 | - 481, 482, 485, 487, 490, 494, 498, 502, 508, 510, | |
2347 | - 512, 514, 519, 521, 524, 528, 533, 538, 540, 541, | |
2348 | - 542, 543, 544, 545, 546, 549, 554, 560, 562, 565, | |
2349 | - 568, 570, 574, 576, 579, 606, 608, 612, 625, 627, | |
2350 | - 631, 638, 643, 645, 655, 660, 675, 679, 682, 685, | |
2351 | - 688, 690, 692, 697, 701, 703, 705, 707, 711, 713, | |
2352 | - 715, 722, 728, 733, 737, 746, 756, 758, 761, 763, | |
2353 | - 764, 765, 769, 771, 773, 774, 776, 781, 784, 794, | |
2354 | - 797, 799, 803, 806, 813, 819, 827, 829, 831, 833, | |
2355 | - 835, 839, 841, 845, 852, 853, 857, 860, 862, 864, | |
2356 | - 866, 868, 870, 872, 874, 881, 884, 886, 895, 897, | |
2357 | - 901, 906, 911, 915, 920, 925, 927, 934, 936, 938, | |
2358 | - 942, 945, 947, 951, 953, 954, 959, 965, 972, 980, | |
2359 | - 987, 990, 993, 997, 1000, 1004, 1013, 1015, 1017, 1021, | |
2360 | - 1023, 1026, 1033, 1041, 1043, 1047, 1054, 1064, 1068, 1071, | |
2361 | - 1074, 1077, 1080, 1083, 1086, 1089, 1091, 1095, 1101, 1106, | |
2362 | - 1108, 1112, 1115, 1119, 1121, 1124, 1126, 1127, 1129, 1133, | |
2363 | - 1137, 1143, 1148, 1151, 1153, 1157, 1163, 1167, 1172, 1181, | |
2364 | - 1185, 1190, 1202, 1204, 1207, 1209, 1211, 1215, 1219, 1222, | |
2365 | - 1226, 1228, 1229, 1230, 1231, 1232, 1236, 1238, 1239, 1240, | |
2366 | - 1241, 1245, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, | |
2367 | - 1255, 1256, 1259, 1264, 1275, 1278, 1282, 1289, 1299, 1305, | |
2368 | - 1311, 1317, 1319, 1325, 1327, 1333, 1335, 1337, 1339, 1341, | |
2369 | - 1345, 1347, 1348, 1349, 1350, 1351, 1352, 1355, 1361, 1363, | |
2370 | - 1365, 1369, 1374, 1379, 1385, 1395, 1401, 1403, 1405, 1412, | |
2371 | - 1415, 1417, 1419, 1423, 1425, 1428, 1432, 1434, 1437, 1444, | |
2372 | - 1450, 1452, 1454, 1458, 1466, 1469, 1471, 1473, 1477, 1482, | |
2373 | - 1491, 1496, 1499, 1506, 1508, 1510, 1514, 1517, 1526, 1533, | |
2374 | - 1535, 1539, 1552, 1554, 1560, 1566, 1570, 1572, 1576, 1579, | |
2375 | - 1581, 1585, 1588, 1590, 1592, 1596, 1599, 1601, 1603, 1607, | |
2376 | - 1610, 1612, 1614, 1618, 1624, 1626, 1630, 1637, 1639, 1641, | |
2377 | - 1643, 1647, 1655, 1658, 1660, 1665, 1669, 1671, 1678, 1686, | |
2378 | - 1703, 1705, 1707, 1711, 1714, 1719, 1721, 1724, 1726, 1728, | |
2379 | - 1730, 1731, 1732, 1733, 1737, 1739, 1741, 1746, 1748, 1750, | |
2380 | - 1752, 1754, 1758, 1761, 1766, 1768, 1773, 1774, 1775, 1776, | |
2381 | - 1777, 1779, 1781, 1783, 1785, 1787, 1791, 1793, 1796, 1802, | |
2382 | - 1807, 1811, 1814, 1816, 1818, 1822, 1824, 1826, 1828, 1832, | |
2383 | - 1835, 1839, 1845, 1847, 1855, 1882, 1884, 1888, 1893, 1900, | |
2384 | - 1904, 1907, 1909, 1920, 1931, 1936, 1945, 1947, 1951, 1954, | |
2385 | - 1956, 1961, 1966, 1971, 1978, 1980, 1981, 1982, 1985, 1990, | |
2386 | - 1995, 1997, 1998, 2000, 2002, 2003, 2005, 2009, 2012, 2016, | |
2387 | - 2019, 2023, 2025, 2027, 2029, 2030, 2032, 2036, 2045, 2047, | |
2388 | - 2049, 2062, 2064, 2070, 2072, 2074, 2078, 2080, 2085, 2090, | |
2389 | - 2095, 2097, 2099, 2103, 2105, 2110, 2115, 2117, 2121, 2123, | |
2390 | - 2128, 2133, 2138, 2140, 2142, 2146, 2148, 2153, 2158, 2163, | |
2391 | - 2168, 2170, 2172, 2174, 2176, 2178, 2182, 2184, 2189, 2194, | |
2392 | - 2196, 2200, 2202, 2207, 2211, 2213, 2218, 2222, 2224, 2229, | |
2393 | - 2233, 2235, 2240, 2244, 2246, 2251, 2255, 2257, 2262, 2268, | |
2394 | - 2270, 2274, 2276, 2279, 2282, 2290, 2292, 2293, 2296, 2298, | |
2395 | - 2301, 2305 | |
2396 | + 464, 470, 472, 473, 474, 475, 476, 480, 482, 485, | |
2397 | + 487, 488, 491, 493, 496, 500, 504, 508, 514, 516, | |
2398 | + 518, 520, 525, 527, 530, 534, 539, 544, 546, 547, | |
2399 | + 548, 549, 550, 551, 552, 555, 560, 566, 568, 571, | |
2400 | + 574, 576, 580, 582, 585, 612, 614, 618, 631, 633, | |
2401 | + 637, 644, 649, 651, 661, 666, 681, 685, 688, 691, | |
2402 | + 694, 696, 698, 703, 707, 709, 711, 713, 717, 719, | |
2403 | + 721, 728, 734, 739, 743, 752, 762, 764, 767, 769, | |
2404 | + 770, 771, 775, 777, 779, 780, 782, 787, 790, 800, | |
2405 | + 803, 805, 809, 812, 819, 825, 833, 835, 837, 839, | |
2406 | + 841, 845, 847, 851, 858, 859, 863, 866, 868, 870, | |
2407 | + 872, 874, 876, 878, 880, 887, 890, 892, 901, 903, | |
2408 | + 907, 912, 917, 921, 926, 931, 933, 940, 942, 944, | |
2409 | + 948, 951, 953, 957, 959, 960, 965, 971, 978, 986, | |
2410 | + 993, 996, 999, 1003, 1006, 1010, 1019, 1021, 1023, 1027, | |
2411 | + 1029, 1032, 1039, 1047, 1049, 1053, 1060, 1070, 1074, 1077, | |
2412 | + 1080, 1083, 1086, 1089, 1092, 1095, 1097, 1101, 1107, 1112, | |
2413 | + 1114, 1118, 1121, 1125, 1127, 1130, 1132, 1133, 1135, 1139, | |
2414 | + 1143, 1149, 1154, 1157, 1159, 1163, 1169, 1173, 1178, 1187, | |
2415 | + 1191, 1196, 1208, 1210, 1213, 1215, 1217, 1221, 1225, 1228, | |
2416 | + 1232, 1234, 1235, 1236, 1237, 1238, 1242, 1244, 1245, 1246, | |
2417 | + 1247, 1251, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, | |
2418 | + 1261, 1262, 1265, 1270, 1281, 1284, 1288, 1295, 1305, 1311, | |
2419 | + 1317, 1323, 1325, 1330, 1332, 1337, 1339, 1341, 1343, 1345, | |
2420 | + 1349, 1351, 1352, 1353, 1354, 1355, 1356, 1359, 1365, 1367, | |
2421 | + 1369, 1373, 1378, 1383, 1389, 1399, 1405, 1407, 1409, 1416, | |
2422 | + 1419, 1421, 1423, 1427, 1429, 1432, 1436, 1438, 1441, 1448, | |
2423 | + 1454, 1456, 1458, 1462, 1470, 1473, 1475, 1477, 1481, 1486, | |
2424 | + 1495, 1500, 1503, 1510, 1512, 1514, 1518, 1521, 1530, 1537, | |
2425 | + 1539, 1543, 1556, 1558, 1564, 1570, 1574, 1576, 1580, 1583, | |
2426 | + 1585, 1589, 1592, 1594, 1596, 1600, 1603, 1605, 1607, 1611, | |
2427 | + 1614, 1616, 1618, 1622, 1628, 1630, 1634, 1641, 1643, 1645, | |
2428 | + 1647, 1651, 1659, 1662, 1664, 1669, 1673, 1675, 1682, 1690, | |
2429 | + 1707, 1709, 1711, 1715, 1718, 1723, 1725, 1728, 1730, 1732, | |
2430 | + 1734, 1735, 1736, 1737, 1741, 1743, 1745, 1750, 1752, 1754, | |
2431 | + 1756, 1758, 1762, 1765, 1770, 1772, 1777, 1778, 1779, 1780, | |
2432 | + 1781, 1783, 1785, 1787, 1789, 1791, 1795, 1797, 1800, 1806, | |
2433 | + 1811, 1815, 1818, 1820, 1822, 1826, 1828, 1830, 1832, 1836, | |
2434 | + 1839, 1843, 1849, 1851, 1859, 1886, 1888, 1892, 1897, 1904, | |
2435 | + 1908, 1911, 1913, 1924, 1935, 1940, 1949, 1951, 1955, 1958, | |
2436 | + 1960, 1965, 1970, 1975, 1982, 1984, 1985, 1986, 1989, 1994, | |
2437 | + 1999, 2001, 2002, 2004, 2006, 2007, 2009, 2013, 2016, 2020, | |
2438 | + 2023, 2027, 2029, 2031, 2033, 2034, 2036, 2040, 2049, 2051, | |
2439 | + 2053, 2066, 2068, 2074, 2076, 2078, 2082, 2084, 2089, 2094, | |
2440 | + 2099, 2101, 2103, 2107, 2109, 2114, 2119, 2121, 2125, 2127, | |
2441 | + 2132, 2137, 2142, 2144, 2146, 2150, 2152, 2157, 2162, 2167, | |
2442 | + 2172, 2174, 2176, 2178, 2180, 2182, 2186, 2188, 2193, 2198, | |
2443 | + 2200, 2204, 2206, 2211, 2215, 2217, 2222, 2226, 2228, 2233, | |
2444 | + 2237, 2239, 2244, 2248, 2250, 2255, 2259, 2261, 2266, 2272, | |
2445 | + 2274, 2278, 2280, 2283, 2286, 2294, 2296, 2297, 2300, 2302, | |
2446 | + 2305, 2309 | |
2447 | }; | |
2448 | #endif | |
2449 | ||
2450 | @@ -2213,7 +2218,7 @@ | |
2451 | ||
2452 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | |
2453 | #line 3 "/usr/lib/bison.simple" | |
2454 | -/* This file comes from bison-1.27. */ | |
2455 | +/* This file comes from bison-1.28. */ | |
2456 | ||
2457 | /* Skeleton output parser for bison, | |
2458 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | |
2459 | @@ -2426,7 +2431,7 @@ | |
2460 | #endif | |
2461 | #endif | |
2462 | \f | |
2463 | -#line 216 "/usr/lib/bison.simple" | |
2464 | +#line 217 "/usr/lib/bison.simple" | |
2465 | ||
2466 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
2467 | into yyparse. The argument should have type void *. | |
2468 | @@ -2755,66 +2760,66 @@ | |
2469 | switch (yyn) { | |
2470 | ||
2471 | case 1: | |
2472 | -#line 460 "./parse.y" | |
2473 | +#line 466 "./parse.y" | |
2474 | {; | |
2475 | break;} | |
2476 | case 18: | |
2477 | -#line 504 "./parse.y" | |
2478 | +#line 510 "./parse.y" | |
2479 | { | |
2480 | yyval.node = build_java_array_type (yyvsp[-2].node, -1); | |
2481 | CLASS_LOADED_P (yyval.node) = 1; | |
2482 | ; | |
2483 | break;} | |
2484 | case 19: | |
2485 | -#line 509 "./parse.y" | |
2486 | +#line 515 "./parse.y" | |
2487 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; | |
2488 | break;} | |
2489 | case 20: | |
2490 | -#line 511 "./parse.y" | |
2491 | +#line 517 "./parse.y" | |
2492 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; | |
2493 | break;} | |
2494 | case 21: | |
2495 | -#line 513 "./parse.y" | |
2496 | +#line 519 "./parse.y" | |
2497 | {RULE ("']' expected"); RECOVER;; | |
2498 | break;} | |
2499 | case 22: | |
2500 | -#line 515 "./parse.y" | |
2501 | +#line 521 "./parse.y" | |
2502 | {RULE ("']' expected"); RECOVER;; | |
2503 | break;} | |
2504 | case 26: | |
2505 | -#line 530 "./parse.y" | |
2506 | +#line 536 "./parse.y" | |
2507 | { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ; | |
2508 | break;} | |
2509 | case 28: | |
2510 | -#line 539 "./parse.y" | |
2511 | +#line 545 "./parse.y" | |
2512 | {yyval.node = NULL;; | |
2513 | break;} | |
2514 | case 36: | |
2515 | -#line 551 "./parse.y" | |
2516 | +#line 557 "./parse.y" | |
2517 | { | |
2518 | yyval.node = NULL; | |
2519 | ; | |
2520 | break;} | |
2521 | case 37: | |
2522 | -#line 555 "./parse.y" | |
2523 | +#line 561 "./parse.y" | |
2524 | { | |
2525 | yyval.node = NULL; | |
2526 | ; | |
2527 | break;} | |
2528 | case 40: | |
2529 | -#line 567 "./parse.y" | |
2530 | +#line 573 "./parse.y" | |
2531 | { ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ; | |
2532 | break;} | |
2533 | case 41: | |
2534 | -#line 569 "./parse.y" | |
2535 | +#line 575 "./parse.y" | |
2536 | {yyerror ("Missing name"); RECOVER;; | |
2537 | break;} | |
2538 | case 42: | |
2539 | -#line 571 "./parse.y" | |
2540 | +#line 577 "./parse.y" | |
2541 | {yyerror ("';' expected"); RECOVER;; | |
2542 | break;} | |
2543 | case 45: | |
2544 | -#line 581 "./parse.y" | |
2545 | +#line 587 "./parse.y" | |
2546 | { | |
2547 | tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name; | |
2548 | int i = IDENTIFIER_LENGTH (name)-1; | |
2549 | @@ -2842,15 +2847,15 @@ | |
2550 | ; | |
2551 | break;} | |
2552 | case 46: | |
2553 | -#line 607 "./parse.y" | |
2554 | +#line 613 "./parse.y" | |
2555 | {yyerror ("Missing name"); RECOVER;; | |
2556 | break;} | |
2557 | case 47: | |
2558 | -#line 609 "./parse.y" | |
2559 | +#line 615 "./parse.y" | |
2560 | {yyerror ("';' expected"); RECOVER;; | |
2561 | break;} | |
2562 | case 48: | |
2563 | -#line 614 "./parse.y" | |
2564 | +#line 620 "./parse.y" | |
2565 | { | |
2566 | tree name = EXPR_WFL_NODE (yyvsp[-3].node); | |
2567 | /* Don't import java.lang.* twice. */ | |
2568 | @@ -2864,15 +2869,15 @@ | |
2569 | ; | |
2570 | break;} | |
2571 | case 49: | |
2572 | -#line 626 "./parse.y" | |
2573 | +#line 632 "./parse.y" | |
2574 | {yyerror ("'*' expected"); RECOVER;; | |
2575 | break;} | |
2576 | case 50: | |
2577 | -#line 628 "./parse.y" | |
2578 | +#line 634 "./parse.y" | |
2579 | {yyerror ("';' expected"); RECOVER;; | |
2580 | break;} | |
2581 | case 51: | |
2582 | -#line 633 "./parse.y" | |
2583 | +#line 639 "./parse.y" | |
2584 | { | |
2585 | maybe_generate_finit (); | |
2586 | maybe_generate_clinit (); | |
2587 | @@ -2880,31 +2885,31 @@ | |
2588 | ; | |
2589 | break;} | |
2590 | case 52: | |
2591 | -#line 639 "./parse.y" | |
2592 | +#line 645 "./parse.y" | |
2593 | { | |
2594 | maybe_generate_clinit (); | |
2595 | yyval.node = yyvsp[0].node; | |
2596 | ; | |
2597 | break;} | |
2598 | case 53: | |
2599 | -#line 644 "./parse.y" | |
2600 | +#line 650 "./parse.y" | |
2601 | { yyval.node = NULL; ; | |
2602 | break;} | |
2603 | case 54: | |
2604 | -#line 646 "./parse.y" | |
2605 | +#line 652 "./parse.y" | |
2606 | { | |
2607 | YYERROR_NOW; | |
2608 | yyerror ("Class or interface declaration expected"); | |
2609 | ; | |
2610 | break;} | |
2611 | case 55: | |
2612 | -#line 657 "./parse.y" | |
2613 | +#line 663 "./parse.y" | |
2614 | { | |
2615 | yyval.value = (1 << yyvsp[0].value); | |
2616 | ; | |
2617 | break;} | |
2618 | case 56: | |
2619 | -#line 661 "./parse.y" | |
2620 | +#line 667 "./parse.y" | |
2621 | { | |
2622 | int acc = (1 << yyvsp[0].value); | |
2623 | if (yyval.value & acc) | |
2624 | @@ -2918,95 +2923,95 @@ | |
2625 | ; | |
2626 | break;} | |
2627 | case 57: | |
2628 | -#line 677 "./parse.y" | |
2629 | +#line 683 "./parse.y" | |
2630 | { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; | |
2631 | break;} | |
2632 | case 58: | |
2633 | -#line 679 "./parse.y" | |
2634 | +#line 685 "./parse.y" | |
2635 | { | |
2636 | yyval.node = yyvsp[0].node; | |
2637 | ; | |
2638 | break;} | |
2639 | case 59: | |
2640 | -#line 683 "./parse.y" | |
2641 | +#line 689 "./parse.y" | |
2642 | { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; | |
2643 | break;} | |
2644 | case 60: | |
2645 | -#line 685 "./parse.y" | |
2646 | +#line 691 "./parse.y" | |
2647 | { | |
2648 | yyval.node = yyvsp[0].node; | |
2649 | ; | |
2650 | break;} | |
2651 | case 61: | |
2652 | -#line 689 "./parse.y" | |
2653 | +#line 695 "./parse.y" | |
2654 | {yyerror ("Missing class name"); RECOVER;; | |
2655 | break;} | |
2656 | case 62: | |
2657 | -#line 691 "./parse.y" | |
2658 | +#line 697 "./parse.y" | |
2659 | {yyerror ("Missing class name"); RECOVER;; | |
2660 | break;} | |
2661 | case 63: | |
2662 | -#line 693 "./parse.y" | |
2663 | +#line 699 "./parse.y" | |
2664 | { | |
2665 | if (!ctxp->class_err) yyerror ("'{' expected"); | |
2666 | DRECOVER(class1); | |
2667 | ; | |
2668 | break;} | |
2669 | case 64: | |
2670 | -#line 698 "./parse.y" | |
2671 | +#line 704 "./parse.y" | |
2672 | {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;; | |
2673 | break;} | |
2674 | case 65: | |
2675 | -#line 702 "./parse.y" | |
2676 | +#line 708 "./parse.y" | |
2677 | { yyval.node = NULL; ; | |
2678 | break;} | |
2679 | case 66: | |
2680 | -#line 704 "./parse.y" | |
2681 | +#line 710 "./parse.y" | |
2682 | { yyval.node = yyvsp[0].node; ; | |
2683 | break;} | |
2684 | case 67: | |
2685 | -#line 706 "./parse.y" | |
2686 | +#line 712 "./parse.y" | |
2687 | {yyerror ("'{' expected"); ctxp->class_err=1;; | |
2688 | break;} | |
2689 | case 68: | |
2690 | -#line 708 "./parse.y" | |
2691 | +#line 714 "./parse.y" | |
2692 | {yyerror ("Missing super class name"); ctxp->class_err=1;; | |
2693 | break;} | |
2694 | case 69: | |
2695 | -#line 712 "./parse.y" | |
2696 | +#line 718 "./parse.y" | |
2697 | { yyval.node = NULL_TREE; ; | |
2698 | break;} | |
2699 | case 70: | |
2700 | -#line 714 "./parse.y" | |
2701 | +#line 720 "./parse.y" | |
2702 | { yyval.node = yyvsp[0].node; ; | |
2703 | break;} | |
2704 | case 71: | |
2705 | -#line 716 "./parse.y" | |
2706 | +#line 722 "./parse.y" | |
2707 | { | |
2708 | ctxp->class_err=1; | |
2709 | yyerror ("Missing interface name"); | |
2710 | ; | |
2711 | break;} | |
2712 | case 72: | |
2713 | -#line 724 "./parse.y" | |
2714 | +#line 730 "./parse.y" | |
2715 | { | |
2716 | ctxp->interface_number = 1; | |
2717 | yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); | |
2718 | ; | |
2719 | break;} | |
2720 | case 73: | |
2721 | -#line 729 "./parse.y" | |
2722 | +#line 735 "./parse.y" | |
2723 | { | |
2724 | ctxp->interface_number++; | |
2725 | yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); | |
2726 | ; | |
2727 | break;} | |
2728 | case 74: | |
2729 | -#line 734 "./parse.y" | |
2730 | +#line 740 "./parse.y" | |
2731 | {yyerror ("Missing interface name"); RECOVER;; | |
2732 | break;} | |
2733 | case 75: | |
2734 | -#line 739 "./parse.y" | |
2735 | +#line 745 "./parse.y" | |
2736 | { | |
2737 | /* Store the location of the `}' when doing xrefs */ | |
2738 | if (flag_emit_xref) | |
2739 | @@ -3016,7 +3021,7 @@ | |
2740 | ; | |
2741 | break;} | |
2742 | case 76: | |
2743 | -#line 747 "./parse.y" | |
2744 | +#line 753 "./parse.y" | |
2745 | { | |
2746 | /* Store the location of the `}' when doing xrefs */ | |
2747 | if (flag_emit_xref) | |
2748 | @@ -3026,27 +3031,27 @@ | |
2749 | ; | |
2750 | break;} | |
2751 | case 82: | |
2752 | -#line 766 "./parse.y" | |
2753 | +#line 772 "./parse.y" | |
2754 | { yyval.node = parse_jdk1_1_error ("instance initializer"); ; | |
2755 | break;} | |
2756 | case 84: | |
2757 | -#line 772 "./parse.y" | |
2758 | +#line 778 "./parse.y" | |
2759 | { yyval.node = yyvsp[-1].node; ; | |
2760 | break;} | |
2761 | case 86: | |
2762 | -#line 775 "./parse.y" | |
2763 | +#line 781 "./parse.y" | |
2764 | { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ; | |
2765 | break;} | |
2766 | case 87: | |
2767 | -#line 777 "./parse.y" | |
2768 | +#line 783 "./parse.y" | |
2769 | { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; | |
2770 | break;} | |
2771 | case 88: | |
2772 | -#line 783 "./parse.y" | |
2773 | +#line 789 "./parse.y" | |
2774 | { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ; | |
2775 | break;} | |
2776 | case 89: | |
2777 | -#line 785 "./parse.y" | |
2778 | +#line 791 "./parse.y" | |
2779 | { | |
2780 | check_modifiers | |
2781 | ("Illegal modifier `%s' for field declaration", | |
2782 | @@ -3056,19 +3061,19 @@ | |
2783 | ; | |
2784 | break;} | |
2785 | case 91: | |
2786 | -#line 798 "./parse.y" | |
2787 | +#line 804 "./parse.y" | |
2788 | { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ; | |
2789 | break;} | |
2790 | case 92: | |
2791 | -#line 800 "./parse.y" | |
2792 | +#line 806 "./parse.y" | |
2793 | {yyerror ("Missing term"); RECOVER;; | |
2794 | break;} | |
2795 | case 93: | |
2796 | -#line 805 "./parse.y" | |
2797 | +#line 811 "./parse.y" | |
2798 | { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ; | |
2799 | break;} | |
2800 | case 94: | |
2801 | -#line 807 "./parse.y" | |
2802 | +#line 813 "./parse.y" | |
2803 | { | |
2804 | if (java_error_count) | |
2805 | yyvsp[0].node = NULL_TREE; | |
2806 | @@ -3077,7 +3082,7 @@ | |
2807 | ; | |
2808 | break;} | |
2809 | case 95: | |
2810 | -#line 814 "./parse.y" | |
2811 | +#line 820 "./parse.y" | |
2812 | { | |
2813 | yyerror ("Missing variable initializer"); | |
2814 | yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE); | |
2815 | @@ -3085,7 +3090,7 @@ | |
2816 | ; | |
2817 | break;} | |
2818 | case 96: | |
2819 | -#line 820 "./parse.y" | |
2820 | +#line 826 "./parse.y" | |
2821 | { | |
2822 | yyerror ("';' expected"); | |
2823 | yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE); | |
2824 | @@ -3093,85 +3098,85 @@ | |
2825 | ; | |
2826 | break;} | |
2827 | case 98: | |
2828 | -#line 830 "./parse.y" | |
2829 | +#line 836 "./parse.y" | |
2830 | { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ; | |
2831 | break;} | |
2832 | case 99: | |
2833 | -#line 832 "./parse.y" | |
2834 | +#line 838 "./parse.y" | |
2835 | {yyerror ("Invalid declaration"); DRECOVER(vdi);; | |
2836 | break;} | |
2837 | case 100: | |
2838 | -#line 834 "./parse.y" | |
2839 | +#line 840 "./parse.y" | |
2840 | {yyerror ("']' expected"); DRECOVER(vdi);; | |
2841 | break;} | |
2842 | case 101: | |
2843 | -#line 836 "./parse.y" | |
2844 | +#line 842 "./parse.y" | |
2845 | {yyerror ("Unbalanced ']'"); DRECOVER(vdi);; | |
2846 | break;} | |
2847 | case 104: | |
2848 | -#line 847 "./parse.y" | |
2849 | +#line 853 "./parse.y" | |
2850 | { | |
2851 | current_function_decl = yyvsp[0].node; | |
2852 | source_start_java_method (current_function_decl); | |
2853 | ; | |
2854 | break;} | |
2855 | case 105: | |
2856 | -#line 852 "./parse.y" | |
2857 | +#line 858 "./parse.y" | |
2858 | { finish_method_declaration (yyvsp[0].node); ; | |
2859 | break;} | |
2860 | case 106: | |
2861 | -#line 854 "./parse.y" | |
2862 | +#line 860 "./parse.y" | |
2863 | {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;; | |
2864 | break;} | |
2865 | case 107: | |
2866 | -#line 859 "./parse.y" | |
2867 | +#line 865 "./parse.y" | |
2868 | { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; | |
2869 | break;} | |
2870 | case 108: | |
2871 | -#line 861 "./parse.y" | |
2872 | +#line 867 "./parse.y" | |
2873 | { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ; | |
2874 | break;} | |
2875 | case 109: | |
2876 | -#line 863 "./parse.y" | |
2877 | +#line 869 "./parse.y" | |
2878 | { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ; | |
2879 | break;} | |
2880 | case 110: | |
2881 | -#line 865 "./parse.y" | |
2882 | +#line 871 "./parse.y" | |
2883 | { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ; | |
2884 | break;} | |
2885 | case 111: | |
2886 | -#line 867 "./parse.y" | |
2887 | +#line 873 "./parse.y" | |
2888 | {RECOVER;; | |
2889 | break;} | |
2890 | case 112: | |
2891 | -#line 869 "./parse.y" | |
2892 | +#line 875 "./parse.y" | |
2893 | {RECOVER;; | |
2894 | break;} | |
2895 | case 113: | |
2896 | -#line 871 "./parse.y" | |
2897 | +#line 877 "./parse.y" | |
2898 | {yyerror ("Identifier expected"); RECOVER;; | |
2899 | break;} | |
2900 | case 114: | |
2901 | -#line 873 "./parse.y" | |
2902 | +#line 879 "./parse.y" | |
2903 | {yyerror ("Identifier expected"); RECOVER;; | |
2904 | break;} | |
2905 | case 115: | |
2906 | -#line 875 "./parse.y" | |
2907 | +#line 881 "./parse.y" | |
2908 | { | |
2909 | yyerror ("Invalid method declaration, return type required"); | |
2910 | RECOVER; | |
2911 | ; | |
2912 | break;} | |
2913 | case 116: | |
2914 | -#line 883 "./parse.y" | |
2915 | +#line 889 "./parse.y" | |
2916 | { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; | |
2917 | break;} | |
2918 | case 117: | |
2919 | -#line 885 "./parse.y" | |
2920 | +#line 891 "./parse.y" | |
2921 | { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; | |
2922 | break;} | |
2923 | case 118: | |
2924 | -#line 887 "./parse.y" | |
2925 | +#line 893 "./parse.y" | |
2926 | { | |
2927 | EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location; | |
2928 | TREE_PURPOSE (yyvsp[-2].node) = | |
2929 | @@ -3182,150 +3187,150 @@ | |
2930 | ; | |
2931 | break;} | |
2932 | case 119: | |
2933 | -#line 896 "./parse.y" | |
2934 | +#line 902 "./parse.y" | |
2935 | {yyerror ("')' expected"); DRECOVER(method_declarator);; | |
2936 | break;} | |
2937 | case 120: | |
2938 | -#line 898 "./parse.y" | |
2939 | +#line 904 "./parse.y" | |
2940 | {yyerror ("']' expected"); RECOVER;; | |
2941 | break;} | |
2942 | case 121: | |
2943 | -#line 903 "./parse.y" | |
2944 | +#line 909 "./parse.y" | |
2945 | { | |
2946 | ctxp->formal_parameter_number = 1; | |
2947 | ; | |
2948 | break;} | |
2949 | case 122: | |
2950 | -#line 907 "./parse.y" | |
2951 | +#line 913 "./parse.y" | |
2952 | { | |
2953 | ctxp->formal_parameter_number += 1; | |
2954 | yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); | |
2955 | ; | |
2956 | break;} | |
2957 | case 123: | |
2958 | -#line 912 "./parse.y" | |
2959 | +#line 918 "./parse.y" | |
2960 | {yyerror ("Missing formal parameter term"); RECOVER;; | |
2961 | break;} | |
2962 | case 124: | |
2963 | -#line 917 "./parse.y" | |
2964 | +#line 923 "./parse.y" | |
2965 | { | |
2966 | yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node); | |
2967 | ; | |
2968 | break;} | |
2969 | case 125: | |
2970 | -#line 921 "./parse.y" | |
2971 | +#line 927 "./parse.y" | |
2972 | { | |
2973 | parse_jdk1_1_error ("final parameters"); | |
2974 | yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node); | |
2975 | ; | |
2976 | break;} | |
2977 | case 126: | |
2978 | -#line 926 "./parse.y" | |
2979 | +#line 932 "./parse.y" | |
2980 | {yyerror ("Missing identifier"); RECOVER;; | |
2981 | break;} | |
2982 | case 127: | |
2983 | -#line 928 "./parse.y" | |
2984 | +#line 934 "./parse.y" | |
2985 | { | |
2986 | SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value)); | |
2987 | yyerror ("Missing identifier"); RECOVER; | |
2988 | ; | |
2989 | break;} | |
2990 | case 128: | |
2991 | -#line 935 "./parse.y" | |
2992 | +#line 941 "./parse.y" | |
2993 | { yyval.node = NULL_TREE; ; | |
2994 | break;} | |
2995 | case 129: | |
2996 | -#line 937 "./parse.y" | |
2997 | +#line 943 "./parse.y" | |
2998 | { yyval.node = yyvsp[0].node; ; | |
2999 | break;} | |
3000 | case 130: | |
3001 | -#line 939 "./parse.y" | |
3002 | +#line 945 "./parse.y" | |
3003 | {yyerror ("Missing class type term"); RECOVER;; | |
3004 | break;} | |
3005 | case 131: | |
3006 | -#line 944 "./parse.y" | |
3007 | +#line 950 "./parse.y" | |
3008 | { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ; | |
3009 | break;} | |
3010 | case 132: | |
3011 | -#line 946 "./parse.y" | |
3012 | +#line 952 "./parse.y" | |
3013 | { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ; | |
3014 | break;} | |
3015 | case 133: | |
3016 | -#line 948 "./parse.y" | |
3017 | +#line 954 "./parse.y" | |
3018 | {yyerror ("Missing class type term"); RECOVER;; | |
3019 | break;} | |
3020 | case 136: | |
3021 | -#line 955 "./parse.y" | |
3022 | +#line 961 "./parse.y" | |
3023 | { yyval.node = NULL_TREE; ; | |
3024 | break;} | |
3025 | case 137: | |
3026 | -#line 961 "./parse.y" | |
3027 | +#line 967 "./parse.y" | |
3028 | { | |
3029 | TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized; | |
3030 | ctxp->static_initialized = yyvsp[0].node; | |
3031 | ; | |
3032 | break;} | |
3033 | case 138: | |
3034 | -#line 966 "./parse.y" | |
3035 | +#line 972 "./parse.y" | |
3036 | { | |
3037 | TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized; | |
3038 | ctxp->static_initialized = yyvsp[-1].node; | |
3039 | ; | |
3040 | break;} | |
3041 | case 139: | |
3042 | -#line 974 "./parse.y" | |
3043 | +#line 980 "./parse.y" | |
3044 | { | |
3045 | SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value)); | |
3046 | ; | |
3047 | break;} | |
3048 | case 140: | |
3049 | -#line 982 "./parse.y" | |
3050 | +#line 988 "./parse.y" | |
3051 | { | |
3052 | current_function_decl = yyvsp[0].node; | |
3053 | source_start_java_method (current_function_decl); | |
3054 | ; | |
3055 | break;} | |
3056 | case 141: | |
3057 | -#line 987 "./parse.y" | |
3058 | +#line 993 "./parse.y" | |
3059 | { finish_method_declaration (yyvsp[0].node); ; | |
3060 | break;} | |
3061 | case 142: | |
3062 | -#line 992 "./parse.y" | |
3063 | +#line 998 "./parse.y" | |
3064 | { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ; | |
3065 | break;} | |
3066 | case 143: | |
3067 | -#line 994 "./parse.y" | |
3068 | +#line 1000 "./parse.y" | |
3069 | { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ; | |
3070 | break;} | |
3071 | case 144: | |
3072 | -#line 999 "./parse.y" | |
3073 | +#line 1005 "./parse.y" | |
3074 | { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ; | |
3075 | break;} | |
3076 | case 145: | |
3077 | -#line 1001 "./parse.y" | |
3078 | +#line 1007 "./parse.y" | |
3079 | { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ; | |
3080 | break;} | |
3081 | case 146: | |
3082 | -#line 1009 "./parse.y" | |
3083 | +#line 1015 "./parse.y" | |
3084 | { | |
3085 | BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node; | |
3086 | yyval.node = yyvsp[0].node; | |
3087 | ; | |
3088 | break;} | |
3089 | case 147: | |
3090 | -#line 1014 "./parse.y" | |
3091 | +#line 1020 "./parse.y" | |
3092 | { yyval.node = yyvsp[0].node; ; | |
3093 | break;} | |
3094 | case 148: | |
3095 | -#line 1016 "./parse.y" | |
3096 | +#line 1022 "./parse.y" | |
3097 | { yyval.node = yyvsp[0].node; ; | |
3098 | break;} | |
3099 | case 149: | |
3100 | -#line 1018 "./parse.y" | |
3101 | +#line 1024 "./parse.y" | |
3102 | { yyval.node = yyvsp[0].node; ; | |
3103 | break;} | |
3104 | case 152: | |
3105 | -#line 1028 "./parse.y" | |
3106 | +#line 1034 "./parse.y" | |
3107 | { | |
3108 | yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE); | |
3109 | yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node); | |
3110 | @@ -3333,7 +3338,7 @@ | |
3111 | ; | |
3112 | break;} | |
3113 | case 153: | |
3114 | -#line 1034 "./parse.y" | |
3115 | +#line 1040 "./parse.y" | |
3116 | { | |
3117 | yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node); | |
3118 | yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node); | |
3119 | @@ -3341,15 +3346,15 @@ | |
3120 | ; | |
3121 | break;} | |
3122 | case 154: | |
3123 | -#line 1042 "./parse.y" | |
3124 | +#line 1048 "./parse.y" | |
3125 | {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; | |
3126 | break;} | |
3127 | case 155: | |
3128 | -#line 1044 "./parse.y" | |
3129 | +#line 1050 "./parse.y" | |
3130 | {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ; | |
3131 | break;} | |
3132 | case 156: | |
3133 | -#line 1049 "./parse.y" | |
3134 | +#line 1055 "./parse.y" | |
3135 | { | |
3136 | tree wfl = build_wfl_node (this_identifier_node); | |
3137 | EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; | |
3138 | @@ -3357,7 +3362,7 @@ | |
3139 | ; | |
3140 | break;} | |
3141 | case 157: | |
3142 | -#line 1055 "./parse.y" | |
3143 | +#line 1061 "./parse.y" | |
3144 | { | |
3145 | tree wfl = build_wfl_node (super_identifier_node); | |
3146 | EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location; | |
3147 | @@ -3365,133 +3370,133 @@ | |
3148 | ; | |
3149 | break;} | |
3150 | case 158: | |
3151 | -#line 1066 "./parse.y" | |
3152 | +#line 1072 "./parse.y" | |
3153 | { create_interface (0, yyvsp[0].node, NULL_TREE); ; | |
3154 | break;} | |
3155 | case 159: | |
3156 | -#line 1068 "./parse.y" | |
3157 | +#line 1074 "./parse.y" | |
3158 | { | |
3159 | yyval.node = yyvsp[0].node; | |
3160 | ; | |
3161 | break;} | |
3162 | case 160: | |
3163 | -#line 1072 "./parse.y" | |
3164 | +#line 1078 "./parse.y" | |
3165 | { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ; | |
3166 | break;} | |
3167 | case 161: | |
3168 | -#line 1074 "./parse.y" | |
3169 | +#line 1080 "./parse.y" | |
3170 | { | |
3171 | yyval.node = yyvsp[0].node; | |
3172 | ; | |
3173 | break;} | |
3174 | case 162: | |
3175 | -#line 1078 "./parse.y" | |
3176 | +#line 1084 "./parse.y" | |
3177 | { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ; | |
3178 | break;} | |
3179 | case 163: | |
3180 | -#line 1080 "./parse.y" | |
3181 | +#line 1086 "./parse.y" | |
3182 | { | |
3183 | yyval.node = yyvsp[0].node; | |
3184 | ; | |
3185 | break;} | |
3186 | case 164: | |
3187 | -#line 1084 "./parse.y" | |
3188 | +#line 1090 "./parse.y" | |
3189 | { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ; | |
3190 | break;} | |
3191 | case 165: | |
3192 | -#line 1086 "./parse.y" | |
3193 | +#line 1092 "./parse.y" | |
3194 | { | |
3195 | yyval.node = yyvsp[0].node; | |
3196 | ; | |
3197 | break;} | |
3198 | case 166: | |
3199 | -#line 1090 "./parse.y" | |
3200 | +#line 1096 "./parse.y" | |
3201 | {yyerror ("'{' expected"); RECOVER;; | |
3202 | break;} | |
3203 | case 167: | |
3204 | -#line 1092 "./parse.y" | |
3205 | +#line 1098 "./parse.y" | |
3206 | {yyerror ("'{' expected"); RECOVER;; | |
3207 | break;} | |
3208 | case 168: | |
3209 | -#line 1097 "./parse.y" | |
3210 | +#line 1103 "./parse.y" | |
3211 | { | |
3212 | ctxp->interface_number = 1; | |
3213 | yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); | |
3214 | ; | |
3215 | break;} | |
3216 | case 169: | |
3217 | -#line 1102 "./parse.y" | |
3218 | +#line 1108 "./parse.y" | |
3219 | { | |
3220 | ctxp->interface_number++; | |
3221 | yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE)); | |
3222 | ; | |
3223 | break;} | |
3224 | case 170: | |
3225 | -#line 1107 "./parse.y" | |
3226 | +#line 1113 "./parse.y" | |
3227 | {yyerror ("Invalid interface type"); RECOVER;; | |
3228 | break;} | |
3229 | case 171: | |
3230 | -#line 1109 "./parse.y" | |
3231 | +#line 1115 "./parse.y" | |
3232 | {yyerror ("Missing term"); RECOVER;; | |
3233 | break;} | |
3234 | case 172: | |
3235 | -#line 1114 "./parse.y" | |
3236 | +#line 1120 "./parse.y" | |
3237 | { yyval.node = NULL_TREE; ; | |
3238 | break;} | |
3239 | case 173: | |
3240 | -#line 1116 "./parse.y" | |
3241 | +#line 1122 "./parse.y" | |
3242 | { yyval.node = NULL_TREE; ; | |
3243 | break;} | |
3244 | case 178: | |
3245 | -#line 1128 "./parse.y" | |
3246 | +#line 1134 "./parse.y" | |
3247 | { yyval.node = parse_jdk1_1_error ("inner class declaration"); ; | |
3248 | break;} | |
3249 | case 179: | |
3250 | -#line 1130 "./parse.y" | |
3251 | +#line 1136 "./parse.y" | |
3252 | { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ; | |
3253 | break;} | |
3254 | case 181: | |
3255 | -#line 1139 "./parse.y" | |
3256 | +#line 1145 "./parse.y" | |
3257 | { | |
3258 | check_abstract_method_header (yyvsp[-1].node); | |
3259 | current_function_decl = NULL_TREE; /* FIXME ? */ | |
3260 | ; | |
3261 | break;} | |
3262 | case 182: | |
3263 | -#line 1144 "./parse.y" | |
3264 | +#line 1150 "./parse.y" | |
3265 | {yyerror ("';' expected"); RECOVER;; | |
3266 | break;} | |
3267 | case 183: | |
3268 | -#line 1150 "./parse.y" | |
3269 | +#line 1156 "./parse.y" | |
3270 | { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ; | |
3271 | break;} | |
3272 | case 184: | |
3273 | -#line 1152 "./parse.y" | |
3274 | +#line 1158 "./parse.y" | |
3275 | { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ; | |
3276 | break;} | |
3277 | case 185: | |
3278 | -#line 1154 "./parse.y" | |
3279 | +#line 1160 "./parse.y" | |
3280 | { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ; | |
3281 | break;} | |
3282 | case 186: | |
3283 | -#line 1159 "./parse.y" | |
3284 | +#line 1165 "./parse.y" | |
3285 | { | |
3286 | yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), | |
3287 | yyvsp[0].node, NULL_TREE); | |
3288 | ; | |
3289 | break;} | |
3290 | case 187: | |
3291 | -#line 1164 "./parse.y" | |
3292 | +#line 1170 "./parse.y" | |
3293 | { | |
3294 | yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node); | |
3295 | ; | |
3296 | break;} | |
3297 | case 188: | |
3298 | -#line 1168 "./parse.y" | |
3299 | +#line 1174 "./parse.y" | |
3300 | {yyerror ("Missing term"); RECOVER;; | |
3301 | break;} | |
3302 | case 189: | |
3303 | -#line 1174 "./parse.y" | |
3304 | +#line 1180 "./parse.y" | |
3305 | { | |
3306 | /* Store the location of the `}' when doing xrefs */ | |
3307 | if (current_function_decl && flag_emit_xref) | |
3308 | @@ -3501,15 +3506,15 @@ | |
3309 | ; | |
3310 | break;} | |
3311 | case 190: | |
3312 | -#line 1182 "./parse.y" | |
3313 | +#line 1188 "./parse.y" | |
3314 | { yyval.node = yyvsp[0].node; ; | |
3315 | break;} | |
3316 | case 191: | |
3317 | -#line 1187 "./parse.y" | |
3318 | +#line 1193 "./parse.y" | |
3319 | { enter_block (); ; | |
3320 | break;} | |
3321 | case 192: | |
3322 | -#line 1192 "./parse.y" | |
3323 | +#line 1198 "./parse.y" | |
3324 | { | |
3325 | maybe_absorb_scoping_blocks (); | |
3326 | /* Store the location of the `}' when doing xrefs */ | |
3327 | @@ -3520,35 +3525,35 @@ | |
3328 | ; | |
3329 | break;} | |
3330 | case 196: | |
3331 | -#line 1210 "./parse.y" | |
3332 | +#line 1216 "./parse.y" | |
3333 | { java_method_add_stmt (current_function_decl, yyvsp[0].node); ; | |
3334 | break;} | |
3335 | case 197: | |
3336 | -#line 1212 "./parse.y" | |
3337 | +#line 1218 "./parse.y" | |
3338 | { parse_jdk1_1_error ("inner class declaration"); ; | |
3339 | break;} | |
3340 | case 199: | |
3341 | -#line 1221 "./parse.y" | |
3342 | +#line 1227 "./parse.y" | |
3343 | { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ; | |
3344 | break;} | |
3345 | case 200: | |
3346 | -#line 1223 "./parse.y" | |
3347 | +#line 1229 "./parse.y" | |
3348 | { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ; | |
3349 | break;} | |
3350 | case 206: | |
3351 | -#line 1233 "./parse.y" | |
3352 | +#line 1239 "./parse.y" | |
3353 | { yyval.node = exit_block (); ; | |
3354 | break;} | |
3355 | case 211: | |
3356 | -#line 1242 "./parse.y" | |
3357 | +#line 1248 "./parse.y" | |
3358 | { yyval.node = exit_block (); ; | |
3359 | break;} | |
3360 | case 223: | |
3361 | -#line 1261 "./parse.y" | |
3362 | +#line 1267 "./parse.y" | |
3363 | { yyval.node = empty_stmt_node; ; | |
3364 | break;} | |
3365 | case 224: | |
3366 | -#line 1266 "./parse.y" | |
3367 | +#line 1272 "./parse.y" | |
3368 | { | |
3369 | yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node), | |
3370 | EXPR_WFL_NODE (yyvsp[-1].node)); | |
3371 | @@ -3558,19 +3563,19 @@ | |
3372 | ; | |
3373 | break;} | |
3374 | case 225: | |
3375 | -#line 1277 "./parse.y" | |
3376 | +#line 1283 "./parse.y" | |
3377 | { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ; | |
3378 | break;} | |
3379 | case 226: | |
3380 | -#line 1279 "./parse.y" | |
3381 | +#line 1285 "./parse.y" | |
3382 | {yyerror ("':' expected"); RECOVER;; | |
3383 | break;} | |
3384 | case 227: | |
3385 | -#line 1284 "./parse.y" | |
3386 | +#line 1290 "./parse.y" | |
3387 | { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ; | |
3388 | break;} | |
3389 | case 228: | |
3390 | -#line 1291 "./parse.y" | |
3391 | +#line 1297 "./parse.y" | |
3392 | { | |
3393 | /* We have a statement. Generate a WFL around it so | |
3394 | we can debug it */ | |
3395 | @@ -3581,7 +3586,7 @@ | |
3396 | ; | |
3397 | break;} | |
3398 | case 229: | |
3399 | -#line 1300 "./parse.y" | |
3400 | +#line 1306 "./parse.y" | |
3401 | { | |
3402 | if (ctxp->prevent_ese != lineno) | |
3403 | yyerror ("Invalid expression statement"); | |
3404 | @@ -3589,7 +3594,7 @@ | |
3405 | ; | |
3406 | break;} | |
3407 | case 230: | |
3408 | -#line 1306 "./parse.y" | |
3409 | +#line 1312 "./parse.y" | |
3410 | { | |
3411 | if (ctxp->prevent_ese != lineno) | |
3412 | yyerror ("Invalid expression statement"); | |
3413 | @@ -3597,7 +3602,7 @@ | |
3414 | ; | |
3415 | break;} | |
3416 | case 231: | |
3417 | -#line 1312 "./parse.y" | |
3418 | +#line 1318 "./parse.y" | |
3419 | { | |
3420 | if (ctxp->prevent_ese != lineno) | |
3421 | yyerror ("Invalid expression statement"); | |
3422 | @@ -3605,84 +3610,82 @@ | |
3423 | ; | |
3424 | break;} | |
3425 | case 232: | |
3426 | -#line 1318 "./parse.y" | |
3427 | +#line 1324 "./parse.y" | |
3428 | {yyerror ("')' expected"); RECOVER;; | |
3429 | break;} | |
3430 | case 233: | |
3431 | -#line 1320 "./parse.y" | |
3432 | +#line 1326 "./parse.y" | |
3433 | { | |
3434 | - yyerror ("Constructor invocation must be first " | |
3435 | - "thing in a constructor"); | |
3436 | + parse_ctor_invocation_error (); | |
3437 | RECOVER; | |
3438 | ; | |
3439 | break;} | |
3440 | case 234: | |
3441 | -#line 1326 "./parse.y" | |
3442 | +#line 1331 "./parse.y" | |
3443 | {yyerror ("')' expected"); RECOVER;; | |
3444 | break;} | |
3445 | case 235: | |
3446 | -#line 1328 "./parse.y" | |
3447 | +#line 1333 "./parse.y" | |
3448 | { | |
3449 | - yyerror ("Constructor invocation must be first " | |
3450 | - "thing in a constructor"); | |
3451 | + parse_ctor_invocation_error (); | |
3452 | RECOVER; | |
3453 | ; | |
3454 | break;} | |
3455 | case 236: | |
3456 | -#line 1334 "./parse.y" | |
3457 | +#line 1338 "./parse.y" | |
3458 | {yyerror ("'(' expected"); RECOVER;; | |
3459 | break;} | |
3460 | case 237: | |
3461 | -#line 1336 "./parse.y" | |
3462 | +#line 1340 "./parse.y" | |
3463 | {yyerror ("')' expected"); RECOVER;; | |
3464 | break;} | |
3465 | case 238: | |
3466 | -#line 1338 "./parse.y" | |
3467 | +#line 1342 "./parse.y" | |
3468 | {yyerror ("')' expected"); RECOVER;; | |
3469 | break;} | |
3470 | case 239: | |
3471 | -#line 1340 "./parse.y" | |
3472 | +#line 1344 "./parse.y" | |
3473 | {yyerror ("';' expected"); RECOVER;; | |
3474 | break;} | |
3475 | case 240: | |
3476 | -#line 1342 "./parse.y" | |
3477 | +#line 1346 "./parse.y" | |
3478 | {yyerror ("';' expected"); RECOVER;; | |
3479 | break;} | |
3480 | case 248: | |
3481 | -#line 1357 "./parse.y" | |
3482 | +#line 1361 "./parse.y" | |
3483 | { | |
3484 | yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node, | |
3485 | yyvsp[0].node, NULL_TREE); | |
3486 | ; | |
3487 | break;} | |
3488 | case 249: | |
3489 | -#line 1362 "./parse.y" | |
3490 | +#line 1366 "./parse.y" | |
3491 | {yyerror ("'(' expected"); RECOVER;; | |
3492 | break;} | |
3493 | case 250: | |
3494 | -#line 1364 "./parse.y" | |
3495 | +#line 1368 "./parse.y" | |
3496 | {yyerror ("Missing term"); RECOVER;; | |
3497 | break;} | |
3498 | case 251: | |
3499 | -#line 1366 "./parse.y" | |
3500 | +#line 1370 "./parse.y" | |
3501 | {yyerror ("')' expected"); RECOVER;; | |
3502 | break;} | |
3503 | case 252: | |
3504 | -#line 1371 "./parse.y" | |
3505 | +#line 1375 "./parse.y" | |
3506 | { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; | |
3507 | break;} | |
3508 | case 253: | |
3509 | -#line 1376 "./parse.y" | |
3510 | +#line 1380 "./parse.y" | |
3511 | { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; | |
3512 | break;} | |
3513 | case 254: | |
3514 | -#line 1381 "./parse.y" | |
3515 | +#line 1385 "./parse.y" | |
3516 | { | |
3517 | enter_block (); | |
3518 | ; | |
3519 | break;} | |
3520 | case 255: | |
3521 | -#line 1385 "./parse.y" | |
3522 | +#line 1389 "./parse.y" | |
3523 | { | |
3524 | /* Make into "proper list" of COMPOUND_EXPRs. | |
3525 | I.e. make the last statment also have its own | |
3526 | @@ -3693,42 +3696,42 @@ | |
3527 | ; | |
3528 | break;} | |
3529 | case 256: | |
3530 | -#line 1397 "./parse.y" | |
3531 | +#line 1401 "./parse.y" | |
3532 | { | |
3533 | yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE); | |
3534 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; | |
3535 | ; | |
3536 | break;} | |
3537 | case 257: | |
3538 | -#line 1402 "./parse.y" | |
3539 | +#line 1406 "./parse.y" | |
3540 | {yyerror ("'(' expected"); RECOVER;; | |
3541 | break;} | |
3542 | case 258: | |
3543 | -#line 1404 "./parse.y" | |
3544 | +#line 1408 "./parse.y" | |
3545 | {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);; | |
3546 | break;} | |
3547 | case 259: | |
3548 | -#line 1406 "./parse.y" | |
3549 | +#line 1410 "./parse.y" | |
3550 | {yyerror ("'{' expected"); RECOVER;; | |
3551 | break;} | |
3552 | case 260: | |
3553 | -#line 1414 "./parse.y" | |
3554 | +#line 1418 "./parse.y" | |
3555 | { yyval.node = NULL_TREE; ; | |
3556 | break;} | |
3557 | case 261: | |
3558 | -#line 1416 "./parse.y" | |
3559 | +#line 1420 "./parse.y" | |
3560 | { yyval.node = NULL_TREE; ; | |
3561 | break;} | |
3562 | case 262: | |
3563 | -#line 1418 "./parse.y" | |
3564 | +#line 1422 "./parse.y" | |
3565 | { yyval.node = NULL_TREE; ; | |
3566 | break;} | |
3567 | case 263: | |
3568 | -#line 1420 "./parse.y" | |
3569 | +#line 1424 "./parse.y" | |
3570 | { yyval.node = NULL_TREE; ; | |
3571 | break;} | |
3572 | case 269: | |
3573 | -#line 1439 "./parse.y" | |
3574 | +#line 1443 "./parse.y" | |
3575 | { | |
3576 | tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node); | |
3577 | EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location; | |
3578 | @@ -3736,7 +3739,7 @@ | |
3579 | ; | |
3580 | break;} | |
3581 | case 270: | |
3582 | -#line 1445 "./parse.y" | |
3583 | +#line 1449 "./parse.y" | |
3584 | { | |
3585 | tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE); | |
3586 | EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location; | |
3587 | @@ -3744,61 +3747,61 @@ | |
3588 | ; | |
3589 | break;} | |
3590 | case 271: | |
3591 | -#line 1451 "./parse.y" | |
3592 | +#line 1455 "./parse.y" | |
3593 | {yyerror ("Missing or invalid constant expression"); RECOVER;; | |
3594 | break;} | |
3595 | case 272: | |
3596 | -#line 1453 "./parse.y" | |
3597 | +#line 1457 "./parse.y" | |
3598 | {yyerror ("':' expected"); RECOVER;; | |
3599 | break;} | |
3600 | case 273: | |
3601 | -#line 1455 "./parse.y" | |
3602 | +#line 1459 "./parse.y" | |
3603 | {yyerror ("':' expected"); RECOVER;; | |
3604 | break;} | |
3605 | case 274: | |
3606 | -#line 1460 "./parse.y" | |
3607 | +#line 1464 "./parse.y" | |
3608 | { | |
3609 | tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0); | |
3610 | yyval.node = build_new_loop (body); | |
3611 | ; | |
3612 | break;} | |
3613 | case 275: | |
3614 | -#line 1468 "./parse.y" | |
3615 | +#line 1472 "./parse.y" | |
3616 | { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; | |
3617 | break;} | |
3618 | case 276: | |
3619 | -#line 1470 "./parse.y" | |
3620 | +#line 1474 "./parse.y" | |
3621 | {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;; | |
3622 | break;} | |
3623 | case 277: | |
3624 | -#line 1472 "./parse.y" | |
3625 | +#line 1476 "./parse.y" | |
3626 | {yyerror ("Missing term and ')' expected"); RECOVER;; | |
3627 | break;} | |
3628 | case 278: | |
3629 | -#line 1474 "./parse.y" | |
3630 | +#line 1478 "./parse.y" | |
3631 | {yyerror ("')' expected"); RECOVER;; | |
3632 | break;} | |
3633 | case 279: | |
3634 | -#line 1479 "./parse.y" | |
3635 | +#line 1483 "./parse.y" | |
3636 | { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ; | |
3637 | break;} | |
3638 | case 280: | |
3639 | -#line 1484 "./parse.y" | |
3640 | +#line 1488 "./parse.y" | |
3641 | { | |
3642 | tree body = build_loop_body (0, NULL_TREE, 1); | |
3643 | yyval.node = build_new_loop (body); | |
3644 | ; | |
3645 | break;} | |
3646 | case 281: | |
3647 | -#line 1493 "./parse.y" | |
3648 | +#line 1497 "./parse.y" | |
3649 | { yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ; | |
3650 | break;} | |
3651 | case 282: | |
3652 | -#line 1498 "./parse.y" | |
3653 | +#line 1502 "./parse.y" | |
3654 | { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ; | |
3655 | break;} | |
3656 | case 283: | |
3657 | -#line 1500 "./parse.y" | |
3658 | +#line 1504 "./parse.y" | |
3659 | { | |
3660 | yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); | |
3661 | /* We have not condition, so we get rid of the EXIT_EXPR */ | |
3662 | @@ -3807,23 +3810,23 @@ | |
3663 | ; | |
3664 | break;} | |
3665 | case 284: | |
3666 | -#line 1507 "./parse.y" | |
3667 | +#line 1511 "./parse.y" | |
3668 | {yyerror ("Invalid control expression"); RECOVER;; | |
3669 | break;} | |
3670 | case 285: | |
3671 | -#line 1509 "./parse.y" | |
3672 | +#line 1513 "./parse.y" | |
3673 | {yyerror ("Invalid update expression"); RECOVER;; | |
3674 | break;} | |
3675 | case 286: | |
3676 | -#line 1511 "./parse.y" | |
3677 | +#line 1515 "./parse.y" | |
3678 | {yyerror ("Invalid update expression"); RECOVER;; | |
3679 | break;} | |
3680 | case 287: | |
3681 | -#line 1516 "./parse.y" | |
3682 | +#line 1520 "./parse.y" | |
3683 | { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);; | |
3684 | break;} | |
3685 | case 288: | |
3686 | -#line 1518 "./parse.y" | |
3687 | +#line 1522 "./parse.y" | |
3688 | { | |
3689 | yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); | |
3690 | /* We have not condition, so we get rid of the EXIT_EXPR */ | |
3691 | @@ -3832,7 +3835,7 @@ | |
3692 | ; | |
3693 | break;} | |
3694 | case 289: | |
3695 | -#line 1528 "./parse.y" | |
3696 | +#line 1532 "./parse.y" | |
3697 | { | |
3698 | /* This scope defined for local variable that may be | |
3699 | defined within the scope of the for loop */ | |
3700 | @@ -3840,15 +3843,15 @@ | |
3701 | ; | |
3702 | break;} | |
3703 | case 290: | |
3704 | -#line 1534 "./parse.y" | |
3705 | +#line 1538 "./parse.y" | |
3706 | {yyerror ("'(' expected"); DRECOVER(for_1);; | |
3707 | break;} | |
3708 | case 291: | |
3709 | -#line 1536 "./parse.y" | |
3710 | +#line 1540 "./parse.y" | |
3711 | {yyerror ("Invalid init statement"); RECOVER;; | |
3712 | break;} | |
3713 | case 292: | |
3714 | -#line 1541 "./parse.y" | |
3715 | +#line 1545 "./parse.y" | |
3716 | { | |
3717 | /* We now declare the loop body. The loop is | |
3718 | declared as a for loop. */ | |
3719 | @@ -3861,11 +3864,11 @@ | |
3720 | ; | |
3721 | break;} | |
3722 | case 293: | |
3723 | -#line 1553 "./parse.y" | |
3724 | +#line 1557 "./parse.y" | |
3725 | { yyval.node = empty_stmt_node; ; | |
3726 | break;} | |
3727 | case 294: | |
3728 | -#line 1555 "./parse.y" | |
3729 | +#line 1559 "./parse.y" | |
3730 | { | |
3731 | /* Init statement recorded within the previously | |
3732 | defined block scope */ | |
3733 | @@ -3873,7 +3876,7 @@ | |
3734 | ; | |
3735 | break;} | |
3736 | case 295: | |
3737 | -#line 1561 "./parse.y" | |
3738 | +#line 1565 "./parse.y" | |
3739 | { | |
3740 | /* Local variable are recorded within the previously | |
3741 | defined block scope */ | |
3742 | @@ -3881,94 +3884,94 @@ | |
3743 | ; | |
3744 | break;} | |
3745 | case 296: | |
3746 | -#line 1567 "./parse.y" | |
3747 | +#line 1571 "./parse.y" | |
3748 | {yyerror ("';' expected"); DRECOVER(for_init_1);; | |
3749 | break;} | |
3750 | case 297: | |
3751 | -#line 1571 "./parse.y" | |
3752 | +#line 1575 "./parse.y" | |
3753 | {yyval.node = empty_stmt_node;; | |
3754 | break;} | |
3755 | case 298: | |
3756 | -#line 1573 "./parse.y" | |
3757 | +#line 1577 "./parse.y" | |
3758 | { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ; | |
3759 | break;} | |
3760 | case 299: | |
3761 | -#line 1578 "./parse.y" | |
3762 | +#line 1582 "./parse.y" | |
3763 | { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ; | |
3764 | break;} | |
3765 | case 300: | |
3766 | -#line 1580 "./parse.y" | |
3767 | +#line 1584 "./parse.y" | |
3768 | { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ; | |
3769 | break;} | |
3770 | case 301: | |
3771 | -#line 1582 "./parse.y" | |
3772 | +#line 1586 "./parse.y" | |
3773 | {yyerror ("Missing term"); RECOVER;; | |
3774 | break;} | |
3775 | case 302: | |
3776 | -#line 1587 "./parse.y" | |
3777 | +#line 1591 "./parse.y" | |
3778 | { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ; | |
3779 | break;} | |
3780 | case 303: | |
3781 | -#line 1589 "./parse.y" | |
3782 | +#line 1593 "./parse.y" | |
3783 | { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ; | |
3784 | break;} | |
3785 | case 304: | |
3786 | -#line 1591 "./parse.y" | |
3787 | +#line 1595 "./parse.y" | |
3788 | {yyerror ("Missing term"); RECOVER;; | |
3789 | break;} | |
3790 | case 305: | |
3791 | -#line 1593 "./parse.y" | |
3792 | +#line 1597 "./parse.y" | |
3793 | {yyerror ("';' expected"); RECOVER;; | |
3794 | break;} | |
3795 | case 306: | |
3796 | -#line 1598 "./parse.y" | |
3797 | +#line 1602 "./parse.y" | |
3798 | { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ; | |
3799 | break;} | |
3800 | case 307: | |
3801 | -#line 1600 "./parse.y" | |
3802 | +#line 1604 "./parse.y" | |
3803 | { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ; | |
3804 | break;} | |
3805 | case 308: | |
3806 | -#line 1602 "./parse.y" | |
3807 | +#line 1606 "./parse.y" | |
3808 | {yyerror ("Missing term"); RECOVER;; | |
3809 | break;} | |
3810 | case 309: | |
3811 | -#line 1604 "./parse.y" | |
3812 | +#line 1608 "./parse.y" | |
3813 | {yyerror ("';' expected"); RECOVER;; | |
3814 | break;} | |
3815 | case 310: | |
3816 | -#line 1609 "./parse.y" | |
3817 | +#line 1613 "./parse.y" | |
3818 | { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ; | |
3819 | break;} | |
3820 | case 311: | |
3821 | -#line 1611 "./parse.y" | |
3822 | +#line 1615 "./parse.y" | |
3823 | { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ; | |
3824 | break;} | |
3825 | case 312: | |
3826 | -#line 1613 "./parse.y" | |
3827 | +#line 1617 "./parse.y" | |
3828 | {yyerror ("Missing term"); RECOVER;; | |
3829 | break;} | |
3830 | case 313: | |
3831 | -#line 1615 "./parse.y" | |
3832 | +#line 1619 "./parse.y" | |
3833 | {yyerror ("';' expected"); RECOVER;; | |
3834 | break;} | |
3835 | case 314: | |
3836 | -#line 1620 "./parse.y" | |
3837 | +#line 1624 "./parse.y" | |
3838 | { | |
3839 | yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node); | |
3840 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location; | |
3841 | ; | |
3842 | break;} | |
3843 | case 315: | |
3844 | -#line 1625 "./parse.y" | |
3845 | +#line 1629 "./parse.y" | |
3846 | {yyerror ("Missing term"); RECOVER;; | |
3847 | break;} | |
3848 | case 316: | |
3849 | -#line 1627 "./parse.y" | |
3850 | +#line 1631 "./parse.y" | |
3851 | {yyerror ("';' expected"); RECOVER;; | |
3852 | break;} | |
3853 | case 317: | |
3854 | -#line 1632 "./parse.y" | |
3855 | +#line 1636 "./parse.y" | |
3856 | { | |
3857 | yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node); | |
3858 | EXPR_WFL_LINECOL (yyval.node) = | |
3859 | @@ -3976,56 +3979,56 @@ | |
3860 | ; | |
3861 | break;} | |
3862 | case 318: | |
3863 | -#line 1638 "./parse.y" | |
3864 | +#line 1642 "./parse.y" | |
3865 | {yyerror ("'{' expected"); RECOVER;; | |
3866 | break;} | |
3867 | case 319: | |
3868 | -#line 1640 "./parse.y" | |
3869 | +#line 1644 "./parse.y" | |
3870 | {yyerror ("'(' expected"); RECOVER;; | |
3871 | break;} | |
3872 | case 320: | |
3873 | -#line 1642 "./parse.y" | |
3874 | +#line 1646 "./parse.y" | |
3875 | {yyerror ("Missing term"); RECOVER;; | |
3876 | break;} | |
3877 | case 321: | |
3878 | -#line 1644 "./parse.y" | |
3879 | +#line 1648 "./parse.y" | |
3880 | {yyerror ("Missing term"); RECOVER;; | |
3881 | break;} | |
3882 | case 322: | |
3883 | -#line 1649 "./parse.y" | |
3884 | +#line 1653 "./parse.y" | |
3885 | { | |
3886 | if ((1 << yyvsp[0].value) != ACC_SYNCHRONIZED) | |
3887 | fatal ("synchronized was '%d' - yyparse", (1 << yyvsp[0].value)); | |
3888 | ; | |
3889 | break;} | |
3890 | case 323: | |
3891 | -#line 1657 "./parse.y" | |
3892 | +#line 1661 "./parse.y" | |
3893 | { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ; | |
3894 | break;} | |
3895 | case 324: | |
3896 | -#line 1659 "./parse.y" | |
3897 | +#line 1663 "./parse.y" | |
3898 | { yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ; | |
3899 | break;} | |
3900 | case 325: | |
3901 | -#line 1661 "./parse.y" | |
3902 | +#line 1665 "./parse.y" | |
3903 | { yyval.node = build_try_finally_statement | |
3904 | (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location, | |
3905 | yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node); | |
3906 | ; | |
3907 | break;} | |
3908 | case 326: | |
3909 | -#line 1666 "./parse.y" | |
3910 | +#line 1670 "./parse.y" | |
3911 | {yyerror ("'{' expected"); DRECOVER (try_statement);; | |
3912 | break;} | |
3913 | case 328: | |
3914 | -#line 1672 "./parse.y" | |
3915 | +#line 1676 "./parse.y" | |
3916 | { | |
3917 | TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node; | |
3918 | yyval.node = yyvsp[0].node; | |
3919 | ; | |
3920 | break;} | |
3921 | case 329: | |
3922 | -#line 1680 "./parse.y" | |
3923 | +#line 1684 "./parse.y" | |
3924 | { | |
3925 | java_method_add_stmt (current_function_decl, yyvsp[0].node); | |
3926 | exit_block (); | |
3927 | @@ -4033,7 +4036,7 @@ | |
3928 | ; | |
3929 | break;} | |
3930 | case 330: | |
3931 | -#line 1688 "./parse.y" | |
3932 | +#line 1692 "./parse.y" | |
3933 | { | |
3934 | /* We add a block to define a scope for | |
3935 | formal_parameter (CCBP). The formal parameter is | |
3936 | @@ -4051,176 +4054,176 @@ | |
3937 | ; | |
3938 | break;} | |
3939 | case 331: | |
3940 | -#line 1704 "./parse.y" | |
3941 | +#line 1708 "./parse.y" | |
3942 | {yyerror ("'(' expected"); RECOVER;; | |
3943 | break;} | |
3944 | case 332: | |
3945 | -#line 1706 "./parse.y" | |
3946 | +#line 1710 "./parse.y" | |
3947 | {yyerror ("Missing term or ')' expected"); DRECOVER (2);; | |
3948 | break;} | |
3949 | case 333: | |
3950 | -#line 1708 "./parse.y" | |
3951 | +#line 1712 "./parse.y" | |
3952 | {yyerror ("')' expected"); DRECOVER (1);; | |
3953 | break;} | |
3954 | case 334: | |
3955 | -#line 1713 "./parse.y" | |
3956 | +#line 1717 "./parse.y" | |
3957 | { yyval.node = yyvsp[0].node; ; | |
3958 | break;} | |
3959 | case 335: | |
3960 | -#line 1715 "./parse.y" | |
3961 | +#line 1719 "./parse.y" | |
3962 | {yyerror ("'{' expected"); RECOVER; ; | |
3963 | break;} | |
3964 | case 339: | |
3965 | -#line 1727 "./parse.y" | |
3966 | +#line 1731 "./parse.y" | |
3967 | { yyval.node = build_this (yyvsp[0].operator.location); ; | |
3968 | break;} | |
3969 | case 340: | |
3970 | -#line 1729 "./parse.y" | |
3971 | +#line 1733 "./parse.y" | |
3972 | {yyval.node = yyvsp[-1].node;; | |
3973 | break;} | |
3974 | case 345: | |
3975 | -#line 1738 "./parse.y" | |
3976 | +#line 1742 "./parse.y" | |
3977 | { yyval.node = parse_jdk1_1_error ("named class literals"); ; | |
3978 | break;} | |
3979 | case 346: | |
3980 | -#line 1740 "./parse.y" | |
3981 | +#line 1744 "./parse.y" | |
3982 | { yyval.node = build_class_ref (yyvsp[-2].node); ; | |
3983 | break;} | |
3984 | case 347: | |
3985 | -#line 1742 "./parse.y" | |
3986 | +#line 1746 "./parse.y" | |
3987 | { yyval.node = build_class_ref (void_type_node); ; | |
3988 | break;} | |
3989 | case 348: | |
3990 | -#line 1747 "./parse.y" | |
3991 | +#line 1751 "./parse.y" | |
3992 | { yyval.node = parse_jdk1_1_error ("class literals"); ; | |
3993 | break;} | |
3994 | case 349: | |
3995 | -#line 1749 "./parse.y" | |
3996 | +#line 1753 "./parse.y" | |
3997 | {yyerror ("')' expected"); RECOVER;; | |
3998 | break;} | |
3999 | case 350: | |
4000 | -#line 1751 "./parse.y" | |
4001 | +#line 1755 "./parse.y" | |
4002 | {yyerror ("'class' or 'this' expected" ); RECOVER;; | |
4003 | break;} | |
4004 | case 351: | |
4005 | -#line 1753 "./parse.y" | |
4006 | +#line 1757 "./parse.y" | |
4007 | {yyerror ("'class' expected" ); RECOVER;; | |
4008 | break;} | |
4009 | case 352: | |
4010 | -#line 1755 "./parse.y" | |
4011 | +#line 1759 "./parse.y" | |
4012 | {yyerror ("'class' expected" ); RECOVER;; | |
4013 | break;} | |
4014 | case 353: | |
4015 | -#line 1760 "./parse.y" | |
4016 | +#line 1764 "./parse.y" | |
4017 | { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ; | |
4018 | break;} | |
4019 | case 354: | |
4020 | -#line 1762 "./parse.y" | |
4021 | +#line 1766 "./parse.y" | |
4022 | { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ; | |
4023 | break;} | |
4024 | case 355: | |
4025 | -#line 1767 "./parse.y" | |
4026 | +#line 1771 "./parse.y" | |
4027 | { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; | |
4028 | break;} | |
4029 | case 356: | |
4030 | -#line 1769 "./parse.y" | |
4031 | +#line 1773 "./parse.y" | |
4032 | { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ; | |
4033 | break;} | |
4034 | case 361: | |
4035 | -#line 1778 "./parse.y" | |
4036 | +#line 1782 "./parse.y" | |
4037 | {yyerror ("'(' expected"); DRECOVER(new_1);; | |
4038 | break;} | |
4039 | case 362: | |
4040 | -#line 1780 "./parse.y" | |
4041 | +#line 1784 "./parse.y" | |
4042 | {yyerror ("'(' expected"); RECOVER;; | |
4043 | break;} | |
4044 | case 363: | |
4045 | -#line 1782 "./parse.y" | |
4046 | +#line 1786 "./parse.y" | |
4047 | {yyerror ("')' or term expected"); RECOVER;; | |
4048 | break;} | |
4049 | case 364: | |
4050 | -#line 1784 "./parse.y" | |
4051 | +#line 1788 "./parse.y" | |
4052 | {yyerror ("')' expected"); RECOVER;; | |
4053 | break;} | |
4054 | case 365: | |
4055 | -#line 1786 "./parse.y" | |
4056 | +#line 1790 "./parse.y" | |
4057 | {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;; | |
4058 | break;} | |
4059 | case 366: | |
4060 | -#line 1788 "./parse.y" | |
4061 | +#line 1792 "./parse.y" | |
4062 | {yyerror ("'(' expected"); RECOVER;; | |
4063 | break;} | |
4064 | case 369: | |
4065 | -#line 1798 "./parse.y" | |
4066 | +#line 1802 "./parse.y" | |
4067 | { | |
4068 | yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE); | |
4069 | ctxp->formal_parameter_number = 1; | |
4070 | ; | |
4071 | break;} | |
4072 | case 370: | |
4073 | -#line 1803 "./parse.y" | |
4074 | +#line 1807 "./parse.y" | |
4075 | { | |
4076 | ctxp->formal_parameter_number += 1; | |
4077 | yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node); | |
4078 | ; | |
4079 | break;} | |
4080 | case 371: | |
4081 | -#line 1808 "./parse.y" | |
4082 | +#line 1812 "./parse.y" | |
4083 | {yyerror ("Missing term"); RECOVER;; | |
4084 | break;} | |
4085 | case 372: | |
4086 | -#line 1813 "./parse.y" | |
4087 | +#line 1817 "./parse.y" | |
4088 | { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; | |
4089 | break;} | |
4090 | case 373: | |
4091 | -#line 1815 "./parse.y" | |
4092 | +#line 1819 "./parse.y" | |
4093 | { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ; | |
4094 | break;} | |
4095 | case 374: | |
4096 | -#line 1817 "./parse.y" | |
4097 | +#line 1821 "./parse.y" | |
4098 | { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));; | |
4099 | break;} | |
4100 | case 375: | |
4101 | -#line 1819 "./parse.y" | |
4102 | +#line 1823 "./parse.y" | |
4103 | { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));; | |
4104 | break;} | |
4105 | case 376: | |
4106 | -#line 1823 "./parse.y" | |
4107 | +#line 1827 "./parse.y" | |
4108 | { yyval.node = parse_jdk1_1_error ("anonymous array"); ; | |
4109 | break;} | |
4110 | case 377: | |
4111 | -#line 1825 "./parse.y" | |
4112 | +#line 1829 "./parse.y" | |
4113 | { yyval.node = parse_jdk1_1_error ("anonymous array"); ; | |
4114 | break;} | |
4115 | case 378: | |
4116 | -#line 1827 "./parse.y" | |
4117 | +#line 1831 "./parse.y" | |
4118 | {yyerror ("'[' expected"); DRECOVER ("]");; | |
4119 | break;} | |
4120 | case 379: | |
4121 | -#line 1829 "./parse.y" | |
4122 | +#line 1833 "./parse.y" | |
4123 | {yyerror ("']' expected"); RECOVER;; | |
4124 | break;} | |
4125 | case 380: | |
4126 | -#line 1834 "./parse.y" | |
4127 | +#line 1838 "./parse.y" | |
4128 | { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ; | |
4129 | break;} | |
4130 | case 381: | |
4131 | -#line 1836 "./parse.y" | |
4132 | +#line 1840 "./parse.y" | |
4133 | { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ; | |
4134 | break;} | |
4135 | case 382: | |
4136 | -#line 1841 "./parse.y" | |
4137 | +#line 1845 "./parse.y" | |
4138 | { | |
4139 | EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location; | |
4140 | yyval.node = yyvsp[-1].node; | |
4141 | ; | |
4142 | break;} | |
4143 | case 383: | |
4144 | -#line 1846 "./parse.y" | |
4145 | +#line 1850 "./parse.y" | |
4146 | {yyerror ("']' expected"); RECOVER;; | |
4147 | break;} | |
4148 | case 384: | |
4149 | -#line 1848 "./parse.y" | |
4150 | +#line 1852 "./parse.y" | |
4151 | { | |
4152 | yyerror ("Missing term"); | |
4153 | yyerror ("']' expected"); | |
4154 | @@ -4228,7 +4231,7 @@ | |
4155 | ; | |
4156 | break;} | |
4157 | case 385: | |
4158 | -#line 1857 "./parse.y" | |
4159 | +#line 1861 "./parse.y" | |
4160 | { | |
4161 | int allocate = 0; | |
4162 | /* If not initialized, allocate memory for the osb | |
4163 | @@ -4256,19 +4259,19 @@ | |
4164 | ; | |
4165 | break;} | |
4166 | case 386: | |
4167 | -#line 1883 "./parse.y" | |
4168 | +#line 1887 "./parse.y" | |
4169 | { CURRENT_OSB (ctxp)++; ; | |
4170 | break;} | |
4171 | case 387: | |
4172 | -#line 1885 "./parse.y" | |
4173 | +#line 1889 "./parse.y" | |
4174 | { yyerror ("']' expected"); RECOVER;; | |
4175 | break;} | |
4176 | case 388: | |
4177 | -#line 1890 "./parse.y" | |
4178 | +#line 1894 "./parse.y" | |
4179 | { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ; | |
4180 | break;} | |
4181 | case 389: | |
4182 | -#line 1894 "./parse.y" | |
4183 | +#line 1898 "./parse.y" | |
4184 | { | |
4185 | tree super_wfl = | |
4186 | build_wfl_node (super_identifier_node); | |
4187 | @@ -4277,19 +4280,19 @@ | |
4188 | ; | |
4189 | break;} | |
4190 | case 390: | |
4191 | -#line 1901 "./parse.y" | |
4192 | +#line 1905 "./parse.y" | |
4193 | {yyerror ("Field expected"); DRECOVER (super_field_acces);; | |
4194 | break;} | |
4195 | case 391: | |
4196 | -#line 1906 "./parse.y" | |
4197 | +#line 1910 "./parse.y" | |
4198 | { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ; | |
4199 | break;} | |
4200 | case 392: | |
4201 | -#line 1908 "./parse.y" | |
4202 | +#line 1912 "./parse.y" | |
4203 | { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ; | |
4204 | break;} | |
4205 | case 393: | |
4206 | -#line 1910 "./parse.y" | |
4207 | +#line 1914 "./parse.y" | |
4208 | { | |
4209 | if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR) | |
4210 | yyval.node = build_this_super_qualified_invocation | |
4211 | @@ -4302,7 +4305,7 @@ | |
4212 | ; | |
4213 | break;} | |
4214 | case 394: | |
4215 | -#line 1921 "./parse.y" | |
4216 | +#line 1925 "./parse.y" | |
4217 | { | |
4218 | if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR) | |
4219 | yyval.node = build_this_super_qualified_invocation | |
4220 | @@ -4315,121 +4318,121 @@ | |
4221 | ; | |
4222 | break;} | |
4223 | case 395: | |
4224 | -#line 1932 "./parse.y" | |
4225 | +#line 1936 "./parse.y" | |
4226 | { | |
4227 | yyval.node = build_this_super_qualified_invocation | |
4228 | (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location); | |
4229 | ; | |
4230 | break;} | |
4231 | case 396: | |
4232 | -#line 1937 "./parse.y" | |
4233 | +#line 1941 "./parse.y" | |
4234 | { | |
4235 | yyval.node = build_this_super_qualified_invocation | |
4236 | (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location); | |
4237 | ; | |
4238 | break;} | |
4239 | case 397: | |
4240 | -#line 1946 "./parse.y" | |
4241 | +#line 1950 "./parse.y" | |
4242 | { yyerror ("'(' expected"); DRECOVER (method_invocation); ; | |
4243 | break;} | |
4244 | case 398: | |
4245 | -#line 1948 "./parse.y" | |
4246 | +#line 1952 "./parse.y" | |
4247 | { yyerror ("'(' expected"); DRECOVER (method_invocation); ; | |
4248 | break;} | |
4249 | case 399: | |
4250 | -#line 1953 "./parse.y" | |
4251 | +#line 1957 "./parse.y" | |
4252 | { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ; | |
4253 | break;} | |
4254 | case 400: | |
4255 | -#line 1955 "./parse.y" | |
4256 | +#line 1959 "./parse.y" | |
4257 | { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ; | |
4258 | break;} | |
4259 | case 401: | |
4260 | -#line 1957 "./parse.y" | |
4261 | +#line 1961 "./parse.y" | |
4262 | { | |
4263 | yyerror ("Missing term and ']' expected"); | |
4264 | DRECOVER(array_access); | |
4265 | ; | |
4266 | break;} | |
4267 | case 402: | |
4268 | -#line 1962 "./parse.y" | |
4269 | +#line 1966 "./parse.y" | |
4270 | { | |
4271 | yyerror ("']' expected"); | |
4272 | DRECOVER(array_access); | |
4273 | ; | |
4274 | break;} | |
4275 | case 403: | |
4276 | -#line 1967 "./parse.y" | |
4277 | +#line 1971 "./parse.y" | |
4278 | { | |
4279 | yyerror ("Missing term and ']' expected"); | |
4280 | DRECOVER(array_access); | |
4281 | ; | |
4282 | break;} | |
4283 | case 404: | |
4284 | -#line 1972 "./parse.y" | |
4285 | +#line 1976 "./parse.y" | |
4286 | { | |
4287 | yyerror ("']' expected"); | |
4288 | DRECOVER(array_access); | |
4289 | ; | |
4290 | break;} | |
4291 | case 409: | |
4292 | -#line 1987 "./parse.y" | |
4293 | +#line 1991 "./parse.y" | |
4294 | { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ; | |
4295 | break;} | |
4296 | case 410: | |
4297 | -#line 1992 "./parse.y" | |
4298 | +#line 1996 "./parse.y" | |
4299 | { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ; | |
4300 | break;} | |
4301 | case 413: | |
4302 | -#line 1999 "./parse.y" | |
4303 | +#line 2003 "./parse.y" | |
4304 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; | |
4305 | break;} | |
4306 | case 414: | |
4307 | -#line 2001 "./parse.y" | |
4308 | +#line 2005 "./parse.y" | |
4309 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; | |
4310 | break;} | |
4311 | case 416: | |
4312 | -#line 2004 "./parse.y" | |
4313 | +#line 2008 "./parse.y" | |
4314 | {yyerror ("Missing term"); RECOVER; | |
4315 | break;} | |
4316 | case 417: | |
4317 | -#line 2006 "./parse.y" | |
4318 | +#line 2010 "./parse.y" | |
4319 | {yyerror ("Missing term"); RECOVER; | |
4320 | break;} | |
4321 | case 418: | |
4322 | -#line 2011 "./parse.y" | |
4323 | +#line 2015 "./parse.y" | |
4324 | {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ; | |
4325 | break;} | |
4326 | case 419: | |
4327 | -#line 2013 "./parse.y" | |
4328 | +#line 2017 "./parse.y" | |
4329 | {yyerror ("Missing term"); RECOVER; | |
4330 | break;} | |
4331 | case 420: | |
4332 | -#line 2018 "./parse.y" | |
4333 | +#line 2022 "./parse.y" | |
4334 | {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ; | |
4335 | break;} | |
4336 | case 421: | |
4337 | -#line 2020 "./parse.y" | |
4338 | +#line 2024 "./parse.y" | |
4339 | {yyerror ("Missing term"); RECOVER; | |
4340 | break;} | |
4341 | case 423: | |
4342 | -#line 2026 "./parse.y" | |
4343 | +#line 2030 "./parse.y" | |
4344 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; | |
4345 | break;} | |
4346 | case 424: | |
4347 | -#line 2028 "./parse.y" | |
4348 | +#line 2032 "./parse.y" | |
4349 | {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ; | |
4350 | break;} | |
4351 | case 426: | |
4352 | -#line 2031 "./parse.y" | |
4353 | +#line 2035 "./parse.y" | |
4354 | {yyerror ("Missing term"); RECOVER; | |
4355 | break;} | |
4356 | case 427: | |
4357 | -#line 2033 "./parse.y" | |
4358 | +#line 2037 "./parse.y" | |
4359 | {yyerror ("Missing term"); RECOVER; | |
4360 | break;} | |
4361 | case 428: | |
4362 | -#line 2038 "./parse.y" | |
4363 | +#line 2042 "./parse.y" | |
4364 | { | |
4365 | tree type = yyvsp[-3].node; | |
4366 | while (CURRENT_OSB (ctxp)--) | |
4367 | @@ -4439,15 +4442,15 @@ | |
4368 | ; | |
4369 | break;} | |
4370 | case 429: | |
4371 | -#line 2046 "./parse.y" | |
4372 | +#line 2050 "./parse.y" | |
4373 | { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ; | |
4374 | break;} | |
4375 | case 430: | |
4376 | -#line 2048 "./parse.y" | |
4377 | +#line 2052 "./parse.y" | |
4378 | { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ; | |
4379 | break;} | |
4380 | case 431: | |
4381 | -#line 2050 "./parse.y" | |
4382 | +#line 2054 "./parse.y" | |
4383 | { | |
4384 | char *ptr; | |
4385 | while (CURRENT_OSB (ctxp)--) | |
4386 | @@ -4462,11 +4465,11 @@ | |
4387 | ; | |
4388 | break;} | |
4389 | case 432: | |
4390 | -#line 2063 "./parse.y" | |
4391 | +#line 2067 "./parse.y" | |
4392 | {yyerror ("']' expected, invalid type expression");; | |
4393 | break;} | |
4394 | case 433: | |
4395 | -#line 2065 "./parse.y" | |
4396 | +#line 2069 "./parse.y" | |
4397 | { | |
4398 | if (ctxp->prevent_ese != lineno) | |
4399 | yyerror ("Invalid type expression"); RECOVER; | |
4400 | @@ -4474,243 +4477,243 @@ | |
4401 | ; | |
4402 | break;} | |
4403 | case 434: | |
4404 | -#line 2071 "./parse.y" | |
4405 | +#line 2075 "./parse.y" | |
4406 | {yyerror ("Missing term"); RECOVER;; | |
4407 | break;} | |
4408 | case 435: | |
4409 | -#line 2073 "./parse.y" | |
4410 | +#line 2077 "./parse.y" | |
4411 | {yyerror ("Missing term"); RECOVER;; | |
4412 | break;} | |
4413 | case 436: | |
4414 | -#line 2075 "./parse.y" | |
4415 | +#line 2079 "./parse.y" | |
4416 | {yyerror ("Missing term"); RECOVER;; | |
4417 | break;} | |
4418 | case 438: | |
4419 | -#line 2081 "./parse.y" | |
4420 | +#line 2085 "./parse.y" | |
4421 | { | |
4422 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), | |
4423 | yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); | |
4424 | ; | |
4425 | break;} | |
4426 | case 439: | |
4427 | -#line 2086 "./parse.y" | |
4428 | +#line 2090 "./parse.y" | |
4429 | { | |
4430 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4431 | yyvsp[-2].node, yyvsp[0].node); | |
4432 | ; | |
4433 | break;} | |
4434 | case 440: | |
4435 | -#line 2091 "./parse.y" | |
4436 | +#line 2095 "./parse.y" | |
4437 | { | |
4438 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4439 | yyvsp[-2].node, yyvsp[0].node); | |
4440 | ; | |
4441 | break;} | |
4442 | case 441: | |
4443 | -#line 2096 "./parse.y" | |
4444 | +#line 2100 "./parse.y" | |
4445 | {yyerror ("Missing term"); RECOVER;; | |
4446 | break;} | |
4447 | case 442: | |
4448 | -#line 2098 "./parse.y" | |
4449 | +#line 2102 "./parse.y" | |
4450 | {yyerror ("Missing term"); RECOVER;; | |
4451 | break;} | |
4452 | case 443: | |
4453 | -#line 2100 "./parse.y" | |
4454 | +#line 2104 "./parse.y" | |
4455 | {yyerror ("Missing term"); RECOVER;; | |
4456 | break;} | |
4457 | case 445: | |
4458 | -#line 2106 "./parse.y" | |
4459 | +#line 2110 "./parse.y" | |
4460 | { | |
4461 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4462 | yyvsp[-2].node, yyvsp[0].node); | |
4463 | ; | |
4464 | break;} | |
4465 | case 446: | |
4466 | -#line 2111 "./parse.y" | |
4467 | +#line 2115 "./parse.y" | |
4468 | { | |
4469 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4470 | yyvsp[-2].node, yyvsp[0].node); | |
4471 | ; | |
4472 | break;} | |
4473 | case 447: | |
4474 | -#line 2116 "./parse.y" | |
4475 | +#line 2120 "./parse.y" | |
4476 | {yyerror ("Missing term"); RECOVER;; | |
4477 | break;} | |
4478 | case 448: | |
4479 | -#line 2118 "./parse.y" | |
4480 | +#line 2122 "./parse.y" | |
4481 | {yyerror ("Missing term"); RECOVER;; | |
4482 | break;} | |
4483 | case 450: | |
4484 | -#line 2124 "./parse.y" | |
4485 | +#line 2128 "./parse.y" | |
4486 | { | |
4487 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4488 | yyvsp[-2].node, yyvsp[0].node); | |
4489 | ; | |
4490 | break;} | |
4491 | case 451: | |
4492 | -#line 2129 "./parse.y" | |
4493 | +#line 2133 "./parse.y" | |
4494 | { | |
4495 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4496 | yyvsp[-2].node, yyvsp[0].node); | |
4497 | ; | |
4498 | break;} | |
4499 | case 452: | |
4500 | -#line 2134 "./parse.y" | |
4501 | +#line 2138 "./parse.y" | |
4502 | { | |
4503 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4504 | yyvsp[-2].node, yyvsp[0].node); | |
4505 | ; | |
4506 | break;} | |
4507 | case 453: | |
4508 | -#line 2139 "./parse.y" | |
4509 | +#line 2143 "./parse.y" | |
4510 | {yyerror ("Missing term"); RECOVER;; | |
4511 | break;} | |
4512 | case 454: | |
4513 | -#line 2141 "./parse.y" | |
4514 | +#line 2145 "./parse.y" | |
4515 | {yyerror ("Missing term"); RECOVER;; | |
4516 | break;} | |
4517 | case 455: | |
4518 | -#line 2143 "./parse.y" | |
4519 | +#line 2147 "./parse.y" | |
4520 | {yyerror ("Missing term"); RECOVER;; | |
4521 | break;} | |
4522 | case 457: | |
4523 | -#line 2149 "./parse.y" | |
4524 | +#line 2153 "./parse.y" | |
4525 | { | |
4526 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4527 | yyvsp[-2].node, yyvsp[0].node); | |
4528 | ; | |
4529 | break;} | |
4530 | case 458: | |
4531 | -#line 2154 "./parse.y" | |
4532 | +#line 2158 "./parse.y" | |
4533 | { | |
4534 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4535 | yyvsp[-2].node, yyvsp[0].node); | |
4536 | ; | |
4537 | break;} | |
4538 | case 459: | |
4539 | -#line 2159 "./parse.y" | |
4540 | +#line 2163 "./parse.y" | |
4541 | { | |
4542 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4543 | yyvsp[-2].node, yyvsp[0].node); | |
4544 | ; | |
4545 | break;} | |
4546 | case 460: | |
4547 | -#line 2164 "./parse.y" | |
4548 | +#line 2168 "./parse.y" | |
4549 | { | |
4550 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4551 | yyvsp[-2].node, yyvsp[0].node); | |
4552 | ; | |
4553 | break;} | |
4554 | case 461: | |
4555 | -#line 2169 "./parse.y" | |
4556 | +#line 2173 "./parse.y" | |
4557 | { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ; | |
4558 | break;} | |
4559 | case 462: | |
4560 | -#line 2171 "./parse.y" | |
4561 | +#line 2175 "./parse.y" | |
4562 | {yyerror ("Missing term"); RECOVER;; | |
4563 | break;} | |
4564 | case 463: | |
4565 | -#line 2173 "./parse.y" | |
4566 | +#line 2177 "./parse.y" | |
4567 | {yyerror ("Missing term"); RECOVER;; | |
4568 | break;} | |
4569 | case 464: | |
4570 | -#line 2175 "./parse.y" | |
4571 | +#line 2179 "./parse.y" | |
4572 | {yyerror ("Missing term"); RECOVER;; | |
4573 | break;} | |
4574 | case 465: | |
4575 | -#line 2177 "./parse.y" | |
4576 | +#line 2181 "./parse.y" | |
4577 | {yyerror ("Missing term"); RECOVER;; | |
4578 | break;} | |
4579 | case 466: | |
4580 | -#line 2179 "./parse.y" | |
4581 | +#line 2183 "./parse.y" | |
4582 | {yyerror ("Invalid reference type"); RECOVER;; | |
4583 | break;} | |
4584 | case 468: | |
4585 | -#line 2185 "./parse.y" | |
4586 | +#line 2189 "./parse.y" | |
4587 | { | |
4588 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4589 | yyvsp[-2].node, yyvsp[0].node); | |
4590 | ; | |
4591 | break;} | |
4592 | case 469: | |
4593 | -#line 2190 "./parse.y" | |
4594 | +#line 2194 "./parse.y" | |
4595 | { | |
4596 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4597 | yyvsp[-2].node, yyvsp[0].node); | |
4598 | ; | |
4599 | break;} | |
4600 | case 470: | |
4601 | -#line 2195 "./parse.y" | |
4602 | +#line 2199 "./parse.y" | |
4603 | {yyerror ("Missing term"); RECOVER;; | |
4604 | break;} | |
4605 | case 471: | |
4606 | -#line 2197 "./parse.y" | |
4607 | +#line 2201 "./parse.y" | |
4608 | {yyerror ("Missing term"); RECOVER;; | |
4609 | break;} | |
4610 | case 473: | |
4611 | -#line 2203 "./parse.y" | |
4612 | +#line 2207 "./parse.y" | |
4613 | { | |
4614 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4615 | yyvsp[-2].node, yyvsp[0].node); | |
4616 | ; | |
4617 | break;} | |
4618 | case 474: | |
4619 | -#line 2208 "./parse.y" | |
4620 | +#line 2212 "./parse.y" | |
4621 | {yyerror ("Missing term"); RECOVER;; | |
4622 | break;} | |
4623 | case 476: | |
4624 | -#line 2214 "./parse.y" | |
4625 | +#line 2218 "./parse.y" | |
4626 | { | |
4627 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4628 | yyvsp[-2].node, yyvsp[0].node); | |
4629 | ; | |
4630 | break;} | |
4631 | case 477: | |
4632 | -#line 2219 "./parse.y" | |
4633 | +#line 2223 "./parse.y" | |
4634 | {yyerror ("Missing term"); RECOVER;; | |
4635 | break;} | |
4636 | case 479: | |
4637 | -#line 2225 "./parse.y" | |
4638 | +#line 2229 "./parse.y" | |
4639 | { | |
4640 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4641 | yyvsp[-2].node, yyvsp[0].node); | |
4642 | ; | |
4643 | break;} | |
4644 | case 480: | |
4645 | -#line 2230 "./parse.y" | |
4646 | +#line 2234 "./parse.y" | |
4647 | {yyerror ("Missing term"); RECOVER;; | |
4648 | break;} | |
4649 | case 482: | |
4650 | -#line 2236 "./parse.y" | |
4651 | +#line 2240 "./parse.y" | |
4652 | { | |
4653 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4654 | yyvsp[-2].node, yyvsp[0].node); | |
4655 | ; | |
4656 | break;} | |
4657 | case 483: | |
4658 | -#line 2241 "./parse.y" | |
4659 | +#line 2245 "./parse.y" | |
4660 | {yyerror ("Missing term"); RECOVER;; | |
4661 | break;} | |
4662 | case 485: | |
4663 | -#line 2247 "./parse.y" | |
4664 | +#line 2251 "./parse.y" | |
4665 | { | |
4666 | yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location, | |
4667 | yyvsp[-2].node, yyvsp[0].node); | |
4668 | ; | |
4669 | break;} | |
4670 | case 486: | |
4671 | -#line 2252 "./parse.y" | |
4672 | +#line 2256 "./parse.y" | |
4673 | {yyerror ("Missing term"); RECOVER;; | |
4674 | break;} | |
4675 | case 488: | |
4676 | -#line 2258 "./parse.y" | |
4677 | +#line 2262 "./parse.y" | |
4678 | { | |
4679 | yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); | |
4680 | EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location; | |
4681 | ; | |
4682 | break;} | |
4683 | case 489: | |
4684 | -#line 2263 "./parse.y" | |
4685 | +#line 2267 "./parse.y" | |
4686 | { | |
4687 | YYERROR_NOW; | |
4688 | yyerror ("Missing term"); | |
4689 | @@ -4718,19 +4721,19 @@ | |
4690 | ; | |
4691 | break;} | |
4692 | case 490: | |
4693 | -#line 2269 "./parse.y" | |
4694 | +#line 2273 "./parse.y" | |
4695 | {yyerror ("Missing term"); DRECOVER (2);; | |
4696 | break;} | |
4697 | case 491: | |
4698 | -#line 2271 "./parse.y" | |
4699 | +#line 2275 "./parse.y" | |
4700 | {yyerror ("Missing term"); DRECOVER (3);; | |
4701 | break;} | |
4702 | case 494: | |
4703 | -#line 2281 "./parse.y" | |
4704 | +#line 2285 "./parse.y" | |
4705 | { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ; | |
4706 | break;} | |
4707 | case 495: | |
4708 | -#line 2283 "./parse.y" | |
4709 | +#line 2287 "./parse.y" | |
4710 | { | |
4711 | if (ctxp->prevent_ese != lineno) | |
4712 | yyerror ("Missing term"); | |
4713 | @@ -4739,7 +4742,7 @@ | |
4714 | break;} | |
4715 | } | |
4716 | /* the action file gets copied in in place of this dollarsign */ | |
4717 | -#line 542 "/usr/lib/bison.simple" | |
4718 | +#line 543 "/usr/lib/bison.simple" | |
4719 | \f | |
4720 | yyvsp -= yylen; | |
4721 | yyssp -= yylen; | |
4722 | @@ -4959,7 +4962,7 @@ | |
4723 | } | |
4724 | return 1; | |
4725 | } | |
4726 | -#line 2309 "./parse.y" | |
4727 | +#line 2313 "./parse.y" | |
4728 | ||
4729 | \f | |
4730 | ||
4731 | @@ -5063,7 +5066,17 @@ | |
4732 | free (toFree); | |
4733 | } | |
4734 | ||
4735 | -/* Reporting JDK1.1 features not implemented */ | |
4736 | +/* Reporting an constructor invocation error. */ | |
4737 | +static void | |
4738 | +parse_ctor_invocation_error () | |
4739 | +{ | |
4740 | + if (DECL_CONSTRUCTOR_P (current_function_decl)) | |
4741 | + yyerror ("Constructor invocation must be first thing in a constructor"); | |
4742 | + else | |
4743 | + yyerror ("Only constructors can invoke constructors"); | |
4744 | +} | |
4745 | + | |
4746 | +/* Reporting JDK1.1 features not implemented. */ | |
4747 | ||
4748 | static tree | |
4749 | parse_jdk1_1_error (msg) | |
4750 | @@ -5972,13 +5985,18 @@ | |
4751 | { | |
4752 | tree meth = TREE_VALUE (mdecl); | |
4753 | tree id = TREE_PURPOSE (mdecl); | |
4754 | - tree this_class = TREE_TYPE (ctxp->current_parsed_class); | |
4755 | tree type_wfl = NULL_TREE; | |
4756 | - tree meth_name = NULL_TREE, current, orig_arg; | |
4757 | + tree meth_name = NULL_TREE; | |
4758 | + tree current, orig_arg, this_class; | |
4759 | int saved_lineno; | |
4760 | int constructor_ok = 0, must_chain; | |
4761 | ||
4762 | check_modifiers_consistency (flags); | |
4763 | + | |
4764 | + if (ctxp->current_parsed_class) | |
4765 | + this_class = TREE_TYPE (ctxp->current_parsed_class); | |
4766 | + else | |
4767 | + return NULL_TREE; | |
4768 | ||
4769 | /* There are some forbidden modifiers for an abstract method and its | |
4770 | class must be abstract as well. */ | |
4771 | @@ -6174,7 +6192,12 @@ | |
4772 | finish_method_declaration (method_body) | |
4773 | tree method_body; | |
4774 | { | |
4775 | - int flags = get_access_flags_from_decl (current_function_decl); | |
4776 | + int flags; | |
4777 | + | |
4778 | + if (!current_function_decl) | |
4779 | + return; | |
4780 | + | |
4781 | + flags = get_access_flags_from_decl (current_function_decl); | |
4782 | ||
4783 | /* 8.4.5 Method Body */ | |
4784 | if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body) | |
4785 | @@ -6989,7 +7012,9 @@ | |
4786 | ||
4787 | /* Resolve and layout if necessary */ | |
4788 | layout_class_methods (TREE_TYPE (decl)); | |
4789 | - if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl))) | |
4790 | + /* Check methods, but only once */ | |
4791 | + if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) | |
4792 | + && !CLASS_LOADED_P (TREE_TYPE (decl))) | |
4793 | CHECK_METHODS (decl); | |
4794 | if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl))) | |
4795 | safe_layout_class (TREE_TYPE (decl)); | |
4796 | @@ -7170,7 +7195,7 @@ | |
4797 | ||
4798 | /* Track method being redefined inside the same class. As a side | |
4799 | effect, set DECL_NAME to an IDENTIFIER (prior entering this | |
4800 | - function it's a FWL, so we can track errors more accurately */ | |
4801 | + function it's a FWL, so we can track errors more accurately.) */ | |
4802 | ||
4803 | static int | |
4804 | check_method_redefinition (class, method) | |
4805 | @@ -7206,9 +7231,126 @@ | |
4806 | return 0; | |
4807 | } | |
4808 | ||
4809 | -/* Check all the methods of CLASS. Methods are first completed then | |
4810 | - checked according to regular method existance rules. | |
4811 | - If no constructor were encountered, then build its declaration. */ | |
4812 | +static void | |
4813 | +check_abstract_method_definitions (do_interface, class_decl, type) | |
4814 | + int do_interface; | |
4815 | + tree class_decl, type; | |
4816 | +{ | |
4817 | + tree class = TREE_TYPE (class_decl); | |
4818 | + tree method, end_type; | |
4819 | + | |
4820 | + end_type = (do_interface ? object_type_node : type); | |
4821 | + for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method)) | |
4822 | + { | |
4823 | + tree other_super, other_method, method_sig, method_name; | |
4824 | + int found = 0; | |
4825 | + | |
4826 | + if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method)) | |
4827 | + continue; | |
4828 | + | |
4829 | + /* Now verify that somewhere in between TYPE and CLASS, | |
4830 | + abstract method METHOD gets a non abstract definition | |
4831 | + that is inherited by CLASS. */ | |
4832 | + | |
4833 | + method_sig = build_java_signature (TREE_TYPE (method)); | |
4834 | + method_name = DECL_NAME (method); | |
4835 | + if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION) | |
4836 | + method_name = EXPR_WFL_NODE (method_name); | |
4837 | + | |
4838 | + for (other_super = class; other_super != end_type; | |
4839 | + other_super = CLASSTYPE_SUPER (other_super)) | |
4840 | + { | |
4841 | + for (other_method = TYPE_METHODS (other_super); other_method; | |
4842 | + other_method = TREE_CHAIN (other_method)) | |
4843 | + { | |
4844 | + tree s = build_java_signature (TREE_TYPE (other_method)); | |
4845 | + tree other_name = DECL_NAME (other_method); | |
4846 | + | |
4847 | + if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION) | |
4848 | + other_name = EXPR_WFL_NODE (other_name); | |
4849 | + if (!IS_CLINIT (other_method) | |
4850 | + && !DECL_CONSTRUCTOR_P (other_method) | |
4851 | + && method_name == other_name && method_sig == s) | |
4852 | + { | |
4853 | + found = 1; | |
4854 | + break; | |
4855 | + } | |
4856 | + } | |
4857 | + } | |
4858 | + | |
4859 | + /* Report that abstract METHOD didn't find an implementation | |
4860 | + that CLASS can use. */ | |
4861 | + if (!found) | |
4862 | + { | |
4863 | + char *t = strdup (lang_printable_name | |
4864 | + (TREE_TYPE (TREE_TYPE (method)), 0)); | |
4865 | + tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method))); | |
4866 | + tree saved_wfl = NULL_TREE; | |
4867 | + | |
4868 | + if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION) | |
4869 | + { | |
4870 | + saved_wfl = DECL_NAME (method); | |
4871 | + DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method)); | |
4872 | + } | |
4873 | + | |
4874 | + parse_error_context | |
4875 | + (lookup_cl (class_decl), | |
4876 | + "Class `%s' doesn't define the abstract method `%s %s' from " | |
4877 | + "%s `%s'. This method must be defined or %s `%s' must be " | |
4878 | + "declared abstract", | |
4879 | + IDENTIFIER_POINTER (DECL_NAME (class_decl)), | |
4880 | + t, lang_printable_name (method, 0), | |
4881 | + (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ? | |
4882 | + "interface" : "class"), | |
4883 | + IDENTIFIER_POINTER (ccn), | |
4884 | + (CLASS_INTERFACE (class_decl) ? "interface" : "class"), | |
4885 | + IDENTIFIER_POINTER (DECL_NAME (class_decl))); | |
4886 | + | |
4887 | + free (t); | |
4888 | + | |
4889 | + if (saved_wfl) | |
4890 | + DECL_NAME (method) = saved_wfl; | |
4891 | + } | |
4892 | + } | |
4893 | +} | |
4894 | + | |
4895 | +/* Check that CLASS_DECL somehoow implements all inherited abstract | |
4896 | + methods. */ | |
4897 | + | |
4898 | +static void | |
4899 | +java_check_abstract_method_definitions (class_decl) | |
4900 | + tree class_decl; | |
4901 | +{ | |
4902 | + tree class = TREE_TYPE (class_decl); | |
4903 | + tree super, vector; | |
4904 | + int i; | |
4905 | + | |
4906 | + if (CLASS_ABSTRACT (class_decl)) | |
4907 | + return; | |
4908 | + | |
4909 | + /* Check for inherited types */ | |
4910 | + for (super = CLASSTYPE_SUPER (class); super != object_type_node; | |
4911 | + super = CLASSTYPE_SUPER (super)) | |
4912 | + { | |
4913 | + if (!CLASS_ABSTRACT (TYPE_NAME (super))) | |
4914 | + continue; | |
4915 | + | |
4916 | + check_abstract_method_definitions (0, class_decl, super); | |
4917 | + } | |
4918 | + | |
4919 | + /* Check for implemented interfaces. */ | |
4920 | + vector = TYPE_BINFO_BASETYPES (class); | |
4921 | + for (i = 1; i < TREE_VEC_LENGTH (vector); i++) | |
4922 | + { | |
4923 | + super = BINFO_TYPE (TREE_VEC_ELT (vector, i)); | |
4924 | + check_abstract_method_definitions (1, class_decl, super); | |
4925 | + } | |
4926 | +} | |
4927 | + | |
4928 | +/* Check all the methods of CLASS_DECL. Methods are first completed | |
4929 | + then checked according to regular method existance rules. If no | |
4930 | + constructor for CLASS_DECL were encountered, then build its | |
4931 | + declaration. */ | |
4932 | ||
4933 | static void | |
4934 | java_check_regular_methods (class_decl) | |
4935 | @@ -7384,7 +7526,7 @@ | |
4936 | ||
4937 | /* Don't forget eventual pending found and saved_found_wfl. Take | |
4938 | into account that we might have exited because we saw an | |
4939 | - aritifical method as the last entry. */ | |
4940 | + artificial method as the last entry. */ | |
4941 | ||
4942 | if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl) | |
4943 | DECL_NAME (found) = saved_found_wfl; | |
4944 | @@ -7392,6 +7534,10 @@ | |
4945 | if (!TYPE_NVIRTUALS (class)) | |
4946 | TYPE_METHODS (class) = nreverse (TYPE_METHODS (class)); | |
4947 | ||
4948 | + /* Search for inherited abstract method not yet implemented in this | |
4949 | + class. */ | |
4950 | + java_check_abstract_method_definitions (class_decl); | |
4951 | + | |
4952 | if (!saw_constructor) | |
4953 | { | |
4954 | /* No constructor seen, we craft one, at line 0. Since this | |
4955 | @@ -7597,14 +7743,15 @@ | |
4956 | return NULL_TREE; | |
4957 | } | |
4958 | ||
4959 | -/* Return the line that matches DECL line number. Used during error | |
4960 | - report */ | |
4961 | +/* Return the line that matches DECL line number, and try its best to | |
4962 | + position the column number. Used during error reports. */ | |
4963 | ||
4964 | static tree | |
4965 | lookup_cl (decl) | |
4966 | tree decl; | |
4967 | { | |
4968 | static tree cl = NULL_TREE; | |
4969 | + char *line, *found; | |
4970 | ||
4971 | if (!decl) | |
4972 | return NULL_TREE; | |
4973 | @@ -7615,6 +7762,14 @@ | |
4974 | EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl)); | |
4975 | EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1); | |
4976 | ||
4977 | + line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)), | |
4978 | + EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl)); | |
4979 | + | |
4980 | + found = strstr ((const char *)line, | |
4981 | + (const char *)IDENTIFIER_POINTER (DECL_NAME (decl))); | |
4982 | + if (found) | |
4983 | + EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line); | |
4984 | + | |
4985 | return cl; | |
4986 | } | |
4987 | ||
4988 | @@ -8149,6 +8304,9 @@ | |
4989 | tree parm_decl; | |
4990 | int i; | |
4991 | ||
4992 | + if (!fndecl) | |
4993 | + return; | |
4994 | + | |
4995 | current_function_decl = fndecl; | |
4996 | ||
4997 | /* New scope for the function */ | |
4998 | @@ -8268,6 +8426,9 @@ | |
4999 | tree fndecl = current_function_decl; | |
5000 | int flag_asynchronous_exceptions = asynchronous_exceptions; | |
5001 | ||
5002 | + if (!fndecl) | |
5003 | + return; | |
5004 | + | |
5005 | java_parser_context_save_global (); | |
5006 | lineno = ctxp->last_ccb_indent1; | |
5007 | ||
5008 | @@ -8323,6 +8484,8 @@ | |
5009 | java_method_add_stmt (fndecl, expr) | |
5010 | tree fndecl, expr; | |
5011 | { | |
5012 | + if (!GET_CURRENT_BLOCK (fndecl)) | |
5013 | + return NULL_TREE; | |
5014 | return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr); | |
5015 | } | |
5016 | ||
5017 | @@ -8721,7 +8884,8 @@ | |
5018 | for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl)) | |
5019 | { | |
5020 | if (DECL_CONSTRUCTOR_P (mdecl) | |
5021 | - && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node) | |
5022 | + && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) | |
5023 | + == end_params_node) | |
5024 | return 0; | |
5025 | } | |
5026 | } | |
5027 | @@ -9064,6 +9228,8 @@ | |
5028 | == soft_initclass_node) | |
5029 | return TREE_OPERAND (op1, 1); | |
5030 | } | |
5031 | + else if (JDECL_P (op1)) | |
5032 | + return op1; | |
5033 | } | |
5034 | return node; | |
5035 | } | |
5036 | @@ -9085,6 +9251,8 @@ | |
5037 | for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q)) | |
5038 | { | |
5039 | tree qual_wfl = QUAL_WFL (q); | |
5040 | + tree ret_decl; /* for EH checking */ | |
5041 | + int location; /* for EH checking */ | |
5042 | ||
5043 | /* 15.10.1 Field Access Using a Primary */ | |
5044 | switch (TREE_CODE (qual_wfl)) | |
5045 | @@ -9103,14 +9271,21 @@ | |
5046 | /* And code for the function call */ | |
5047 | if (complete_function_arguments (qual_wfl)) | |
5048 | return 1; | |
5049 | + | |
5050 | if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR) | |
5051 | CALL_USING_SUPER (qual_wfl) = 1; | |
5052 | - *where_found = | |
5053 | - patch_method_invocation (qual_wfl, decl, type, &is_static, NULL); | |
5054 | + location = (TREE_CODE (qual_wfl) == CALL_EXPR ? | |
5055 | + EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0); | |
5056 | + *where_found = patch_method_invocation (qual_wfl, decl, type, | |
5057 | + &is_static, &ret_decl); | |
5058 | if (*where_found == error_mark_node) | |
5059 | return 1; | |
5060 | *type_found = type = QUAL_DECL_TYPE (*where_found); | |
5061 | ||
5062 | + /* EH check */ | |
5063 | + if (location) | |
5064 | + check_thrown_exceptions (location, ret_decl); | |
5065 | + | |
5066 | /* If the previous call was static and this one is too, | |
5067 | build a compound expression to hold the two (because in | |
5068 | that case, previous function calls aren't transported as | |
5069 | @@ -9145,6 +9320,7 @@ | |
5070 | ||
5071 | case CONDITIONAL_EXPR: | |
5072 | case STRING_CST: | |
5073 | + case MODIFY_EXPR: | |
5074 | *where_found = decl = java_complete_tree (qual_wfl); | |
5075 | if (decl == error_mark_node) | |
5076 | return 1; | |
5077 | @@ -9882,6 +10058,11 @@ | |
5078 | if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) && | |
5079 | TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t)) | |
5080 | TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta)); | |
5081 | + | |
5082 | + /* Resolve unresolved returned type isses */ | |
5083 | + t = TREE_TYPE (TREE_TYPE (method)); | |
5084 | + if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t))) | |
5085 | + resolve_and_layout (TREE_TYPE (t), NULL); | |
5086 | ||
5087 | if (flag_emit_class_files || flag_emit_xref) | |
5088 | func = method; | |
5089 | @@ -10042,7 +10223,7 @@ | |
5090 | parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s", | |
5091 | (lc ? "constructor" : "method"), | |
5092 | (lc ? | |
5093 | - IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) : | |
5094 | + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))) : | |
5095 | IDENTIFIER_POINTER (name)), | |
5096 | IDENTIFIER_POINTER (signature), | |
5097 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))), | |
5098 | @@ -10061,7 +10242,8 @@ | |
5099 | tree list = NULL_TREE, all_list = NULL_TREE; | |
5100 | ||
5101 | /* Search interfaces */ | |
5102 | - if (CLASS_INTERFACE (TYPE_NAME (class))) | |
5103 | + if (CLASS_INTERFACE (TYPE_NAME (class)) | |
5104 | + || CLASS_ABSTRACT (TYPE_NAME (class))) | |
5105 | { | |
5106 | static tree searched_interfaces = NULL_TREE; | |
5107 | static int search_not_done = 0; | |
5108 | @@ -10292,7 +10474,7 @@ | |
5109 | break; | |
5110 | case NEW_ARRAY_EXPR: | |
5111 | qual = TREE_CHAIN (qual); | |
5112 | - new_array_found = 1; | |
5113 | + again = new_array_found = 1; | |
5114 | continue; | |
5115 | case NEW_CLASS_EXPR: | |
5116 | case CONVERT_EXPR: | |
5117 | @@ -10320,12 +10502,8 @@ | |
5118 | && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION) | |
5119 | name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl)); | |
5120 | ||
5121 | - else if (code == ARRAY_REF && | |
5122 | - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION) | |
5123 | - name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0)); | |
5124 | - | |
5125 | - else if (code == CALL_EXPR && | |
5126 | - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION) | |
5127 | + else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) && | |
5128 | + TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION) | |
5129 | name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0)); | |
5130 | ||
5131 | else if (code == STRING_CST || code == CONDITIONAL_EXPR) | |
5132 | @@ -10335,8 +10513,15 @@ | |
5133 | again = 1; | |
5134 | } | |
5135 | else | |
5136 | - name = EXPR_WFL_NODE (qual_wfl); | |
5137 | - | |
5138 | + { | |
5139 | + name = EXPR_WFL_NODE (qual_wfl); | |
5140 | + if (!name) | |
5141 | + { | |
5142 | + qual = EXPR_WFL_QUALIFICATION (qual_wfl); | |
5143 | + again = 1; | |
5144 | + } | |
5145 | + } | |
5146 | + | |
5147 | /* If we have a THIS (from a primary), we set the context accordingly */ | |
5148 | if (name == this_identifier_node) | |
5149 | { | |
5150 | @@ -10370,7 +10555,8 @@ | |
5151 | declaration or parameter declaration, then it is an expression | |
5152 | name. We don't carry this test out if we're in the context of the | |
5153 | use of SUPER or THIS */ | |
5154 | - if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name))) | |
5155 | + if (!this_found && !super_found && | |
5156 | + TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name))) | |
5157 | { | |
5158 | RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; | |
5159 | QUAL_RESOLUTION (qual) = decl; | |
5160 | @@ -10387,15 +10573,17 @@ | |
5161 | QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl); | |
5162 | } | |
5163 | ||
5164 | - /* We reclassify NAME as a type name if: | |
5165 | + /* We reclassify NAME as yielding to a type name resolution if: | |
5166 | - NAME is a class/interface declared within the compilation | |
5167 | unit containing NAME, | |
5168 | - NAME is imported via a single-type-import declaration, | |
5169 | - NAME is declared in an another compilation unit of the package | |
5170 | of the compilation unit containing NAME, | |
5171 | - NAME is declared by exactly on type-import-on-demand declaration | |
5172 | - of the compilation unit containing NAME. */ | |
5173 | - else if ((decl = resolve_and_layout (name, NULL_TREE))) | |
5174 | + of the compilation unit containing NAME. | |
5175 | + - NAME is actually a STRING_CST. */ | |
5176 | + else if (TREE_CODE (name) == STRING_CST || | |
5177 | + (decl = resolve_and_layout (name, NULL_TREE))) | |
5178 | { | |
5179 | RESOLVE_TYPE_NAME_P (qual_wfl) = 1; | |
5180 | QUAL_RESOLUTION (qual) = decl; | |
5181 | @@ -10480,7 +10668,9 @@ | |
5182 | { | |
5183 | tree value = DECL_INITIAL (node); | |
5184 | DECL_INITIAL (node) = NULL_TREE; | |
5185 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
5186 | value = fold_constant_for_init (value, node); | |
5187 | + pop_obstacks (); | |
5188 | DECL_INITIAL (node) = value; | |
5189 | if (value != NULL_TREE) | |
5190 | return value; | |
5191 | @@ -10500,8 +10690,7 @@ | |
5192 | TREE_OPERAND (node, 1) = java_stabilize_reference (op1); | |
5193 | return node; | |
5194 | } | |
5195 | - else | |
5196 | - return stabilize_reference (node); | |
5197 | + return stabilize_reference (node); | |
5198 | } | |
5199 | ||
5200 | /* Patch tree nodes in a function body. When a BLOCK is found, push | |
5201 | @@ -10683,8 +10872,12 @@ | |
5202 | && JDECL_P (TREE_OPERAND (cn, 1)) | |
5203 | && FIELD_FINAL (TREE_OPERAND (cn, 1)) | |
5204 | && DECL_INITIAL (TREE_OPERAND (cn, 1))) | |
5205 | - cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)), | |
5206 | - TREE_OPERAND (cn, 1)); | |
5207 | + { | |
5208 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
5209 | + cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)), | |
5210 | + TREE_OPERAND (cn, 1)); | |
5211 | + pop_obstacks (); | |
5212 | + } | |
5213 | ||
5214 | if (!TREE_CONSTANT (cn) && !flag_emit_xref) | |
5215 | { | |
5216 | @@ -10937,7 +11130,11 @@ | |
5217 | && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn) | |
5218 | && DECL_INITIAL (nn) != NULL_TREE) | |
5219 | { | |
5220 | - tree value = fold_constant_for_init (nn, nn); | |
5221 | + tree value; | |
5222 | + | |
5223 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
5224 | + value = fold_constant_for_init (nn, nn); | |
5225 | + pop_obstacks (); | |
5226 | if (value != NULL_TREE) | |
5227 | { | |
5228 | tree type = TREE_TYPE (value); | |
5229 | @@ -10951,14 +11148,17 @@ | |
5230 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
5231 | return error_mark_node; | |
5232 | ||
5233 | - if (COMPOUND_ASSIGN_P (wfl_op2)) | |
5234 | + flag = COMPOUND_ASSIGN_P (wfl_op2); | |
5235 | + if (flag) | |
5236 | { | |
5237 | tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0)); | |
5238 | ||
5239 | /* Hand stablize the lhs on both places */ | |
5240 | TREE_OPERAND (node, 0) = lvalue; | |
5241 | - TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue; | |
5242 | + TREE_OPERAND (TREE_OPERAND (node, 1), 0) = | |
5243 | + (flag_emit_class_files ? lvalue : save_expr (lvalue)); | |
5244 | ||
5245 | + /* 15.25.2.a: Left hand is not an array access. FIXME */ | |
5246 | /* Now complete the RHS. We write it back later on. */ | |
5247 | nn = java_complete_tree (TREE_OPERAND (node, 1)); | |
5248 | ||
5249 | @@ -10969,6 +11169,8 @@ | |
5250 | E1 = (T)(E1 op E2), with T being the type of E1. */ | |
5251 | nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2), | |
5252 | TREE_TYPE (lvalue), nn)); | |
5253 | + | |
5254 | + /* 15.25.2.b: Left hand is an array access. FIXME */ | |
5255 | } | |
5256 | ||
5257 | /* If we're about to patch a NEW_ARRAY_INIT, we call a special | |
5258 | @@ -10992,6 +11194,10 @@ | |
5259 | if ((nn = patch_string (TREE_OPERAND (node, 1)))) | |
5260 | TREE_OPERAND (node, 1) = nn; | |
5261 | node = patch_assignment (node, wfl_op1, wfl_op2); | |
5262 | + /* Reorganize the tree if necessary. */ | |
5263 | + if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node)) | |
5264 | + || JSTRING_P (TREE_TYPE (node)))) | |
5265 | + node = java_refold (node); | |
5266 | CAN_COMPLETE_NORMALLY (node) = 1; | |
5267 | return node; | |
5268 | ||
5269 | @@ -12000,6 +12206,81 @@ | |
5270 | #undef BUILD_OPERATOR_STRING | |
5271 | } | |
5272 | ||
5273 | +/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */ | |
5274 | + | |
5275 | +static int | |
5276 | +java_decl_equiv (var_acc1, var_acc2) | |
5277 | + tree var_acc1, var_acc2; | |
5278 | +{ | |
5279 | + if (JDECL_P (var_acc1)) | |
5280 | + return (var_acc1 == var_acc2); | |
5281 | + | |
5282 | + return (TREE_CODE (var_acc1) == COMPONENT_REF | |
5283 | + && TREE_CODE (var_acc2) == COMPONENT_REF | |
5284 | + && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0) | |
5285 | + == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0) | |
5286 | + && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1)); | |
5287 | +} | |
5288 | + | |
5289 | +/* Return a non zero value if CODE is one of the operators that can be | |
5290 | + used in conjunction with the `=' operator in a compound assignment. */ | |
5291 | + | |
5292 | +static int | |
5293 | +binop_compound_p (code) | |
5294 | + enum tree_code code; | |
5295 | +{ | |
5296 | + int i; | |
5297 | + for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++) | |
5298 | + if (binop_lookup [i] == code) | |
5299 | + break; | |
5300 | + | |
5301 | + return i < BINOP_COMPOUND_CANDIDATES; | |
5302 | +} | |
5303 | + | |
5304 | +/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */ | |
5305 | + | |
5306 | +static tree | |
5307 | +java_refold (t) | |
5308 | + tree t; | |
5309 | +{ | |
5310 | + tree c, b, ns, decl; | |
5311 | + | |
5312 | + if (TREE_CODE (t) != MODIFY_EXPR) | |
5313 | + return t; | |
5314 | + | |
5315 | + c = TREE_OPERAND (t, 1); | |
5316 | + if (! (c && TREE_CODE (c) == COMPOUND_EXPR | |
5317 | + && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR | |
5318 | + && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1))))) | |
5319 | + return t; | |
5320 | + | |
5321 | + /* Now the left branch of the binary operator. */ | |
5322 | + b = TREE_OPERAND (TREE_OPERAND (c, 1), 0); | |
5323 | + if (! (b && TREE_CODE (b) == NOP_EXPR | |
5324 | + && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR)) | |
5325 | + return t; | |
5326 | + | |
5327 | + ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0); | |
5328 | + if (! (ns && TREE_CODE (ns) == NOP_EXPR | |
5329 | + && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR)) | |
5330 | + return t; | |
5331 | + | |
5332 | + decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0); | |
5333 | + if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF) | |
5334 | + /* It's got to be the an equivalent decl */ | |
5335 | + && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0))) | |
5336 | + { | |
5337 | + /* Shorten the NOP_EXPR/SAVE_EXPR path. */ | |
5338 | + TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0); | |
5339 | + /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */ | |
5340 | + TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1); | |
5341 | + /* Change the right part of the BINOP_EXPR */ | |
5342 | + TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0); | |
5343 | + } | |
5344 | + | |
5345 | + return t; | |
5346 | +} | |
5347 | + | |
5348 | /* Binary operators (15.16 up to 15.18). We return error_mark_node on | |
5349 | errors but we modify NODE so that it contains the type computed | |
5350 | according to the expression, when it's fixed. Otherwise, we write | |
5351 | @@ -12046,6 +12327,12 @@ | |
5352 | if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE) | |
5353 | TREE_SET_CODE (node, TRUNC_DIV_EXPR); | |
5354 | ||
5355 | + if (TREE_CODE (prom_type) == INTEGER_TYPE | |
5356 | + && flag_use_divide_subroutine | |
5357 | + && ! flag_emit_class_files | |
5358 | + && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR)) | |
5359 | + return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2); | |
5360 | + | |
5361 | /* This one is more complicated. FLOATs are processed by a | |
5362 | function call to soft_fmod. Duplicate the value of the | |
5363 | COMPOUND_ASSIGN_P flag. */ | |
5364 | @@ -12658,7 +12945,7 @@ | |
5365 | case PREINCREMENT_EXPR: | |
5366 | /* 15.14.2 Prefix Decrement Operator -- */ | |
5367 | case PREDECREMENT_EXPR: | |
5368 | - decl = strip_out_static_field_access_decl (op); | |
5369 | + op = decl = strip_out_static_field_access_decl (op); | |
5370 | /* We really should have a JAVA_ARRAY_EXPR to avoid this */ | |
5371 | if (!JDECL_P (decl) | |
5372 | && TREE_CODE (decl) != COMPONENT_REF | |
5373 | @@ -12697,15 +12984,28 @@ | |
5374 | else | |
5375 | { | |
5376 | /* Before the addition, binary numeric promotion is performed on | |
5377 | - both operands */ | |
5378 | - value = build_int_2 (1, 0); | |
5379 | - TREE_TYPE (node) = | |
5380 | - binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value); | |
5381 | - /* And write the promoted incremented and increment */ | |
5382 | + both operands, if really necessary */ | |
5383 | + if (JINTEGRAL_TYPE_P (op_type)) | |
5384 | + { | |
5385 | + value = build_int_2 (1, 0); | |
5386 | + TREE_TYPE (value) = TREE_TYPE (node) = op_type; | |
5387 | + } | |
5388 | + else | |
5389 | + { | |
5390 | + value = build_int_2 (1, 0); | |
5391 | + TREE_TYPE (node) = | |
5392 | + binary_numeric_promotion (op_type, | |
5393 | + TREE_TYPE (value), &op, &value); | |
5394 | + } | |
5395 | + /* And write back into the node. */ | |
5396 | TREE_OPERAND (node, 0) = op; | |
5397 | TREE_OPERAND (node, 1) = value; | |
5398 | - /* Convert the overall back into its original type. */ | |
5399 | - return fold (convert (op_type, node)); | |
5400 | + /* Convert the overall back into its original type, if | |
5401 | + necessary, and return */ | |
5402 | + if (JINTEGRAL_TYPE_P (op_type)) | |
5403 | + return fold (node); | |
5404 | + else | |
5405 | + return fold (convert (op_type, node)); | |
5406 | } | |
5407 | break; | |
5408 | ||
5409 | @@ -13210,6 +13510,7 @@ | |
5410 | new_value = NULL_TREE; | |
5411 | wfl_value = TREE_VALUE (entry); | |
5412 | ||
5413 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
5414 | value = java_complete_tree (TREE_VALUE (entry)); | |
5415 | /* patch_string return error_mark_node if arg is error_mark_node */ | |
5416 | if ((patched = patch_string (value))) | |
5417 | @@ -13225,7 +13526,8 @@ | |
5418 | new_value = try_builtin_assignconv (wfl_operator, type, value); | |
5419 | if (!new_value && (new_value = try_reference_assignconv (type, value))) | |
5420 | type_value = promote_type (type); | |
5421 | - | |
5422 | + | |
5423 | + pop_obstacks (); | |
5424 | /* Check and report errors */ | |
5425 | if (!new_value) | |
5426 | { | |
5427 | @@ -13564,6 +13866,54 @@ | |
5428 | return loop; | |
5429 | } | |
5430 | ||
5431 | +/* Try to find the loop a block might be related to. This comprises | |
5432 | + the case where the LOOP_EXPR is found as the second operand of a | |
5433 | + COMPOUND_EXPR, because the loop happens to have an initialization | |
5434 | + part, then expressed as the first operand of the COMPOUND_EXPR. If | |
5435 | + the search finds something, 1 is returned. Otherwise, 0 is | |
5436 | + returned. The search is assumed to start from a | |
5437 | + LABELED_BLOCK_EXPR's block. */ | |
5438 | + | |
5439 | +static tree | |
5440 | +search_loop (statement) | |
5441 | + tree statement; | |
5442 | +{ | |
5443 | + if (TREE_CODE (statement) == LOOP_EXPR) | |
5444 | + return statement; | |
5445 | + | |
5446 | + if (TREE_CODE (statement) == BLOCK) | |
5447 | + statement = BLOCK_SUBBLOCKS (statement); | |
5448 | + else | |
5449 | + return NULL_TREE; | |
5450 | + | |
5451 | + if (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
5452 | + while (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
5453 | + statement = TREE_OPERAND (statement, 1); | |
5454 | + | |
5455 | + return (TREE_CODE (statement) == LOOP_EXPR | |
5456 | + && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE); | |
5457 | +} | |
5458 | + | |
5459 | +/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is | |
5460 | + returned otherwise. */ | |
5461 | + | |
5462 | +static int | |
5463 | +labeled_block_contains_loop_p (block, loop) | |
5464 | + tree block, loop; | |
5465 | +{ | |
5466 | + if (!block) | |
5467 | + return 0; | |
5468 | + | |
5469 | + if (LABELED_BLOCK_BODY (block) == loop) | |
5470 | + return 1; | |
5471 | + | |
5472 | + if (IS_FOR_LOOP_P (loop) | |
5473 | + && search_loop (LABELED_BLOCK_BODY (block)) == loop) | |
5474 | + return 1; | |
5475 | + | |
5476 | + return 0; | |
5477 | +} | |
5478 | + | |
5479 | /* If the loop isn't surrounded by a labeled statement, create one and | |
5480 | insert LOOP as its body. */ | |
5481 | ||
5482 | @@ -13572,33 +13922,17 @@ | |
5483 | tree loop; | |
5484 | { | |
5485 | tree loop_label; | |
5486 | - tree block = ctxp->current_labeled_block; | |
5487 | + | |
5488 | TREE_TYPE (loop) = void_type_node; | |
5489 | - if (block != NULL_TREE) | |
5490 | - { | |
5491 | - tree block_body = LABELED_BLOCK_BODY (block); | |
5492 | - if (IS_FOR_LOOP_P (loop)) | |
5493 | - { | |
5494 | - if (TREE_CODE (block_body) == BLOCK) | |
5495 | - { | |
5496 | - block_body = BLOCK_EXPR_BODY (block_body); | |
5497 | - if (block_body == loop | |
5498 | - || (TREE_CODE (block_body) == COMPOUND_EXPR | |
5499 | - && TREE_OPERAND (block_body, 1) == loop)) | |
5500 | - return loop; | |
5501 | - } | |
5502 | - } | |
5503 | - else | |
5504 | - { | |
5505 | - if (block_body == loop) | |
5506 | - return loop; | |
5507 | - } | |
5508 | - } | |
5509 | + if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop)) | |
5510 | + return loop; | |
5511 | + | |
5512 | loop_label = build_labeled_block (0, NULL_TREE); | |
5513 | + /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL | |
5514 | + that LOOP_LABEL could enquire about, for a better accuracy. FIXME */ | |
5515 | LABELED_BLOCK_BODY (loop_label) = loop; | |
5516 | PUSH_LABELED_BLOCK (loop_label); | |
5517 | - loop = loop_label; | |
5518 | - return loop; | |
5519 | + return loop_label; | |
5520 | } | |
5521 | ||
5522 | /* 14.13, 14.14: break and continue Statements */ | |
5523 | @@ -13690,7 +14024,7 @@ | |
5524 | } | |
5525 | target_stmt = LABELED_BLOCK_BODY (labeled_block); | |
5526 | if (TREE_CODE (target_stmt) == SWITCH_EXPR | |
5527 | - || TREE_CODE (target_stmt) == LOOP_EXPR) | |
5528 | + || search_loop (target_stmt)) | |
5529 | { | |
5530 | bc_label = labeled_block; | |
5531 | break; | |
5532 | @@ -13704,7 +14038,7 @@ | |
5533 | /* Our break/continue don't return values. */ | |
5534 | TREE_TYPE (node) = void_type_node; | |
5535 | /* Encapsulate the break within a compound statement so that it's | |
5536 | - expanded all the times by expand_expr (and not clobered | |
5537 | + expanded all the times by expand_expr (and not clobbered | |
5538 | sometimes, like after a if statement) */ | |
5539 | node = add_stmt_to_compound (NULL_TREE, void_type_node, node); | |
5540 | TREE_SIDE_EFFECTS (node) = 1; | |
5541 | @@ -14099,11 +14433,20 @@ | |
5542 | continue; | |
5543 | #endif | |
5544 | EXPR_WFL_LINECOL (wfl_operator) = location; | |
5545 | - parse_error_context | |
5546 | - (wfl_operator, "Exception `%s' must be caught, or it must be " | |
5547 | - "declared in the `throws' clause of `%s'", | |
5548 | - lang_printable_name (TREE_VALUE (throws), 0), | |
5549 | - IDENTIFIER_POINTER (DECL_NAME (current_function_decl))); | |
5550 | + if (DECL_NAME (current_function_decl) == finit_identifier_node) | |
5551 | + parse_error_context | |
5552 | + (wfl_operator, "Exception `%s' can't be thrown in initializer", | |
5553 | + lang_printable_name (TREE_VALUE (throws), 0)); | |
5554 | + else | |
5555 | + { | |
5556 | + parse_error_context | |
5557 | + (wfl_operator, "Exception `%s' must be caught, or it must be " | |
5558 | + "declared in the `throws' clause of `%s'", | |
5559 | + lang_printable_name (TREE_VALUE (throws), 0), | |
5560 | + (DECL_NAME (current_function_decl) == init_identifier_node ? | |
5561 | + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) : | |
5562 | + IDENTIFIER_POINTER (DECL_NAME (current_function_decl)))); | |
5563 | + } | |
5564 | } | |
5565 | } | |
5566 | ||
5567 | Only in gcc-2.95.2/gcc/java: parse.c.orig | |
5568 | Only in gcc-2.95.2/gcc/java: parse.c.rej | |
5569 | diff -u -r gcc-2.95.2-orig/gcc/java/parse.y gcc-2.95.2/gcc/java/parse.y | |
5570 | --- gcc-2.95.2-orig/gcc/java/parse.y Mon Jun 28 15:56:22 1999 | |
5571 | +++ gcc-2.95.2/gcc/java/parse.y Sun Oct 31 21:27:43 1999 | |
5572 | @@ -91,6 +91,7 @@ | |
5573 | static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...)) | |
5574 | ATTRIBUTE_PRINTF_2; | |
5575 | static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list)); | |
5576 | +static void parse_ctor_invocation_error PROTO ((void)); | |
5577 | static tree parse_jdk1_1_error PROTO ((char *)); | |
5578 | static void complete_class_report_errors PROTO ((jdep *)); | |
5579 | static int process_imports PROTO ((void)); | |
5580 | @@ -243,6 +244,7 @@ | |
5581 | static tree strip_out_static_field_access_decl PROTO ((tree)); | |
5582 | static jdeplist *reverse_jdep_list PROTO ((struct parser_ctxt *)); | |
5583 | static void static_ref_err PROTO ((tree, tree, tree)); | |
5584 | +static tree java_refold PROTO ((tree)); | |
5585 | ||
5586 | /* Number of error found so far. */ | |
5587 | int java_error_count; | |
5588 | @@ -274,6 +276,10 @@ | |
5589 | binop_lookup [((VALUE) - PLUS_TK)% \ | |
5590 | (sizeof (binop_lookup) / sizeof (binop_lookup[0]))] | |
5591 | ||
5592 | +/* This is the end index for binary operators that can also be used | |
5593 | + in compound assignements. */ | |
5594 | +#define BINOP_COMPOUND_CANDIDATES 11 | |
5595 | + | |
5596 | /* Fake WFL used to report error message. It is initialized once if | |
5597 | needed and reused with it's location information is overriden. */ | |
5598 | tree wfl_operator = NULL_TREE; | |
5599 | @@ -1318,16 +1324,14 @@ | |
5600 | {yyerror ("')' expected"); RECOVER;} | |
5601 | | this_or_super OP_TK CP_TK error | |
5602 | { | |
5603 | - yyerror ("Constructor invocation must be first " | |
5604 | - "thing in a constructor"); | |
5605 | + parse_ctor_invocation_error (); | |
5606 | RECOVER; | |
5607 | } | |
5608 | | this_or_super OP_TK argument_list error | |
5609 | {yyerror ("')' expected"); RECOVER;} | |
5610 | | this_or_super OP_TK argument_list CP_TK error | |
5611 | { | |
5612 | - yyerror ("Constructor invocation must be first " | |
5613 | - "thing in a constructor"); | |
5614 | + parse_ctor_invocation_error (); | |
5615 | RECOVER; | |
5616 | } | |
5617 | | name DOT_TK SUPER_TK error | |
5618 | @@ -2409,7 +2413,17 @@ | |
5619 | free (toFree); | |
5620 | } | |
5621 | ||
5622 | -/* Reporting JDK1.1 features not implemented */ | |
5623 | +/* Reporting an constructor invocation error. */ | |
5624 | +static void | |
5625 | +parse_ctor_invocation_error () | |
5626 | +{ | |
5627 | + if (DECL_CONSTRUCTOR_P (current_function_decl)) | |
5628 | + yyerror ("Constructor invocation must be first thing in a constructor"); | |
5629 | + else | |
5630 | + yyerror ("Only constructors can invoke constructors"); | |
5631 | +} | |
5632 | + | |
5633 | +/* Reporting JDK1.1 features not implemented. */ | |
5634 | ||
5635 | static tree | |
5636 | parse_jdk1_1_error (msg) | |
5637 | @@ -3318,13 +3332,18 @@ | |
5638 | { | |
5639 | tree meth = TREE_VALUE (mdecl); | |
5640 | tree id = TREE_PURPOSE (mdecl); | |
5641 | - tree this_class = TREE_TYPE (ctxp->current_parsed_class); | |
5642 | tree type_wfl = NULL_TREE; | |
5643 | - tree meth_name = NULL_TREE, current, orig_arg; | |
5644 | + tree meth_name = NULL_TREE; | |
5645 | + tree current, orig_arg, this_class; | |
5646 | int saved_lineno; | |
5647 | int constructor_ok = 0, must_chain; | |
5648 | ||
5649 | check_modifiers_consistency (flags); | |
5650 | + | |
5651 | + if (ctxp->current_parsed_class) | |
5652 | + this_class = TREE_TYPE (ctxp->current_parsed_class); | |
5653 | + else | |
5654 | + return NULL_TREE; | |
5655 | ||
5656 | /* There are some forbidden modifiers for an abstract method and its | |
5657 | class must be abstract as well. */ | |
5658 | @@ -3520,7 +3539,12 @@ | |
5659 | finish_method_declaration (method_body) | |
5660 | tree method_body; | |
5661 | { | |
5662 | - int flags = get_access_flags_from_decl (current_function_decl); | |
5663 | + int flags; | |
5664 | + | |
5665 | + if (!current_function_decl) | |
5666 | + return; | |
5667 | + | |
5668 | + flags = get_access_flags_from_decl (current_function_decl); | |
5669 | ||
5670 | /* 8.4.5 Method Body */ | |
5671 | if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body) | |
5672 | @@ -4335,7 +4359,9 @@ | |
5673 | ||
5674 | /* Resolve and layout if necessary */ | |
5675 | layout_class_methods (TREE_TYPE (decl)); | |
5676 | - if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl))) | |
5677 | + /* Check methods, but only once */ | |
5678 | + if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) | |
5679 | + && !CLASS_LOADED_P (TREE_TYPE (decl))) | |
5680 | CHECK_METHODS (decl); | |
5681 | if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl))) | |
5682 | safe_layout_class (TREE_TYPE (decl)); | |
5683 | @@ -4516,7 +4542,7 @@ | |
5684 | ||
5685 | /* Track method being redefined inside the same class. As a side | |
5686 | effect, set DECL_NAME to an IDENTIFIER (prior entering this | |
5687 | - function it's a FWL, so we can track errors more accurately */ | |
5688 | + function it's a FWL, so we can track errors more accurately.) */ | |
5689 | ||
5690 | static int | |
5691 | check_method_redefinition (class, method) | |
5692 | @@ -4552,9 +4578,126 @@ | |
5693 | return 0; | |
5694 | } | |
5695 | ||
5696 | -/* Check all the methods of CLASS. Methods are first completed then | |
5697 | - checked according to regular method existance rules. | |
5698 | - If no constructor were encountered, then build its declaration. */ | |
5699 | +static void | |
5700 | +check_abstract_method_definitions (do_interface, class_decl, type) | |
5701 | + int do_interface; | |
5702 | + tree class_decl, type; | |
5703 | +{ | |
5704 | + tree class = TREE_TYPE (class_decl); | |
5705 | + tree method, end_type; | |
5706 | + | |
5707 | + end_type = (do_interface ? object_type_node : type); | |
5708 | + for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method)) | |
5709 | + { | |
5710 | + tree other_super, other_method, method_sig, method_name; | |
5711 | + int found = 0; | |
5712 | + | |
5713 | + if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method)) | |
5714 | + continue; | |
5715 | + | |
5716 | + /* Now verify that somewhere in between TYPE and CLASS, | |
5717 | + abstract method METHOD gets a non abstract definition | |
5718 | + that is inherited by CLASS. */ | |
5719 | + | |
5720 | + method_sig = build_java_signature (TREE_TYPE (method)); | |
5721 | + method_name = DECL_NAME (method); | |
5722 | + if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION) | |
5723 | + method_name = EXPR_WFL_NODE (method_name); | |
5724 | + | |
5725 | + for (other_super = class; other_super != end_type; | |
5726 | + other_super = CLASSTYPE_SUPER (other_super)) | |
5727 | + { | |
5728 | + for (other_method = TYPE_METHODS (other_super); other_method; | |
5729 | + other_method = TREE_CHAIN (other_method)) | |
5730 | + { | |
5731 | + tree s = build_java_signature (TREE_TYPE (other_method)); | |
5732 | + tree other_name = DECL_NAME (other_method); | |
5733 | + | |
5734 | + if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION) | |
5735 | + other_name = EXPR_WFL_NODE (other_name); | |
5736 | + if (!IS_CLINIT (other_method) | |
5737 | + && !DECL_CONSTRUCTOR_P (other_method) | |
5738 | + && method_name == other_name && method_sig == s) | |
5739 | + { | |
5740 | + found = 1; | |
5741 | + break; | |
5742 | + } | |
5743 | + } | |
5744 | + } | |
5745 | + | |
5746 | + /* Report that abstract METHOD didn't find an implementation | |
5747 | + that CLASS can use. */ | |
5748 | + if (!found) | |
5749 | + { | |
5750 | + char *t = strdup (lang_printable_name | |
5751 | + (TREE_TYPE (TREE_TYPE (method)), 0)); | |
5752 | + tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method))); | |
5753 | + tree saved_wfl = NULL_TREE; | |
5754 | + | |
5755 | + if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION) | |
5756 | + { | |
5757 | + saved_wfl = DECL_NAME (method); | |
5758 | + DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method)); | |
5759 | + } | |
5760 | + | |
5761 | + parse_error_context | |
5762 | + (lookup_cl (class_decl), | |
5763 | + "Class `%s' doesn't define the abstract method `%s %s' from " | |
5764 | + "%s `%s'. This method must be defined or %s `%s' must be " | |
5765 | + "declared abstract", | |
5766 | + IDENTIFIER_POINTER (DECL_NAME (class_decl)), | |
5767 | + t, lang_printable_name (method, 0), | |
5768 | + (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ? | |
5769 | + "interface" : "class"), | |
5770 | + IDENTIFIER_POINTER (ccn), | |
5771 | + (CLASS_INTERFACE (class_decl) ? "interface" : "class"), | |
5772 | + IDENTIFIER_POINTER (DECL_NAME (class_decl))); | |
5773 | + | |
5774 | + free (t); | |
5775 | + | |
5776 | + if (saved_wfl) | |
5777 | + DECL_NAME (method) = saved_wfl; | |
5778 | + } | |
5779 | + } | |
5780 | +} | |
5781 | + | |
5782 | +/* Check that CLASS_DECL somehoow implements all inherited abstract | |
5783 | + methods. */ | |
5784 | + | |
5785 | +static void | |
5786 | +java_check_abstract_method_definitions (class_decl) | |
5787 | + tree class_decl; | |
5788 | +{ | |
5789 | + tree class = TREE_TYPE (class_decl); | |
5790 | + tree super, vector; | |
5791 | + int i; | |
5792 | + | |
5793 | + if (CLASS_ABSTRACT (class_decl)) | |
5794 | + return; | |
5795 | + | |
5796 | + /* Check for inherited types */ | |
5797 | + for (super = CLASSTYPE_SUPER (class); super != object_type_node; | |
5798 | + super = CLASSTYPE_SUPER (super)) | |
5799 | + { | |
5800 | + if (!CLASS_ABSTRACT (TYPE_NAME (super))) | |
5801 | + continue; | |
5802 | + | |
5803 | + check_abstract_method_definitions (0, class_decl, super); | |
5804 | + } | |
5805 | + | |
5806 | + /* Check for implemented interfaces. */ | |
5807 | + vector = TYPE_BINFO_BASETYPES (class); | |
5808 | + for (i = 1; i < TREE_VEC_LENGTH (vector); i++) | |
5809 | + { | |
5810 | + super = BINFO_TYPE (TREE_VEC_ELT (vector, i)); | |
5811 | + check_abstract_method_definitions (1, class_decl, super); | |
5812 | + } | |
5813 | +} | |
5814 | + | |
5815 | +/* Check all the methods of CLASS_DECL. Methods are first completed | |
5816 | + then checked according to regular method existance rules. If no | |
5817 | + constructor for CLASS_DECL were encountered, then build its | |
5818 | + declaration. */ | |
5819 | ||
5820 | static void | |
5821 | java_check_regular_methods (class_decl) | |
5822 | @@ -4730,7 +4873,7 @@ | |
5823 | ||
5824 | /* Don't forget eventual pending found and saved_found_wfl. Take | |
5825 | into account that we might have exited because we saw an | |
5826 | - aritifical method as the last entry. */ | |
5827 | + artificial method as the last entry. */ | |
5828 | ||
5829 | if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl) | |
5830 | DECL_NAME (found) = saved_found_wfl; | |
5831 | @@ -4738,6 +4881,10 @@ | |
5832 | if (!TYPE_NVIRTUALS (class)) | |
5833 | TYPE_METHODS (class) = nreverse (TYPE_METHODS (class)); | |
5834 | ||
5835 | + /* Search for inherited abstract method not yet implemented in this | |
5836 | + class. */ | |
5837 | + java_check_abstract_method_definitions (class_decl); | |
5838 | + | |
5839 | if (!saw_constructor) | |
5840 | { | |
5841 | /* No constructor seen, we craft one, at line 0. Since this | |
5842 | @@ -4943,14 +5090,15 @@ | |
5843 | return NULL_TREE; | |
5844 | } | |
5845 | ||
5846 | -/* Return the line that matches DECL line number. Used during error | |
5847 | - report */ | |
5848 | +/* Return the line that matches DECL line number, and try its best to | |
5849 | + position the column number. Used during error reports. */ | |
5850 | ||
5851 | static tree | |
5852 | lookup_cl (decl) | |
5853 | tree decl; | |
5854 | { | |
5855 | static tree cl = NULL_TREE; | |
5856 | + char *line, *found; | |
5857 | ||
5858 | if (!decl) | |
5859 | return NULL_TREE; | |
5860 | @@ -4961,6 +5109,14 @@ | |
5861 | EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl)); | |
5862 | EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1); | |
5863 | ||
5864 | + line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)), | |
5865 | + EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl)); | |
5866 | + | |
5867 | + found = strstr ((const char *)line, | |
5868 | + (const char *)IDENTIFIER_POINTER (DECL_NAME (decl))); | |
5869 | + if (found) | |
5870 | + EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line); | |
5871 | + | |
5872 | return cl; | |
5873 | } | |
5874 | ||
5875 | @@ -5495,6 +5651,9 @@ | |
5876 | tree parm_decl; | |
5877 | int i; | |
5878 | ||
5879 | + if (!fndecl) | |
5880 | + return; | |
5881 | + | |
5882 | current_function_decl = fndecl; | |
5883 | ||
5884 | /* New scope for the function */ | |
5885 | @@ -5614,6 +5773,9 @@ | |
5886 | tree fndecl = current_function_decl; | |
5887 | int flag_asynchronous_exceptions = asynchronous_exceptions; | |
5888 | ||
5889 | + if (!fndecl) | |
5890 | + return; | |
5891 | + | |
5892 | java_parser_context_save_global (); | |
5893 | lineno = ctxp->last_ccb_indent1; | |
5894 | ||
5895 | @@ -5669,6 +5831,8 @@ | |
5896 | java_method_add_stmt (fndecl, expr) | |
5897 | tree fndecl, expr; | |
5898 | { | |
5899 | + if (!GET_CURRENT_BLOCK (fndecl)) | |
5900 | + return NULL_TREE; | |
5901 | return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr); | |
5902 | } | |
5903 | ||
5904 | @@ -6067,7 +6231,8 @@ | |
5905 | for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl)) | |
5906 | { | |
5907 | if (DECL_CONSTRUCTOR_P (mdecl) | |
5908 | - && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node) | |
5909 | + && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) | |
5910 | + == end_params_node) | |
5911 | return 0; | |
5912 | } | |
5913 | } | |
5914 | @@ -6410,6 +6575,8 @@ | |
5915 | == soft_initclass_node) | |
5916 | return TREE_OPERAND (op1, 1); | |
5917 | } | |
5918 | + else if (JDECL_P (op1)) | |
5919 | + return op1; | |
5920 | } | |
5921 | return node; | |
5922 | } | |
5923 | @@ -6431,6 +6598,8 @@ | |
5924 | for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q)) | |
5925 | { | |
5926 | tree qual_wfl = QUAL_WFL (q); | |
5927 | + tree ret_decl; /* for EH checking */ | |
5928 | + int location; /* for EH checking */ | |
5929 | ||
5930 | /* 15.10.1 Field Access Using a Primary */ | |
5931 | switch (TREE_CODE (qual_wfl)) | |
5932 | @@ -6449,14 +6618,21 @@ | |
5933 | /* And code for the function call */ | |
5934 | if (complete_function_arguments (qual_wfl)) | |
5935 | return 1; | |
5936 | + | |
5937 | if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR) | |
5938 | CALL_USING_SUPER (qual_wfl) = 1; | |
5939 | - *where_found = | |
5940 | - patch_method_invocation (qual_wfl, decl, type, &is_static, NULL); | |
5941 | + location = (TREE_CODE (qual_wfl) == CALL_EXPR ? | |
5942 | + EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0); | |
5943 | + *where_found = patch_method_invocation (qual_wfl, decl, type, | |
5944 | + &is_static, &ret_decl); | |
5945 | if (*where_found == error_mark_node) | |
5946 | return 1; | |
5947 | *type_found = type = QUAL_DECL_TYPE (*where_found); | |
5948 | ||
5949 | + /* EH check */ | |
5950 | + if (location) | |
5951 | + check_thrown_exceptions (location, ret_decl); | |
5952 | + | |
5953 | /* If the previous call was static and this one is too, | |
5954 | build a compound expression to hold the two (because in | |
5955 | that case, previous function calls aren't transported as | |
5956 | @@ -6491,6 +6667,7 @@ | |
5957 | ||
5958 | case CONDITIONAL_EXPR: | |
5959 | case STRING_CST: | |
5960 | + case MODIFY_EXPR: | |
5961 | *where_found = decl = java_complete_tree (qual_wfl); | |
5962 | if (decl == error_mark_node) | |
5963 | return 1; | |
5964 | @@ -7228,6 +7405,11 @@ | |
5965 | if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) && | |
5966 | TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t)) | |
5967 | TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta)); | |
5968 | + | |
5969 | + /* Resolve unresolved returned type isses */ | |
5970 | + t = TREE_TYPE (TREE_TYPE (method)); | |
5971 | + if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t))) | |
5972 | + resolve_and_layout (TREE_TYPE (t), NULL); | |
5973 | ||
5974 | if (flag_emit_class_files || flag_emit_xref) | |
5975 | func = method; | |
5976 | @@ -7388,7 +7570,7 @@ | |
5977 | parse_error_context (cl, "Can't find %s `%s(%s)' in class `%s'%s", | |
5978 | (lc ? "constructor" : "method"), | |
5979 | (lc ? | |
5980 | - IDENTIFIER_POINTER(DECL_NAME (TYPE_NAME (class))) : | |
5981 | + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))) : | |
5982 | IDENTIFIER_POINTER (name)), | |
5983 | IDENTIFIER_POINTER (signature), | |
5984 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))), | |
5985 | @@ -7407,7 +7589,8 @@ | |
5986 | tree list = NULL_TREE, all_list = NULL_TREE; | |
5987 | ||
5988 | /* Search interfaces */ | |
5989 | - if (CLASS_INTERFACE (TYPE_NAME (class))) | |
5990 | + if (CLASS_INTERFACE (TYPE_NAME (class)) | |
5991 | + || CLASS_ABSTRACT (TYPE_NAME (class))) | |
5992 | { | |
5993 | static tree searched_interfaces = NULL_TREE; | |
5994 | static int search_not_done = 0; | |
5995 | @@ -7638,7 +7821,7 @@ | |
5996 | break; | |
5997 | case NEW_ARRAY_EXPR: | |
5998 | qual = TREE_CHAIN (qual); | |
5999 | - new_array_found = 1; | |
6000 | + again = new_array_found = 1; | |
6001 | continue; | |
6002 | case NEW_CLASS_EXPR: | |
6003 | case CONVERT_EXPR: | |
6004 | @@ -7666,12 +7849,8 @@ | |
6005 | && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION) | |
6006 | name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl)); | |
6007 | ||
6008 | - else if (code == ARRAY_REF && | |
6009 | - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION) | |
6010 | - name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0)); | |
6011 | - | |
6012 | - else if (code == CALL_EXPR && | |
6013 | - TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION) | |
6014 | + else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) && | |
6015 | + TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION) | |
6016 | name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0)); | |
6017 | ||
6018 | else if (code == STRING_CST || code == CONDITIONAL_EXPR) | |
6019 | @@ -7681,8 +7860,15 @@ | |
6020 | again = 1; | |
6021 | } | |
6022 | else | |
6023 | - name = EXPR_WFL_NODE (qual_wfl); | |
6024 | - | |
6025 | + { | |
6026 | + name = EXPR_WFL_NODE (qual_wfl); | |
6027 | + if (!name) | |
6028 | + { | |
6029 | + qual = EXPR_WFL_QUALIFICATION (qual_wfl); | |
6030 | + again = 1; | |
6031 | + } | |
6032 | + } | |
6033 | + | |
6034 | /* If we have a THIS (from a primary), we set the context accordingly */ | |
6035 | if (name == this_identifier_node) | |
6036 | { | |
6037 | @@ -7716,7 +7902,8 @@ | |
6038 | declaration or parameter declaration, then it is an expression | |
6039 | name. We don't carry this test out if we're in the context of the | |
6040 | use of SUPER or THIS */ | |
6041 | - if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name))) | |
6042 | + if (!this_found && !super_found && | |
6043 | + TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name))) | |
6044 | { | |
6045 | RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; | |
6046 | QUAL_RESOLUTION (qual) = decl; | |
6047 | @@ -7733,15 +7920,17 @@ | |
6048 | QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl); | |
6049 | } | |
6050 | ||
6051 | - /* We reclassify NAME as a type name if: | |
6052 | + /* We reclassify NAME as yielding to a type name resolution if: | |
6053 | - NAME is a class/interface declared within the compilation | |
6054 | unit containing NAME, | |
6055 | - NAME is imported via a single-type-import declaration, | |
6056 | - NAME is declared in an another compilation unit of the package | |
6057 | of the compilation unit containing NAME, | |
6058 | - NAME is declared by exactly on type-import-on-demand declaration | |
6059 | - of the compilation unit containing NAME. */ | |
6060 | - else if ((decl = resolve_and_layout (name, NULL_TREE))) | |
6061 | + of the compilation unit containing NAME. | |
6062 | + - NAME is actually a STRING_CST. */ | |
6063 | + else if (TREE_CODE (name) == STRING_CST || | |
6064 | + (decl = resolve_and_layout (name, NULL_TREE))) | |
6065 | { | |
6066 | RESOLVE_TYPE_NAME_P (qual_wfl) = 1; | |
6067 | QUAL_RESOLUTION (qual) = decl; | |
6068 | @@ -7826,7 +8015,9 @@ | |
6069 | { | |
6070 | tree value = DECL_INITIAL (node); | |
6071 | DECL_INITIAL (node) = NULL_TREE; | |
6072 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
6073 | value = fold_constant_for_init (value, node); | |
6074 | + pop_obstacks (); | |
6075 | DECL_INITIAL (node) = value; | |
6076 | if (value != NULL_TREE) | |
6077 | return value; | |
6078 | @@ -7846,8 +8037,7 @@ | |
6079 | TREE_OPERAND (node, 1) = java_stabilize_reference (op1); | |
6080 | return node; | |
6081 | } | |
6082 | - else | |
6083 | - return stabilize_reference (node); | |
6084 | + return stabilize_reference (node); | |
6085 | } | |
6086 | ||
6087 | /* Patch tree nodes in a function body. When a BLOCK is found, push | |
6088 | @@ -8029,8 +8219,12 @@ | |
6089 | && JDECL_P (TREE_OPERAND (cn, 1)) | |
6090 | && FIELD_FINAL (TREE_OPERAND (cn, 1)) | |
6091 | && DECL_INITIAL (TREE_OPERAND (cn, 1))) | |
6092 | - cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)), | |
6093 | - TREE_OPERAND (cn, 1)); | |
6094 | + { | |
6095 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
6096 | + cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)), | |
6097 | + TREE_OPERAND (cn, 1)); | |
6098 | + pop_obstacks (); | |
6099 | + } | |
6100 | ||
6101 | if (!TREE_CONSTANT (cn) && !flag_emit_xref) | |
6102 | { | |
6103 | @@ -8283,7 +8477,11 @@ | |
6104 | && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn) | |
6105 | && DECL_INITIAL (nn) != NULL_TREE) | |
6106 | { | |
6107 | - tree value = fold_constant_for_init (nn, nn); | |
6108 | + tree value; | |
6109 | + | |
6110 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
6111 | + value = fold_constant_for_init (nn, nn); | |
6112 | + pop_obstacks (); | |
6113 | if (value != NULL_TREE) | |
6114 | { | |
6115 | tree type = TREE_TYPE (value); | |
6116 | @@ -8297,14 +8495,17 @@ | |
6117 | if (TREE_OPERAND (node, 0) == error_mark_node) | |
6118 | return error_mark_node; | |
6119 | ||
6120 | - if (COMPOUND_ASSIGN_P (wfl_op2)) | |
6121 | + flag = COMPOUND_ASSIGN_P (wfl_op2); | |
6122 | + if (flag) | |
6123 | { | |
6124 | tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0)); | |
6125 | ||
6126 | /* Hand stablize the lhs on both places */ | |
6127 | TREE_OPERAND (node, 0) = lvalue; | |
6128 | - TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue; | |
6129 | + TREE_OPERAND (TREE_OPERAND (node, 1), 0) = | |
6130 | + (flag_emit_class_files ? lvalue : save_expr (lvalue)); | |
6131 | ||
6132 | + /* 15.25.2.a: Left hand is not an array access. FIXME */ | |
6133 | /* Now complete the RHS. We write it back later on. */ | |
6134 | nn = java_complete_tree (TREE_OPERAND (node, 1)); | |
6135 | ||
6136 | @@ -8315,6 +8516,8 @@ | |
6137 | E1 = (T)(E1 op E2), with T being the type of E1. */ | |
6138 | nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2), | |
6139 | TREE_TYPE (lvalue), nn)); | |
6140 | + | |
6141 | + /* 15.25.2.b: Left hand is an array access. FIXME */ | |
6142 | } | |
6143 | ||
6144 | /* If we're about to patch a NEW_ARRAY_INIT, we call a special | |
6145 | @@ -8338,6 +8541,10 @@ | |
6146 | if ((nn = patch_string (TREE_OPERAND (node, 1)))) | |
6147 | TREE_OPERAND (node, 1) = nn; | |
6148 | node = patch_assignment (node, wfl_op1, wfl_op2); | |
6149 | + /* Reorganize the tree if necessary. */ | |
6150 | + if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node)) | |
6151 | + || JSTRING_P (TREE_TYPE (node)))) | |
6152 | + node = java_refold (node); | |
6153 | CAN_COMPLETE_NORMALLY (node) = 1; | |
6154 | return node; | |
6155 | ||
6156 | @@ -9346,6 +9553,81 @@ | |
6157 | #undef BUILD_OPERATOR_STRING | |
6158 | } | |
6159 | ||
6160 | +/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */ | |
6161 | + | |
6162 | +static int | |
6163 | +java_decl_equiv (var_acc1, var_acc2) | |
6164 | + tree var_acc1, var_acc2; | |
6165 | +{ | |
6166 | + if (JDECL_P (var_acc1)) | |
6167 | + return (var_acc1 == var_acc2); | |
6168 | + | |
6169 | + return (TREE_CODE (var_acc1) == COMPONENT_REF | |
6170 | + && TREE_CODE (var_acc2) == COMPONENT_REF | |
6171 | + && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0) | |
6172 | + == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0) | |
6173 | + && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1)); | |
6174 | +} | |
6175 | + | |
6176 | +/* Return a non zero value if CODE is one of the operators that can be | |
6177 | + used in conjunction with the `=' operator in a compound assignment. */ | |
6178 | + | |
6179 | +static int | |
6180 | +binop_compound_p (code) | |
6181 | + enum tree_code code; | |
6182 | +{ | |
6183 | + int i; | |
6184 | + for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++) | |
6185 | + if (binop_lookup [i] == code) | |
6186 | + break; | |
6187 | + | |
6188 | + return i < BINOP_COMPOUND_CANDIDATES; | |
6189 | +} | |
6190 | + | |
6191 | +/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */ | |
6192 | + | |
6193 | +static tree | |
6194 | +java_refold (t) | |
6195 | + tree t; | |
6196 | +{ | |
6197 | + tree c, b, ns, decl; | |
6198 | + | |
6199 | + if (TREE_CODE (t) != MODIFY_EXPR) | |
6200 | + return t; | |
6201 | + | |
6202 | + c = TREE_OPERAND (t, 1); | |
6203 | + if (! (c && TREE_CODE (c) == COMPOUND_EXPR | |
6204 | + && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR | |
6205 | + && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1))))) | |
6206 | + return t; | |
6207 | + | |
6208 | + /* Now the left branch of the binary operator. */ | |
6209 | + b = TREE_OPERAND (TREE_OPERAND (c, 1), 0); | |
6210 | + if (! (b && TREE_CODE (b) == NOP_EXPR | |
6211 | + && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR)) | |
6212 | + return t; | |
6213 | + | |
6214 | + ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0); | |
6215 | + if (! (ns && TREE_CODE (ns) == NOP_EXPR | |
6216 | + && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR)) | |
6217 | + return t; | |
6218 | + | |
6219 | + decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0); | |
6220 | + if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF) | |
6221 | + /* It's got to be the an equivalent decl */ | |
6222 | + && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0))) | |
6223 | + { | |
6224 | + /* Shorten the NOP_EXPR/SAVE_EXPR path. */ | |
6225 | + TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0); | |
6226 | + /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */ | |
6227 | + TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1); | |
6228 | + /* Change the right part of the BINOP_EXPR */ | |
6229 | + TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0); | |
6230 | + } | |
6231 | + | |
6232 | + return t; | |
6233 | +} | |
6234 | + | |
6235 | /* Binary operators (15.16 up to 15.18). We return error_mark_node on | |
6236 | errors but we modify NODE so that it contains the type computed | |
6237 | according to the expression, when it's fixed. Otherwise, we write | |
6238 | @@ -9392,6 +9674,12 @@ | |
6239 | if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE) | |
6240 | TREE_SET_CODE (node, TRUNC_DIV_EXPR); | |
6241 | ||
6242 | + if (TREE_CODE (prom_type) == INTEGER_TYPE | |
6243 | + && flag_use_divide_subroutine | |
6244 | + && ! flag_emit_class_files | |
6245 | + && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR)) | |
6246 | + return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2); | |
6247 | + | |
6248 | /* This one is more complicated. FLOATs are processed by a | |
6249 | function call to soft_fmod. Duplicate the value of the | |
6250 | COMPOUND_ASSIGN_P flag. */ | |
6251 | @@ -10004,7 +10292,7 @@ | |
6252 | case PREINCREMENT_EXPR: | |
6253 | /* 15.14.2 Prefix Decrement Operator -- */ | |
6254 | case PREDECREMENT_EXPR: | |
6255 | - decl = strip_out_static_field_access_decl (op); | |
6256 | + op = decl = strip_out_static_field_access_decl (op); | |
6257 | /* We really should have a JAVA_ARRAY_EXPR to avoid this */ | |
6258 | if (!JDECL_P (decl) | |
6259 | && TREE_CODE (decl) != COMPONENT_REF | |
6260 | @@ -10043,15 +10331,28 @@ | |
6261 | else | |
6262 | { | |
6263 | /* Before the addition, binary numeric promotion is performed on | |
6264 | - both operands */ | |
6265 | - value = build_int_2 (1, 0); | |
6266 | - TREE_TYPE (node) = | |
6267 | - binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value); | |
6268 | - /* And write the promoted incremented and increment */ | |
6269 | + both operands, if really necessary */ | |
6270 | + if (JINTEGRAL_TYPE_P (op_type)) | |
6271 | + { | |
6272 | + value = build_int_2 (1, 0); | |
6273 | + TREE_TYPE (value) = TREE_TYPE (node) = op_type; | |
6274 | + } | |
6275 | + else | |
6276 | + { | |
6277 | + value = build_int_2 (1, 0); | |
6278 | + TREE_TYPE (node) = | |
6279 | + binary_numeric_promotion (op_type, | |
6280 | + TREE_TYPE (value), &op, &value); | |
6281 | + } | |
6282 | + /* And write back into the node. */ | |
6283 | TREE_OPERAND (node, 0) = op; | |
6284 | TREE_OPERAND (node, 1) = value; | |
6285 | - /* Convert the overall back into its original type. */ | |
6286 | - return fold (convert (op_type, node)); | |
6287 | + /* Convert the overall back into its original type, if | |
6288 | + necessary, and return */ | |
6289 | + if (JINTEGRAL_TYPE_P (op_type)) | |
6290 | + return fold (node); | |
6291 | + else | |
6292 | + return fold (convert (op_type, node)); | |
6293 | } | |
6294 | break; | |
6295 | ||
6296 | @@ -10556,6 +10857,7 @@ | |
6297 | new_value = NULL_TREE; | |
6298 | wfl_value = TREE_VALUE (entry); | |
6299 | ||
6300 | + push_obstacks (&permanent_obstack, &permanent_obstack); | |
6301 | value = java_complete_tree (TREE_VALUE (entry)); | |
6302 | /* patch_string return error_mark_node if arg is error_mark_node */ | |
6303 | if ((patched = patch_string (value))) | |
6304 | @@ -10571,7 +10873,8 @@ | |
6305 | new_value = try_builtin_assignconv (wfl_operator, type, value); | |
6306 | if (!new_value && (new_value = try_reference_assignconv (type, value))) | |
6307 | type_value = promote_type (type); | |
6308 | - | |
6309 | + | |
6310 | + pop_obstacks (); | |
6311 | /* Check and report errors */ | |
6312 | if (!new_value) | |
6313 | { | |
6314 | @@ -10910,6 +11213,54 @@ | |
6315 | return loop; | |
6316 | } | |
6317 | ||
6318 | +/* Try to find the loop a block might be related to. This comprises | |
6319 | + the case where the LOOP_EXPR is found as the second operand of a | |
6320 | + COMPOUND_EXPR, because the loop happens to have an initialization | |
6321 | + part, then expressed as the first operand of the COMPOUND_EXPR. If | |
6322 | + the search finds something, 1 is returned. Otherwise, 0 is | |
6323 | + returned. The search is assumed to start from a | |
6324 | + LABELED_BLOCK_EXPR's block. */ | |
6325 | + | |
6326 | +static tree | |
6327 | +search_loop (statement) | |
6328 | + tree statement; | |
6329 | +{ | |
6330 | + if (TREE_CODE (statement) == LOOP_EXPR) | |
6331 | + return statement; | |
6332 | + | |
6333 | + if (TREE_CODE (statement) == BLOCK) | |
6334 | + statement = BLOCK_SUBBLOCKS (statement); | |
6335 | + else | |
6336 | + return NULL_TREE; | |
6337 | + | |
6338 | + if (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
6339 | + while (statement && TREE_CODE (statement) == COMPOUND_EXPR) | |
6340 | + statement = TREE_OPERAND (statement, 1); | |
6341 | + | |
6342 | + return (TREE_CODE (statement) == LOOP_EXPR | |
6343 | + && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE); | |
6344 | +} | |
6345 | + | |
6346 | +/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is | |
6347 | + returned otherwise. */ | |
6348 | + | |
6349 | +static int | |
6350 | +labeled_block_contains_loop_p (block, loop) | |
6351 | + tree block, loop; | |
6352 | +{ | |
6353 | + if (!block) | |
6354 | + return 0; | |
6355 | + | |
6356 | + if (LABELED_BLOCK_BODY (block) == loop) | |
6357 | + return 1; | |
6358 | + | |
6359 | + if (IS_FOR_LOOP_P (loop) | |
6360 | + && search_loop (LABELED_BLOCK_BODY (block)) == loop) | |
6361 | + return 1; | |
6362 | + | |
6363 | + return 0; | |
6364 | +} | |
6365 | + | |
6366 | /* If the loop isn't surrounded by a labeled statement, create one and | |
6367 | insert LOOP as its body. */ | |
6368 | ||
6369 | @@ -10918,33 +11269,17 @@ | |
6370 | tree loop; | |
6371 | { | |
6372 | tree loop_label; | |
6373 | - tree block = ctxp->current_labeled_block; | |
6374 | + | |
6375 | TREE_TYPE (loop) = void_type_node; | |
6376 | - if (block != NULL_TREE) | |
6377 | - { | |
6378 | - tree block_body = LABELED_BLOCK_BODY (block); | |
6379 | - if (IS_FOR_LOOP_P (loop)) | |
6380 | - { | |
6381 | - if (TREE_CODE (block_body) == BLOCK) | |
6382 | - { | |
6383 | - block_body = BLOCK_EXPR_BODY (block_body); | |
6384 | - if (block_body == loop | |
6385 | - || (TREE_CODE (block_body) == COMPOUND_EXPR | |
6386 | - && TREE_OPERAND (block_body, 1) == loop)) | |
6387 | - return loop; | |
6388 | - } | |
6389 | - } | |
6390 | - else | |
6391 | - { | |
6392 | - if (block_body == loop) | |
6393 | - return loop; | |
6394 | - } | |
6395 | - } | |
6396 | + if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop)) | |
6397 | + return loop; | |
6398 | + | |
6399 | loop_label = build_labeled_block (0, NULL_TREE); | |
6400 | + /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL | |
6401 | + that LOOP_LABEL could enquire about, for a better accuracy. FIXME */ | |
6402 | LABELED_BLOCK_BODY (loop_label) = loop; | |
6403 | PUSH_LABELED_BLOCK (loop_label); | |
6404 | - loop = loop_label; | |
6405 | - return loop; | |
6406 | + return loop_label; | |
6407 | } | |
6408 | ||
6409 | /* 14.13, 14.14: break and continue Statements */ | |
6410 | @@ -11036,7 +11371,7 @@ | |
6411 | } | |
6412 | target_stmt = LABELED_BLOCK_BODY (labeled_block); | |
6413 | if (TREE_CODE (target_stmt) == SWITCH_EXPR | |
6414 | - || TREE_CODE (target_stmt) == LOOP_EXPR) | |
6415 | + || search_loop (target_stmt)) | |
6416 | { | |
6417 | bc_label = labeled_block; | |
6418 | break; | |
6419 | @@ -11050,7 +11385,7 @@ | |
6420 | /* Our break/continue don't return values. */ | |
6421 | TREE_TYPE (node) = void_type_node; | |
6422 | /* Encapsulate the break within a compound statement so that it's | |
6423 | - expanded all the times by expand_expr (and not clobered | |
6424 | + expanded all the times by expand_expr (and not clobbered | |
6425 | sometimes, like after a if statement) */ | |
6426 | node = add_stmt_to_compound (NULL_TREE, void_type_node, node); | |
6427 | TREE_SIDE_EFFECTS (node) = 1; | |
6428 | @@ -11445,11 +11780,20 @@ | |
6429 | continue; | |
6430 | #endif | |
6431 | EXPR_WFL_LINECOL (wfl_operator) = location; | |
6432 | - parse_error_context | |
6433 | - (wfl_operator, "Exception `%s' must be caught, or it must be " | |
6434 | - "declared in the `throws' clause of `%s'", | |
6435 | - lang_printable_name (TREE_VALUE (throws), 0), | |
6436 | - IDENTIFIER_POINTER (DECL_NAME (current_function_decl))); | |
6437 | + if (DECL_NAME (current_function_decl) == finit_identifier_node) | |
6438 | + parse_error_context | |
6439 | + (wfl_operator, "Exception `%s' can't be thrown in initializer", | |
6440 | + lang_printable_name (TREE_VALUE (throws), 0)); | |
6441 | + else | |
6442 | + { | |
6443 | + parse_error_context | |
6444 | + (wfl_operator, "Exception `%s' must be caught, or it must be " | |
6445 | + "declared in the `throws' clause of `%s'", | |
6446 | + lang_printable_name (TREE_VALUE (throws), 0), | |
6447 | + (DECL_NAME (current_function_decl) == init_identifier_node ? | |
6448 | + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) : | |
6449 | + IDENTIFIER_POINTER (DECL_NAME (current_function_decl)))); | |
6450 | + } | |
6451 | } | |
6452 | } | |
6453 | ||
6454 | Only in gcc-2.95.2/gcc/java: parse.y.orig | |
6455 | Only in gcc-2.95.2/gcc/java: parse.y.rej | |
6456 | Only in gcc-2.95.2/gcc/java: super.patch | |
6457 | diff -u -r gcc-2.95.2-orig/gcc/java/typeck.c gcc-2.95.2/gcc/java/typeck.c | |
6458 | --- gcc-2.95.2-orig/gcc/java/typeck.c Fri May 14 02:33:34 1999 | |
6459 | +++ gcc-2.95.2/gcc/java/typeck.c Sat Oct 30 19:45:50 1999 | |
6460 | @@ -55,23 +55,43 @@ | |
6461 | ||
6462 | /* Convert an IEEE real to an integer type. The result of such a | |
6463 | conversion when the source operand is a NaN isn't defined by | |
6464 | - IEEE754, but by the Java language standard: it must be zero. This | |
6465 | - conversion produces something like: | |
6466 | - | |
6467 | - ({ double tmp = expr; (tmp != tmp) ? 0 : (int)tmp; }) | |
6468 | - | |
6469 | - */ | |
6470 | + IEEE754, but by the Java language standard: it must be zero. Also, | |
6471 | + overflows must be clipped to within range. This conversion | |
6472 | + produces something like: | |
6473 | + | |
6474 | + ((expr >= (float)MAX_INT) | |
6475 | + ? MAX_INT | |
6476 | + : ((expr <= (float)MIN_INT) | |
6477 | + ? MIN_INT | |
6478 | + : ((expr != expr) | |
6479 | + ? 0 | |
6480 | + : (int)expr))) */ | |
6481 | ||
6482 | static tree | |
6483 | convert_ieee_real_to_integer (type, expr) | |
6484 | tree type, expr; | |
6485 | { | |
6486 | + tree result; | |
6487 | expr = save_expr (expr); | |
6488 | ||
6489 | - return build (COND_EXPR, type, | |
6490 | - build (NE_EXPR, boolean_type_node, expr, expr), | |
6491 | - convert (type, integer_zero_node), | |
6492 | - convert_to_integer (type, expr)); | |
6493 | + result = build (COND_EXPR, type, | |
6494 | + build (NE_EXPR, boolean_type_node, expr, expr), | |
6495 | + convert (type, integer_zero_node), | |
6496 | + convert_to_integer (type, expr)); | |
6497 | + | |
6498 | + result = build (COND_EXPR, type, | |
6499 | + build (LE_EXPR, boolean_type_node, expr, | |
6500 | + convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))), | |
6501 | + TYPE_MIN_VALUE (type), | |
6502 | + result); | |
6503 | + | |
6504 | + result = build (COND_EXPR, type, | |
6505 | + build (GE_EXPR, boolean_type_node, expr, | |
6506 | + convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))), | |
6507 | + TYPE_MAX_VALUE (type), | |
6508 | + result); | |
6509 | + | |
6510 | + return result; | |
6511 | } | |
6512 | ||
6513 | /* Create an expression whose value is that of EXPR, | |
6514 | @@ -100,12 +120,9 @@ | |
6515 | return fold (convert_to_boolean (type, expr)); | |
6516 | if (code == INTEGER_TYPE) | |
6517 | { | |
6518 | - if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE | |
6519 | -#ifdef TARGET_SOFT_FLOAT | |
6520 | - && !TARGET_SOFT_FLOAT | |
6521 | -#endif | |
6522 | - && !flag_emit_class_files | |
6523 | - && !flag_fast_math | |
6524 | + if (! flag_fast_math | |
6525 | + && ! flag_emit_class_files | |
6526 | + && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE | |
6527 | && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT) | |
6528 | return fold (convert_ieee_real_to_integer (type, expr)); | |
6529 | else | |
6530 | Only in gcc-2.95.2/gcc/java: typeck.c.orig | |
6531 | diff -u -r gcc-2.95.2-orig/gcc/java/verify.c gcc-2.95.2/gcc/java/verify.c | |
6532 | --- gcc-2.95.2-orig/gcc/java/verify.c Wed Jun 23 11:33:10 1999 | |
6533 | +++ gcc-2.95.2/gcc/java/verify.c Sun Oct 31 14:53:38 1999 | |
6534 | @@ -397,7 +397,8 @@ | |
6535 | || handler_pc < 0 || handler_pc >= length | |
6536 | || (handler_pc >= start_pc && handler_pc < end_pc) | |
6537 | || ! (instruction_bits [start_pc] & BCODE_INSTRUCTION_START) | |
6538 | - || ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START) | |
6539 | + || (end_pc < length && | |
6540 | + ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START)) | |
6541 | || ! (instruction_bits [handler_pc] & BCODE_INSTRUCTION_START)) | |
6542 | { | |
6543 | error ("bad pc in exception_table"); |