diff options
-rw-r--r-- | gcc/java/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/java/parse.y | 1519 |
2 files changed, 765 insertions, 760 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 56fda44..c650282 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2002-06-10 Akim Demaille <akim@epita.fr> + + * parse.y (interface_type_list, class_member_declaration) + (unary_expression_not_plus_minus): Remove duplicate %type. + Whitespace changes. + 2002-06-09 Tom Tromey <tromey@redhat.com> * Make-lang.in (java/lang.o): Use LANGHOOKS_DEF_H. diff --git a/gcc/java/parse.y b/gcc/java/parse.y index ed8a132..864984b 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -35,7 +35,7 @@ Language Specification. J. Gosling, B. Joy, G. Steele. Addison Wesley The following modifications were brought to the original grammar: method_body: added the rule '| block SC_TK' -static_initializer: added the rule 'static block SC_TK'. +static_initializer: added the rule 'static block SC_TK'. Note: All the extra rules described above should go away when the empty_statement rule will work. @@ -117,7 +117,7 @@ static void check_abstract_method_header PARAMS ((tree)); static tree lookup_java_interface_method2 PARAMS ((tree, tree)); static tree resolve_expression_name PARAMS ((tree, tree *)); static tree maybe_create_class_interface_decl PARAMS ((tree, tree, tree, tree)); -static int check_class_interface_creation PARAMS ((int, int, tree, +static int check_class_interface_creation PARAMS ((int, int, tree, tree, tree, tree)); static tree patch_method_invocation PARAMS ((tree, tree, tree, int, int *, tree *)); @@ -127,9 +127,9 @@ static tree resolve_and_layout PARAMS ((tree, tree)); static tree qualify_and_find PARAMS ((tree, tree, tree)); static tree resolve_no_layout PARAMS ((tree, tree)); static int invocation_mode PARAMS ((tree, int)); -static tree find_applicable_accessible_methods_list PARAMS ((int, tree, +static tree find_applicable_accessible_methods_list PARAMS ((int, tree, tree, tree)); -static void search_applicable_methods_list PARAMS ((int, tree, tree, tree, +static void search_applicable_methods_list PARAMS ((int, tree, tree, tree, tree *, tree *)); static tree find_most_specific_methods_list PARAMS ((tree)); static int argument_types_convertible PARAMS ((tree, tree)); @@ -181,7 +181,7 @@ static tree patch_array_ref PARAMS ((tree)); static tree make_qualified_name PARAMS ((tree, tree, int)); static tree merge_qualified_name PARAMS ((tree, tree)); static tree make_qualified_primary PARAMS ((tree, tree, int)); -static int resolve_qualified_expression_name PARAMS ((tree, tree *, +static int resolve_qualified_expression_name PARAMS ((tree, tree *, tree *, tree *)); static void qualify_ambiguous_name PARAMS ((tree)); static tree resolve_field_access PARAMS ((tree, tree *, tree *)); @@ -194,7 +194,7 @@ static tree build_return PARAMS ((int, tree)); static tree patch_return PARAMS ((tree)); static tree maybe_access_field PARAMS ((tree, tree, tree)); static int complete_function_arguments PARAMS ((tree)); -static int check_for_static_method_reference PARAMS ((tree, tree, tree, +static int check_for_static_method_reference PARAMS ((tree, tree, tree, tree, tree)); static int not_accessible_p PARAMS ((tree, tree, tree, int)); static void check_deprecation PARAMS ((tree, tree)); @@ -311,7 +311,7 @@ static tree maybe_build_thisn_access_method PARAMS ((tree)); static tree build_outer_field_access PARAMS ((tree, tree)); static tree build_outer_field_access_methods PARAMS ((tree)); -static tree build_outer_field_access_expr PARAMS ((int, tree, tree, +static tree build_outer_field_access_expr PARAMS ((int, tree, tree, tree, tree)); static tree build_outer_method_access_method PARAMS ((tree)); static tree build_new_access_id PARAMS ((void)); @@ -319,7 +319,7 @@ static tree build_outer_field_access_method PARAMS ((tree, tree, tree, tree, tree)); static int outer_field_access_p PARAMS ((tree, tree)); -static int outer_field_expanded_access_p PARAMS ((tree, tree *, +static int outer_field_expanded_access_p PARAMS ((tree, tree *, tree *, tree *)); static tree outer_field_access_fix PARAMS ((tree, tree, tree)); static tree build_incomplete_class_ref PARAMS ((int, tree)); @@ -340,14 +340,14 @@ static int emit_test_initialization PARAMS ((PTR *, PTR)); static char *string_convert_int_cst PARAMS ((tree)); /* Number of error found so far. */ -int java_error_count; +int java_error_count; /* Number of warning found so far. */ int java_warning_count; /* Tell when not to fold, when doing xrefs */ int do_not_fold; /* Cyclic inheritance report, as it can be set by layout_class */ const char *cyclic_inheritance_report; - + /* The current parser context */ struct parser_ctxt *ctxp; @@ -359,10 +359,10 @@ struct parser_ctxt *ctxp_for_generation = NULL; covers both integral/floating point division. The code is changed once the type of both operator is worked out. */ -static const enum tree_code binop_lookup[19] = - { +static const enum tree_code binop_lookup[19] = + { PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR, - LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR, + LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR, BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR, TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR, @@ -378,7 +378,7 @@ static const enum tree_code binop_lookup[19] = static GTY(()) tree label_id; /* The "StringBuffer" identifier used for the String `+' operator. */ -static GTY(()) tree wfl_string_buffer; +static GTY(()) tree wfl_string_buffer; /* The "append" identifier used for String `+' operator. */ static GTY(()) tree wfl_append; @@ -397,7 +397,7 @@ static GTY(()) tree inst_id; static GTY(()) tree java_lang_cloneable; /* The "java.io.Serializable" qualified name. */ -static GTY(()) tree java_io_serializable; +static GTY(()) tree java_io_serializable; /* Context and flag for static blocks */ static GTY(()) tree current_static_block; @@ -407,7 +407,7 @@ static GTY(()) tree wpv_id; /* The list of all packages we've seen so far */ static GTY(()) tree package_list; - + /* Hold THIS for the scope of the current method decl. */ static GTY(()) tree current_this; @@ -420,7 +420,7 @@ static GTY(()) tree currently_caught_type_list; are duplicate labels. FIXME: probably this should just be attached to the switch itself; then it could be referenced via `ctxp->current_loop'. */ -static GTY(()) tree case_label_list; +static GTY(()) tree case_label_list; /* Anonymous class counter. Will be reset to 1 every time a non anonymous class gets created. */ @@ -471,13 +471,13 @@ static GTY(()) tree src_parse_roots[1]; %token PLUS_TK MINUS_TK MULT_TK DIV_TK REM_TK %token LS_TK SRS_TK ZRS_TK %token AND_TK XOR_TK OR_TK -%token BOOL_AND_TK BOOL_OR_TK +%token BOOL_AND_TK BOOL_OR_TK %token EQ_TK NEQ_TK GT_TK GTE_TK LT_TK LTE_TK /* This maps to the same binop_lookup entry than the token above */ %token PLUS_ASSIGN_TK MINUS_ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK -%token REM_ASSIGN_TK +%token REM_ASSIGN_TK %token LS_ASSIGN_TK SRS_ASSIGN_TK ZRS_ASSIGN_TK %token AND_ASSIGN_TK XOR_ASSIGN_TK OR_ASSIGN_TK @@ -497,7 +497,7 @@ static GTY(()) tree src_parse_roots[1]; %token DEFAULT_TK IF_TK THROW_TK %token BOOLEAN_TK DO_TK IMPLEMENTS_TK -%token THROWS_TK BREAK_TK IMPORT_TK +%token THROWS_TK BREAK_TK IMPORT_TK %token ELSE_TK INSTANCEOF_TK RETURN_TK %token VOID_TK CATCH_TK INTERFACE_TK %token CASE_TK EXTENDS_TK FINALLY_TK @@ -528,12 +528,11 @@ static GTY(()) tree src_parse_roots[1]; %type <node> type_declaration compilation_unit field_declaration method_declaration extends_interfaces interfaces interface_type_list - class_member_declaration - import_declarations package_declaration + import_declarations package_declaration type_declarations interface_body interface_member_declaration constant_declaration interface_member_declarations interface_type - abstract_method_declaration interface_type_list + abstract_method_declaration %type <node> class_body_declaration class_member_declaration static_initializer constructor_declaration block %type <node> class_body_declarations constructor_header @@ -558,14 +557,14 @@ static GTY(()) tree src_parse_roots[1]; array_creation_expression array_type class_instance_creation_expression field_access method_invocation array_access something_dot_new - argument_list postfix_expression while_expression + argument_list postfix_expression while_expression post_increment_expression post_decrement_expression unary_expression_not_plus_minus unary_expression pre_increment_expression pre_decrement_expression - unary_expression_not_plus_minus cast_expression + cast_expression multiplicative_expression additive_expression - shift_expression relational_expression - equality_expression and_expression + shift_expression relational_expression + equality_expression and_expression exclusive_or_expression inclusive_or_expression conditional_and_expression conditional_or_expression conditional_expression assignment_expression @@ -577,22 +576,22 @@ static GTY(()) tree src_parse_roots[1]; anonymous_class_creation trap_overflow_corner_case %type <node> return_statement break_statement continue_statement -%type <operator> ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK +%type <operator> ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK %type <operator> REM_ASSIGN_TK PLUS_ASSIGN_TK MINUS_ASSIGN_TK %type <operator> LS_ASSIGN_TK SRS_ASSIGN_TK ZRS_ASSIGN_TK %type <operator> AND_ASSIGN_TK XOR_ASSIGN_TK OR_ASSIGN_TK %type <operator> ASSIGN_ANY_TK assignment_operator -%token <operator> EQ_TK GTE_TK ZRS_TK SRS_TK GT_TK LTE_TK LS_TK +%token <operator> EQ_TK GTE_TK ZRS_TK SRS_TK GT_TK LTE_TK LS_TK %token <operator> BOOL_AND_TK AND_TK BOOL_OR_TK OR_TK INCR_TK PLUS_TK %token <operator> DECR_TK MINUS_TK MULT_TK DIV_TK XOR_TK REM_TK NEQ_TK %token <operator> NEG_TK REL_QM_TK REL_CL_TK NOT_TK LT_TK OCB_TK CCB_TK %token <operator> OP_TK OSB_TK DOT_TK THROW_TK INSTANCEOF_TK -%type <operator> THIS_TK SUPER_TK RETURN_TK BREAK_TK CONTINUE_TK +%type <operator> THIS_TK SUPER_TK RETURN_TK BREAK_TK CONTINUE_TK %type <operator> CASE_TK DEFAULT_TK TRY_TK CATCH_TK SYNCHRONIZED_TK %type <operator> NEW_TK -%type <node> method_body - +%type <node> method_body + %type <node> literal INT_LIT_TK FP_LIT_TK BOOL_LIT_TK CHAR_LIT_TK STRING_LIT_TK NULL_TK VOID_TK @@ -601,7 +600,7 @@ static GTY(()) tree src_parse_roots[1]; %type <node> formal_parameter_list formal_parameter method_declarator method_header -%type <node> primitive_type reference_type type +%type <node> primitive_type reference_type type BOOLEAN_TK INTEGRAL_TK FP_TK /* Added or modified JDK 1.1 rule types */ @@ -613,10 +612,10 @@ goal: { /* Register static variables with the garbage collector. */ - ggc_add_root (&ctxp, 1, + ggc_add_root (&ctxp, 1, sizeof (struct parser_ctxt *), mark_parser_ctxt); - ggc_add_root (&ctxp_for_generation, 1, + ggc_add_root (&ctxp_for_generation, 1, sizeof (struct parser_ctxt *), mark_parser_ctxt); } @@ -665,7 +664,7 @@ interface_type: array_type: primitive_type dims - { + { int osb = pop_current_osb (ctxp); tree t = build_java_array_type (($1), -1); while (--osb) @@ -673,7 +672,7 @@ array_type: $$ = t; } | name dims - { + { int osb = pop_current_osb (ctxp); tree t = $1; while (osb--) @@ -731,7 +730,7 @@ type_declarations: package_declaration: PACKAGE_TK name SC_TK - { + { ctxp->package = EXPR_WFL_NODE ($2); register_package (ctxp->package); } @@ -765,7 +764,7 @@ single_type_import_declaration: if (err && err != name) parse_error_context ($2, "Ambiguous class: `%s' and `%s'", - IDENTIFIER_POINTER (name), + IDENTIFIER_POINTER (name), IDENTIFIER_POINTER (err)); else REGISTER_IMPORT ($2, last_name); @@ -793,7 +792,7 @@ type_import_on_demand_declaration: if (! it) { read_import_dir ($2); - ctxp->import_demand_list = + ctxp->import_demand_list = chainon (ctxp->import_demand_list, build_tree_list ($2, NULL_TREE)); } @@ -829,7 +828,7 @@ modifiers: { int acc = (1 << $2); if ($$ & acc) - parse_error_context + parse_error_context (ctxp->modifier_ctx [$2], "Modifier `%s' declared twice", java_accstring_lookup (acc)); else @@ -844,7 +843,7 @@ class_declaration: modifiers CLASS_TK identifier super interfaces { create_class ($1, $3, $4, $5); } class_body -| CLASS_TK identifier super interfaces +| CLASS_TK identifier super interfaces { create_class (0, $2, $3, $4); } class_body | modifiers CLASS_TK error @@ -853,7 +852,7 @@ class_declaration: {yyerror ("Missing class name"); RECOVER;} | CLASS_TK identifier error { - if (!ctxp->class_err) yyerror ("'{' expected"); + if (!ctxp->class_err) yyerror ("'{' expected"); DRECOVER(class1); } | modifiers CLASS_TK identifier error @@ -877,18 +876,18 @@ interfaces: | IMPLEMENTS_TK error { ctxp->class_err=1; - yyerror ("Missing interface name"); + yyerror ("Missing interface name"); } ; interface_type_list: interface_type - { + { ctxp->interface_number = 1; $$ = build_tree_list ($1, NULL_TREE); } | interface_type_list C_TK interface_type - { + { ctxp->interface_number++; $$ = chainon ($1, build_tree_list ($3, NULL_TREE)); } @@ -898,18 +897,18 @@ interface_type_list: class_body: OCB_TK CCB_TK - { + { /* Store the location of the `}' when doing xrefs */ if (flag_emit_xref) - DECL_END_SOURCE_LINE (GET_CPC ()) = + DECL_END_SOURCE_LINE (GET_CPC ()) = EXPR_WFL_ADD_COL ($2.location, 1); $$ = GET_CPC (); } | OCB_TK class_body_declarations CCB_TK - { + { /* Store the location of the `}' when doing xrefs */ if (flag_emit_xref) - DECL_END_SOURCE_LINE (GET_CPC ()) = + DECL_END_SOURCE_LINE (GET_CPC ()) = EXPR_WFL_ADD_COL ($3.location, 1); $$ = GET_CPC (); } @@ -950,7 +949,7 @@ field_declaration: { register_fields (0, $1, $2); } | modifiers type variable_declarators SC_TK { - check_modifiers + check_modifiers ("Illegal modifier `%s' for field declaration", $1, FIELD_MODIFIERS); check_modifiers_consistency ($1); @@ -971,10 +970,10 @@ variable_declarator: variable_declarator_id { $$ = build_tree_list ($1, NULL_TREE); } | variable_declarator_id ASSIGN_TK variable_initializer - { + { if (java_error_count) $3 = NULL_TREE; - $$ = build_tree_list + $$ = build_tree_list ($1, build_assignment ($2.token, $2.location, $1, $3)); } | variable_declarator_id ASSIGN_TK error @@ -998,7 +997,7 @@ variable_declarator_id: | identifier error {yyerror ("Invalid declaration"); DRECOVER(vdi);} | variable_declarator_id OSB_TK error - { + { tree node = java_lval.node; if (node && (TREE_CODE (node) == INTEGER_CST || TREE_CODE (node) == EXPR_WITH_FILE_LOCATION)) @@ -1018,7 +1017,7 @@ variable_initializer: /* 19.8.3 Productions from 8.4: Method Declarations */ method_declaration: - method_header + method_header { current_function_decl = $1; if (current_function_decl @@ -1033,7 +1032,7 @@ method_declaration: {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;} ; -method_header: +method_header: type method_declarator throws { $$ = method_header (0, $1, $2, $3); } | VOID_TK method_declarator throws @@ -1071,7 +1070,7 @@ method_header: method_declarator: identifier OP_TK CP_TK - { + { ctxp->formal_parameter_number = 0; $$ = method_declarator ($1, NULL_TREE); } @@ -1080,10 +1079,10 @@ method_declarator: | method_declarator OSB_TK CSB_TK { EXPR_WFL_LINECOL (wfl_operator) = $2.location; - TREE_PURPOSE ($1) = + TREE_PURPOSE ($1) = build_unresolved_array_type (TREE_PURPOSE ($1)); - parse_warning_context - (wfl_operator, + parse_warning_context + (wfl_operator, "Discouraged form of returned type specification"); } | identifier OP_TK error @@ -1112,7 +1111,7 @@ formal_parameter: $$ = build_tree_list ($2, $1); } | final type variable_declarator_id /* Added, JDK1.1 final parms */ - { + { $$ = build_tree_list ($3, $2); ARG_FINAL_P ($$) = 1; } @@ -1177,7 +1176,7 @@ static: /* Test lval.sub_token here */ /* Can't have a static initializer in an innerclass */ if ($1 | ACC_STATIC && GET_CPC_LIST () && !TOPLEVEL_CLASS_DECL_P (GET_CPC ())) - parse_error_context + parse_error_context (MODIFIER_WFL (STATIC_TK), "Can't define static initializer in class `%s'. Static initializer can only be defined in top-level classes", IDENTIFIER_POINTER (DECL_NAME (GET_CPC ()))); @@ -1205,8 +1204,8 @@ constructor_header: constructor_declarator: simple_name OP_TK CP_TK - { - ctxp->formal_parameter_number = 0; + { + ctxp->formal_parameter_number = 0; $$ = method_declarator ($1, NULL_TREE); } | simple_name OP_TK formal_parameter_list CP_TK @@ -1218,7 +1217,7 @@ constructor_body: body so we can safely perform all the required code addition (super invocation and field initialization) */ block_begin constructor_block_end - { + { BLOCK_EXPR_BODY ($2) = empty_stmt_node; $$ = $2; } @@ -1237,14 +1236,14 @@ constructor_block_end: /* Error recovery for that rule moved down expression_statement: rule. */ explicit_constructor_invocation: this_or_super OP_TK CP_TK SC_TK - { - $$ = build_method_invocation ($1, NULL_TREE); + { + $$ = build_method_invocation ($1, NULL_TREE); $$ = build_debugable_stmt (EXPR_WFL_LINECOL ($1), $$); $$ = java_method_add_stmt (current_function_decl, $$); } | this_or_super OP_TK argument_list CP_TK SC_TK - { - $$ = build_method_invocation ($1, $3); + { + $$ = build_method_invocation ($1, $3); $$ = build_debugable_stmt (EXPR_WFL_LINECOL ($1), $$); $$ = java_method_add_stmt (current_function_decl, $$); } @@ -1294,12 +1293,12 @@ interface_declaration: extends_interfaces: EXTENDS_TK interface_type - { + { ctxp->interface_number = 1; $$ = build_tree_list ($2, NULL_TREE); } | extends_interfaces C_TK interface_type - { + { ctxp->interface_number++; $$ = chainon ($1, build_tree_list ($3, NULL_TREE)); } @@ -1336,7 +1335,7 @@ constant_declaration: abstract_method_declaration: method_header SC_TK - { + { check_abstract_method_header ($1); current_function_decl = NULL_TREE; /* FIXME ? */ } @@ -1358,8 +1357,8 @@ array_initializer: variable_initializers: variable_initializer - { - $$ = tree_cons (maybe_build_array_element_wfl ($1), + { + $$ = tree_cons (maybe_build_array_element_wfl ($1), $1, NULL_TREE); } | variable_initializers C_TK variable_initializer @@ -1373,12 +1372,12 @@ variable_initializers: /* 19.11 Production from 14: Blocks and Statements */ block: OCB_TK CCB_TK - { + { /* Store the location of the `}' when doing xrefs */ if (current_function_decl && flag_emit_xref) - DECL_END_SOURCE_LINE (current_function_decl) = + DECL_END_SOURCE_LINE (current_function_decl) = EXPR_WFL_ADD_COL ($2.location, 1); - $$ = empty_stmt_node; + $$ = empty_stmt_node; } | block_begin block_statements block_end { $$ = $3; } @@ -1391,12 +1390,12 @@ block_begin: block_end: CCB_TK - { + { maybe_absorb_scoping_blocks (); /* Store the location of the `}' when doing xrefs */ if (current_function_decl && flag_emit_xref) - DECL_END_SOURCE_LINE (current_function_decl) = - EXPR_WFL_ADD_COL ($1.location, 1); + DECL_END_SOURCE_LINE (current_function_decl) = + EXPR_WFL_ADD_COL ($1.location, 1); $$ = exit_block (); if (!BLOCK_SUBBLOCKS ($$)) BLOCK_SUBBLOCKS ($$) = empty_stmt_node; @@ -1413,7 +1412,7 @@ block_statement: | statement { java_method_add_stmt (current_function_decl, $1); } | class_declaration /* Added, JDK1.1 local classes */ - { + { LOCAL_CLASS_P (TREE_TYPE (GET_CPC ())) = 1; end_class_declaration (1); } @@ -1465,14 +1464,14 @@ statement_without_trailing_substatement: empty_statement: SC_TK - { - if (flag_extraneous_semicolon - && ! current_static_block - && (! current_function_decl || + { + if (flag_extraneous_semicolon + && ! current_static_block + && (! current_function_decl || /* Verify we're not in a inner class declaration */ (GET_CPC () != TYPE_NAME (DECL_CONTEXT (current_function_decl))))) - + { EXPR_WFL_SET_LINECOL (wfl_operator, lineno, -1); parse_warning_context (wfl_operator, "An empty declaration is a deprecated feature that should not be used"); @@ -1484,7 +1483,7 @@ empty_statement: label_decl: identifier REL_CL_TK { - $$ = build_labeled_block (EXPR_WFL_LINECOL ($1), + $$ = build_labeled_block (EXPR_WFL_LINECOL ($1), EXPR_WFL_NODE ($1)); pushlevel (2); push_labeled_block ($$); @@ -1516,7 +1515,7 @@ expression_statement: info to be eventually generate here. */ $$ = JAVA_MAYBE_GENERATE_DEBUG_INFO ($$); } -| error SC_TK +| error SC_TK { YYNOT_TWICE yyerror ("Invalid expression statement"); DRECOVER (expr_stmt); @@ -1557,7 +1556,7 @@ expression_statement: {yyerror ("';' expected"); RECOVER;} ; -statement_expression: +statement_expression: assignment | pre_increment_expression | pre_decrement_expression @@ -1569,8 +1568,8 @@ statement_expression: if_then_statement: IF_TK OP_TK expression CP_TK statement - { - $$ = build_if_else_statement ($2.location, $3, + { + $$ = build_if_else_statement ($2.location, $3, $5, NULL_TREE); } | IF_TK error @@ -1597,7 +1596,7 @@ switch_statement: enter_block (); } switch_block - { + { /* Make into "proper list" of COMPOUND_EXPRs. I.e. make the last statement also have its own COMPOUND_EXPR. */ @@ -1609,7 +1608,7 @@ switch_statement: switch_expression: SWITCH_TK OP_TK expression CP_TK - { + { $$ = build (SWITCH_EXPR, NULL_TREE, $3, NULL_TREE); EXPR_WFL_LINECOL ($$) = $2.location; } @@ -1635,7 +1634,7 @@ switch_block: { $$ = NULL_TREE; } ; -switch_block_statement_groups: +switch_block_statement_groups: switch_block_statement_group | switch_block_statement_groups switch_block_statement_group ; @@ -1651,13 +1650,13 @@ switch_labels: switch_label: CASE_TK constant_expression REL_CL_TK - { + { tree lab = build1 (CASE_EXPR, NULL_TREE, $2); EXPR_WFL_LINECOL (lab) = $1.location; java_method_add_stmt (current_function_decl, lab); } | DEFAULT_TK REL_CL_TK - { + { tree lab = build (DEFAULT_EXPR, NULL_TREE, NULL_TREE); EXPR_WFL_LINECOL (lab) = $1.location; java_method_add_stmt (current_function_decl, lab); @@ -1672,7 +1671,7 @@ switch_label: while_expression: WHILE_TK OP_TK expression CP_TK - { + { tree body = build_loop_body ($2.location, $3, 0); $$ = build_new_loop (body); } @@ -1696,14 +1695,14 @@ while_statement_nsi: do_statement_begin: DO_TK - { + { tree body = build_loop_body (0, NULL_TREE, 1); $$ = build_new_loop (body); } /* Need error handing here. FIXME */ ; -do_statement: +do_statement: do_statement_begin statement WHILE_TK OP_TK expression CP_TK SC_TK { $$ = finish_loop_body ($4.location, $5, $2, 1); } ; @@ -1716,10 +1715,10 @@ for_statement: $$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7); } | for_begin SC_TK SC_TK for_update CP_TK statement - { + { $$ = finish_for_loop (0, NULL_TREE, $4, $6); /* We have not condition, so we get rid of the EXIT_EXPR */ - LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) = + LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) = empty_stmt_node; } | for_begin SC_TK error @@ -1734,20 +1733,20 @@ for_statement_nsi: for_begin SC_TK expression SC_TK for_update CP_TK statement_nsi { $$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7);} | for_begin SC_TK SC_TK for_update CP_TK statement_nsi - { + { $$ = finish_for_loop (0, NULL_TREE, $4, $6); /* We have not condition, so we get rid of the EXIT_EXPR */ - LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) = + LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) = empty_stmt_node; } ; for_header: FOR_TK OP_TK - { + { /* This scope defined for local variable that may be defined within the scope of the for loop */ - enter_block (); + enter_block (); } | FOR_TK error {yyerror ("'(' expected"); DRECOVER(for_1);} @@ -1757,7 +1756,7 @@ for_header: for_begin: for_header for_init - { + { /* We now declare the loop body. The loop is declared as a for loop. */ tree body = build_loop_body (0, NULL_TREE, 0); @@ -1771,13 +1770,13 @@ for_begin: for_init: /* Can be empty */ { $$ = empty_stmt_node; } | statement_expression_list - { + { /* Init statement recorded within the previously defined block scope */ $$ = java_method_add_stmt (current_function_decl, $1); } | local_variable_declaration - { + { /* Local variable are recorded within the previously defined block scope */ $$ = NULL_TREE; @@ -1836,7 +1835,7 @@ return_statement: throw_statement: THROW_TK expression SC_TK - { + { $$ = build1 (THROW_EXPR, NULL_TREE, $2); EXPR_WFL_LINECOL ($$) = $1.location; } @@ -1848,9 +1847,9 @@ throw_statement: synchronized_statement: synchronized OP_TK expression CP_TK block - { + { $$ = build (SYNCHRONIZED_EXPR, NULL_TREE, $3, $5); - EXPR_WFL_LINECOL ($$) = + EXPR_WFL_LINECOL ($$) = EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK)); } | synchronized OP_TK expression CP_TK error @@ -1870,7 +1869,7 @@ synchronized: "Illegal modifier `%s'. Only `synchronized' was expected here", $1, ACC_SYNCHRONIZED); if ($1 != ACC_SYNCHRONIZED) - MODIFIER_WFL (SYNCHRONIZED_TK) = + MODIFIER_WFL (SYNCHRONIZED_TK) = build_wfl_node (NULL_TREE); } ; @@ -1881,7 +1880,7 @@ try_statement: | TRY_TK block finally { $$ = build_try_finally_statement ($1.location, $2, $3); } | TRY_TK block catches finally - { $$ = build_try_finally_statement + { $$ = build_try_finally_statement ($1.location, build_try_statement ($1.location, $2, $3), $4); } @@ -1892,7 +1891,7 @@ try_statement: catches: catch_clause | catches catch_clause - { + { TREE_CHAIN ($2) = $1; $$ = $2; } @@ -1900,7 +1899,7 @@ catches: catch_clause: catch_clause_parameter block - { + { java_method_add_stmt (current_function_decl, $2); exit_block (); $$ = $1; @@ -1909,14 +1908,14 @@ catch_clause: catch_clause_parameter: CATCH_TK OP_TK formal_parameter CP_TK - { + { /* We add a block to define a scope for formal_parameter (CCBP). The formal parameter is declared initialized by the appropriate function call */ tree ccpb = enter_block (); tree init = build_assignment - (ASSIGN_TK, $2.location, TREE_PURPOSE ($3), + (ASSIGN_TK, $2.location, TREE_PURPOSE ($3), build (JAVA_EXC_OBJ_EXPR, ptr_type_node)); declare_local_variables (0, TREE_VALUE ($3), build_tree_list (TREE_PURPOSE ($3), @@ -1926,9 +1925,9 @@ catch_clause_parameter: } | CATCH_TK error {yyerror ("'(' expected"); RECOVER; $$ = NULL_TREE;} -| CATCH_TK OP_TK error +| CATCH_TK OP_TK error { - yyerror ("Missing term or ')' expected"); + yyerror ("Missing term or ')' expected"); RECOVER; $$ = NULL_TREE; } | CATCH_TK OP_TK error CP_TK /* That's for () */ @@ -1963,11 +1962,11 @@ primary_no_new_array: refering to a 'ClassName' (class_name) rule that doesn't exist. Used name: instead. */ | name DOT_TK THIS_TK - { + { tree wfl = build_wfl_node (this_identifier_node); $$ = make_qualified_primary ($1, wfl, EXPR_WFL_LINECOL ($1)); } -| OP_TK expression error +| OP_TK expression error {yyerror ("')' expected"); RECOVER;} | name DOT_TK error {yyerror ("'class' or 'this' expected" ); RECOVER;} @@ -1985,7 +1984,7 @@ type_literals: | primitive_type DOT_TK CLASS_TK { $$ = build_incomplete_class_ref ($2.location, $1); } | VOID_TK DOT_TK CLASS_TK - { + { $$ = build_incomplete_class_ref ($2.location, void_type_node); } @@ -2001,20 +2000,20 @@ class_instance_creation_expression: primary instead of primary solely which couldn't work in all situations. */ | something_dot_new identifier OP_TK CP_TK - { + { tree ctor = build_new_invocation ($2, NULL_TREE); - $$ = make_qualified_primary ($1, ctor, + $$ = make_qualified_primary ($1, ctor, EXPR_WFL_LINECOL ($1)); } | something_dot_new identifier OP_TK CP_TK class_body | something_dot_new identifier OP_TK argument_list CP_TK - { + { tree ctor = build_new_invocation ($2, $4); - $$ = make_qualified_primary ($1, ctor, + $$ = make_qualified_primary ($1, ctor, EXPR_WFL_LINECOL ($1)); } | something_dot_new identifier OP_TK argument_list CP_TK class_body -| NEW_TK error SC_TK +| NEW_TK error SC_TK {yyerror ("'(' expected"); DRECOVER(new_1);} | NEW_TK class_type error {yyerror ("'(' expected"); RECOVER;} @@ -2034,10 +2033,10 @@ class_instance_creation_expression: in the documentation but doesn't exist. */ anonymous_class_creation: - NEW_TK class_type OP_TK argument_list CP_TK + NEW_TK class_type OP_TK argument_list CP_TK { create_anonymous_class ($1.location, $2); } class_body - { + { tree id = build_wfl_node (DECL_NAME (GET_CPC ())); EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL ($2); @@ -2059,7 +2058,7 @@ anonymous_class_creation: must be generated following the hints provided by the `new' expression. Whether a super constructor of that nature exists or not is to be verified - later on in verify_constructor_super. + later on in verify_constructor_super. It's during the expansion of a `new' statement refering to an anonymous class that a ctor will @@ -2067,10 +2066,10 @@ anonymous_class_creation: right arguments. */ } -| NEW_TK class_type OP_TK CP_TK +| NEW_TK class_type OP_TK CP_TK { create_anonymous_class ($1.location, $2); } - class_body - { + class_body + { tree id = build_wfl_node (DECL_NAME (GET_CPC ())); EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL ($2); @@ -2093,9 +2092,9 @@ something_dot_new: /* Added, not part of the specs. */ argument_list: expression - { + { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); - ctxp->formal_parameter_number = 1; + ctxp->formal_parameter_number = 1; } | argument_list C_TK expression { @@ -2129,12 +2128,12 @@ array_creation_expression: $2, get_identifier (sig), $4); } | NEW_TK primitive_type dims array_initializer - { + { int osb = pop_current_osb (ctxp); tree type = $2; while (osb--) type = build_java_array_type (type, -1); - $$ = build (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE, + $$ = build (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE, build_pointer_type (type), NULL_TREE, $4); } | NEW_TK error CSB_TK @@ -2152,7 +2151,7 @@ dim_exprs: dim_expr: OSB_TK expression CSB_TK - { + { if (JNUMERIC_TYPE_P (TREE_TYPE ($2))) { $2 = build_wfl_node ($2); @@ -2171,9 +2170,9 @@ dim_expr: } ; -dims: +dims: OSB_TK CSB_TK - { + { int allocate = 0; /* If not initialized, allocate memory for the osb numbers stack */ @@ -2185,7 +2184,7 @@ dims: /* If capacity overflown, reallocate a bigger chunk */ else if (ctxp->osb_depth+1 == ctxp->osb_limit) allocate = ctxp->osb_limit << 1; - + if (allocate) { allocate *= sizeof (int); @@ -2207,7 +2206,7 @@ dims: field_access: primary DOT_TK identifier { $$ = make_qualified_primary ($1, $3, $2.location); } - /* FIXME - REWRITE TO: + /* FIXME - REWRITE TO: { $$ = build_binop (COMPONENT_REF, $2.location, $1, $3); } */ | SUPER_TK DOT_TK identifier { @@ -2225,9 +2224,9 @@ method_invocation: | name OP_TK argument_list CP_TK { $$ = build_method_invocation ($1, $3); } | primary DOT_TK identifier OP_TK CP_TK - { + { if (TREE_CODE ($1) == THIS_EXPR) - $$ = build_this_super_qualified_invocation + $$ = build_this_super_qualified_invocation (1, $3, NULL_TREE, 0, $2.location); else { @@ -2236,9 +2235,9 @@ method_invocation: } } | primary DOT_TK identifier OP_TK argument_list CP_TK - { + { if (TREE_CODE ($1) == THIS_EXPR) - $$ = build_this_super_qualified_invocation + $$ = build_this_super_qualified_invocation (1, $3, $5, 0, $2.location); else { @@ -2247,13 +2246,13 @@ method_invocation: } } | SUPER_TK DOT_TK identifier OP_TK CP_TK - { - $$ = build_this_super_qualified_invocation + { + $$ = build_this_super_qualified_invocation (0, $3, NULL_TREE, $1.location, $2.location); } | SUPER_TK DOT_TK identifier OP_TK argument_list CP_TK { - $$ = build_this_super_qualified_invocation + $$ = build_this_super_qualified_invocation (0, $3, $5, $1.location, $2.location); } /* Screws up thing. I let it here until I'm convinced it can @@ -2361,22 +2360,22 @@ unary_expression_not_plus_minus: cast_expression: /* Error handling here is potentially weak */ OP_TK primitive_type dims CP_TK unary_expression - { + { tree type = $2; int osb = pop_current_osb (ctxp); while (osb--) type = build_java_array_type (type, -1); - $$ = build_cast ($1.location, type, $5); + $$ = build_cast ($1.location, type, $5); } | OP_TK primitive_type CP_TK unary_expression { $$ = build_cast ($1.location, $2, $4); } | OP_TK expression CP_TK unary_expression_not_plus_minus { $$ = build_cast ($1.location, $2, $4); } | OP_TK name dims CP_TK unary_expression_not_plus_minus - { + { const char *ptr; - int osb = pop_current_osb (ctxp); - obstack_grow (&temporary_obstack, + int osb = pop_current_osb (ctxp); + obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (EXPR_WFL_NODE ($2)), IDENTIFIER_LENGTH (EXPR_WFL_NODE ($2))); while (osb--) @@ -2404,19 +2403,19 @@ cast_expression: /* Error handling here is potentially weak */ multiplicative_expression: unary_expression | multiplicative_expression MULT_TK unary_expression - { - $$ = build_binop (BINOP_LOOKUP ($2.token), + { + $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, $1, $3); } | multiplicative_expression DIV_TK unary_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | multiplicative_expression REM_TK unary_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | multiplicative_expression MULT_TK error {yyerror ("Missing term"); RECOVER;} @@ -2431,12 +2430,12 @@ additive_expression: | additive_expression PLUS_TK multiplicative_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | additive_expression MINUS_TK multiplicative_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | additive_expression PLUS_TK error {yyerror ("Missing term"); RECOVER;} @@ -2449,17 +2448,17 @@ shift_expression: | shift_expression LS_TK additive_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | shift_expression SRS_TK additive_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | shift_expression ZRS_TK additive_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | shift_expression LS_TK error {yyerror ("Missing term"); RECOVER;} @@ -2474,22 +2473,22 @@ relational_expression: | relational_expression LT_TK shift_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | relational_expression GT_TK shift_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | relational_expression LTE_TK shift_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | relational_expression GTE_TK shift_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | relational_expression INSTANCEOF_TK reference_type { $$ = build_binop (INSTANCEOF_EXPR, $2.location, $1, $3); } @@ -2510,12 +2509,12 @@ equality_expression: | equality_expression EQ_TK relational_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | equality_expression NEQ_TK relational_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | equality_expression EQ_TK error {yyerror ("Missing term"); RECOVER;} @@ -2528,7 +2527,7 @@ and_expression: | and_expression AND_TK equality_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | and_expression AND_TK error {yyerror ("Missing term"); RECOVER;} @@ -2539,7 +2538,7 @@ exclusive_or_expression: | exclusive_or_expression XOR_TK and_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | exclusive_or_expression XOR_TK error {yyerror ("Missing term"); RECOVER;} @@ -2550,7 +2549,7 @@ inclusive_or_expression: | inclusive_or_expression OR_TK exclusive_or_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | inclusive_or_expression OR_TK error {yyerror ("Missing term"); RECOVER;} @@ -2561,7 +2560,7 @@ conditional_and_expression: | conditional_and_expression BOOL_AND_TK inclusive_or_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | conditional_and_expression BOOL_AND_TK error {yyerror ("Missing term"); RECOVER;} @@ -2572,7 +2571,7 @@ conditional_or_expression: | conditional_or_expression BOOL_OR_TK conditional_and_expression { $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location, - $1, $3); + $1, $3); } | conditional_or_expression BOOL_OR_TK error {yyerror ("Missing term"); RECOVER;} @@ -2644,10 +2643,10 @@ pop_current_osb (ctxp) if (ctxp->osb_depth < 0) abort (); - + to_return = CURRENT_OSB (ctxp); ctxp->osb_depth--; - + return to_return; } @@ -2675,7 +2674,7 @@ create_new_parser_context (copy_from_previous) } else memset ((PTR) new, 0, sizeof (struct parser_ctxt)); - + new->next = ctxp; ctxp = new; } @@ -2686,9 +2685,9 @@ void java_push_parser_context () { create_new_parser_context (0); -} +} -void +void java_pop_parser_context (generate) int generate; { @@ -2719,7 +2718,7 @@ java_pop_parser_context (generate) if ((ctxp = next)) /* Assignment is really meant here */ for (current = ctxp->import_list; current; current = TREE_CHAIN (current)) IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_VALUE (current)) = 1; - + /* If we pushed a context to parse a class intended to be generated, we keep it so we can remember the class. What we could actually do is to just update a list of class names. */ @@ -2826,7 +2825,7 @@ java_parser_context_resume () ctxp = restored; /* Re-installed the data for the parsing to carry on */ - memcpy (&ctxp->marker_begining, &old->marker_begining, + memcpy (&ctxp->marker_begining, &old->marker_begining, (size_t)(&ctxp->marker_end - &ctxp->marker_begining)); /* Buffer context can now be discarded */ @@ -2877,7 +2876,7 @@ java_parser_context_pop_initialized_field () if (CPC_STATIC_INITIALIZER_LIST (ctxp)) { stmts = CPC_STATIC_INITIALIZER_STMT (ctxp); - CPC_STATIC_INITIALIZER_LIST (ctxp) = + CPC_STATIC_INITIALIZER_LIST (ctxp) = TREE_CHAIN (CPC_STATIC_INITIALIZER_LIST (ctxp)); /* Keep initialization in order to enforce 8.5 */ if (stmts && !java_error_count) @@ -2888,7 +2887,7 @@ java_parser_context_pop_initialized_field () if (CPC_INSTANCE_INITIALIZER_LIST (ctxp)) { stmts = CPC_INSTANCE_INITIALIZER_STMT (ctxp); - CPC_INSTANCE_INITIALIZER_LIST (ctxp) = + CPC_INSTANCE_INITIALIZER_LIST (ctxp) = TREE_CHAIN (CPC_INSTANCE_INITIALIZER_LIST (ctxp)); if (stmts && !java_error_count) TYPE_II_STMT_LIST (class_type) = nreverse (stmts); @@ -2904,10 +2903,10 @@ reorder_static_initialized (list) keep them in lexical order. */ tree marker, previous = NULL_TREE; for (marker = list; marker; previous = marker, marker = TREE_CHAIN (marker)) - if (TREE_CODE (marker) == TREE_LIST + if (TREE_CODE (marker) == TREE_LIST && !TREE_VALUE (marker) && !TREE_PURPOSE (marker)) break; - + /* No static initialized, the list is fine as is */ if (!previous) list = TREE_CHAIN (marker); @@ -2947,7 +2946,7 @@ java_debug_context_do (tab) fprintf (stderr, "lineno: %d\n", copy->lineno); TAB_CONTEXT (tab); fprintf (stderr, "package: %s\n", - (copy->package ? + (copy->package ? IDENTIFIER_POINTER (copy->package) : "<none>")); TAB_CONTEXT (tab); fprintf (stderr, "context for saving: %d\n", copy->saved_data_ctx); @@ -2980,7 +2979,7 @@ static void parse_ctor_invocation_error () { if (DECL_CONSTRUCTOR_P (current_function_decl)) - yyerror ("Constructor invocation must be first thing in a constructor"); + yyerror ("Constructor invocation must be first thing in a constructor"); else yyerror ("Only constructors can invoke constructors"); } @@ -3008,7 +3007,7 @@ yyerror (msg) int save_lineno; char *remainder, *code_from_source; - + if (!force_error && prev_lineno == lineno) return; @@ -3035,7 +3034,7 @@ yyerror (msg) java_warning_count++; else java_error_count++; - + if (elc.col == 0 && msg && msg[1] == ';') { elc.col = ctxp->p_line->char_col-1; @@ -3047,7 +3046,7 @@ yyerror (msg) prev_msg = msg; code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col); - obstack_grow0 (&temporary_obstack, + obstack_grow0 (&temporary_obstack, code_from_source, strlen (code_from_source)); remainder = obstack_finish (&temporary_obstack); if (do_warning) @@ -3075,7 +3074,7 @@ issue_warning_error_from_context (cl, msg, ap) force_error = 1; ctxp->elc.line = EXPR_WFL_LINENO (cl); - ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 : + ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 : (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl))); /* We have a CL, that's a good reason for using it if it contains data */ @@ -3143,7 +3142,7 @@ find_expr_with_wfl (node) case LOOP_EXPR: node = TREE_OPERAND (node, 0); continue; - + case LABELED_BLOCK_EXPR: node = TREE_OPERAND (node, 1); continue; @@ -3196,7 +3195,7 @@ int java_report_errors () { if (java_error_count) - fprintf (stderr, "%d error%s", + fprintf (stderr, "%d error%s", java_error_count, (java_error_count == 1 ? "" : "s")); if (java_warning_count) fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""), @@ -3240,8 +3239,8 @@ classitf_redefinition_error (context, id, decl, cl) const char *context; tree id, decl, cl; { - parse_error_context (cl, "%s `%s' already defined in %s:%d", - context, IDENTIFIER_POINTER (id), + parse_error_context (cl, "%s `%s' already defined in %s:%d", + context, IDENTIFIER_POINTER (id), DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); /* Here we should point out where its redefined. It's a unicode. FIXME */ } @@ -3260,7 +3259,7 @@ variable_redefinition_error (context, name, type, line) type_name = lang_printable_name (type, 0); parse_error_context (context, - "Variable `%s' is already defined in this method and was declared `%s %s' at line %d", + "Variable `%s' is already defined in this method and was declared `%s %s' at line %d", IDENTIFIER_POINTER (name), type_name, IDENTIFIER_POINTER (name), line); } @@ -3295,7 +3294,7 @@ build_array_from_name (type, type_wfl, name, ret_name) /* Eventually get more dims */ more_dims = build_type_name_from_array_name (name, &name); - + /* If we have, then craft a new type for this variable */ if (more_dims) { @@ -3390,9 +3389,9 @@ check_class_interface_creation (is_interface, flags, raw_name, qualified_name, d int uaaf = CLASS_MODIFIERS; /* Usually allowed access flags */ if (!quiet_flag) - fprintf (stderr, " %s%s %s", + fprintf (stderr, " %s%s %s", (CPC_INNER_P () ? "inner" : ""), - (is_interface ? "interface" : "class"), + (is_interface ? "interface" : "class"), IDENTIFIER_POINTER (qualified_name)); /* Scope of an interface/class type name: @@ -3402,7 +3401,7 @@ check_class_interface_creation (is_interface, flags, raw_name, qualified_name, d && (node = find_name_in_single_imports (raw_name)) && !CPC_INNER_P ()) { - parse_error_context + parse_error_context (cl, "%s name `%s' clashes with imported type `%s'", (is_interface ? "Interface" : "Class"), IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node)); @@ -3410,7 +3409,7 @@ check_class_interface_creation (is_interface, flags, raw_name, qualified_name, d } if (decl && CLASS_COMPLETE_P (decl)) { - classitf_redefinition_error ((is_interface ? "Interface" : "Class"), + classitf_redefinition_error ((is_interface ? "Interface" : "Class"), qualified_name, decl, cl); return 1; } @@ -3425,17 +3424,17 @@ check_class_interface_creation (is_interface, flags, raw_name, qualified_name, d const char *f; /* Contains OS dependent assumption on path separator. FIXME */ - for (f = &input_filename [strlen (input_filename)]; + for (f = &input_filename [strlen (input_filename)]; f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR; f--) ; if (f[0] == '/' || f[0] == DIR_SEPARATOR) f++; - if (strncmp (IDENTIFIER_POINTER (raw_name), + if (strncmp (IDENTIFIER_POINTER (raw_name), f , IDENTIFIER_LENGTH (raw_name)) || f [IDENTIFIER_LENGTH (raw_name)] != '.') parse_error_context - (cl, "Public %s `%s' must be defined in a file called `%s.java'", + (cl, "Public %s `%s' must be defined in a file called `%s.java'", (is_interface ? "interface" : "class"), IDENTIFIER_POINTER (qualified_name), IDENTIFIER_POINTER (raw_name)); @@ -3450,7 +3449,7 @@ check_class_interface_creation (is_interface, flags, raw_name, qualified_name, d complaining a second time */ if (CPC_INNER_P () && !TOPLEVEL_CLASS_DECL_P (GET_CPC())) { - parse_error_context (cl, "Inner class `%s' can't be static. Static classes can only occur in interfaces and top-level classes", + parse_error_context (cl, "Inner class `%s' can't be static. Static classes can only occur in interfaces and top-level classes", IDENTIFIER_POINTER (qualified_name)); sca = ACC_STATIC; } @@ -3478,14 +3477,14 @@ check_class_interface_creation (is_interface, flags, raw_name, qualified_name, d } } - if (is_interface) + if (is_interface) { if (CPC_INNER_P ()) uaaf = INTERFACE_INNER_MODIFIERS; else uaaf = INTERFACE_MODIFIERS; - - check_modifiers ("Illegal modifier `%s' for interface declaration", + + check_modifiers ("Illegal modifier `%s' for interface declaration", flags, uaaf); } else @@ -3528,11 +3527,11 @@ check_inner_class_redefinition (raw_name, cl) { tree scope_list; - for (scope_list = GET_CPC_LIST (); scope_list; + for (scope_list = GET_CPC_LIST (); scope_list; scope_list = GET_NEXT_ENCLOSING_CPC (scope_list)) if (raw_name == GET_CPC_UN_NODE (scope_list)) { - parse_error_context + parse_error_context (cl, "The class name `%s' is already defined in this scope. An inner class may not have the same simple name as any of its enclosing classes", IDENTIFIER_POINTER (raw_name)); return 1; @@ -3588,7 +3587,7 @@ resolve_inner_class (circularity_hash, cl, enclosing, super, class_type) { if (!cl) cl = lookup_cl (local_enclosing); - + parse_error_context (cl, "Cyclic inheritance involving %s", IDENTIFIER_POINTER (DECL_NAME (local_enclosing))); @@ -3625,7 +3624,7 @@ find_as_inner_class (enclosing, name, cl) qual = build_tree_list (cl, NULL_TREE); else qual = build_tree_list (build_expr_wfl (name, NULL, 0, 0), NULL_TREE); - + if ((to_return = find_as_inner_class_do (qual, enclosing))) return to_return; @@ -3635,10 +3634,10 @@ find_as_inner_class (enclosing, name, cl) { tree acc = NULL_TREE, decl = NULL_TREE, ptr; - for (qual = EXPR_WFL_QUALIFICATION (cl); qual && !decl; + for (qual = EXPR_WFL_QUALIFICATION (cl); qual && !decl; qual = TREE_CHAIN (qual)) { - acc = merge_qualified_name (acc, + acc = merge_qualified_name (acc, EXPR_WFL_NODE (TREE_PURPOSE (qual))); BUILD_PTR_FROM_NAME (ptr, acc); decl = do_resolve_class (NULL_TREE, ptr, NULL_TREE, cl); @@ -3646,7 +3645,7 @@ find_as_inner_class (enclosing, name, cl) /* A NULL qual and a decl means that the search ended successfully?!? We have to do something then. FIXME */ - + if (decl) enclosing = decl; else @@ -3655,7 +3654,7 @@ find_as_inner_class (enclosing, name, cl) /* Otherwise, create a qual for the other part of the resolution. */ else qual = build_tree_list (build_expr_wfl (name, NULL, 0, 0), NULL_TREE); - + return find_as_inner_class_do (qual, enclosing); } @@ -3701,7 +3700,7 @@ set_nested_class_simple_name_value (outer, set) tree l; for (l = DECL_INNER_CLASS_LIST (outer); l; l = TREE_CHAIN (l)) - IDENTIFIER_GLOBAL_VALUE (TREE_VALUE (l)) = (set ? + IDENTIFIER_GLOBAL_VALUE (TREE_VALUE (l)) = (set ? TREE_PURPOSE (l) : NULL_TREE); } @@ -3711,7 +3710,7 @@ link_nested_class_to_enclosing () if (GET_ENCLOSING_CPC ()) { tree enclosing = GET_ENCLOSING_CPC_CONTEXT (); - DECL_INNER_CLASS_LIST (enclosing) = + DECL_INNER_CLASS_LIST (enclosing) = tree_cons (GET_CPC (), GET_CPC_UN (), DECL_INNER_CLASS_LIST (enclosing)); } @@ -3740,7 +3739,7 @@ maybe_make_nested_class_name (name) obstack_1grow (&temporary_obstack, '$'); } obstack_grow0 (&temporary_obstack, - IDENTIFIER_POINTER (name), + IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name)); id = get_identifier (obstack_finish (&temporary_obstack)); if (ctxp->package) @@ -3785,7 +3784,7 @@ maybe_create_class_interface_decl (decl, raw_name, qualified_name, cl) /* Install a new dependency list element */ create_jdep_list (ctxp); - SOURCE_FRONTEND_DEBUG (("Defining class/interface %s", + SOURCE_FRONTEND_DEBUG (("Defining class/interface %s", IDENTIFIER_POINTER (qualified_name))); return decl; } @@ -3836,7 +3835,7 @@ create_interface (flags, id, super) EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */ - /* Basic checks: scope, redefinition, modifiers */ + /* Basic checks: scope, redefinition, modifiers */ if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id)) { PUSH_ERROR (); @@ -3861,7 +3860,7 @@ create_interface (flags, id, super) - abstract is obsolete (comes first, it's a warning, or should be) - Can't use twice the same (checked in the modifier rule) */ if ((flags & ACC_ABSTRACT) && flag_redundant) - parse_warning_context + parse_warning_context (MODIFIER_WFL (ABSTRACT_TK), "Redundant use of `abstract' modifier. Interface `%s' is implicitly abstract", IDENTIFIER_POINTER (raw_name)); @@ -3869,7 +3868,7 @@ create_interface (flags, id, super) decl = maybe_create_class_interface_decl (decl, raw_name, q_name, id); /* Set super info and mark the class a complete */ - set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl), + set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl), object_type_node, ctxp->interface_number); ctxp->interface_number = 0; CLASS_COMPLETE_P (decl) = 1; @@ -3982,7 +3981,7 @@ create_class (flags, id, super, interfaces) PUSH_ERROR (); return NULL_TREE; } - + /* Suspend the current parsing context if we're parsing an inner class or an anonymous class. */ if (CPC_INNER_P ()) @@ -3992,13 +3991,13 @@ create_class (flags, id, super, interfaces) if (CLASS_INTERFACE (GET_CPC ())) flags |= ACC_PUBLIC; } - + /* Push a new context for (static) initialized upon declaration fields */ java_parser_context_push_initialized_field (); - /* Class modifier check: + /* Class modifier check: - Allowed modifier (already done at that point) - - abstract AND final forbidden + - abstract AND final forbidden - Public classes defined in the correct file */ if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL)) parse_error_context @@ -4018,7 +4017,7 @@ create_class (flags, id, super, interfaces) return NULL_TREE; } - super_decl_type = + super_decl_type = register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE); } else if (TREE_TYPE (decl) != object_type_node) @@ -4035,7 +4034,7 @@ create_class (flags, id, super, interfaces) } /* Set super info and mark the class as complete. */ - set_super_info (flags, TREE_TYPE (decl), super_decl_type, + set_super_info (flags, TREE_TYPE (decl), super_decl_type, ctxp->interface_number); ctxp->interface_number = 0; CLASS_COMPLETE_P (decl) = 1; @@ -4099,14 +4098,14 @@ add_inner_class_fields (class_decl, fct_decl) f = add_field (TREE_TYPE (class_decl), build_current_thisn (TREE_TYPE (class_decl)), - build_pointer_type (TREE_TYPE (DECL_CONTEXT (class_decl))), + build_pointer_type (TREE_TYPE (DECL_CONTEXT (class_decl))), ACC_PRIVATE); FIELD_THISN (f) = 1; if (!fct_decl) return; - - for (block = GET_CURRENT_BLOCK (fct_decl); + + for (block = GET_CURRENT_BLOCK (fct_decl); block && TREE_CODE (block) == BLOCK; block = BLOCK_SUPERCONTEXT (block)) { tree decl; @@ -4114,11 +4113,11 @@ add_inner_class_fields (class_decl, fct_decl) { tree name, pname; tree wfl, init, list; - + /* Avoid non final arguments. */ if (!LOCAL_FINAL_P (decl)) continue; - + MANGLE_OUTER_LOCAL_VARIABLE_NAME (name, DECL_NAME (decl)); MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID (pname, DECL_NAME (decl)); wfl = build_wfl_node (name); @@ -4130,7 +4129,7 @@ add_inner_class_fields (class_decl, fct_decl) invoking it (hence the constructor will also feature a hidden parameter, set to the value of the outer context local at the time the inner class is created.) - + Note: we take into account all possible locals that can be accessed by the inner class. It's actually not trivial to minimize these aliases down to the ones really @@ -4145,14 +4144,14 @@ add_inner_class_fields (class_decl, fct_decl) identify locals really used in the inner class. We leave the flag FIELD_LOCAL_ALIAS_USED around for that future use. - + On the other hand, it only affect local inner classes, whose constructors (and finit$ call) will be featuring unecessary arguments. It's easy for a developper to keep this number of parameter down by using the `final' keyword only when necessary. For the time being, we can issue a warning on unecessary finals. FIXME */ - init = build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (wfl), + init = build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (wfl), wfl, init); /* Register the field. The TREE_LIST holding the part @@ -4246,19 +4245,19 @@ duplicate_declaration_error_p (new_field_name, new_type, cl) if (decl) { char *t1 = xstrdup (purify_type_name - ((TREE_CODE (new_type) == POINTER_TYPE + ((TREE_CODE (new_type) == POINTER_TYPE && TREE_TYPE (new_type) == NULL_TREE) ? IDENTIFIER_POINTER (TYPE_NAME (new_type)) : lang_printable_name (new_type, 1))); /* The type may not have been completed by the time we report the error */ char *t2 = xstrdup (purify_type_name - ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE + ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ? IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) : lang_printable_name (TREE_TYPE (decl), 1))); - parse_error_context - (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)", + parse_error_context + (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)", t1, IDENTIFIER_POINTER (new_field_name), t2, IDENTIFIER_POINTER (DECL_NAME (decl)), DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); @@ -4311,7 +4310,7 @@ register_fields (flags, type, variable_list) /* If TYPE is fully resolved and we don't have a reference, make one */ PROMOTE_RECORD_IF_COMPLETE (type, must_chain); - for (current = variable_list, saved_type = type; current; + for (current = variable_list, saved_type = type; current; current = TREE_CHAIN (current), type = saved_type) { tree real_type; @@ -4323,7 +4322,7 @@ register_fields (flags, type, variable_list) /* Can't declare non-final static fields in inner classes */ if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (class_type) && !(flags & ACC_FINAL)) - parse_error_context + parse_error_context (cl, "Field `%s' can't be static in inner class `%s' unless it is final", IDENTIFIER_POINTER (EXPR_WFL_NODE (cl)), lang_printable_name (class_type, 0)); @@ -4377,11 +4376,11 @@ register_fields (flags, type, variable_list) FIELD_LOCAL_ALIAS (field_decl) = 1; FIELD_FINAL (field_decl) = 0; } - + /* Check if we must chain. */ if (must_chain) register_incomplete_type (JDEP_FIELD, wfl, field_decl, type); - + /* If we have an initialization value tied to the field */ if (init) { @@ -4396,7 +4395,7 @@ register_fields (flags, type, variable_list) appropriately. */ TREE_CHAIN (init) = CPC_STATIC_INITIALIZER_STMT (ctxp); SET_CPC_STATIC_INITIALIZER_STMT (ctxp, init); - if (TREE_OPERAND (init, 1) + if (TREE_OPERAND (init, 1) && TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT) TREE_STATIC (TREE_OPERAND (init, 1)) = 1; } @@ -4428,8 +4427,8 @@ generate_finit (class_type) tree list = TYPE_FINIT_STMT_LIST (class_type); tree mdecl, current, parms; - parms = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION, - class_type, NULL_TREE, + parms = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION, + class_type, NULL_TREE, &count); CRAFTED_PARAM_LIST_FIXUP (parms); mdecl = create_artificial_method (class_type, ACC_PRIVATE, void_type_node, @@ -4441,8 +4440,8 @@ generate_finit (class_type) start_artificial_method_body (mdecl); for (current = list; current; current = TREE_CHAIN (current)) - java_method_add_stmt (mdecl, - build_debugable_stmt (EXPR_WFL_LINECOL (current), + java_method_add_stmt (mdecl, + build_debugable_stmt (EXPR_WFL_LINECOL (current), current)); end_artificial_method_body (mdecl); return mdecl; @@ -4471,7 +4470,7 @@ generate_instinit (class_type) mdecl, NULL_TREE); /* Gather all the statements in a compound */ - for (current = TYPE_II_STMT_LIST (class_type); + for (current = TYPE_II_STMT_LIST (class_type); current; current = TREE_CHAIN (current)) compound = add_stmt_to_compound (compound, NULL_TREE, current); @@ -4480,10 +4479,10 @@ generate_instinit (class_type) We do that only if all ctors of CLASS_TYPE are set to catch a checked exception. This doesn't apply to anonymous classes (since they don't have declared ctors.) */ - if (!ANONYMOUS_CLASS_P (class_type) && + if (!ANONYMOUS_CLASS_P (class_type) && ctors_unchecked_throws_clause_p (class_type)) { - compound = encapsulate_with_try_catch (0, exception_type_node, compound, + compound = encapsulate_with_try_catch (0, exception_type_node, compound, build1 (THROW_EXPR, NULL_TREE, build_wfl_node (wpv_id))); DECL_FUNCTION_THROWS (mdecl) = build_tree_list (NULL_TREE, @@ -4546,7 +4545,7 @@ method_header (flags, type, mdecl, throws) return error_mark_node; meth = TREE_VALUE (mdecl); id = TREE_PURPOSE (mdecl); - + check_modifiers_consistency (flags); if (GET_CPC ()) @@ -4554,7 +4553,7 @@ method_header (flags, type, mdecl, throws) if (!this_class || this_class == error_mark_node) return NULL_TREE; - + /* There are some forbidden modifiers for an abstract method and its class must be abstract as well. */ if (type && (flags & ACC_ABSTRACT)) @@ -4567,8 +4566,8 @@ method_header (flags, type, mdecl, throws) ABSTRACT_CHECK (flags, ACC_STRICT, id, "Strictfp"); if (!CLASS_ABSTRACT (TYPE_NAME (this_class)) && !CLASS_INTERFACE (TYPE_NAME (this_class))) - parse_error_context - (id, "Class `%s' must be declared abstract to define abstract method `%s'", + parse_error_context + (id, "Class `%s' must be declared abstract to define abstract method `%s'", IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())), IDENTIFIER_POINTER (EXPR_WFL_NODE (id))); } @@ -4580,7 +4579,7 @@ method_header (flags, type, mdecl, throws) /* 8.6: Constructor declarations: we might be trying to define a method without specifying a return type. */ if (EXPR_WFL_NODE (id) != GET_CPC_UN ()) - parse_error_context + parse_error_context (id, "Invalid method declaration, return type required"); /* 8.6.3: Constructor modifiers */ else @@ -4619,7 +4618,7 @@ method_header (flags, type, mdecl, throws) /* Inner class can't declare static methods */ if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (this_class)) { - parse_error_context + parse_error_context (id, "Method `%s' can't be static in inner class `%s'. Only members of interfaces and top-level classes can be static", IDENTIFIER_POINTER (EXPR_WFL_NODE (id)), lang_printable_name (this_class, 0)); @@ -4661,7 +4660,7 @@ method_header (flags, type, mdecl, throws) /* When defining an abstract or interface method, the curly bracket at level 1 doesn't exist because there is no function body */ - lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 : + lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 : EXPR_WFL_LINENO (id)); /* Remember the original argument list */ @@ -4682,7 +4681,7 @@ method_header (flags, type, mdecl, throws) register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE); } else - meth = add_method (this_class, flags, meth_name, + meth = add_method (this_class, flags, meth_name, build_java_signature (meth)); /* Remember final parameters */ @@ -4708,7 +4707,7 @@ method_header (flags, type, mdecl, throws) { register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current), NULL_TREE, NULL_TREE); - JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) = + JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) = &TREE_VALUE (current); } DECL_FUNCTION_THROWS (meth) = throws; @@ -4723,7 +4722,7 @@ method_header (flags, type, mdecl, throws) DECL_CONSTRUCTOR_P (meth) = 1; /* Compute and store the number of artificial parameters declared for this constructor */ - for (count = 0, current = TYPE_FIELDS (this_class); current; + for (count = 0, current = TYPE_FIELDS (this_class); current; current = TREE_CHAIN (current)) if (FIELD_LOCAL_ALIAS (current)) count++; @@ -4776,7 +4775,7 @@ finish_method_declaration (method_body) if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body) { tree name = DECL_NAME (current_function_decl); - parse_error_context (DECL_FUNCTION_WFL (current_function_decl), + parse_error_context (DECL_FUNCTION_WFL (current_function_decl), "%s method `%s' can't have a body defined", (METHOD_NATIVE (current_function_decl) ? "Native" : "Abstract"), @@ -4787,15 +4786,15 @@ finish_method_declaration (method_body) { tree name = DECL_NAME (current_function_decl); parse_error_context - (DECL_FUNCTION_WFL (current_function_decl), + (DECL_FUNCTION_WFL (current_function_decl), "Non native and non abstract method `%s' must have a body defined", IDENTIFIER_POINTER (name)); method_body = NULL_TREE; } - if (flag_emit_class_files && method_body - && TREE_CODE (method_body) == NOP_EXPR - && TREE_TYPE (current_function_decl) + if (flag_emit_class_files && method_body + && TREE_CODE (method_body) == NOP_EXPR + && TREE_TYPE (current_function_decl) && TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node) method_body = build1 (RETURN_EXPR, void_type_node, NULL); @@ -4812,7 +4811,7 @@ finish_method_declaration (method_body) ARG_FINAL_P parameter that might have been set on some of this function parameters. */ UNMARK_FINAL_PARMS (current_function_decl); - + /* So we don't have an irrelevant function declaration context for the next static block we'll see. */ current_function_decl = NULL_TREE; @@ -4852,15 +4851,15 @@ verify_constructor_circularity (meth, current) vcc_list = nreverse (vcc_list); for (liste = vcc_list; liste; liste = TREE_CHAIN (liste)) { - parse_error_context + parse_error_context (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s", constructor_circularity_msg - (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); + (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); java_error_count--; } } t = xstrdup (lang_printable_name (meth, 0)); - parse_error_context (TREE_PURPOSE (c), + parse_error_context (TREE_PURPOSE (c), "%s: recursive invocation of constructor `%s'", constructor_circularity_msg (current, meth), t); free (t); @@ -4914,7 +4913,7 @@ check_abstract_method_header (meth) OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags, ACC_ABSTRACT, "abstract method", IDENTIFIER_POINTER (DECL_NAME (meth))); - OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags, + OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags, ACC_PUBLIC, "abstract method", IDENTIFIER_POINTER (DECL_NAME (meth))); @@ -4944,13 +4943,13 @@ method_declarator (id, list) this$<n> decl in the name field of its parameter declaration. We also might have to hide the outer context local alias initializers. Not done when the class is a toplevel class. */ - if (PURE_INNER_CLASS_DECL_P (GET_CPC ()) + if (PURE_INNER_CLASS_DECL_P (GET_CPC ()) && EXPR_WFL_NODE (id) == GET_CPC_UN ()) { tree aliases_list, type, thisn; /* First the aliases, linked to the regular parameters */ aliases_list = - build_alias_initializer_parameter_list (AIPL_FUNCTION_DECLARATION, + build_alias_initializer_parameter_list (AIPL_FUNCTION_DECLARATION, TREE_TYPE (GET_CPC ()), NULL_TREE, NULL); list = chainon (nreverse (aliases_list), list); @@ -4961,7 +4960,7 @@ method_declarator (id, list) list = tree_cons (build_wfl_node (thisn), build_pointer_type (type), list); } - + for (current = list; current; current = TREE_CHAIN (current)) { int must_chain = 0; @@ -5004,7 +5003,7 @@ method_declarator (id, list) if (must_chain) { patch_stage = JDEP_METHOD; - type = register_incomplete_type (patch_stage, + type = register_incomplete_type (patch_stage, type_wfl, wfl_name, type); jdep = CLASSD_LAST (ctxp->classd_list); JDEP_MISC (jdep) = id; @@ -5014,7 +5013,7 @@ method_declarator (id, list) arg_node = build_tree_list (name, real_type); /* Remeber arguments declared final. */ ARG_FINAL_P (arg_node) = ARG_FINAL_P (current); - + if (jdep) JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node); TREE_CHAIN (arg_node) = arg_types; @@ -5029,7 +5028,7 @@ static int unresolved_type_p (wfl, returned) tree wfl; tree *returned; - + { if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION) { @@ -5064,7 +5063,7 @@ parser_qualified_classname (name) if (ctxp->package) return merge_qualified_name (ctxp->package, name); - else + else return name; } @@ -5080,9 +5079,9 @@ parser_check_super_interface (super_decl, this_decl, this_wfl) /* Has to be an interface */ if (!CLASS_INTERFACE (super_decl)) { - parse_error_context + parse_error_context (this_wfl, "%s `%s' can't implement/extend %s `%s'", - (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ? + (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ? "Interface" : "Class"), IDENTIFIER_POINTER (DECL_NAME (this_decl)), (TYPE_ARRAY_P (super_type) ? "array" : "class"), @@ -5090,7 +5089,7 @@ parser_check_super_interface (super_decl, this_decl, this_wfl) return 1; } - /* Check top-level interface access. Inner classes are subject to member + /* Check top-level interface access. Inner classes are subject to member access rules (6.6.1). */ if (! INNER_CLASS_P (super_type) && check_pkg_class_access (DECL_NAME (super_decl), @@ -5115,7 +5114,7 @@ parser_check_super (super_decl, this_decl, wfl) /* SUPER should be a CLASS (neither an array nor an interface) */ if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type))) { - parse_error_context + parse_error_context (wfl, "Class `%s' can't subclass %s `%s'", IDENTIFIER_POINTER (DECL_NAME (this_decl)), (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"), @@ -5135,7 +5134,7 @@ parser_check_super (super_decl, this_decl, wfl) if (! INNER_CLASS_P (super_type) && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true))) return 1; - + SOURCE_FRONTEND_DEBUG (("Completing class %s with %s", IDENTIFIER_POINTER (DECL_NAME (this_decl)), IDENTIFIER_POINTER (DECL_NAME (super_decl)))); @@ -5149,7 +5148,7 @@ static void create_jdep_list (ctxp) struct parser_ctxt *ctxp; { - jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist)); + jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist)); new->first = new->last = NULL; new->next = ctxp->classd_list; ctxp->classd_list = new; @@ -5219,7 +5218,7 @@ register_incomplete_type (kind, wfl, decl, ptr) && GET_ENCLOSING_CPC ()) JDEP_ENCLOSING (new) = TREE_VALUE (GET_ENCLOSING_CPC ()); else if (kind == JDEP_SUPER) - JDEP_ENCLOSING (new) = (GET_ENCLOSING_CPC () ? + JDEP_ENCLOSING (new) = (GET_ENCLOSING_CPC () ? TREE_VALUE (GET_ENCLOSING_CPC ()) : NULL_TREE); else JDEP_ENCLOSING (new) = GET_CPC (); @@ -5302,7 +5301,7 @@ check_circular_reference (type) return lookup_cl (TYPE_NAME (type)); return NULL_TREE; } - + for (i = 0; i < TREE_VEC_LENGTH (basetype_vec); i++) { tree vec_elt = TREE_VEC_ELT (basetype_vec, i); @@ -5358,7 +5357,7 @@ build_alias_initializer_parameter_list (mode, class_type, parm, artificial) switch (mode) { case AIPL_FUNCTION_DECLARATION: - MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id, + MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id, &buffer [4]); purpose = build_wfl_node (mangled_id); if (TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE) @@ -5374,7 +5373,7 @@ build_alias_initializer_parameter_list (mode, class_type, parm, artificial) break; case AIPL_FUNCTION_FINIT_INVOCATION: - MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id, + MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id, &buffer [4]); /* Now, this is wrong. purpose should always be the NAME of something and value its matching value (decl, type, @@ -5407,7 +5406,7 @@ build_alias_initializer_parameter_list (mode, class_type, parm, artificial) } if (additional_parms) { - if (ANONYMOUS_CLASS_P (class_type) + if (ANONYMOUS_CLASS_P (class_type) && mode == AIPL_FUNCTION_CTOR_INVOCATION) additional_parms = nreverse (additional_parms); parm = chainon (additional_parms, parm); @@ -5431,7 +5430,7 @@ craft_constructor (class_decl, args) int i = 0, artificial = 0; tree decl, ctor_name; char buffer [80]; - + /* The constructor name is <init> unless we're dealing with an anonymous class, in which case the name will be fixed after having be expanded. */ @@ -5451,7 +5450,7 @@ craft_constructor (class_decl, args) /* Some more arguments to be hidden here. The values of the local variables of the outer context that the inner class needs to see. */ parm = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION, - class_type, parm, + class_type, parm, &artificial); } @@ -5463,7 +5462,7 @@ craft_constructor (class_decl, args) } CRAFTED_PARAM_LIST_FIXUP (parm); - decl = create_artificial_method (class_type, flags, void_type_node, + decl = create_artificial_method (class_type, flags, void_type_node, ctor_name, parm); fix_method_argument_names (parm, decl); /* Now, mark the artificial parameters. */ @@ -5542,7 +5541,7 @@ jdep_resolve_class (dep) JDEP_DECL (dep), JDEP_WFL (dep)); JDEP_RESOLVED (dep, decl); } - + if (!decl) complete_class_report_errors (dep); else if (PURE_INNER_CLASS_DECL_P (decl)) @@ -5576,8 +5575,8 @@ java_complete_class () ctxp->class_list = nreverse (ctxp->class_list); ctxp->classd_list = reverse_jdep_list (ctxp); - for (cclassd = ctxp->classd_list, cclass = ctxp->class_list; - cclass && cclassd; + for (cclassd = ctxp->classd_list, cclass = ctxp->class_list; + cclass && cclassd; cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd)) { jdep *dep; @@ -5601,7 +5600,7 @@ java_complete_class () /* Simply patch super */ if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep))) continue; - BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO + BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl); break; @@ -5616,7 +5615,7 @@ java_complete_class () DECL_ALIGN (field_decl) = 0; DECL_USER_ALIGN (field_decl) = 0; layout_decl (field_decl, 0); - SOURCE_FRONTEND_DEBUG + SOURCE_FRONTEND_DEBUG (("Completed field/var decl `%s' with `%s'", IDENTIFIER_POINTER (DECL_NAME (field_decl)), IDENTIFIER_POINTER (DECL_NAME (decl)))); @@ -5633,11 +5632,11 @@ java_complete_class () if (TREE_CODE (type) == RECORD_TYPE) type = promote_type (type); JDEP_APPLY_PATCH (dep, type); - SOURCE_FRONTEND_DEBUG + SOURCE_FRONTEND_DEBUG (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ? "Completing fct `%s' with ret type `%s'": "Completing arg `%s' with type `%s'"), - IDENTIFIER_POINTER (EXPR_WFL_NODE + IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))), IDENTIFIER_POINTER (DECL_NAME (decl)))); } @@ -5682,14 +5681,14 @@ java_complete_class () case JDEP_TYPE: JDEP_APPLY_PATCH (dep, TREE_TYPE (decl)); - SOURCE_FRONTEND_DEBUG + SOURCE_FRONTEND_DEBUG (("Completing a random type dependency on a '%s' node", tree_code_name [TREE_CODE (JDEP_DECL (dep))])); break; case JDEP_EXCEPTION: JDEP_APPLY_PATCH (dep, TREE_TYPE (decl)); - SOURCE_FRONTEND_DEBUG + SOURCE_FRONTEND_DEBUG (("Completing `%s' `throws' argument node", IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))))); break; @@ -5717,7 +5716,7 @@ resolve_class (enclosing, class_type, decl, cl) tree resolved_type = TREE_TYPE (class_type); int array_dims = 0; tree resolved_type_decl; - + if (resolved_type != NULL_TREE) { tree resolved_type_decl = TYPE_NAME (resolved_type); @@ -5738,7 +5737,7 @@ resolve_class (enclosing, class_type, decl, cl) WFL_STRIP_BRACKET (cl, cl); /* 2- Resolve the bare type */ - if (!(resolved_type_decl = do_resolve_class (enclosing, class_type, + if (!(resolved_type_decl = do_resolve_class (enclosing, class_type, decl, cl))) return NULL_TREE; resolved_type = TREE_TYPE (resolved_type_decl); @@ -5773,7 +5772,7 @@ do_resolve_class (enclosing, class_type, decl, cl) through when searching the current class as an inner class, in order to detect circular references. Remember to free it before returning the section 0- of this function. */ - circularity_hash = htab_create (20, htab_hash_pointer, htab_eq_pointer, + circularity_hash = htab_create (20, htab_hash_pointer, htab_eq_pointer, NULL); /* 0- Search in the current class as an inner class. @@ -5789,7 +5788,7 @@ do_resolve_class (enclosing, class_type, decl, cl) /* If we haven't found anything because SUPER reached Object and ENCLOSING happens to be an innerclass, try the enclosing context. */ - if ((!super || super == object_type_node) && + if ((!super || super == object_type_node) && enclosing && INNER_CLASS_DECL_P (enclosing)) enclosing = DECL_CONTEXT (enclosing); else @@ -5840,22 +5839,22 @@ do_resolve_class (enclosing, class_type, decl, cl) /* If there is a current package (ctxp->package), it's the first element of package_list and we can skip it. */ - for (package = (ctxp->package ? + for (package = (ctxp->package ? TREE_CHAIN (package_list) : package_list); package; package = TREE_CHAIN (package)) if ((new_class_decl = qualify_and_find (class_type, - TREE_PURPOSE (package), + TREE_PURPOSE (package), TYPE_NAME (class_type)))) return new_class_decl; } /* 5- Check an other compilation unit that bears the name of type */ load_class (TYPE_NAME (class_type), 0); - + if (!cl) cl = lookup_cl (decl); - - /* If we don't have a value for CL, then we're being called recursively. + + /* If we don't have a value for CL, then we're being called recursively. We can't check package access just yet, but it will be taken care of by the caller. */ if (cl) @@ -5970,7 +5969,7 @@ resolve_and_layout (something, cl) /* Check methods */ if (CLASS_FROM_SOURCE_P (decl_type)) java_check_methods (decl); - /* Layout the type if necessary */ + /* Layout the type if necessary */ if (decl_type != current_class && !CLASS_LOADED_P (decl_type)) safe_layout_class (decl_type); @@ -5989,7 +5988,7 @@ resolve_no_layout (name, cl) java_parser_context_save_global (); decl = resolve_class (TYPE_NAME (current_class), ptr, NULL_TREE, cl); java_parser_context_restore_global (); - + return decl; } @@ -6029,7 +6028,7 @@ complete_class_report_errors (dep) switch (JDEP_KIND (dep)) { case JDEP_SUPER: - parse_error_context + parse_error_context (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found", purify_type_name (name), IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); @@ -6049,7 +6048,7 @@ complete_class_report_errors (dep) break; case JDEP_METHOD_RETURN: /* Covers return type */ parse_error_context - (JDEP_WFL (dep), "Type `%s' not found in the declaration of the return type of method `%s'", + (JDEP_WFL (dep), "Type `%s' not found in the declaration of the return type of method `%s'", purify_type_name (name), IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep)))); break; @@ -6062,13 +6061,13 @@ complete_class_report_errors (dep) break; case JDEP_VARIABLE: parse_error_context - (JDEP_WFL (dep), "Type `%s' not found in the declaration of the local variable `%s'", - purify_type_name (IDENTIFIER_POINTER + (JDEP_WFL (dep), "Type `%s' not found in the declaration of the local variable `%s'", + purify_type_name (IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))), IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep)))); break; case JDEP_EXCEPTION: /* As specified by `throws' */ - parse_error_context + parse_error_context (JDEP_WFL (dep), "Class `%s' not found in `throws'", IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))); break; @@ -6095,11 +6094,11 @@ get_printable_method_name (decl) name = DECL_NAME (decl); DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))); } - + to_return = lang_printable_name (decl, 0); if (DECL_CONSTRUCTOR_P (decl)) DECL_NAME (decl) = name; - + return to_return; } @@ -6127,7 +6126,7 @@ check_method_redefinition (class, method) && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef)) && !DECL_ARTIFICIAL (method)) { - parse_error_context + parse_error_context (DECL_FUNCTION_WFL (method), "Duplicate %s declaration `%s'", (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"), get_printable_method_name (redef)); @@ -6153,14 +6152,14 @@ check_abstract_method_definitions (do_interface, class_decl, type) tree other_super, other_method, method_sig, method_name; int found = 0; int end_type_reached = 0; - + if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method)) continue; - + /* Now verify that somewhere in between TYPE and CLASS, abstract method METHOD gets a non abstract definition that is inherited by CLASS. */ - + method_sig = build_java_signature (TREE_TYPE (method)); method_name = DECL_NAME (method); if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION) @@ -6170,14 +6169,14 @@ check_abstract_method_definitions (do_interface, class_decl, type) do { if (other_super == end_type) end_type_reached = 1; - + /* Method search */ for (other_method = TYPE_METHODS (other_super); other_method; other_method = TREE_CHAIN (other_method)) { tree s = build_java_signature (TREE_TYPE (other_method)); tree other_name = DECL_NAME (other_method); - + if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION) other_name = EXPR_WFL_NODE (other_name); if (!DECL_CLINIT_P (other_method) @@ -6192,21 +6191,21 @@ check_abstract_method_definitions (do_interface, class_decl, type) } other_super = CLASSTYPE_SUPER (other_super); } while (!end_type_reached); - + /* Report that abstract METHOD didn't find an implementation that CLASS can use. */ if (!found) { - char *t = xstrdup (lang_printable_name + char *t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0)); tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method))); - - parse_error_context + + parse_error_context (lookup_cl (class_decl), "Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract", IDENTIFIER_POINTER (DECL_NAME (class_decl)), - t, lang_printable_name (method, 0), - (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ? + t, lang_printable_name (method, 0), + (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ? "interface" : "class"), IDENTIFIER_POINTER (ccn), (CLASS_INTERFACE (class_decl) ? "interface" : "class"), @@ -6274,7 +6273,7 @@ check_method_types_complete (decl) if (!INCOMPLETE_TYPE_P (TREE_TYPE (type))) return 0; - + args = TYPE_ARG_TYPES (type); if (TREE_CODE (type) == METHOD_TYPE) args = TREE_CHAIN (args); @@ -6298,7 +6297,7 @@ java_check_methods (class_decl) java_check_abstract_methods (class_decl); else java_check_regular_methods (class_decl); - + CLASS_METHOD_CHECKED_P (TREE_TYPE (class_decl)) = 1; } @@ -6350,9 +6349,9 @@ java_check_regular_methods (class_decl) mthrows; mthrows = TREE_CHAIN (mthrows)) { if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node)) - parse_error_context + parse_error_context (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be a subclass of class `java.lang.Throwable'", - IDENTIFIER_POINTER + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows))))); } @@ -6363,7 +6362,7 @@ java_check_regular_methods (class_decl) if (METHOD_STATIC (method) && !TOPLEVEL_CLASS_DECL_P (class_decl)) { char *t = xstrdup (lang_printable_name (class, 0)); - parse_error_context + parse_error_context (method_wfl, "Method `%s' can't be static in inner class `%s'. Only members of interfaces and top-level classes can be static", lang_printable_name (method, 0), t); free (t); @@ -6380,7 +6379,7 @@ java_check_regular_methods (class_decl) /* If `found' is declared in an interface, make sure the modifier matches. */ - if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found))) + if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found))) && clinit_identifier_node != DECL_NAME (found) && !METHOD_PUBLIC (method)) { @@ -6395,13 +6394,13 @@ java_check_regular_methods (class_decl) types. */ if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method))) { - char *t = xstrdup + char *t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0)); - parse_error_context + parse_error_context (method_wfl, - "Method `%s' was defined with return type `%s' in class `%s'", + "Method `%s' was defined with return type `%s' in class `%s'", lang_printable_name (found, 0), t, - IDENTIFIER_POINTER + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); free (t); } @@ -6414,7 +6413,7 @@ java_check_regular_methods (class_decl) /* Static *can* override static */ if (METHOD_STATIC (found) && METHOD_STATIC (method)) continue; - parse_error_context + parse_error_context (method_wfl, "%s methods can't be overriden. Method `%s' is %s in class `%s'", (METHOD_FINAL (found) ? "Final" : "Static"), @@ -6428,7 +6427,7 @@ java_check_regular_methods (class_decl) /* Static method can't override instance method. */ if (METHOD_STATIC (method)) { - parse_error_context + parse_error_context (method_wfl, "Instance methods can't be overriden by a static method. Method `%s' is an instance method in class `%s'", lang_printable_name (found, 0), @@ -6446,17 +6445,17 @@ java_check_regular_methods (class_decl) taken care of. */ if (!CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found))) && ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method)) - || (METHOD_PROTECTED (found) + || (METHOD_PROTECTED (found) && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method))) || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC)) && METHOD_PRIVATE (method)))) { - parse_error_context + parse_error_context (method_wfl, "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 0), - (METHOD_PUBLIC (method) ? "public" : + (METHOD_PUBLIC (method) ? "public" : (METHOD_PRIVATE (method) ? "private" : "protected")), - IDENTIFIER_POINTER (DECL_NAME + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); continue; } @@ -6467,7 +6466,7 @@ java_check_regular_methods (class_decl) /* Inheriting multiple methods with the same signature. FIXME */ } - + if (!TYPE_NVIRTUALS (class)) TYPE_METHODS (class) = nreverse (TYPE_METHODS (class)); @@ -6499,17 +6498,17 @@ check_throws_clauses (method, method_wfl, found) if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows))) continue; /* Checked expression must be compatible */ - for (fthrows = DECL_FUNCTION_THROWS (found); + for (fthrows = DECL_FUNCTION_THROWS (found); fthrows; fthrows = TREE_CHAIN (fthrows)) if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows))) break; if (!fthrows) { - parse_error_context + parse_error_context (method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'", IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))), lang_printable_name (found, 0), - IDENTIFIER_POINTER + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); } } @@ -6538,11 +6537,11 @@ java_check_abstract_methods (interface_decl) { char *t; t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0)); - parse_error_context + parse_error_context (DECL_FUNCTION_WFL (found), "Method `%s' was defined with return type `%s' in class `%s'", lang_printable_name (found, 0), t, - IDENTIFIER_POINTER + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); free (t); continue; @@ -6560,23 +6559,23 @@ java_check_abstract_methods (interface_decl) if (!vec_elt) continue; sub_interface = BINFO_TYPE (vec_elt); - for (sub_interface_method = TYPE_METHODS (sub_interface); + for (sub_interface_method = TYPE_METHODS (sub_interface); sub_interface_method; sub_interface_method = TREE_CHAIN (sub_interface_method)) { - found = lookup_java_interface_method2 (interface, + found = lookup_java_interface_method2 (interface, sub_interface_method); if (found && (found != sub_interface_method)) { - parse_error_context + parse_error_context (lookup_cl (sub_interface_method), "Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'", IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))), lang_printable_name (found, 0), - IDENTIFIER_POINTER - (DECL_NAME (TYPE_NAME + IDENTIFIER_POINTER + (DECL_NAME (TYPE_NAME (DECL_CONTEXT (sub_interface_method)))), - IDENTIFIER_POINTER + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); } } @@ -6601,13 +6600,13 @@ lookup_java_interface_method2 (class, method_decl) { tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return; if ((BINFO_TYPE (vec_elt) != object_type_node) - && (to_return = + && (to_return = lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1))) return to_return; } for (i = 0; i < n; i++) { - to_return = lookup_java_interface_method2 + to_return = lookup_java_interface_method2 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl); if (to_return) return to_return; @@ -6628,7 +6627,7 @@ lookup_java_method2 (clas, method_decl, do_interface) method_signature = build_java_argument_signature (TREE_TYPE (method_decl)); name = DECL_NAME (method_decl); - method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? + method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? EXPR_WFL_NODE (name) : name); method_type = TREE_TYPE (TREE_TYPE (method_decl)); @@ -6641,7 +6640,7 @@ lookup_java_method2 (clas, method_decl, do_interface) tree name = DECL_NAME (method); if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? EXPR_WFL_NODE (name) : name) == method_name - && method_sig == method_signature + && method_sig == method_signature && TREE_TYPE (TREE_TYPE (method)) != method_type) return method; } @@ -6659,7 +6658,7 @@ lookup_cl (decl) tree decl; { char *line, *found; - + if (!decl) return NULL_TREE; @@ -6671,10 +6670,10 @@ lookup_cl (decl) EXPR_WFL_FILENAME_NODE (cl_v) = get_identifier (DECL_SOURCE_FILE (decl)); EXPR_WFL_SET_LINECOL (cl_v, DECL_SOURCE_LINE_FIRST (decl), -1); - line = java_get_line_col (EXPR_WFL_FILENAME (cl_v), + line = java_get_line_col (EXPR_WFL_FILENAME (cl_v), EXPR_WFL_LINENO (cl_v), EXPR_WFL_COLNO (cl_v)); - found = strstr ((const char *)line, + found = strstr ((const char *)line, (const char *)IDENTIFIER_POINTER (DECL_NAME (decl))); if (found) EXPR_WFL_SET_LINECOL (cl_v, EXPR_WFL_LINENO (cl_v), found - line); @@ -6718,7 +6717,7 @@ process_imports () /* Don't load twice something already defined. */ if (IDENTIFIER_CLASS_VALUE (to_be_found)) continue; - + while (1) { tree left; @@ -6727,7 +6726,7 @@ process_imports () load_class (to_be_found, 0); error_found = check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true); - + /* We found it, we can bail out */ if (IDENTIFIER_CLASS_VALUE (to_be_found)) break; @@ -6764,7 +6763,7 @@ find_in_imports (enclosing_type, class_type) tree enclosing_type; tree class_type; { - tree import = (enclosing_type ? TYPE_IMPORT_LIST (enclosing_type) : + tree import = (enclosing_type ? TYPE_IMPORT_LIST (enclosing_type) : ctxp->import_list); while (import) { @@ -6852,7 +6851,7 @@ read_import_dir (wfl) int current_entry_len = zipd->filename_length; if (current_entry_len >= BUFFER_LENGTH (filename) - && strncmp (filename->data, current_entry, + && strncmp (filename->data, current_entry, BUFFER_LENGTH (filename)) != 0) continue; found |= note_possible_classname (current_entry, @@ -6879,7 +6878,7 @@ read_import_dir (wfl) *filename->ptr++ = '/'; for (;;) { - int len; + int len; const char *d_name; struct dirent *direntp = readdir (dirp); if (!direntp) @@ -6921,7 +6920,7 @@ read_import_dir (wfl) /* Possibly find a type in the import on demands specified types. Returns 1 if an error occurred, 0 otherwise. Run through the entire list, to detected potential double definitions. */ - + static int find_in_imports_on_demand (enclosing_type, class_type) tree enclosing_type; @@ -6942,15 +6941,15 @@ find_in_imports_on_demand (enclosing_type, class_type) const char *id_name; tree decl, type_name_copy; - obstack_grow (&temporary_obstack, + obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))), IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import)))); obstack_1grow (&temporary_obstack, '.'); - obstack_grow0 (&temporary_obstack, + obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (class_type_name), IDENTIFIER_LENGTH (class_type_name)); id_name = obstack_finish (&temporary_obstack); - + if (! (node = maybe_get_identifier (id_name))) continue; @@ -6988,7 +6987,7 @@ find_in_imports_on_demand (enclosing_type, class_type) TYPE_NAME (class_type) = type_name_copy; continue; } - + /* If the loaded class is accessible, we keep a tab on it to detect and report multiple inclusions. */ if (IS_A_CLASSFILE_NAME (node)) @@ -7001,13 +7000,13 @@ find_in_imports_on_demand (enclosing_type, class_type) else if (seen_once >= 0) { tree location = (cl ? cl : TREE_PURPOSE (import)); - tree package = (cl ? EXPR_WFL_NODE (cl) : + tree package = (cl ? EXPR_WFL_NODE (cl) : EXPR_WFL_NODE (TREE_PURPOSE (import))); seen_once++; - parse_error_context + parse_error_context (location, "Type `%s' also potentially defined in package `%s'", - IDENTIFIER_POINTER (TYPE_NAME (class_type)), + IDENTIFIER_POINTER (TYPE_NAME (class_type)), IDENTIFIER_POINTER (package)); } } @@ -7058,14 +7057,14 @@ resolve_package (pkg, next, type_name) /* Try to progressively construct a type name */ if (TREE_CODE (pkg) == EXPR_WITH_FILE_LOCATION) - for (current = EXPR_WFL_QUALIFICATION (pkg); + for (current = EXPR_WFL_QUALIFICATION (pkg); current; current = TREE_CHAIN (current)) { /* If we don't have what we're expecting, exit now. TYPE_NAME will be null and the error caught later. */ if (TREE_CODE (QUAL_WFL (current)) != EXPR_WITH_FILE_LOCATION) break; - *type_name = + *type_name = merge_qualified_name (*type_name, EXPR_WFL_NODE (QUAL_WFL (current))); if ((decl = resolve_no_layout (*type_name, NULL_TREE))) { @@ -7080,7 +7079,7 @@ resolve_package (pkg, next, type_name) } -/* Check accessibility of inner classes according to member access rules. +/* Check accessibility of inner classes according to member access rules. DECL is the inner class, ENCLOSING_DECL is the class from which the access is being attempted. */ @@ -7107,11 +7106,11 @@ check_inner_class_access (decl, enclosing_decl, cl) class in which DECL is declared. */ tree top_level = decl; while (DECL_CONTEXT (top_level)) - top_level = DECL_CONTEXT (top_level); + top_level = DECL_CONTEXT (top_level); while (DECL_CONTEXT (enclosing_decl)) enclosing_decl = DECL_CONTEXT (enclosing_decl); if (top_level == enclosing_decl) - return; + return; access = "private"; } else if (CLASS_PROTECTED (decl)) @@ -7120,7 +7119,7 @@ check_inner_class_access (decl, enclosing_decl, cl) /* Access is permitted from within the same package... */ if (in_same_package (decl, enclosing_decl)) return; - + /* ... or from within the body of a subtype of the context in which DECL is declared. */ decl_context = DECL_CONTEXT (decl); @@ -7128,19 +7127,19 @@ check_inner_class_access (decl, enclosing_decl, cl) { if (CLASS_INTERFACE (decl)) { - if (interface_of_p (TREE_TYPE (decl_context), + if (interface_of_p (TREE_TYPE (decl_context), enclosing_decl_type)) return; } else { /* Eww. The order of the arguments is different!! */ - if (inherits_from_p (enclosing_decl_type, + if (inherits_from_p (enclosing_decl_type, TREE_TYPE (decl_context))) return; } enclosing_decl = DECL_CONTEXT (enclosing_decl); - } + } access = "protected"; } else if (! CLASS_PUBLIC (decl)) @@ -7192,7 +7191,7 @@ check_pkg_class_access (class_name, cl, verbose) return 0; if (verbose) - parse_error_context + parse_error_context (cl, "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed", (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"), IDENTIFIER_POINTER (class_name)); @@ -7228,10 +7227,10 @@ declare_local_variables (modifier, type, vlist) for (i = 0; i <= 10; i++) if (1 << i & modifier) break; if (modifier == ACC_FINAL) final_p = 1; - else + else { - parse_error_context - (ctxp->modifier_ctx [i], + parse_error_context + (ctxp->modifier_ctx [i], "Only `final' is allowed as a local variables modifier"); return; } @@ -7277,16 +7276,16 @@ declare_local_variables (modifier, type, vlist) MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); DECL_FINAL (decl) = final_p; BLOCK_CHAIN_DECL (decl); - + /* If doing xreferencing, replace the line number with the WFL compound value */ if (flag_emit_xref) DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl); - + /* Don't try to use an INIT statement when an error was found */ if (init && java_error_count) init = NULL_TREE; - + /* Add the initialization function to the current function's code */ if (init) { @@ -7297,7 +7296,7 @@ declare_local_variables (modifier, type, vlist) build_debugable_stmt (EXPR_WFL_LINECOL (init), init)); } - + /* Setup dependency the type of the decl */ if (must_chain) { @@ -7332,7 +7331,7 @@ source_start_java_method (fndecl) { tree type = TREE_VALUE (tem); tree name = TREE_PURPOSE (tem); - + /* If type is incomplete. Create an incomplete decl and ask for the decl to be patched later */ if (INCOMPLETE_TYPE_P (type)) @@ -7377,13 +7376,13 @@ create_artificial_method (class, flags, type, name, args) tree mdecl; java_parser_context_save_global (); - lineno = 0; - mdecl = make_node (FUNCTION_TYPE); + lineno = 0; + mdecl = make_node (FUNCTION_TYPE); TREE_TYPE (mdecl) = type; TYPE_ARG_TYPES (mdecl) = args; - mdecl = add_method (class, flags, name, build_java_signature (mdecl)); + mdecl = add_method (class, flags, name, build_java_signature (mdecl)); java_parser_context_restore_global (); - DECL_ARTIFICIAL (mdecl) = 1; + DECL_ARTIFICIAL (mdecl) = 1; return mdecl; } @@ -7494,10 +7493,10 @@ add_stmt_to_block (b, type, stmt) tree b, type, stmt; { tree body = BLOCK_EXPR_BODY (b), c; - + if (java_error_count) return body; - + if ((c = add_stmt_to_compound (body, type, stmt)) == body) return body; @@ -7527,10 +7526,10 @@ void java_layout_seen_class_methods () while (1) { - for (current = previous_list; + for (current = previous_list; current != end; current = TREE_CHAIN (current)) layout_class_methods (TREE_TYPE (TREE_VALUE (current))); - + if (previous_list != all_class_list) { end = previous_list; @@ -7571,7 +7570,7 @@ java_reorder_fields () after having reversed the fields */ else { - TYPE_FIELDS (current_class) = + TYPE_FIELDS (current_class) = nreverse (TYPE_FIELDS (current_class)); TYPE_SIZE (current_class) = NULL_TREE; } @@ -7701,7 +7700,7 @@ java_complete_expand_methods (class_decl) if (!DECL_CONSTRUCTOR_P (decl)) continue; - + no_body = !DECL_FUNCTION_BODY (decl); /* Don't generate debug info on line zero when expanding a generated constructor. */ @@ -7720,7 +7719,7 @@ java_complete_expand_methods (class_decl) /* Ctors aren't part of this batch. */ if (DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl)) continue; - + /* Skip abstract or native methods -- but do handle native methods when generating JNI stubs. */ if (METHOD_ABSTRACT (decl) || (! flag_jni && METHOD_NATIVE (decl))) @@ -7748,7 +7747,7 @@ java_complete_expand_methods (class_decl) java_complete_expand_method (clinit); ctxp->explicit_constructor_p = 0; } - + /* We might have generated a class$ that we now want to expand */ if (TYPE_DOT_CLASS (current_class)) java_complete_expand_method (TYPE_DOT_CLASS (current_class)); @@ -7757,7 +7756,7 @@ java_complete_expand_methods (class_decl) prove wrong.) */ if (!CLASS_INTERFACE (class_decl)) for (decl = TYPE_METHODS (current_class); decl; decl = TREE_CHAIN (decl)) - if (DECL_CONSTRUCTOR_P (decl) + if (DECL_CONSTRUCTOR_P (decl) && verify_constructor_circularity (decl, decl)) break; @@ -7778,7 +7777,7 @@ maybe_generate_pre_expand_clinit (class_type) return NULL_TREE; /* Go through all static fields and pre expand them */ - for (current = TYPE_FIELDS (class_type); current; + for (current = TYPE_FIELDS (class_type); current; current = TREE_CHAIN (current)) if (FIELD_STATIC (current)) build_field_ref (NULL_TREE, class_type, DECL_NAME (current)); @@ -7838,17 +7837,17 @@ analyze_clinit_body (this_class, bbody) case BLOCK: bbody = BLOCK_EXPR_BODY (bbody); break; - + case EXPR_WITH_FILE_LOCATION: bbody = EXPR_WFL_NODE (bbody); break; - + case COMPOUND_EXPR: if (analyze_clinit_body (this_class, TREE_OPERAND (bbody, 0))) return 1; bbody = TREE_OPERAND (bbody, 1); break; - + case MODIFY_EXPR: /* If we're generating to class file and we're dealing with an array initialization, we return 1 to keep <clinit> */ @@ -7883,7 +7882,7 @@ maybe_yank_clinit (mdecl) { tree type, current; tree fbody, bbody; - + if (!DECL_CLINIT_P (mdecl)) return 0; @@ -7902,7 +7901,7 @@ maybe_yank_clinit (mdecl) type = DECL_CONTEXT (mdecl); current = TYPE_FIELDS (type); - for (current = (current ? TREE_CHAIN (current) : current); + for (current = (current ? TREE_CHAIN (current) : current); current; current = TREE_CHAIN (current)) { tree f_init; @@ -7937,7 +7936,7 @@ maybe_yank_clinit (mdecl) if (TYPE_METHODS (type) == mdecl) TYPE_METHODS (type) = TREE_CHAIN (mdecl); else - for (current = TYPE_METHODS (type); current; + for (current = TYPE_METHODS (type); current; current = TREE_CHAIN (current)) if (TREE_CHAIN (current) == mdecl) { @@ -7963,7 +7962,7 @@ start_complete_expand_method (mdecl) for (; tem; tem = TREE_CHAIN (tem)) { - /* TREE_CHAIN (tem) will change after pushdecl. */ + /* TREE_CHAIN (tem) will change after pushdecl. */ tree next = TREE_CHAIN (tem); tree type = TREE_TYPE (tem); if (PROMOTE_PROTOTYPES @@ -7995,7 +7994,7 @@ java_complete_expand_method (mdecl) /* Fix constructors before expanding them */ if (DECL_CONSTRUCTOR_P (mdecl)) fix_constructors (mdecl); - + /* Expand functions that have a body */ if (!DECL_FUNCTION_BODY (mdecl)) return; @@ -8012,35 +8011,35 @@ java_complete_expand_method (mdecl) announce_function (mdecl); if (! quiet_flag) fprintf (stderr, "]"); - + /* Prepare the function for tree completion */ start_complete_expand_method (mdecl); /* Install the current this */ - current_this = (!METHOD_STATIC (mdecl) ? + current_this = (!METHOD_STATIC (mdecl) ? BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE); /* Purge the `throws' list of unchecked exceptions (we save a copy of the list and re-install it later.) */ exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl)); purge_unchecked_exceptions (mdecl); - + /* Install exceptions thrown with `throws' */ PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl)); - + if (block_body != NULL_TREE) { block_body = java_complete_tree (block_body); - + /* Before we check initialization, attached all class initialization variable to the block_body */ htab_traverse (DECL_FUNCTION_INIT_TEST_TABLE (mdecl), attach_init_test_initialization_flags, block_body); - + if (! flag_emit_xref && ! METHOD_NATIVE (mdecl)) { check_for_initialization (block_body, mdecl); - + /* Go through all the flags marking the initialization of static variables and see whether they're definitively assigned, in which case the type is remembered as @@ -8052,7 +8051,7 @@ java_complete_expand_method (mdecl) initialization of self. */ if (METHOD_STATIC (mdecl)) { - *(htab_find_slot + *(htab_find_slot (DECL_FUNCTION_INITIALIZED_CLASS_TABLE (mdecl), DECL_CONTEXT (mdecl), INSERT)) = DECL_CONTEXT (mdecl); } @@ -8060,9 +8059,9 @@ java_complete_expand_method (mdecl) } ctxp->explicit_constructor_p = 0; } - + BLOCK_EXPR_BODY (fbody) = block_body; - + /* If we saw a return but couldn't evaluate it properly, we'll have an error_mark_node here. */ if (block_body != error_mark_node @@ -8133,7 +8132,7 @@ java_expand_method_bodies (class) } } - /* Prepare the function for RTL expansion */ + /* Prepare the function for RTL expansion */ start_complete_expand_method (decl); /* Expand function start, generate initialization flag @@ -8174,7 +8173,7 @@ build_outer_field_access (id, decl) && (!FIELD_PRIVATE (decl) || !flag_emit_class_files )) { tree thisn = build_current_thisn (current_class); - access = make_qualified_primary (build_wfl_node (thisn), + access = make_qualified_primary (build_wfl_node (thisn), id, EXPR_WFL_LINECOL (id)); } /* Otherwise, generate access methods to outer this and access the @@ -8212,11 +8211,11 @@ static int outer_field_access_p (type, decl) tree type, decl; { - if (!INNER_CLASS_TYPE_P (type) + if (!INNER_CLASS_TYPE_P (type) || TREE_CODE (decl) != FIELD_DECL || DECL_CONTEXT (decl) == type) return 0; - + /* If the inner class extends the declaration context of the field we're try to acces, then this isn't an outer field access */ if (inherits_from_p (type, DECL_CONTEXT (decl))) @@ -8259,21 +8258,21 @@ outer_field_expanded_access_p (node, name, arg_type, arg) /* Well, gcj generates slightly different tree nodes when compiling to native or bytecodes. It's the case for function calls. */ - if (flag_emit_class_files + if (flag_emit_class_files && TREE_CODE (node) == CALL_EXPR && OUTER_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (TREE_OPERAND (node, 0)))) identified = 1; else if (!flag_emit_class_files) { node = TREE_OPERAND (node, 0); - + if (node && TREE_OPERAND (node, 0) && TREE_CODE (TREE_OPERAND (node, 0)) == ADDR_EXPR) { node = TREE_OPERAND (node, 0); if (TREE_OPERAND (node, 0) && TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL - && (OUTER_FIELD_ACCESS_IDENTIFIER_P + && (OUTER_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (TREE_OPERAND (node, 0))))) identified = 1; } @@ -8299,10 +8298,10 @@ outer_field_access_fix (wfl, node, rhs) tree wfl, node, rhs; { tree name, arg_type, arg; - + if (outer_field_expanded_access_p (node, &name, &arg_type, &arg)) { - node = build_outer_field_access_expr (EXPR_WFL_LINECOL (wfl), + node = build_outer_field_access_expr (EXPR_WFL_LINECOL (wfl), arg_type, name, arg, rhs); return java_complete_tree (node); } @@ -8310,7 +8309,7 @@ outer_field_access_fix (wfl, node, rhs) } /* Construct the expression that calls an access method: - <type>.access$<n>(<arg1> [, <arg2>]); + <type>.access$<n>(<arg1> [, <arg2>]); ARG2 can be NULL and will be omitted in that case. It will denote a read access. */ @@ -8322,7 +8321,7 @@ build_outer_field_access_expr (lc, type, access_method_name, arg1, arg2) { tree args, cn, access; - args = arg1 ? arg1 : + args = arg1 ? arg1 : build_wfl_node (build_current_thisn (current_class)); args = build_tree_list (NULL_TREE, args); @@ -8363,12 +8362,12 @@ build_outer_field_access_methods (decl) tree decl; { tree id, args, stmt, mdecl; - + if (FIELD_INNER_ACCESS_P (decl)) return FIELD_INNER_ACCESS (decl); MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); - + /* Create the identifier and a function named after it. */ id = build_new_access_id (); @@ -8382,14 +8381,14 @@ build_outer_field_access_methods (decl) stmt = make_qualified_primary (build_wfl_node (inst_id), build_wfl_node (DECL_NAME (decl)), 0); stmt = build_return (0, stmt); - mdecl = build_outer_field_access_method (DECL_CONTEXT (decl), + mdecl = build_outer_field_access_method (DECL_CONTEXT (decl), TREE_TYPE (decl), id, args, stmt); DECL_FUNCTION_ACCESS_DECL (mdecl) = decl; /* Create the write access method. No write access for final variable */ if (!FIELD_FINAL (decl)) { - args = build_tree_list (inst_id, + args = build_tree_list (inst_id, build_pointer_type (DECL_CONTEXT (decl))); TREE_CHAIN (args) = build_tree_list (wpv_id, TREE_TYPE (decl)); TREE_CHAIN (TREE_CHAIN (args)) = end_params_node; @@ -8397,8 +8396,8 @@ build_outer_field_access_methods (decl) build_wfl_node (DECL_NAME (decl)), 0); stmt = build_return (0, build_assignment (ASSIGN_TK, 0, stmt, build_wfl_node (wpv_id))); - mdecl = build_outer_field_access_method (DECL_CONTEXT (decl), - TREE_TYPE (decl), id, + mdecl = build_outer_field_access_method (DECL_CONTEXT (decl), + TREE_TYPE (decl), id, args, stmt); } DECL_FUNCTION_ACCESS_DECL (mdecl) = decl; @@ -8409,7 +8408,7 @@ build_outer_field_access_methods (decl) /* Build an field access method NAME. */ -static tree +static tree build_outer_field_access_method (class, type, name, args, body) tree class, type, name, args, body; { @@ -8460,17 +8459,17 @@ build_outer_method_access_method (decl) carg = TYPE_ARG_TYPES (TREE_TYPE (decl)); /* Create the arguments, as much as the original */ - for (; carg && carg != end_params_node; + for (; carg && carg != end_params_node; carg = TREE_CHAIN (carg)) { sprintf (buffer, "write_parm_value$%d", parm_id_count++); - args = chainon (args, build_tree_list (get_identifier (buffer), + args = chainon (args, build_tree_list (get_identifier (buffer), TREE_VALUE (carg))); } args = chainon (args, end_params_node); /* Create the method */ - mdecl = create_artificial_method (class, ACC_STATIC, + mdecl = create_artificial_method (class, ACC_STATIC, TREE_TYPE (TREE_TYPE (decl)), id, args); layout_class_method (class, NULL_TREE, mdecl, NULL_TREE); /* There is a potential bug here. We should be able to use @@ -8494,10 +8493,10 @@ build_outer_method_access_method (decl) call_args = tree_cons (NULL_TREE, build_wfl_node (TREE_PURPOSE (carg)), call_args); - body = build_method_invocation (build_wfl_node (DECL_NAME (decl)), + body = build_method_invocation (build_wfl_node (DECL_NAME (decl)), call_args); if (!METHOD_STATIC (decl)) - body = make_qualified_primary (build_wfl_node (TREE_PURPOSE (args)), + body = make_qualified_primary (build_wfl_node (TREE_PURPOSE (args)), body, 0); if (TREE_TYPE (TREE_TYPE (decl)) != void_type_node) body = build_return (0, body); @@ -8517,7 +8516,7 @@ build_outer_method_access_method (decl) the enclosing instance of an inner class. The enclosing instance is kept in a generated field called this$<n>, with <n> being the inner class nesting level (starting from 0.) */ - + /* Build an access to a given this$<n>, always chaining access call to others. Access methods to this$<n> are build on the fly if necessary. This CAN'T be used to solely access this$<n-1> from @@ -8563,7 +8562,7 @@ build_access_to_thisn (from, to, lc) /* Build an access function to the this$<n> local to TYPE. NULL_TREE is returned if nothing needs to be generated. Otherwise, the method - generated and a method decl is returned. + generated and a method decl is returned. NOTE: These generated methods should be declared in a class file attribute so that they can't be referred to directly. */ @@ -8591,7 +8590,7 @@ maybe_build_thisn_access_method (type) fix_method_argument_names (args, mdecl); layout_class_method (type, NULL_TREE, mdecl, NULL_TREE); stmt = build_current_thisn (type); - stmt = make_qualified_primary (build_wfl_node (inst_id), + stmt = make_qualified_primary (build_wfl_node (inst_id), build_wfl_node (stmt), 0); stmt = build_return (0, stmt); @@ -8630,10 +8629,10 @@ build_current_thisn (type) i = saved_type_i; else { - for (i = -1, decl = DECL_CONTEXT (TYPE_NAME (type)); + for (i = -1, decl = DECL_CONTEXT (TYPE_NAME (type)); decl; decl = DECL_CONTEXT (decl), i++) ; - + saved_type = type; saved_type_i = i; } @@ -8643,7 +8642,7 @@ build_current_thisn (type) if (i == saved_i) return saved_thisn; - + sprintf (buffer, "this$%d", i); saved_i = i; saved_thisn = get_identifier (buffer); @@ -8704,32 +8703,32 @@ build_dot_class_method (class) TREE_CHAIN (args) = end_params_node; /* Build the qualified name java.lang.Class.forName */ - tmp = MQN (MQN (MQN (BWF ("java"), + tmp = MQN (MQN (MQN (BWF ("java"), BWF ("lang")), BWF ("Class")), BWF ("forName")); load_class (class_not_found_type_node, 1); load_class (no_class_def_found_type_node, 1); - + /* Create the "class$" function */ - mdecl = create_artificial_method (class, ACC_STATIC, + mdecl = create_artificial_method (class, ACC_STATIC, build_pointer_type (class_type_node), classdollar_identifier_node, args); - DECL_FUNCTION_THROWS (mdecl) = + DECL_FUNCTION_THROWS (mdecl) = build_tree_list (NULL_TREE, no_class_def_found_type_node); /* We start by building the try block. We need to build: return (java.lang.Class.forName (type)); */ - stmt = build_method_invocation (tmp, + stmt = build_method_invocation (tmp, build_tree_list (NULL_TREE, type_parm_wfl)); stmt = build_return (0, stmt); /* Now onto the catch block. We start by building the expression throwing a new exception: throw new NoClassDefFoundError (_.getMessage) */ - throw_stmt = make_qualified_name (build_wfl_node (wpv_id), + throw_stmt = make_qualified_name (build_wfl_node (wpv_id), get_message_wfl, 0); throw_stmt = build_method_invocation (throw_stmt, NULL_TREE); - + /* Build new NoClassDefFoundError (_.getMessage) */ - throw_stmt = build_new_invocation + throw_stmt = build_new_invocation (build_wfl_node (get_identifier ("NoClassDefFoundError")), build_tree_list (build_pointer_type (string_type_node), throw_stmt)); @@ -8767,7 +8766,7 @@ build_dot_class_method_invocation (type) sig_id = unmangle_classname (IDENTIFIER_POINTER (sig_id), IDENTIFIER_LENGTH (sig_id)); - s = build_string (IDENTIFIER_LENGTH (sig_id), + s = build_string (IDENTIFIER_LENGTH (sig_id), IDENTIFIER_POINTER (sig_id)); return build_method_invocation (build_wfl_node (classdollar_identifier_node), build_tree_list (NULL_TREE, s)); @@ -8804,17 +8803,17 @@ fix_constructors (mdecl) const char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl)); DECL_NAME (mdecl) = DECL_NAME (sclass_decl); parse_error_context - (lookup_cl (TYPE_NAME (class_type)), + (lookup_cl (TYPE_NAME (class_type)), "No constructor matching `%s' found in class `%s'", lang_printable_name (mdecl, 0), n); DECL_NAME (mdecl) = save; } - + /* The constructor body must be crafted by hand. It's the constructor we defined when we realize we didn't have the CLASSNAME() constructor */ start_artificial_method_body (mdecl); - + /* Insert an assignment to the this$<n> hidden field, if necessary */ if ((thisn_assign = build_thisn_assign ())) @@ -8832,13 +8831,13 @@ fix_constructors (mdecl) end_artificial_method_body (mdecl); } /* Search for an explicit constructor invocation */ - else + else { int found = 0; int invokes_this = 0; tree found_call = NULL_TREE; tree main_block = BLOCK_EXPR_BODY (body); - + while (body) switch (TREE_CODE (body)) { @@ -8878,7 +8877,7 @@ fix_constructors (mdecl) TREE_OPERAND (found_call, 0)); TREE_OPERAND (found_call, 0) = empty_stmt_node; } - + DECL_INIT_CALLS_THIS (mdecl) = invokes_this; /* Insert the instance initializer block right after. */ @@ -8922,12 +8921,12 @@ verify_constructor_super (mdecl) tree arg_type = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl))); if (super_inner) arg_type = TREE_CHAIN (arg_type); - for (m_arg_type = mdecl_arg_type; - (arg_type != end_params_node + for (m_arg_type = mdecl_arg_type; + (arg_type != end_params_node && m_arg_type != end_params_node); - arg_type = TREE_CHAIN (arg_type), + arg_type = TREE_CHAIN (arg_type), m_arg_type = TREE_CHAIN (m_arg_type)) - if (!valid_method_invocation_conversion_p + if (!valid_method_invocation_conversion_p (TREE_VALUE (arg_type), TREE_VALUE (m_arg_type))) break; @@ -9007,7 +9006,7 @@ java_expand_classes () anything, unless we're emitting xrefs or checking the syntax only (but not using -fsyntax-only for the purpose of generating bytecode. */ - if (java_error_count && !flag_emit_xref + if (java_error_count && !flag_emit_xref && (!flag_syntax_only && !flag_emit_class_files)) return; @@ -9046,14 +9045,14 @@ java_expand_classes () situation, the compiler cannot fall back to the original source, having already read the outer class, so we must prevent that situation. */ - for (current = ctxp->class_list; - current; + for (current = ctxp->class_list; + current; current = TREE_CHAIN (current)) reversed_class_list = tree_cons (NULL_TREE, current, reversed_class_list); - for (current = reversed_class_list; - current; + for (current = reversed_class_list; + current; current = TREE_CHAIN (current)) { current_class = TREE_TYPE (TREE_VALUE (current)); @@ -9154,7 +9153,7 @@ make_qualified_name (left, right, location) EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left); EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE); } - + wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0); EXPR_WFL_LINECOL (wfl) = location; chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE)); @@ -9204,7 +9203,7 @@ resolve_expression_name (id, orig) return decl; /* 15.13.1: NAME can appear within a class declaration */ - else + else { decl = lookup_field_wrapper (current_class, name); if (decl) @@ -9279,13 +9278,13 @@ resolve_expression_name (id, orig) /* We've got an error here */ if (INNER_CLASS_TYPE_P (current_class)) - parse_error_context (id, + parse_error_context (id, "Local variable `%s' can't be accessed from within the inner class `%s' unless it is declared final", IDENTIFIER_POINTER (name), IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)))); else - parse_error_context (id, "Undefined variable `%s'", + parse_error_context (id, "Undefined variable `%s'", IDENTIFIER_POINTER (name)); return error_mark_node; @@ -9295,10 +9294,10 @@ static void static_ref_err (wfl, field_id, class_type) tree wfl, field_id, class_type; { - parse_error_context - (wfl, + parse_error_context + (wfl, "Can't make a static reference to nonstatic variable `%s' in class `%s'", - IDENTIFIER_POINTER (field_id), + IDENTIFIER_POINTER (field_id), IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type)))); } @@ -9321,8 +9320,8 @@ resolve_field_access (qual_wfl, field_decl, field_type) return error_mark_node; /* Resolve the LENGTH field of an array here */ - if (DECL_P (decl) && DECL_NAME (decl) == length_identifier_node - && type_found && TYPE_ARRAY_P (type_found) + if (DECL_P (decl) && DECL_NAME (decl) == length_identifier_node + && type_found && TYPE_ARRAY_P (type_found) && ! flag_emit_class_files && ! flag_emit_xref) { tree length = build_java_array_length_access (where_found); @@ -9349,8 +9348,8 @@ resolve_field_access (qual_wfl, field_decl, field_type) if (!type_found) type_found = DECL_CONTEXT (decl); is_static = FIELD_STATIC (decl); - field_ref = build_field_ref ((is_static && !flag_emit_xref? - NULL_TREE : where_found), + field_ref = build_field_ref ((is_static && !flag_emit_xref? + NULL_TREE : where_found), type_found, DECL_NAME (decl)); if (field_ref == error_mark_node) return error_mark_node; @@ -9363,7 +9362,7 @@ resolve_field_access (qual_wfl, field_decl, field_type) if (field_decl) *field_decl = decl; if (field_type) - *field_type = (QUAL_DECL_TYPE (decl) ? + *field_type = (QUAL_DECL_TYPE (decl) ? QUAL_DECL_TYPE (decl) : TREE_TYPE (decl)); return field_ref; } @@ -9407,7 +9406,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) int is_static; tree decl = NULL_TREE, type = NULL_TREE, q; /* For certain for of inner class instantiation */ - tree saved_current, saved_this; + tree saved_current, saved_this; #define RESTORE_THIS_AND_CURRENT_CLASS \ { current_class = saved_current; current_this = saved_this;} @@ -9428,7 +9427,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) build the code to access it. */ if (JDECL_P (decl) && !FIELD_STATIC (decl)) { - decl = maybe_access_field (decl, *where_found, + decl = maybe_access_field (decl, *where_found, DECL_CONTEXT (decl)); if (decl == error_mark_node) return 1; @@ -9444,7 +9443,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) saved and restored shortly after */ saved_current = current_class; saved_this = current_this; - if (decl + if (decl && (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR || from_qualified_this)) { @@ -9481,7 +9480,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) if (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR && INNER_ENCLOSING_SCOPE_CHECK (type)) { - parse_error_context + parse_error_context (qual_wfl, "No enclosing instance for inner class `%s' is in scope%s", lang_printable_name (type, 0), (!current_this ? "" : @@ -9495,8 +9494,8 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) RESTORE_THIS_AND_CURRENT_CLASS; /* EH check. No check on access$<n> functions */ - if (location - && !OUTER_FIELD_ACCESS_IDENTIFIER_P + if (location + && !OUTER_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (current_function_decl))) check_thrown_exceptions (location, ret_decl); @@ -9590,7 +9589,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) { if (!current_this) { - parse_error_context + parse_error_context (wfl, "Keyword `this' used outside allowed context"); return 1; } @@ -9613,8 +9612,8 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) if (!enclosing_context_p (type, current_class)) { char *p = xstrdup (lang_printable_name (type, 0)); - parse_error_context (qual_wfl, "Can't use variable `%s.this': type `%s' isn't an outer type of type `%s'", - p, p, + parse_error_context (qual_wfl, "Can't use variable `%s.this': type `%s' isn't an outer type of type `%s'", + p, p, lang_printable_name (current_class, 0)); free (p); return 1; @@ -9645,12 +9644,12 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) if (METHOD_STATIC (current_function_decl) || current_class == object_type_node) { - parse_error_context + parse_error_context (wfl, "Keyword `super' used outside allowed context"); return 1; } /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */ - node = build_cast (EXPR_WFL_LINECOL (qual_wfl), + node = build_cast (EXPR_WFL_LINECOL (qual_wfl), CLASSTYPE_SUPER (current_class), build_this (EXPR_WFL_LINECOL (qual_wfl))); *where_found = decl = java_complete_tree (node); @@ -9692,7 +9691,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) else { if (from_super || from_cast) - parse_error_context + parse_error_context ((from_cast ? qual_wfl : wfl), "No variable `%s' defined in class `%s'", IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), @@ -9714,7 +9713,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) /* Sneak preview. If next we see a `new', we're facing a qualification with resulted in a type being selected instead of a field. Report the error */ - if(TREE_CHAIN (q) + if(TREE_CHAIN (q) && TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR) { parse_error_context (qual_wfl, "Undefined variable `%s'", @@ -9724,7 +9723,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) if (not_accessible_p (TREE_TYPE (decl), decl, type, 0)) { - parse_error_context + parse_error_context (qual_wfl, "Can't access %s field `%s.%s' from `%s'", java_accstring_lookup (get_access_flags_from_decl (decl)), GET_TYPE_NAME (type), @@ -9738,7 +9737,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) from_type = 1; } /* We resolve an expression name */ - else + else { tree field_decl = NULL_TREE; @@ -9796,14 +9795,14 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) if (!from_type && !JREFERENCE_TYPE_P (type)) { - parse_error_context + parse_error_context (qual_wfl, "Attempt to reference field `%s' in `%s %s'", IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), lang_printable_name (type, 0), IDENTIFIER_POINTER (DECL_NAME (decl))); return 1; } - + field_decl = lookup_field_wrapper (type, EXPR_WFL_NODE (qual_wfl)); @@ -9817,7 +9816,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) inner_decl = resolve_class (decl, ptr, NULL_TREE, qual_wfl); if (inner_decl) { - check_inner_class_access (inner_decl, decl, qual_wfl); + check_inner_class_access (inner_decl, decl, qual_wfl); type = TREE_TYPE (inner_decl); decl = inner_decl; from_type = 1; @@ -9827,9 +9826,9 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) if (field_decl == NULL_TREE) { - parse_error_context + parse_error_context (qual_wfl, "No variable `%s' defined in type `%s'", - IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), + IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), GET_TYPE_NAME (type)); return 1; } @@ -9844,37 +9843,37 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) field_decl_type = TREE_TYPE (TREE_TYPE (field_decl)); else field_decl_type = TREE_TYPE (field_decl); - if (!JPRIMITIVE_TYPE_P (field_decl_type) + if (!JPRIMITIVE_TYPE_P (field_decl_type) && !CLASS_LOADED_P (field_decl_type) && !TYPE_ARRAY_P (field_decl_type)) resolve_and_layout (field_decl_type, NULL_TREE); - + /* Check on accessibility here */ if (not_accessible_p (current_class, field_decl, DECL_CONTEXT (field_decl), from_super)) { - parse_error_context + parse_error_context (qual_wfl, "Can't access %s field `%s.%s' from `%s'", - java_accstring_lookup + java_accstring_lookup (get_access_flags_from_decl (field_decl)), GET_TYPE_NAME (type), IDENTIFIER_POINTER (DECL_NAME (field_decl)), - IDENTIFIER_POINTER + IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)))); return 1; } check_deprecation (qual_wfl, field_decl); - + /* There are things to check when fields are accessed from type. There are no restrictions on a static declaration of the field when it is accessed from an interface */ is_static = FIELD_STATIC (field_decl); - if (!from_super && from_type - && !TYPE_INTERFACE_P (type) - && !is_static - && (current_function_decl + if (!from_super && from_type + && !TYPE_INTERFACE_P (type) + && !is_static + && (current_function_decl && METHOD_STATIC (current_function_decl))) { static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type); @@ -9919,11 +9918,11 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) /* Sneak preview. If decl is qualified by a `new', report the error here to be accurate on the peculiar construct */ - if (TREE_CHAIN (q) + if (TREE_CHAIN (q) && TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR && !JREFERENCE_TYPE_P (type)) { - parse_error_context (qual_wfl, "Attempt to reference field `new' in a `%s'", + parse_error_context (qual_wfl, "Attempt to reference field `new' in a `%s'", lang_printable_name (type, 0)); return 1; } @@ -9959,7 +9958,7 @@ not_accessible_p (reference, member, where, from_super) /* Access always granted for members declared public */ if (access_flag & ACC_PUBLIC) return 0; - + /* Check access on protected members */ if (access_flag & ACC_PROTECTED) { @@ -10027,7 +10026,7 @@ check_deprecation (wfl, decl) /* Complain if the field is deprecated and the file it was defined in isn't compiled at the same time the file which contains its use is */ - if (DECL_DEPRECATED (decl) + if (DECL_DEPRECATED (decl) && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file))) { char the [20]; @@ -10050,8 +10049,8 @@ check_deprecation (wfl, decl) /* Don't issue a message if the context as been deprecated as a whole. */ if (! CLASS_DEPRECATED (TYPE_NAME (DECL_CONTEXT (decl)))) - parse_warning_context - (wfl, "The %s `%s' in class `%s' has been deprecated", + parse_warning_context + (wfl, "The %s `%s' in class `%s' has been deprecated", the, lang_printable_name (decl, 0), IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))))); } @@ -10103,7 +10102,7 @@ maybe_access_field (decl, where, type) { if (TREE_CODE (decl) == FIELD_DECL && decl != current_this && !FIELD_STATIC (decl)) - decl = build_field_ref (where ? where : current_this, + decl = build_field_ref (where ? where : current_this, (type ? type : DECL_CONTEXT (decl)), DECL_NAME (decl)); return decl; @@ -10129,7 +10128,7 @@ patch_method_invocation (patch, primary, where, from_super, int is_super_init = 0; tree this_arg = NULL_TREE; int is_array_clone_call = 0; - + /* Should be overriden if everything goes well. Otherwise, if something fails, it should keep this value. It stop the evaluation of a bogus assignment. See java_complete_tree, @@ -10152,14 +10151,14 @@ patch_method_invocation (patch, primary, where, from_super, data during error report. */ identifier_wfl = cut_identifier_in_qualified (wfl); identifier = EXPR_WFL_NODE (identifier_wfl); - + /* Given the context, IDENTIFIER is syntactically qualified as a MethodName. We need to qualify what's before */ qualify_ambiguous_name (wfl); resolved = resolve_field_access (wfl, NULL, NULL); if (TREE_CODE (resolved) == VAR_DECL && FIELD_STATIC (resolved) - && FIELD_FINAL (resolved) + && FIELD_FINAL (resolved) && !inherits_from_p (DECL_CONTEXT (resolved), current_class) && !flag_emit_class_files && !flag_emit_xref) resolved = build_class_init (DECL_CONTEXT (resolved), resolved); @@ -10169,14 +10168,14 @@ patch_method_invocation (patch, primary, where, from_super, type = GET_SKIP_TYPE (resolved); resolve_and_layout (type, NULL_TREE); - + if (JPRIMITIVE_TYPE_P (type)) { parse_error_context (identifier_wfl, "Can't invoke a method on primitive type `%s'", IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))); - PATCH_METHOD_RETURN_ERROR (); + PATCH_METHOD_RETURN_ERROR (); } list = lookup_method_invoke (0, identifier_wfl, type, identifier, args); @@ -10190,17 +10189,17 @@ patch_method_invocation (patch, primary, where, from_super, parse_error_context (identifier_wfl, "Can't make static reference to method `%s' in interface `%s'", - IDENTIFIER_POINTER (identifier), + IDENTIFIER_POINTER (identifier), IDENTIFIER_POINTER (name)); PATCH_METHOD_RETURN_ERROR (); } if (list && !METHOD_STATIC (list)) { char *fct_name = xstrdup (lang_printable_name (list, 0)); - parse_error_context + parse_error_context (identifier_wfl, "Can't make static reference to method `%s %s' in class `%s'", - lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), + lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))); free (fct_name); PATCH_METHOD_RETURN_ERROR (); @@ -10208,10 +10207,10 @@ patch_method_invocation (patch, primary, where, from_super, } else this_arg = primary = resolved; - + if (TYPE_ARRAY_P (type) && identifier == get_identifier ("clone")) is_array_clone_call = 1; - + /* IDENTIFIER_WFL will be used to report any problem further */ wfl = identifier_wfl; } @@ -10221,13 +10220,13 @@ patch_method_invocation (patch, primary, where, from_super, { tree class_to_search = NULL_TREE; int lc; /* Looking for Constructor */ - + /* We search constructor in their target class */ if (CALL_CONSTRUCTOR_P (patch)) { if (TREE_CODE (patch) == NEW_CLASS_EXPR) class_to_search = EXPR_WFL_NODE (wfl); - else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == + else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == this_identifier_node) class_to_search = NULL_TREE; else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == @@ -10235,7 +10234,7 @@ patch_method_invocation (patch, primary, where, from_super, { is_super_init = 1; if (CLASSTYPE_SUPER (current_class)) - class_to_search = + class_to_search = DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class))); else { @@ -10251,19 +10250,19 @@ patch_method_invocation (patch, primary, where, from_super, if (!class_to_search) { - parse_error_context + parse_error_context (wfl, "Class `%s' not found in type declaration", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); PATCH_METHOD_RETURN_ERROR (); } - + /* Can't instantiate an abstract class, but we can invoke it's constructor. It's use within the `new' context is denied here. */ - if (CLASS_ABSTRACT (class_to_search) + if (CLASS_ABSTRACT (class_to_search) && TREE_CODE (patch) == NEW_CLASS_EXPR) { - parse_error_context + parse_error_context (wfl, "Class `%s' is an abstract class. It can't be instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl))); PATCH_METHOD_RETURN_ERROR (); @@ -10315,13 +10314,13 @@ patch_method_invocation (patch, primary, where, from_super, can't be executed then. */ if (!list) PATCH_METHOD_RETURN_ERROR (); - + if (TYPE_ARRAY_P (class_to_search) && DECL_NAME (list) == get_identifier ("clone")) is_array_clone_call = 1; /* Check for static reference if non static methods */ - if (check_for_static_method_reference (wfl, patch, list, + if (check_for_static_method_reference (wfl, patch, list, class_to_search, primary)) PATCH_METHOD_RETURN_ERROR (); @@ -10331,7 +10330,7 @@ patch_method_invocation (patch, primary, where, from_super, && INNER_ENCLOSING_SCOPE_CHECK (class_to_search) && !DECL_INIT_P (current_function_decl)) { - parse_error_context + parse_error_context (wfl, "No enclosing instance for inner class `%s' is in scope%s", lang_printable_name (class_to_search, 0), (!current_this ? "" : @@ -10359,16 +10358,16 @@ patch_method_invocation (patch, primary, where, from_super, x(a1,...,an) into TYPE_OF(this$<n>).x(a1,....an) 2) We're generating bytecodes: - + - LIST is non static. It's invocation is transformed from x(a1,....,an) into access$<n>(this$<n>,a1,...,an). - LIST is static. It's invocation is transformed from x(a1,....,an) into TYPE_OF(this$<n>).x(a1,....an). Of course, this$<n> can be abitrary complex, ranging from - this$0 (the immediate outer context) to - access$0(access$0(...(this$0))). - + this$0 (the immediate outer context) to + access$0(access$0(...(this$0))). + maybe_use_access_method returns a non zero value if the this_arg has to be moved into the (then generated) stub argument list. In the meantime, the selected function @@ -10384,13 +10383,13 @@ patch_method_invocation (patch, primary, where, from_super, /* Merge point of all resolution schemes. If we have nothing, this is an error, already signaled */ - if (!list) + if (!list) PATCH_METHOD_RETURN_ERROR (); /* Check accessibility, position the is_static flag, build and return the call */ if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, - (primary ? TREE_TYPE (TREE_TYPE (primary)) : + (primary ? TREE_TYPE (TREE_TYPE (primary)) : NULL_TREE), from_super) /* Calls to clone() on array types are permitted as a special-case. */ && !is_array_clone_call) @@ -10421,7 +10420,7 @@ patch_method_invocation (patch, primary, where, from_super, /* If invoking a innerclass constructor, there are hidden parameters to pass */ - if (TREE_CODE (patch) == NEW_CLASS_EXPR + if (TREE_CODE (patch) == NEW_CLASS_EXPR && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list))) { /* And make sure we add the accessed local variables to be saved @@ -10465,12 +10464,12 @@ patch_method_invocation (patch, primary, where, from_super, /* This handles the situation where a constructor invocation needs to have an enclosing context passed as a second parameter (the constructor is one of an inner class). */ - if ((is_super_init || + if ((is_super_init || (TREE_CODE (patch) == CALL_EXPR && name == this_identifier_node)) && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list))) { tree dest = TYPE_NAME (DECL_CONTEXT (list)); - tree extra_arg = + tree extra_arg = build_access_to_thisn (current_class, DECL_CONTEXT (dest), 0); extra_arg = java_complete_tree (extra_arg); args = tree_cons (NULL_TREE, extra_arg, args); @@ -10484,8 +10483,8 @@ patch_method_invocation (patch, primary, where, from_super, invoke any method relying on `this'. Exceptions are: we're invoking a static function, primary exists and is not the current this, we're creating a new object. */ - if (ctxp->explicit_constructor_p - && !is_static_flag + if (ctxp->explicit_constructor_p + && !is_static_flag && (!primary || primary == current_this) && (TREE_CODE (patch) != NEW_CLASS_EXPR)) { @@ -10493,7 +10492,7 @@ patch_method_invocation (patch, primary, where, from_super, PATCH_METHOD_RETURN_ERROR (); } java_parser_context_restore_global (); - if (is_static) + if (is_static) *is_static = is_static_flag; /* Sometimes, we want the decl of the selected method. Such as for EH checking */ @@ -10505,12 +10504,12 @@ patch_method_invocation (patch, primary, where, from_super, if (is_super_init && CLASS_HAS_FINIT_P (current_class)) { tree finit_parms, finit_call; - + /* Prepare to pass hidden parameters to finit$, if any. */ - finit_parms = build_alias_initializer_parameter_list + finit_parms = build_alias_initializer_parameter_list (AIPL_FUNCTION_FINIT_INVOCATION, current_class, NULL_TREE, NULL); - - finit_call = + + finit_call = build_method_invocation (build_wfl_node (finit_identifier_node), finit_parms); @@ -10531,12 +10530,12 @@ static int check_for_static_method_reference (wfl, node, method, where, primary) tree wfl, node, method, where, primary; { - if (METHOD_STATIC (current_function_decl) + if (METHOD_STATIC (current_function_decl) && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node)) { char *fct_name = xstrdup (lang_printable_name (method, 0)); - parse_error_context - (wfl, "Can't make static reference to method `%s %s' in class `%s'", + parse_error_context + (wfl, "Can't make static reference to method `%s %s' in class `%s'", lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where)))); free (fct_name); @@ -10560,13 +10559,13 @@ maybe_use_access_method (is_super_init, mdecl, this_arg) int to_return = 0; int non_static_context = !METHOD_STATIC (md); - if (is_super_init + if (is_super_init || DECL_CONTEXT (md) == current_class - || !PURE_INNER_CLASS_TYPE_P (current_class) + || !PURE_INNER_CLASS_TYPE_P (current_class) || DECL_FINIT_P (md) || DECL_INSTINIT_P (md)) return 0; - + /* If we're calling a method found in an enclosing class, generate what it takes to retrieve the right this. Don't do that if we're invoking a static method. Note that if MD's type is unrelated to @@ -10591,7 +10590,7 @@ maybe_use_access_method (is_super_init, mdecl, this_arg) ta = build_access_to_thisn (ctx, type, 0); break; } - type = (DECL_CONTEXT (TYPE_NAME (type)) ? + type = (DECL_CONTEXT (TYPE_NAME (type)) ? TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))) : NULL_TREE); } } @@ -10635,7 +10634,7 @@ patch_invoke (patch, method, args) t = TYPE_ARG_TYPES (TREE_TYPE (method)); if (TREE_CODE (patch) == NEW_CLASS_EXPR) t = TREE_CHAIN (t); - for (ta = args; t != end_params_node && ta; + for (ta = args; t != end_params_node && ta; t = TREE_CHAIN (t), ta = TREE_CHAIN (ta)) if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) && TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t)) @@ -10726,7 +10725,7 @@ patch_invoke (patch, method, args) new = build (CALL_EXPR, promote_type (class), build_address_of (alloc_node), tree_cons (NULL_TREE, build_class_ref (class), - build_tree_list (NULL_TREE, + build_tree_list (NULL_TREE, size_in_bytes (class))), NULL_TREE); saved_new = save_expr (new); @@ -10864,7 +10863,7 @@ lookup_method_invoke (lc, cl, class, name, arg_list) char string [4096]; if (!cm || not_accessible_p (class, cm, NULL_TREE, 0)) continue; - sprintf + sprintf (string, " `%s' in `%s'%s", get_printable_method_name (cm), IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))), @@ -10900,7 +10899,7 @@ find_applicable_accessible_methods_list (lc, class, name, arglist) static int search_not_done = 0; tree list = NULL_TREE, all_list = NULL_TREE; - /* Check the hash table to determine if this class has been searched + /* Check the hash table to determine if this class has been searched already. */ if (searched_classes) { @@ -10912,7 +10911,7 @@ find_applicable_accessible_methods_list (lc, class, name, arglist) searched_classes = htab_create (10, htab_hash_pointer, htab_eq_pointer, NULL); } - + search_not_done++; *htab_find_slot (searched_classes, class, INSERT) = class; @@ -10923,12 +10922,12 @@ find_applicable_accessible_methods_list (lc, class, name, arglist) } /* Search interfaces */ - if (TREE_CODE (TYPE_NAME (class)) == TYPE_DECL + if (TREE_CODE (TYPE_NAME (class)) == TYPE_DECL && CLASS_INTERFACE (TYPE_NAME (class))) { int i, n; tree basetype_vec = TYPE_BINFO_BASETYPES (class); - search_applicable_methods_list (lc, TYPE_METHODS (class), + search_applicable_methods_list (lc, TYPE_METHODS (class), name, arglist, &list, &all_list); n = TREE_VEC_LENGTH (basetype_vec); for (i = 1; i < n; i++) @@ -10936,7 +10935,7 @@ find_applicable_accessible_methods_list (lc, class, name, arglist) tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)); tree rlist; - rlist = find_applicable_accessible_methods_list (lc, t, name, + rlist = find_applicable_accessible_methods_list (lc, t, name, arglist); list = chainon (rlist, list); } @@ -10944,7 +10943,7 @@ find_applicable_accessible_methods_list (lc, class, name, arglist) /* Search classes */ else { - search_applicable_methods_list (lc, TYPE_METHODS (class), + search_applicable_methods_list (lc, TYPE_METHODS (class), name, arglist, &list, &all_list); /* When looking finit$, class$ or instinit$, we turn LC to 1 so @@ -10980,7 +10979,7 @@ find_applicable_accessible_methods_list (lc, class, name, arglist) { tree rlist; class = CLASSTYPE_SUPER (class); - rlist = find_applicable_accessible_methods_list (lc, class, + rlist = find_applicable_accessible_methods_list (lc, class, name, arglist); list = chainon (rlist, list); } @@ -10996,7 +10995,7 @@ find_applicable_accessible_methods_list (lc, class, name, arglist) && TYPE_METHODS (object_type_node) && htab_find (searched_classes, object_type_node) == NULL) { - search_applicable_methods_list (lc, + search_applicable_methods_list (lc, TYPE_METHODS (object_type_node), name, arglist, &list, &all_list); } @@ -11011,7 +11010,7 @@ find_applicable_accessible_methods_list (lc, class, name, arglist) /* Effectively search for the appropriate method in method */ -static void +static void search_applicable_methods_list (lc, method, name, arglist, list, all_list) int lc; tree method, name, arglist; @@ -11023,14 +11022,14 @@ search_applicable_methods_list (lc, method, name, arglist, list, all_list) other classes */ if (lc && !DECL_CONSTRUCTOR_P (method)) continue; - else if (!lc && (DECL_CONSTRUCTOR_P (method) + else if (!lc && (DECL_CONSTRUCTOR_P (method) || (DECL_NAME (method) != name))) continue; if (argument_types_convertible (method, arglist)) { /* Retain accessible methods only */ - if (!not_accessible_p (DECL_CONTEXT (current_function_decl), + if (!not_accessible_p (DECL_CONTEXT (current_function_decl), method, NULL_TREE, 0)) *list = tree_cons (NULL_TREE, method, *list); else @@ -11067,13 +11066,13 @@ find_most_specific_methods_list (list) /* Compare arguments and location where methods where declared */ if (argument_types_convertible (method_v, current_v)) { - if (valid_method_invocation_conversion_p + if (valid_method_invocation_conversion_p (DECL_CONTEXT (method_v), DECL_CONTEXT (current_v)) || (INNER_CLASS_TYPE_P (DECL_CONTEXT (current_v)) && enclosing_context_p (DECL_CONTEXT (method_v), DECL_CONTEXT (current_v)))) { - int v = (DECL_SPECIFIC_COUNT (current_v) += + int v = (DECL_SPECIFIC_COUNT (current_v) += (INNER_CLASS_TYPE_P (DECL_CONTEXT (current_v)) ? 2 : 1)); max = (v > max ? v : max); } @@ -11267,7 +11266,7 @@ qualify_ambiguous_name (id) else if (code == TREE_LIST) name = EXPR_WFL_NODE (TREE_PURPOSE (qual_wfl)); - else if (code == STRING_CST || code == CONDITIONAL_EXPR + else if (code == STRING_CST || code == CONDITIONAL_EXPR || code == PLUS_EXPR) { qual = TREE_CHAIN (qual); @@ -11292,7 +11291,7 @@ qualify_ambiguous_name (id) if (TREE_CODE (TREE_PURPOSE (qual)) == ARRAY_REF && TREE_CODE (TREE_OPERAND (TREE_PURPOSE (qual), 0)) == EXPR_WITH_FILE_LOCATION - && EXPR_WFL_NODE (TREE_OPERAND (TREE_PURPOSE (qual), 0)) == + && EXPR_WFL_NODE (TREE_OPERAND (TREE_PURPOSE (qual), 0)) == this_identifier_node) { qual = TREE_OPERAND (TREE_PURPOSE (qual), 0); @@ -11325,12 +11324,12 @@ qualify_ambiguous_name (id) super_found = again = 1; } } while (again); - + /* If name appears within the scope of a local variable declaration or parameter declaration, then it is an expression name. We don't carry this test out if we're in the context of the use of SUPER or THIS */ - if (!this_found && !super_found + if (!this_found && !super_found && TREE_CODE (name) != STRING_CST && TREE_CODE (name) != INTEGER_CST && (decl = IDENTIFIER_LOCAL_VALUE (name))) { @@ -11356,7 +11355,7 @@ qualify_ambiguous_name (id) - NAME is declared in an another compilation unit of the package of the compilation unit containing NAME, - NAME is declared by exactly on type-import-on-demand declaration - of the compilation unit containing NAME. + of the compilation unit containing NAME. - NAME is actually a STRING_CST. This can't happen if the expression was qualified by `this.' */ else if (! this_found && @@ -11380,7 +11379,7 @@ qualify_ambiguous_name (id) containing NAME. FIXME */ /* Otherwise, NAME is reclassified as a package name */ - else + else RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1; /* Propagate the qualification accross other components of the @@ -11390,7 +11389,7 @@ qualify_ambiguous_name (id) { if (RESOLVE_PACKAGE_NAME_P (qual_wfl)) RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1; - else + else RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1; } @@ -11430,7 +11429,7 @@ breakdown_qualified (left, right, source) if (right) *right = get_identifier (p+1); *left = get_identifier (base); - + return 0; } @@ -11443,7 +11442,7 @@ in_same_package (name1, name2) tree tmp; tree pkg1; tree pkg2; - + if (TREE_CODE (name1) == TYPE_DECL) name1 = DECL_NAME (name1); if (TREE_CODE (name2) == TYPE_DECL) @@ -11459,7 +11458,7 @@ in_same_package (name1, name2) breakdown_qualified (&pkg1, &tmp, name1); breakdown_qualified (&pkg2, &tmp, name2); - + return (pkg1 == pkg2); } @@ -11552,7 +11551,7 @@ java_complete_lhs (node) int error_seen = 0; if (TREE_CODE (stmt) == COMPOUND_EXPR) { - /* Re-order from (((A; B); C); ...; Z) to + /* Re-order from (((A; B); C); ...; Z) to (A; (B; (C ; (...; Z)))). This makes it easier to scan the statements left-to-right without using recursion (which might overflow the stack @@ -11698,11 +11697,11 @@ java_complete_lhs (node) nn = ctxp->current_loop; /* It must be assignable to the type of the switch expression. */ - if (!try_builtin_assignconv (NULL_TREE, + if (!try_builtin_assignconv (NULL_TREE, TREE_TYPE (TREE_OPERAND (nn, 0)), cn)) { EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); - parse_error_context + parse_error_context (wfl_operator, "Incompatible type for case. Can't convert `%s' to `int'", lang_printable_name (TREE_TYPE (cn), 0)); @@ -11733,7 +11732,7 @@ java_complete_lhs (node) if (SWITCH_HAS_DEFAULT (nn)) { EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); - parse_error_context (wfl_operator, + parse_error_context (wfl_operator, "Duplicate case label: `default'"); return error_mark_node; } @@ -11808,7 +11807,7 @@ java_complete_lhs (node) /* 3- Expression section */ case COMPOUND_EXPR: wfl_op2 = TREE_OPERAND (node, 1); - TREE_OPERAND (node, 0) = nn = + TREE_OPERAND (node, 0) = nn = java_complete_tree (TREE_OPERAND (node, 0)); if (wfl_op2 == empty_stmt_node) CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn); @@ -11895,7 +11894,7 @@ java_complete_lhs (node) } else TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node)); - + } break; @@ -11905,7 +11904,7 @@ java_complete_lhs (node) for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn)) { int location = EXPR_WFL_LINECOL (TREE_VALUE (cn)); - tree dim = convert (int_type_node, + tree dim = convert (int_type_node, java_complete_tree (TREE_VALUE (cn))); if (dim == error_mark_node) { @@ -11917,7 +11916,7 @@ java_complete_lhs (node) TREE_VALUE (cn) = dim; /* Setup the location of the current dimension, for later error report. */ - TREE_PURPOSE (cn) = + TREE_PURPOSE (cn) = build_expr_wfl (NULL_TREE, input_filename, 0, 0); EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location; } @@ -11966,8 +11965,8 @@ java_complete_lhs (node) check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl); /* If we call this(...), register signature and positions */ if (in_this) - DECL_CONSTRUCTOR_CALLS (current_function_decl) = - tree_cons (wfl, decl, + DECL_CONSTRUCTOR_CALLS (current_function_decl) = + tree_cons (wfl, decl, DECL_CONSTRUCTOR_CALLS (current_function_decl)); CAN_COMPLETE_NORMALLY (node) = 1; return force_evaluation_order (node); @@ -11977,20 +11976,20 @@ java_complete_lhs (node) /* Save potential wfls */ wfl_op1 = TREE_OPERAND (node, 0); TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1); - + if (MODIFY_EXPR_FROM_INITIALIZATION_P (node) && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn) && DECL_INITIAL (nn) != NULL_TREE) { tree value; - + value = fold_constant_for_init (nn, nn); /* When we have a primitype type, or a string and we're not emitting a class file, we actually don't want to generate anything for the assignment. */ if (value != NULL_TREE && - (JPRIMITIVE_TYPE_P (TREE_TYPE (value)) || + (JPRIMITIVE_TYPE_P (TREE_TYPE (value)) || (TREE_TYPE (value) == string_ptr_type_node && ! flag_emit_class_files))) { @@ -12026,11 +12025,11 @@ java_complete_lhs (node) { /* This might break when accessing outer field from inner class. TESTME, FIXME */ - tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0)); + tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0)); /* Hand stabilize the lhs on both places */ TREE_OPERAND (node, 0) = lvalue; - TREE_OPERAND (TREE_OPERAND (node, 1), 0) = + TREE_OPERAND (TREE_OPERAND (node, 1), 0) = (flag_emit_class_files ? lvalue : save_expr (lvalue)); /* 15.25.2.a: Left hand is not an array access. FIXME */ @@ -12040,9 +12039,9 @@ java_complete_lhs (node) if ((cn = patch_string (nn))) nn = cn; - /* The last part of the rewrite for E1 op= E2 is to have + /* The last part of the rewrite for E1 op= E2 is to have E1 = (T)(E1 op E2), with T being the type of E1. */ - nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2), + nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2), TREE_TYPE (lvalue), nn)); /* If the assignment is compound and has reference type, @@ -12096,7 +12095,7 @@ java_complete_lhs (node) if (node == error_mark_node) return error_mark_node; /* Reorganize the tree if necessary. */ - if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node)) + if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node)) || JSTRING_P (TREE_TYPE (node)))) node = java_refold (node); } @@ -12105,9 +12104,9 @@ java_complete_lhs (node) undergone a conversion in patch_assignment. We do that only when it's necessary to have DECL_INITIAL properly set. */ nn = TREE_OPERAND (node, 0); - if (TREE_CODE (nn) == VAR_DECL + if (TREE_CODE (nn) == VAR_DECL && DECL_INITIAL (nn) && CONSTANT_VALUE_P (DECL_INITIAL (nn)) - && FIELD_STATIC (nn) && FIELD_FINAL (nn) + && FIELD_STATIC (nn) && FIELD_FINAL (nn) && (JPRIMITIVE_TYPE_P (TREE_TYPE (nn)) || TREE_TYPE (nn) == string_ptr_type_node)) DECL_INITIAL (nn) = TREE_OPERAND (node, 1); @@ -12129,7 +12128,7 @@ java_complete_lhs (node) case RDIV_EXPR: case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: - case EQ_EXPR: + case EQ_EXPR: case NE_EXPR: case GT_EXPR: case GE_EXPR: @@ -12248,13 +12247,13 @@ java_complete_lhs (node) if (ctxp->explicit_constructor_p) { EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); - parse_error_context + parse_error_context (wfl_operator, "Can't reference `this' or `super' before the superclass constructor has been called"); TREE_TYPE (node) = error_mark_node; return error_mark_node; } return current_this; - + case CLASS_LITERAL: CAN_COMPLETE_NORMALLY (node) = 1; node = patch_incomplete_class_ref (node); @@ -12351,7 +12350,7 @@ enter_block () for the first time for a given function. The current function body (DECL_FUNCTION_BODY) is set to be block B. */ - tree fndecl = current_function_decl; + tree fndecl = current_function_decl; if (!fndecl) { BLOCK_SUPERCONTEXT (b) = current_static_block; @@ -12413,7 +12412,7 @@ lookup_name_in_blocks (name) if (TREE_CODE (b) != BLOCK) abort (); - for (current = BLOCK_EXPR_DECLS (b); current; + for (current = BLOCK_EXPR_DECLS (b); current; current = TREE_CHAIN (current)) if (DECL_NAME (current) == name) return current; @@ -12446,7 +12445,7 @@ build_wfl_wrap (node, location) int location; { tree wfl, node_to_insert = node; - + /* We want to process THIS . xxx symbolicaly, to keep it consistent with the way we're processing SUPER. A THIS from a primary as a different form than a SUPER. Turn THIS into something symbolic */ @@ -12494,7 +12493,7 @@ build_this_super_qualified_invocation (use_this, name, args, lloc, rloc) int lloc, rloc; { tree invok; - tree wfl = + tree wfl = build_wfl_node (use_this ? this_identifier_node : super_identifier_node); EXPR_WFL_LINECOL (wfl) = lloc; invok = build_method_invocation (name, args); @@ -12631,7 +12630,7 @@ print_int_node (node) static char buffer [80]; if (TREE_CONSTANT_OVERFLOW (node)) sprintf (buffer, "<overflow>"); - + if (TREE_INT_CST_HIGH (node) == 0) sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED, TREE_INT_CST_LOW (node)); @@ -12701,7 +12700,7 @@ patch_assignment (node, wfl_op1) { lhs_type = TREE_TYPE (lvalue); } - else + else { parse_error_context (wfl_op1, "Invalid left hand side of assignment"); error_found = 1; @@ -12774,12 +12773,12 @@ patch_assignment (node, wfl_op1) /* 10.10: Array Store Exception runtime check */ if (!flag_emit_class_files && !flag_emit_xref - && lvalue_from_array + && lvalue_from_array && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type))) { tree array, store_check, base, index_expr; - - /* Save RHS so that it doesn't get re-evaluated by the store check. */ + + /* Save RHS so that it doesn't get re-evaluated by the store check. */ new_rhs = save_expr (new_rhs); /* Get the INDIRECT_REF. */ @@ -12787,27 +12786,27 @@ patch_assignment (node, wfl_op1) /* Get the array pointer expr. */ array = TREE_OPERAND (array, 0); store_check = build_java_arraystore_check (array, new_rhs); - + index_expr = TREE_OPERAND (lvalue, 1); - + if (TREE_CODE (index_expr) == COMPOUND_EXPR) { - /* A COMPOUND_EXPR here is a bounds check. The bounds check must + /* A COMPOUND_EXPR here is a bounds check. The bounds check must happen before the store check, so prepare to insert the store check within the second operand of the existing COMPOUND_EXPR. */ base = index_expr; } else base = lvalue; - + index_expr = TREE_OPERAND (base, 1); - TREE_OPERAND (base, 1) = build (COMPOUND_EXPR, TREE_TYPE (index_expr), + TREE_OPERAND (base, 1) = build (COMPOUND_EXPR, TREE_TYPE (index_expr), store_check, index_expr); } /* Final locals can be used as case values in switch statement. Prepare them for this eventuality. */ - if (TREE_CODE (lvalue) == VAR_DECL + if (TREE_CODE (lvalue) == VAR_DECL && DECL_FINAL (lvalue) && TREE_CONSTANT (new_rhs) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (lvalue)) @@ -12876,10 +12875,10 @@ try_builtin_assignconv (wfl_op1, lhs_type, rhs) else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)) new_rhs = convert (lhs_type, rhs); - /* Try a narrowing primitive conversion (5.1.3): + /* Try a narrowing primitive conversion (5.1.3): - expression is a constant expression of type int AND - variable is byte, short or char AND - - The value of the expression is representable in the type of the + - The value of the expression is representable in the type of the variable */ else if (rhs_type == int_type_node && TREE_CONSTANT (rhs) && (lhs_type == byte_type_node || lhs_type == char_type_node @@ -12888,8 +12887,8 @@ try_builtin_assignconv (wfl_op1, lhs_type, rhs) if (int_fits_type_p (rhs, lhs_type)) new_rhs = convert (lhs_type, rhs); else if (wfl_op1) /* Might be called with a NULL */ - parse_warning_context - (wfl_op1, "Constant expression `%s' too wide for narrowing primitive conversion to `%s'", + parse_warning_context + (wfl_op1, "Constant expression `%s' too wide for narrowing primitive conversion to `%s'", print_int_node (rhs), lang_printable_name (lhs_type, 0)); /* Reported a warning that will turn into an error further down, so we don't return */ @@ -12934,7 +12933,7 @@ valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type) /* From here, an integral is widened if its precision is smaller than the precision of the LHS or if the LHS is a floating point type, or the RHS is a float and the RHS a double. */ - if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type) + if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type) && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type))) || (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type)) || (rhs_type == float_type_node && lhs_type == double_type_node)) @@ -12982,7 +12981,7 @@ valid_ref_assignconv_cast_p (source, dest, cast) if (TYPE_CLASS_P (source)) { if (TYPE_CLASS_P (dest)) - return (source == dest + return (source == dest || inherits_from_p (source, dest) || (cast && inherits_from_p (dest, source))); if (TYPE_INTERFACE_P (dest)) @@ -13023,16 +13022,16 @@ valid_ref_assignconv_cast_p (source, dest, cast) tree source_type; tree source_sig; tree source_name; - for (method_source = TYPE_METHODS (source); method_source; + for (method_source = TYPE_METHODS (source); method_source; method_source = TREE_CHAIN (method_source)) { - source_sig = + source_sig = build_java_argument_signature (TREE_TYPE (method_source)); source_type = TREE_TYPE (TREE_TYPE (method_source)); source_name = DECL_NAME (method_source); for (method_dest = TYPE_METHODS (dest); method_dest; method_dest = TREE_CHAIN (method_dest)) - if (source_sig == + if (source_sig == build_java_argument_signature (TREE_TYPE (method_dest)) && source_name == DECL_NAME (method_dest) && source_type != TREE_TYPE (TREE_TYPE (method_dest))) @@ -13065,7 +13064,7 @@ valid_ref_assignconv_cast_p (source, dest, cast) { tree source_element_type = TYPE_ARRAY_ELEMENT (source); tree dest_element_type = TYPE_ARRAY_ELEMENT (dest); - + /* In case of severe errors, they turn out null */ if (!dest_element_type || !source_element_type) return 0; @@ -13157,7 +13156,7 @@ operator_string (node) sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \ return buffer; \ } - + static char buffer [10]; switch (TREE_CODE (node)) { @@ -13204,7 +13203,7 @@ java_decl_equiv (var_acc1, var_acc2) { if (JDECL_P (var_acc1)) return (var_acc1 == var_acc2); - + return (TREE_CODE (var_acc1) == COMPONENT_REF && TREE_CODE (var_acc2) == COMPONENT_REF && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0) @@ -13246,7 +13245,7 @@ java_refold (t) /* Now the left branch of the binary operator. */ b = TREE_OPERAND (TREE_OPERAND (c, 1), 0); - if (! (b && TREE_CODE (b) == NOP_EXPR + if (! (b && TREE_CODE (b) == NOP_EXPR && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR)) return t; @@ -13300,7 +13299,7 @@ patch_binop (node, wfl_op1, wfl_op2) error situation, unless it's too early to tell (in case we're handling a `+', `==', `!=' or `instanceof'.) We want to set op<n>_type correctly so the error can be later on reported accurately. */ - if (! (code == PLUS_EXPR || code == NE_EXPR + if (! (code == PLUS_EXPR || code == NE_EXPR || code == EQ_EXPR || code == INSTANCEOF_EXPR)) { tree n; @@ -13345,7 +13344,7 @@ patch_binop (node, wfl_op1, wfl_op2) parse_warning_context (wfl_operator, "Evaluating this expression will result in an arithmetic exception being thrown"); TREE_CONSTANT (node) = 0; } - + /* Change the division operator if necessary */ if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE) TREE_SET_CODE (node, TRUNC_DIV_EXPR); @@ -13368,7 +13367,7 @@ patch_binop (node, wfl_op1, wfl_op2) && ! flag_emit_class_files && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR)) return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2); - + /* This one is more complicated. FLOATs are processed by a function call to soft_fmod. Duplicate the value of the COMPOUND_ASSIGN_P flag. */ @@ -13390,7 +13389,7 @@ patch_binop (node, wfl_op1, wfl_op2) purpose of the a previous usage of the String concatenation operator */ - if (TREE_CODE (op1) == STRING_CST + if (TREE_CODE (op1) == STRING_CST || TREE_CODE (op2) == STRING_CST || JSTRING_TYPE_P (op1_type) || JSTRING_TYPE_P (op2_type) @@ -13430,7 +13429,7 @@ patch_binop (node, wfl_op1, wfl_op2) lang_printable_name (op2_type, 0)); else parse_error_context (wfl_operator, - "Incompatible type for `%s'. Can't convert shift distance from `%s' to integral", + "Incompatible type for `%s'. Can't convert shift distance from `%s' to integral", operator_string (node), lang_printable_name (op2_type, 0)); } @@ -13450,10 +13449,10 @@ patch_binop (node, wfl_op1, wfl_op2) /* Shift int only up to 0x1f and long up to 0x3f */ if (prom_type == int_type_node) - op2 = fold (build (BIT_AND_EXPR, int_type_node, op2, + op2 = fold (build (BIT_AND_EXPR, int_type_node, op2, build_int_2 (0x1f, 0))); else - op2 = fold (build (BIT_AND_EXPR, int_type_node, op2, + op2 = fold (build (BIT_AND_EXPR, int_type_node, op2, build_int_2 (0x3f, 0))); /* The >>> operator is a >> operating on unsigned quantities */ @@ -13481,7 +13480,7 @@ patch_binop (node, wfl_op1, wfl_op2) TREE_TYPE (node) = boolean_type_node; /* OP1_TYPE might be NULL when OP1 is a string constant. */ - if ((cn = patch_string (op1))) + if ((cn = patch_string (op1))) { op1 = cn; op1_type = TREE_TYPE (op1); @@ -13527,13 +13526,13 @@ patch_binop (node, wfl_op1, wfl_op2) { char *t1 = xstrdup (lang_printable_name (op1_type, 0)); SET_WFL_OPERATOR (wfl_operator, node, wfl_op1); - parse_error_context + parse_error_context (wfl_operator, "Impossible for `%s' to be instance of `%s'", t1, lang_printable_name (op2_type, 0)); free (t1); error_found = 1; } - + break; /* 15.21 Bitwise and Logical Operators */ @@ -13545,7 +13544,7 @@ patch_binop (node, wfl_op1, wfl_op2) expression retain that type */ prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2); - else if (TREE_CODE (op1_type) == BOOLEAN_TYPE + else if (TREE_CODE (op1_type) == BOOLEAN_TYPE && TREE_CODE (op1_type) == BOOLEAN_TYPE) /* The type of the bitwise operator expression is BOOLEAN */ prom_type = boolean_type_node; @@ -13567,7 +13566,7 @@ patch_binop (node, wfl_op1, wfl_op2) /* 15.23 Conditional-Or Operator */ case TRUTH_ORIF_EXPR: /* Operands must be of BOOLEAN type */ - if (TREE_CODE (op1_type) != BOOLEAN_TYPE || + if (TREE_CODE (op1_type) != BOOLEAN_TYPE || TREE_CODE (op2_type) != BOOLEAN_TYPE) { if (TREE_CODE (op1_type) != BOOLEAN_TYPE) @@ -13617,48 +13616,48 @@ patch_binop (node, wfl_op1, wfl_op2) case EQ_EXPR: case NE_EXPR: /* It's time for us to patch the strings. */ - if ((cn = patch_string (op1))) + if ((cn = patch_string (op1))) { op1 = cn; op1_type = TREE_TYPE (op1); } - if ((cn = patch_string (op2))) + if ((cn = patch_string (op2))) { op2 = cn; op2_type = TREE_TYPE (op2); } - + /* 15.20.1 Numerical Equality Operators == and != */ /* Binary numeric promotion is performed on the operands */ if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type)) binary_numeric_promotion (op1_type, op2_type, &op1, &op2); - + /* 15.20.2 Boolean Equality Operators == and != */ else if (TREE_CODE (op1_type) == BOOLEAN_TYPE && TREE_CODE (op2_type) == BOOLEAN_TYPE) ; /* Nothing to do here */ - + /* 15.20.3 Reference Equality Operators == and != */ /* Types have to be either references or the null type. If they're references, it must be possible to convert either type to the other by casting conversion. */ - else if (op1 == null_pointer_node || op2 == null_pointer_node + else if (op1 == null_pointer_node || op2 == null_pointer_node || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type) && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1) - || valid_ref_assignconv_cast_p (op2_type, + || valid_ref_assignconv_cast_p (op2_type, op1_type, 1)))) ; /* Nothing to do here */ - + /* Else we have an error figure what can't be converted into what and report the error */ else { char *t1; t1 = xstrdup (lang_printable_name (op1_type, 0)); - parse_error_context + parse_error_context (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' to `%s'", - operator_string (node), t1, + operator_string (node), t1, lang_printable_name (op2_type, 0)); free (t1); TREE_TYPE (node) = boolean_type_node; @@ -13678,7 +13677,7 @@ patch_binop (node, wfl_op1, wfl_op2) TREE_OPERAND (node, 1) = op2; TREE_TYPE (node) = prom_type; TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); - + if (flag_emit_xref) return node; @@ -13730,9 +13729,9 @@ merge_string_cste (op1, op2, after) { /* Handle two string constants right away */ if (TREE_CODE (op2) == STRING_CST) - return do_merge_string_cste (op1, TREE_STRING_POINTER (op2), + return do_merge_string_cste (op1, TREE_STRING_POINTER (op2), TREE_STRING_LENGTH (op2), after); - + /* Reasonable integer constant can be treated right away */ if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2)) { @@ -13741,7 +13740,7 @@ merge_string_cste (op1, op2, after) static const char *const null_pointer = "null"; char ch[3]; const char *string; - + if (op2 == boolean_true_node) string = boolean_true; else if (op2 == boolean_false_node) @@ -13778,11 +13777,11 @@ string_constant_concatenation (op1, op2) { tree string, rest; int invert; - + string = (TREE_CODE (op1) == STRING_CST ? op1 : op2); rest = (string == op1 ? op2 : op1); invert = (string == op1 ? 0 : 1 ); - + /* Walk REST, only if it looks reasonable */ if (TREE_CODE (rest) != STRING_CST && !IS_CRAFTED_STRING_BUFFER_P (rest) @@ -13814,7 +13813,7 @@ build_string_concatenation (op1, op2) if (flag_emit_xref) return build (PLUS_EXPR, string_type_node, op1, op2); - + /* Try to do some static optimization */ if ((result = string_constant_concatenation (op1, op2))) return result; @@ -13843,7 +13842,7 @@ build_string_concatenation (op1, op2) initialize a new one */ if (!IS_CRAFTED_STRING_BUFFER_P (op1)) { - /* Two solutions here: + /* Two solutions here: 1) OP1 is a constant string reference, we call new StringBuffer(OP1) 2) OP1 is something else, we call new StringBuffer().append(OP1). */ if (TREE_CONSTANT (op1) && JSTRING_TYPE_P (TREE_TYPE (op1))) @@ -13954,19 +13953,19 @@ build_incdec (op_token, op_location, op1, is_post_p) tree op1; int is_post_p; { - static const enum tree_code lookup [2][2] = + static const enum tree_code lookup [2][2] = { { PREDECREMENT_EXPR, PREINCREMENT_EXPR, }, { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, }, }; - tree node = build (lookup [is_post_p][(op_token - DECR_TK)], + tree node = build (lookup [is_post_p][(op_token - DECR_TK)], NULL_TREE, op1, NULL_TREE); TREE_SIDE_EFFECTS (node) = 1; /* Store the location of the operator, for better error report. The string of the operator will be rebuild based on the OP value. */ EXPR_WFL_LINECOL (node) = op_location; return node; -} +} /* Build an incomplete cast operator, based on the use of the CONVERT_EXPR. Note that TREE_TYPE of the constructed node is @@ -14067,7 +14066,7 @@ patch_unaryop (node, wfl_op) decl = DECL_FUNCTION_ACCESS_DECL (decl); } /* We really should have a JAVA_ARRAY_EXPR to avoid this */ - else if (!JDECL_P (decl) + else if (!JDECL_P (decl) && TREE_CODE (decl) != COMPONENT_REF && !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF) && TREE_CODE (decl) != INDIRECT_REF @@ -14078,7 +14077,7 @@ patch_unaryop (node, wfl_op) TREE_TYPE (node) = error_mark_node; error_found = 1; } - + /* From now on, we know that op if a variable and that it has a valid wfl. We use wfl_op to locate errors related to the ++/-- operand. */ @@ -14102,8 +14101,8 @@ patch_unaryop (node, wfl_op) else { value = build_int_2 (1, 0); - TREE_TYPE (node) = - binary_numeric_promotion (op_type, + TREE_TYPE (node) = + binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value); } @@ -14111,10 +14110,10 @@ patch_unaryop (node, wfl_op) if (outer_field_flag) { /* We re-generate an access to the field */ - value = build (PLUS_EXPR, TREE_TYPE (op), + value = build (PLUS_EXPR, TREE_TYPE (op), build_outer_field_access (wfl_op, decl), value); - - /* And we patch the original access$() into a write + + /* And we patch the original access$() into a write with plus_op as a rhs */ return outer_field_access_fix (node, op, value); } @@ -14199,7 +14198,7 @@ patch_unaryop (node, wfl_op) } break; } - + if (error_found) return error_mark_node; @@ -14225,7 +14224,7 @@ resolve_type_during_patch (type) tree type_decl = resolve_and_layout (EXPR_WFL_NODE (type), type); if (!type_decl) { - parse_error_context (type, + parse_error_context (type, "Class `%s' not found in type declaration", IDENTIFIER_POINTER (EXPR_WFL_NODE (type))); return NULL_TREE; @@ -14284,7 +14283,7 @@ patch_cast (node, wfl_op) /* The remaining legal casts involve conversion between reference types. Check for their compile time correctness. */ - if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type) + if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type) && valid_ref_assignconv_cast_p (op_type, cast_type, 1)) { TREE_TYPE (node) = promote_type (cast_type); @@ -14363,7 +14362,7 @@ patch_array_ref (node) /* The array reference must be an array */ if (!TYPE_ARRAY_P (array_type)) { - parse_error_context + parse_error_context (wfl_operator, "`[]' can only be applied to arrays. It can't be applied to `%s'", lang_printable_name (array_type, 0)); @@ -14413,7 +14412,7 @@ build_newarray_node (type, dims, extra_dims) int extra_dims; { tree node = - build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims), + build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims), build_int_2 (extra_dims, 0)); return node; } @@ -14455,9 +14454,9 @@ patch_newarray (node) /* Report errors on types here */ if (dim_error) { - parse_error_context - (TREE_PURPOSE (cdim), - "Incompatible type for dimension in array creation expression. %s convert `%s' to `int'", + parse_error_context + (TREE_PURPOSE (cdim), + "Incompatible type for dimension in array creation expression. %s convert `%s' to `int'", (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ? "Explicit cast needed to" : "Can't"), lang_printable_name (TREE_TYPE (dim), 0)); @@ -14506,13 +14505,13 @@ patch_newarray (node) (primitive or not) matters. */ if (ndims == 1) return build_new_array (type, TREE_VALUE (dims)); - + /* Can't reuse what's already written in expr.c because it uses the JVM stack representation. Provide a build_multianewarray. FIXME */ return build (CALL_EXPR, array_type, build_address_of (soft_multianewarray_node), tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)), - tree_cons (NULL_TREE, + tree_cons (NULL_TREE, build_int_2 (ndims, 0), dims )), NULL_TREE); } @@ -14593,7 +14592,7 @@ patch_new_array_init (type, node) TREE_PURPOSE (current) = NULL_TREE; all_constant = 0; } - if (elt && TREE_CODE (elt) == TREE_LIST + if (elt && TREE_CODE (elt) == TREE_LIST && TREE_VALUE (elt) == error_mark_node) error_seen = 1; } @@ -14633,9 +14632,9 @@ array_constructor_check_entry (type, entry) value = patched; if (value == error_mark_node) return 1; - + type_value = TREE_TYPE (value); - + /* At anytime, try_builtin_assignconv can report a warning on constant overflow during narrowing. */ SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value); @@ -14650,12 +14649,12 @@ array_constructor_check_entry (type, entry) "Can't" : "Explicit cast needed to"); if (!array_type_string) array_type_string = xstrdup (lang_printable_name (type, 1)); - parse_error_context + parse_error_context (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'", msg, lang_printable_name (type_value, 1), array_type_string); error_seen = 1; } - + if (new_value) TREE_VALUE (entry) = new_value; @@ -14716,7 +14715,7 @@ patch_return (node) isn't declared with the keyword `void' */ if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth))) error_found = 2; - + if (DECL_INSTINIT_P (current_function_decl)) error_found = 1; @@ -14725,7 +14724,7 @@ patch_return (node) if (DECL_INSTINIT_P (current_function_decl)) parse_error_context (wfl_operator, "`return' inside instance initializer"); - + else if (DECL_CLINIT_P (current_function_decl)) parse_error_context (wfl_operator, "`return' inside static initializer"); @@ -14733,14 +14732,14 @@ patch_return (node) else if (!DECL_CONSTRUCTOR_P (meth)) { char *t = xstrdup (lang_printable_name (mtype, 0)); - parse_error_context (wfl_operator, + parse_error_context (wfl_operator, "`return' with%s value from `%s %s'", - (error_found == 1 ? "" : "out"), + (error_found == 1 ? "" : "out"), t, lang_printable_name (meth, 0)); free (t); } else - parse_error_context (wfl_operator, + parse_error_context (wfl_operator, "`return' with value from constructor `%s'", lang_printable_name (meth, 0)); return error_mark_node; @@ -14756,7 +14755,7 @@ patch_return (node) if ((patched = patch_string (exp))) exp = patched; - + modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp); EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node); modify = java_complete_tree (modify); @@ -14806,13 +14805,13 @@ patch_if_else_statement (node) if (TREE_TYPE (expression) != boolean_type_node && TREE_TYPE (expression) != promoted_boolean_type_node) { - parse_error_context - (wfl_operator, - "Incompatible type for `if'. Can't convert `%s' to `boolean'", + parse_error_context + (wfl_operator, + "Incompatible type for `if'. Can't convert `%s' to `boolean'", lang_printable_name (TREE_TYPE (expression), 0)); return error_mark_node; } - + if (TREE_CODE (expression) == INTEGER_CST) { if (integer_zerop (expression)) @@ -14858,7 +14857,7 @@ build_labeled_block (location, label) parse_error_context (wfl_operator, "Declaration of `%s' shadows a previous label declaration", IDENTIFIER_POINTER (label)); - EXPR_WFL_LINECOL (wfl_operator) = + EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name)); parse_error_context (wfl_operator, "This is the location of the previous declaration of label `%s'", @@ -14908,7 +14907,7 @@ build_new_loop (loop_body) COMPOUND_EXPR (loop main body) EXIT_EXPR (this order is for while/for loops. LABELED_BLOCK_EXPR the order is reversed for do loops) - LABEL_DECL (a continue occurring here branches at the + LABEL_DECL (a continue occurring here branches at the BODY end of this labeled block) INCREMENT (if any) @@ -14939,8 +14938,8 @@ build_loop_body (location, condition, reversed) body = build_labeled_block (0, continue_identifier_node); first = (reversed ? body : condition); second = (reversed ? condition : body); - return - build (COMPOUND_EXPR, NULL_TREE, + return + build (COMPOUND_EXPR, NULL_TREE, build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node); } @@ -15084,7 +15083,7 @@ build_bc_statement (location, is_break, name) if (name) { - if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE + if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE (merge_qualified_name (label_id, EXPR_WFL_NODE (name))))) /* Null means that we don't have a target for this named break/continue. In this case, we make the target to be the @@ -15094,7 +15093,7 @@ build_bc_statement (location, is_break, name) } /* Unlabeled break/continue will be handled during the break/continue patch operation */ - break_continue + break_continue = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE); IS_BREAK_STMT_P (break_continue) = is_break; @@ -15113,7 +15112,7 @@ patch_bc_statement (node) tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt; tree labeled_block = ctxp->current_labeled_block; EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); - + /* Having an identifier here means that the target is unknown. */ if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE) { @@ -15132,7 +15131,7 @@ patch_bc_statement (node) parse_error_context (wfl_operator, "`continue' must be in loop"); else - parse_error_context + parse_error_context (wfl_operator, "continue label `%s' does not name a loop", IDENTIFIER_POINTER (bc_label)); return error_mark_node; @@ -15148,7 +15147,7 @@ patch_bc_statement (node) } } else if (!bc_label) - { + { for (;; labeled_block = TREE_CHAIN (labeled_block)) { if (labeled_block == NULL_TREE) @@ -15194,15 +15193,15 @@ patch_exit_expr (node) /* The type of expression must be boolean */ if (TREE_TYPE (expression) != boolean_type_node) { - parse_error_context - (wfl_operator, - "Incompatible type for loop conditional. Can't convert `%s' to `boolean'", + parse_error_context + (wfl_operator, + "Incompatible type for loop conditional. Can't convert `%s' to `boolean'", lang_printable_name (TREE_TYPE (expression), 0)); return error_mark_node; } /* Now we know things are allright, invert the condition, fold and return */ - TREE_OPERAND (node, 0) = + TREE_OPERAND (node, 0) = fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression)); if (! integer_zerop (TREE_OPERAND (node, 0)) @@ -15288,7 +15287,7 @@ patch_switch_statement (node) TREE_TYPE (node) = void_type_node; TREE_SIDE_EFFECTS (node) = 1; CAN_COMPLETE_NORMALLY (node) - = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)) + = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)) || ! SWITCH_HAS_DEFAULT (node); return node; } @@ -15309,11 +15308,11 @@ encapsulate_with_try_catch (location, type, try_stmts, catch_stmts) try_block = build_expr_block (try_stmts, NULL_TREE); /* Build a catch block: we need a catch clause parameter */ - catch_clause_param = build_decl (VAR_DECL, + catch_clause_param = build_decl (VAR_DECL, wpv_id, build_pointer_type (type)); /* And a block */ catch_block = build_expr_block (NULL_TREE, catch_clause_param); - + /* Initialize the variable and store in the block */ catch = build (MODIFY_EXPR, NULL_TREE, catch_clause_param, build (JAVA_EXC_OBJ_EXPR, ptr_type_node)); @@ -15384,7 +15383,7 @@ patch_try_statement (node) only parameter of the clause statement in of class Throwable or a subclass of Throwable, but that was done earlier. The catch clause parameter type has also been resolved. */ - + /* Just make sure that the catch clause parameter type inherits from java.lang.Throwable */ if (!inherits_from_p (carg_type, throwable_type_node)) @@ -15396,7 +15395,7 @@ patch_try_statement (node) error_found = 1; continue; } - + /* Partial check for unreachable catch statement: The catch clause is reachable iff is no earlier catch block A in the try statement such that the type of the catch @@ -15413,7 +15412,7 @@ patch_try_statement (node) if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl)))) { EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current); - parse_error_context + parse_error_context (wfl_operator, "`catch' not reached because of the catch clause at line %d", EXPR_WFL_LINENO (sub_current)); @@ -15449,7 +15448,7 @@ patch_try_statement (node) POP_EXCEPTIONS (); /* Verification ends here */ - if (error_found) + if (error_found) return error_mark_node; TREE_OPERAND (node, 0) = try; @@ -15500,7 +15499,7 @@ patch_synchronized_statement (node, wfl_op1) that the handler that catches all throw exception calls _Jv_MonitorExit and then rethrow the exception. The synchronized statement is then implemented as: - TRY + TRY { _Jv_MonitorEnter (expression) synchronized_block @@ -15562,17 +15561,17 @@ patch_throw_statement (node, wfl_op1) is explicitly declared in the `throws' clause of each constructor. This doesn't apply to anonymous classes, since they don't have declared constructors. */ - if (!unchecked_ok + if (!unchecked_ok && DECL_INSTINIT_P (current_function_decl) && !ANONYMOUS_CLASS_P (current_class)) { tree current; - for (current = TYPE_METHODS (current_class); current; + for (current = TYPE_METHODS (current_class); current; current = TREE_CHAIN (current)) - if (DECL_CONSTRUCTOR_P (current) + if (DECL_CONSTRUCTOR_P (current) && !check_thrown_exceptions_do (TREE_TYPE (expr))) { - parse_error_context (wfl_operator, "Checked exception `%s' can't be thrown in instance initializer (not all declared constructor are declaring it in their `throws' clause)", + parse_error_context (wfl_operator, "Checked exception `%s' can't be thrown in instance initializer (not all declared constructor are declaring it in their `throws' clause)", lang_printable_name (TREE_TYPE (expr), 0)); return error_mark_node; } @@ -15601,7 +15600,7 @@ patch_throw_statement (node, wfl_op1) /* We report that the exception can't be throw from a try block in all circumstances but when the `throw' is inside a static block. */ - else if (!EXCEPTIONS_P (currently_caught_type_list) + else if (!EXCEPTIONS_P (currently_caught_type_list) && !tryblock_throws_ok) { if (DECL_CLINIT_P (current_function_decl)) @@ -15610,13 +15609,13 @@ patch_throw_statement (node, wfl_op1) lang_printable_name (type, 0)); else parse_error_context (wfl_operator, - "Checked exception `%s' isn't thrown from a `try' block", + "Checked exception `%s' isn't thrown from a `try' block", lang_printable_name (type, 0)); } /* Otherwise, the current method doesn't have the appropriate throws declaration */ else - parse_error_context (wfl_operator, "Checked exception `%s' doesn't match any of current method's `throws' declaration(s)", + parse_error_context (wfl_operator, "Checked exception `%s' doesn't match any of current method's `throws' declaration(s)", lang_printable_name (type, 0)); return error_mark_node; } @@ -15640,8 +15639,8 @@ check_thrown_exceptions (location, decl) { tree throws; /* For all the unchecked exceptions thrown by DECL */ - for (throws = DECL_FUNCTION_THROWS (decl); throws; - throws = TREE_CHAIN (throws)) + for (throws = DECL_FUNCTION_THROWS (decl); throws; + throws = TREE_CHAIN (throws)) if (!check_thrown_exceptions_do (TREE_VALUE (throws))) { #if 1 @@ -15654,10 +15653,10 @@ check_thrown_exceptions (location, decl) parse_error_context (wfl_operator, "Exception `%s' can't be thrown in initializer", lang_printable_name (TREE_VALUE (throws), 0)); - else + else { - parse_error_context - (wfl_operator, "Exception `%s' must be caught, or it must be declared in the `throws' clause of `%s'", + parse_error_context + (wfl_operator, "Exception `%s' must be caught, or it must be declared in the `throws' clause of `%s'", lang_printable_name (TREE_VALUE (throws), 0), (DECL_INIT_P (current_function_decl) ? IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) : @@ -15780,7 +15779,7 @@ patch_conditional_expr (node, wfl_cond, wfl_op1) /* Second and third can be numeric, boolean (i.e. primitive), references or null. Anything else results in an error */ if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2)) - || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node) + || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node) && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node)) || (t1 == boolean_type_node && t2 == boolean_type_node))) error_found = 1; @@ -15812,9 +15811,9 @@ patch_conditional_expr (node, wfl_cond, wfl_op1) /* Otherwise, binary numeric promotion is applied and the resulting type is the promoted type of operand 1 and 2 */ - else - resulting_type = binary_numeric_promotion (t1, t2, - &TREE_OPERAND (node, 1), + else + resulting_type = binary_numeric_promotion (t1, t2, + &TREE_OPERAND (node, 1), &TREE_OPERAND (node, 2)); } @@ -15913,7 +15912,7 @@ fold_constant_for_init (node, context) case BIT_IOR_EXPR: case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: - case EQ_EXPR: + case EQ_EXPR: case NE_EXPR: case GT_EXPR: case GE_EXPR: @@ -15984,7 +15983,7 @@ fold_constant_for_init (node, context) else if (! QUALIFIED_P (name)) { decl = lookup_field_wrapper (DECL_CONTEXT (context), name); - if (decl == NULL_TREE + if (decl == NULL_TREE || (! FIELD_STATIC (decl) && ! FIELD_FINAL (decl))) return NULL_TREE; return fold_constant_for_init (decl, decl); @@ -16101,7 +16100,7 @@ attach_init_test_initialization_flags (entry, ptr) { tree block = (tree)ptr; struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry; - + TREE_CHAIN (ite->value) = BLOCK_EXPR_DECLS (block); BLOCK_EXPR_DECLS (block) = ite->value; return true; @@ -16131,14 +16130,14 @@ emit_test_initialization (entry_p, info) if (current_function_decl == TREE_PURPOSE (l) && java_treetreehash_find (cf_ht, key) == NULL) return true; - + ite = java_treetreehash_new (cf_ht, key); /* If we don't have a variable, create one and install it. */ if (*ite == NULL) { tree block; - + decl = build_decl (VAR_DECL, NULL_TREE, boolean_type_node); MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); LOCAL_CLASS_INITIALIZATION_FLAG (decl) = 1; |