From bfecd57cd46ac368213f55fc4a3ff67c8c59c5ea Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 4 Oct 2016 17:32:31 +0200 Subject: [PATCH] extend.texi (Java Exceptions): Remove. * doc/extend.texi (Java Exceptions): Remove. (java_interface): Remove. cp/ * cp-tree.h (enum cp_tree_index): Remove CPTI_JAVA_*, CPTI_LANG_NAME_JAVA and CPTI_JCLASS. (java_byte_type_node, java_short_type_node, java_int_type_node, java_long_type_node, java_float_type_node, java_double_type_node, java_char_type_node, java_boolean_type_node, lang_name_java, jclass_node): Remove. (enum languages): Remove lang_java. (TYPE_FOR_JAVA): Remove. (struct lang_type_class): Remove java_interface bit-field. (TYPE_JAVA_INTERFACE): Remove. (pragma_java_exceptions): Remove. (check_java_method, build_java_class_ref): Remove prototypes. * name-lookup.c (pushtag_1): Don't set TYPE_FOR_JAVA. * decl2.c (acceptable_java_type, check_java_method): Remove. (import_export_decl): Remove TYPE_FOR_JAVA handling. (build_java_method_aliases): Remove. (c_parse_final_cleanups): Don't call build_java_method_aliases. (possibly_inlined_p): Don't test pragma_java_exceptions. * init.c (build_new_1): Remove TYPE_FOR_JAVA handling. (build_java_class_ref): Remove. * pt.c (maybe_new_partial_specialization, lookup_template_class_1, instantiate_class_template_1): Don't copy TYPE_FOR_JAVA. * except.c (eh_type_info): Remove java type handling. (decl_is_java_type, choose_personality_routine): Remove. (initialize_handler_parm): Don't call choose_personality_routine. (expand_start_catch_block): Don't handle java types. (build_throw): Likewise. * cp-lang.c (cp_eh_personality): Don't handle pragma_java_exceptions. * typeck.c (structural_comptypes): Don't compare TYPE_FOR_JAVA. * call.c (build_over_call): Don't handle TYPE_JAVA_INTERFACE. (java_iface_lookup_fn): Remove. (build_java_interface_fn_ref): Remove. * tree.c (cxx_attribute_table): Remove java_interface. (handle_java_interface_attribute): Remove. * lex.c (pragma_java_exceptions): Remove. (init_cp_pragma): Don't register GCC java_exceptions pragma. (handle_pragma_java_exceptions): Remove. (retrofit_lang_decl): Don't handle lang_name_java. * method.c (implicitly_declare_fn): Don't handle TYPE_FOR_JAVA. * error.c (language_to_string): Don't handle lang_java. * decl.c (record_builtin_java_type): Remove. (initialize_predefined_identifiers): Remove Java. (cxx_init_decl_processing): Remove java_*_type_node. (cp_finish_decl): Don't handle TYPE_FOR_JAVA. (grokfndecl): Likewise. (check_special_function_return_type): Likewise. (grokdeclarator): Don't set TYPE_FOR_JAVA. (grokparms): Don't handle TYPE_FOR_JAVA. (xref_basetypes): Likewise. (check_function_type): Likewise. (finish_constructor_body): Likewise. * mangle.c (write_builtin_type): Don't handle TYPE_FOR_JAVA and java_*_type_node. (write_bare_function_type): Don't handle TYPE_FOR_JAVA. (write_java_integer_type_codes): Remove. * class.c (add_method): Don't handle TYPE_FOR_JAVA. (add_implicitly_declared_members, determine_key_method, finish_struct_1): Likewise. (push_lang_context): Don't handle lang_name_java. testsuite/ * g++.dg/other/java3.C: Remove. * g++.dg/other/java1.C: Remove. * g++.dg/other/error12.C: Remove. * g++.dg/other/java2.C: Remove. * g++.dg/warn/Wnvdtor.C: Remove. * g++.dg/lookup/java1.C: Remove. * g++.dg/lookup/java2.C: Remove. * g++.dg/ext/pr34829.C: Remove. * g++.dg/ext/java-3.C: Remove. * g++.dg/ext/java-1.C: Remove. * g++.dg/ext/java-2.C: Remove. * g++.old-deja/g++.oliva/dwarf2.C: Remove. From-SVN: r240750 --- gcc/ChangeLog | 5 + gcc/cp/ChangeLog | 62 +++++ gcc/cp/call.c | 67 +---- gcc/cp/class.c | 62 +---- gcc/cp/cp-lang.c | 5 +- gcc/cp/cp-tree.h | 49 +--- gcc/cp/decl.c | 129 +-------- gcc/cp/decl2.c | 122 +-------- gcc/cp/error.c | 3 - gcc/cp/except.c | 152 +---------- gcc/cp/init.c | 256 +++++------------- gcc/cp/lex.c | 19 -- gcc/cp/mangle.c | 64 +---- gcc/cp/method.c | 2 +- gcc/cp/name-lookup.c | 3 - gcc/cp/pt.c | 3 - gcc/cp/tree.c | 28 -- gcc/cp/typeck.c | 2 - gcc/doc/extend.texi | 44 --- gcc/testsuite/ChangeLog | 15 + gcc/testsuite/g++.dg/ext/java-1.C | 26 -- gcc/testsuite/g++.dg/ext/java-2.C | 79 ------ gcc/testsuite/g++.dg/ext/java-3.C | 39 --- gcc/testsuite/g++.dg/ext/pr34829.C | 22 -- gcc/testsuite/g++.dg/lookup/java1.C | 68 ----- gcc/testsuite/g++.dg/lookup/java2.C | 47 ---- gcc/testsuite/g++.dg/other/error12.C | 9 - gcc/testsuite/g++.dg/other/java1.C | 22 -- gcc/testsuite/g++.dg/other/java2.C | 11 - gcc/testsuite/g++.dg/other/java3.C | 7 - gcc/testsuite/g++.dg/warn/Wnvdtor.C | 11 - gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C | 10 - 32 files changed, 193 insertions(+), 1250 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/ext/java-1.C delete mode 100644 gcc/testsuite/g++.dg/ext/java-2.C delete mode 100644 gcc/testsuite/g++.dg/ext/java-3.C delete mode 100644 gcc/testsuite/g++.dg/ext/pr34829.C delete mode 100644 gcc/testsuite/g++.dg/lookup/java1.C delete mode 100644 gcc/testsuite/g++.dg/lookup/java2.C delete mode 100644 gcc/testsuite/g++.dg/other/error12.C delete mode 100644 gcc/testsuite/g++.dg/other/java1.C delete mode 100644 gcc/testsuite/g++.dg/other/java2.C delete mode 100644 gcc/testsuite/g++.dg/other/java3.C delete mode 100644 gcc/testsuite/g++.dg/warn/Wnvdtor.C delete mode 100644 gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3be8781adbf..8aa75ab867b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-04 Jakub Jelinek + + * doc/extend.texi (Java Exceptions): Remove. + (java_interface): Remove. + 2016-10-04 Doug Gilmore PR tree-optimization/77808 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0f27cfdb583..48edc6e03ef 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,65 @@ +2016-10-04 Jakub Jelinek + + * cp-tree.h (enum cp_tree_index): Remove CPTI_JAVA_*, + CPTI_LANG_NAME_JAVA and CPTI_JCLASS. + (java_byte_type_node, java_short_type_node, java_int_type_node, + java_long_type_node, java_float_type_node, java_double_type_node, + java_char_type_node, java_boolean_type_node, lang_name_java, + jclass_node): Remove. + (enum languages): Remove lang_java. + (TYPE_FOR_JAVA): Remove. + (struct lang_type_class): Remove java_interface bit-field. + (TYPE_JAVA_INTERFACE): Remove. + (pragma_java_exceptions): Remove. + (check_java_method, build_java_class_ref): Remove prototypes. + * name-lookup.c (pushtag_1): Don't set TYPE_FOR_JAVA. + * decl2.c (acceptable_java_type, check_java_method): Remove. + (import_export_decl): Remove TYPE_FOR_JAVA handling. + (build_java_method_aliases): Remove. + (c_parse_final_cleanups): Don't call build_java_method_aliases. + (possibly_inlined_p): Don't test pragma_java_exceptions. + * init.c (build_new_1): Remove TYPE_FOR_JAVA handling. + (build_java_class_ref): Remove. + * pt.c (maybe_new_partial_specialization, lookup_template_class_1, + instantiate_class_template_1): Don't copy TYPE_FOR_JAVA. + * except.c (eh_type_info): Remove java type handling. + (decl_is_java_type, choose_personality_routine): Remove. + (initialize_handler_parm): Don't call choose_personality_routine. + (expand_start_catch_block): Don't handle java types. + (build_throw): Likewise. + * cp-lang.c (cp_eh_personality): Don't handle pragma_java_exceptions. + * typeck.c (structural_comptypes): Don't compare TYPE_FOR_JAVA. + * call.c (build_over_call): Don't handle TYPE_JAVA_INTERFACE. + (java_iface_lookup_fn): Remove. + (build_java_interface_fn_ref): Remove. + * tree.c (cxx_attribute_table): Remove java_interface. + (handle_java_interface_attribute): Remove. + * lex.c (pragma_java_exceptions): Remove. + (init_cp_pragma): Don't register GCC java_exceptions pragma. + (handle_pragma_java_exceptions): Remove. + (retrofit_lang_decl): Don't handle lang_name_java. + * method.c (implicitly_declare_fn): Don't handle TYPE_FOR_JAVA. + * error.c (language_to_string): Don't handle lang_java. + * decl.c (record_builtin_java_type): Remove. + (initialize_predefined_identifiers): Remove Java. + (cxx_init_decl_processing): Remove java_*_type_node. + (cp_finish_decl): Don't handle TYPE_FOR_JAVA. + (grokfndecl): Likewise. + (check_special_function_return_type): Likewise. + (grokdeclarator): Don't set TYPE_FOR_JAVA. + (grokparms): Don't handle TYPE_FOR_JAVA. + (xref_basetypes): Likewise. + (check_function_type): Likewise. + (finish_constructor_body): Likewise. + * mangle.c (write_builtin_type): Don't handle TYPE_FOR_JAVA + and java_*_type_node. + (write_bare_function_type): Don't handle TYPE_FOR_JAVA. + (write_java_integer_type_codes): Remove. + * class.c (add_method): Don't handle TYPE_FOR_JAVA. + (add_implicitly_declared_members, determine_key_method, + finish_struct_1): Likewise. + (push_lang_context): Don't handle lang_name_java. + 2016-10-03 Marek Polacek Core 903 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index c2365802103..8c5cb20eccb 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -146,7 +146,6 @@ static int joust (struct z_candidate *, struct z_candidate *, bool, tsubst_flags_t); static int compare_ics (conversion *, conversion *); static tree build_over_call (struct z_candidate *, int, tsubst_flags_t); -static tree build_java_interface_fn_ref (tree, tree); #define convert_like(CONV, EXPR, COMPLAIN) \ convert_like_real ((CONV), (EXPR), NULL_TREE, 0, 0, \ /*issue_conversion_warnings=*/true, \ @@ -7935,10 +7934,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) if (TREE_SIDE_EFFECTS (argarray[0])) argarray[0] = save_expr (argarray[0]); t = build_pointer_type (TREE_TYPE (fn)); - if (DECL_CONTEXT (fn) && TYPE_JAVA_INTERFACE (DECL_CONTEXT (fn))) - fn = build_java_interface_fn_ref (fn, argarray[0]); - else - fn = build_vfn_ref (argarray[0], DECL_VINDEX (fn)); + fn = build_vfn_ref (argarray[0], DECL_VINDEX (fn)); TREE_TYPE (fn) = t; } else @@ -8045,67 +8041,6 @@ build_cxx_call (tree fn, int nargs, tree *argarray, return convert_from_reference (fn); } -static GTY(()) tree java_iface_lookup_fn; - -/* Make an expression which yields the address of the Java interface - method FN. This is achieved by generating a call to libjava's - _Jv_LookupInterfaceMethodIdx(). */ - -static tree -build_java_interface_fn_ref (tree fn, tree instance) -{ - tree lookup_fn, method, idx; - tree klass_ref, iface, iface_ref; - int i; - - if (!java_iface_lookup_fn) - { - tree ftype = build_function_type_list (ptr_type_node, - ptr_type_node, ptr_type_node, - java_int_type_node, NULL_TREE); - java_iface_lookup_fn - = add_builtin_function ("_Jv_LookupInterfaceMethodIdx", ftype, - 0, NOT_BUILT_IN, NULL, NULL_TREE); - } - - /* Look up the pointer to the runtime java.lang.Class object for `instance'. - This is the first entry in the vtable. */ - klass_ref = build_vtbl_ref (cp_build_indirect_ref (instance, RO_NULL, - tf_warning_or_error), - integer_zero_node); - - /* Get the java.lang.Class pointer for the interface being called. */ - iface = DECL_CONTEXT (fn); - iface_ref = lookup_field (iface, get_identifier ("class$"), 0, false); - if (!iface_ref || !VAR_P (iface_ref) - || DECL_CONTEXT (iface_ref) != iface) - { - error ("could not find class$ field in java interface type %qT", - iface); - return error_mark_node; - } - iface_ref = build_address (iface_ref); - iface_ref = convert (build_pointer_type (iface), iface_ref); - - /* Determine the itable index of FN. */ - i = 1; - for (method = TYPE_METHODS (iface); method; method = DECL_CHAIN (method)) - { - if (!DECL_VIRTUAL_P (method)) - continue; - if (fn == method) - break; - i++; - } - idx = build_int_cst (NULL_TREE, i); - - lookup_fn = build1 (ADDR_EXPR, - build_pointer_type (TREE_TYPE (java_iface_lookup_fn)), - java_iface_lookup_fn); - return build_call_nary (ptr_type_node, lookup_fn, - 3, klass_ref, iface_ref, idx); -} - /* Returns the value to use for the in-charge parameter when making a call to a function with the indicated NAME. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index dab163020f4..34d10ba5cde 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1047,19 +1047,7 @@ add_method (tree type, tree method, tree using_decl) if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (method)) slot = CLASSTYPE_CONSTRUCTOR_SLOT; else if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method)) - { - slot = CLASSTYPE_DESTRUCTOR_SLOT; - - if (TYPE_FOR_JAVA (type)) - { - if (!DECL_ARTIFICIAL (method)) - error ("Java class %qT cannot have a destructor", type); - else if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) - error ("Java class %qT cannot have an implicit non-trivial " - "destructor", - type); - } - } + slot = CLASSTYPE_DESTRUCTOR_SLOT; else { tree m; @@ -3349,17 +3337,8 @@ add_implicitly_declared_members (tree t, tree* access_decls, /* Destructor. */ if (!CLASSTYPE_DESTRUCTORS (t)) - { - /* In general, we create destructors lazily. */ - CLASSTYPE_LAZY_DESTRUCTOR (t) = 1; - - if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) - && TYPE_FOR_JAVA (t)) - /* But if this is a Java class, any non-trivial destructor is - invalid, even if compiler-generated. Therefore, if the - destructor is non-trivial we create it now. */ - lazily_declare_fn (sfk_destructor, t); - } + /* In general, we create destructors lazily. */ + CLASSTYPE_LAZY_DESTRUCTOR (t) = 1; /* [class.ctor] @@ -3382,7 +3361,7 @@ add_implicitly_declared_members (tree t, tree* access_decls, If a class definition does not explicitly declare a copy constructor, one is declared implicitly. */ - if (! TYPE_HAS_COPY_CTOR (t) && ! TYPE_FOR_JAVA (t)) + if (! TYPE_HAS_COPY_CTOR (t)) { TYPE_HAS_COPY_CTOR (t) = 1; TYPE_HAS_CONST_COPY_CTOR (t) = !cant_have_const_cctor; @@ -3395,7 +3374,7 @@ add_implicitly_declared_members (tree t, tree* access_decls, when it is needed. For now, just record whether or not the type of the parameter to the assignment operator will be a const or non-const reference. */ - if (!TYPE_HAS_COPY_ASSIGN (t) && !TYPE_FOR_JAVA (t)) + if (!TYPE_HAS_COPY_ASSIGN (t)) { TYPE_HAS_COPY_ASSIGN (t) = 1; TYPE_HAS_CONST_COPY_ASSIGN (t) = !cant_have_const_assignment; @@ -6653,8 +6632,7 @@ determine_key_method (tree type) { tree method; - if (TYPE_FOR_JAVA (type) - || processing_template_decl + if (processing_template_decl || CLASSTYPE_TEMPLATE_INSTANTIATION (type) || CLASSTYPE_INTERFACE_KNOWN (type)) return; @@ -7095,9 +7073,7 @@ finish_struct_1 (tree t) /* Build the VTT for T. */ build_vtt (t); - /* This warning does not make sense for Java classes, since they - cannot have destructors. */ - if (!TYPE_FOR_JAVA (t) && warn_nonvdtor + if (warn_nonvdtor && TYPE_POLYMORPHIC_P (t) && accessible_nvdtor_p (t) && !CLASSTYPE_FINAL (t)) warning (OPT_Wnon_virtual_dtor, @@ -7832,29 +7808,9 @@ push_lang_context (tree name) vec_safe_push (current_lang_base, current_lang_name); if (name == lang_name_cplusplus) - { - current_lang_name = name; - } - else if (name == lang_name_java) - { - current_lang_name = name; - /* DECL_IGNORED_P is initially set for these types, to avoid clutter. - (See record_builtin_java_type in decl.c.) However, that causes - incorrect debug entries if these types are actually used. - So we re-enable debug output after extern "Java". */ - DECL_IGNORED_P (TYPE_NAME (java_byte_type_node)) = 0; - DECL_IGNORED_P (TYPE_NAME (java_short_type_node)) = 0; - DECL_IGNORED_P (TYPE_NAME (java_int_type_node)) = 0; - DECL_IGNORED_P (TYPE_NAME (java_long_type_node)) = 0; - DECL_IGNORED_P (TYPE_NAME (java_float_type_node)) = 0; - DECL_IGNORED_P (TYPE_NAME (java_double_type_node)) = 0; - DECL_IGNORED_P (TYPE_NAME (java_char_type_node)) = 0; - DECL_IGNORED_P (TYPE_NAME (java_boolean_type_node)) = 0; - } + current_lang_name = name; else if (name == lang_name_c) - { - current_lang_name = name; - } + current_lang_name = name; else error ("language string %<\"%E\"%> not recognized", name); } diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 8cfee4f8a9e..e1b47372804 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -137,10 +137,7 @@ static tree cp_eh_personality (void) { if (!cp_eh_personality_decl) - { - const char *lang = (pragma_java_exceptions ? "gcj" : "gxx"); - cp_eh_personality_decl = build_personality_function (lang); - } + cp_eh_personality_decl = build_personality_function ("gxx"); return cp_eh_personality_decl; } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index c7a38faa10f..85702c53a41 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -201,7 +201,6 @@ operator == (const cp_expr &lhs, tree rhs) 1: TYPE_HAS_USER_CONSTRUCTOR. 2: TYPE_HAS_LATE_RETURN_TYPE (in FUNCTION_TYPE, METHOD_TYPE) TYPE_PTRMEMFUNC_FLAG (in RECORD_TYPE) - 3: TYPE_FOR_JAVA. 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR 5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE) ENUM_FIXED_UNDERLYING_TYPE_P (in ENUMERAL_TYPE) @@ -1083,15 +1082,6 @@ union GTY((desc ("cp_tree_node_structure (&%h)"), enum cp_tree_index { - CPTI_JAVA_BYTE_TYPE, - CPTI_JAVA_SHORT_TYPE, - CPTI_JAVA_INT_TYPE, - CPTI_JAVA_LONG_TYPE, - CPTI_JAVA_FLOAT_TYPE, - CPTI_JAVA_DOUBLE_TYPE, - CPTI_JAVA_CHAR_TYPE, - CPTI_JAVA_BOOLEAN_TYPE, - CPTI_WCHAR_DECL, CPTI_VTABLE_ENTRY_TYPE, CPTI_DELTA_TYPE, @@ -1129,12 +1119,10 @@ enum cp_tree_index CPTI_LANG_NAME_C, CPTI_LANG_NAME_CPLUSPLUS, - CPTI_LANG_NAME_JAVA, CPTI_EMPTY_EXCEPT_SPEC, CPTI_NOEXCEPT_TRUE_SPEC, CPTI_NOEXCEPT_FALSE_SPEC, - CPTI_JCLASS, CPTI_TERMINATE, CPTI_CALL_UNEXPECTED, CPTI_ATEXIT_FN_PTR_TYPE, @@ -1154,15 +1142,6 @@ enum cp_tree_index extern GTY(()) tree cp_global_trees[CPTI_MAX]; -#define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE] -#define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE] -#define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE] -#define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE] -#define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE] -#define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE] -#define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE] -#define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE] - #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL] #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE] /* The type used to represent an offset by which to adjust the `this' @@ -1222,16 +1201,12 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; #define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER] #define lang_name_c cp_global_trees[CPTI_LANG_NAME_C] #define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS] -#define lang_name_java cp_global_trees[CPTI_LANG_NAME_JAVA] /* Exception specifier used for throw(). */ #define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC] #define noexcept_true_spec cp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC] #define noexcept_false_spec cp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC] -/* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */ -#define jclass_node cp_global_trees[CPTI_JCLASS] - /* The declaration for `std::terminate'. */ #define terminate_node cp_global_trees[CPTI_TERMINATE] @@ -1549,7 +1524,7 @@ extern bool statement_code_p[MAX_TREE_CODES]; #define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)] -enum languages { lang_c, lang_cplusplus, lang_java }; +enum languages { lang_c, lang_cplusplus }; /* Macros to make error reporting functions' lives easier. */ #define TYPE_LINKAGE_IDENTIFIER(NODE) \ @@ -1599,9 +1574,6 @@ enum languages { lang_c, lang_cplusplus, lang_java }; #define OVERLOAD_TYPE_P(T) \ (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE) -/* True if this a "Java" type, defined in 'extern "Java"'. */ -#define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE) - /* True if this type is dependent. This predicate is only valid if TYPE_DEPENDENT_P_VALID is true. */ #define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE) @@ -1715,19 +1687,18 @@ struct GTY(()) lang_type_class { unsigned diamond_shaped : 1; unsigned repeated_base : 1; unsigned being_defined : 1; - unsigned java_interface : 1; unsigned debug_requested : 1; unsigned fields_readonly : 1; + unsigned ptrmemfunc_flag : 1; unsigned use_template : 2; - unsigned ptrmemfunc_flag : 1; unsigned was_anonymous : 1; unsigned lazy_default_ctor : 1; unsigned lazy_copy_ctor : 1; unsigned lazy_copy_assign : 1; unsigned lazy_destructor : 1; - unsigned has_const_copy_ctor : 1; + unsigned has_complex_copy_ctor : 1; unsigned has_complex_copy_assign : 1; unsigned non_aggregate : 1; @@ -1735,8 +1706,8 @@ struct GTY(()) lang_type_class { unsigned has_list_ctor : 1; unsigned non_std_layout : 1; unsigned is_literal : 1; - unsigned lazy_move_ctor : 1; + unsigned lazy_move_assign : 1; unsigned has_complex_move_ctor : 1; unsigned has_complex_move_assign : 1; @@ -1749,7 +1720,7 @@ struct GTY(()) lang_type_class { /* There are some bits left to fill out a 32-bit word. Keep track of this by updating the size of this bitfield whenever you add or remove a flag. */ - unsigned dummy : 3; + unsigned dummy : 4; tree primary_base; vec *vcall_indices; @@ -2011,11 +1982,6 @@ struct GTY(()) lang_type { #define CLASSTYPE_ALIGN_UNIT(NODE) \ (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT) -/* True if this a Java interface type, declared with - '__attribute__ ((java_interface))'. */ -#define TYPE_JAVA_INTERFACE(NODE) \ - (LANG_TYPE_CLASS_CHECK (NODE)->java_interface) - /* A vec of virtual functions which cannot be inherited by derived classes. When deriving from this type, the derived class must provide its own definition for each of these functions. */ @@ -5542,9 +5508,6 @@ concept_template_p (tree t) e.g "int f(void)". */ extern cp_parameter_declarator *no_parameters; -/* True if we saw "#pragma GCC java_exceptions". */ -extern bool pragma_java_exceptions; - /* in call.c */ extern bool check_dtor_name (tree, tree); int magic_varargs_p (tree); @@ -5844,7 +5807,6 @@ extern tree cxx_maybe_build_cleanup (tree, tsubst_flags_t); /* in decl2.c */ extern void note_mangling_alias (tree, tree); extern void generate_mangling_aliases (void); -extern bool check_java_method (tree); extern tree build_memfn_type (tree, tree, cp_cv_quals, cp_ref_qualifier); extern tree build_pointer_ptrmemfn_type (tree); extern tree change_return_type (tree, tree); @@ -5988,7 +5950,6 @@ extern tree build_vec_delete (tree, tree, tsubst_flags_t); extern tree create_temporary_var (tree); extern void initialize_vtbl_ptrs (tree); -extern tree build_java_class_ref (tree); extern tree scalar_constant_value (tree); extern tree decl_really_constant_value (tree); extern int diagnose_uninitialized_cst_or_ref_member (tree, bool, bool); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 65966f85454..c8f766618d1 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -77,7 +77,6 @@ static void bad_specifiers (tree, enum bad_spec_place, int, int, int, int, int); static void check_for_uninitialized_const_var (tree); static tree local_variable_p_walkfn (tree *, int *, void *); -static tree record_builtin_java_type (const char *, int); static const char *tag_name (enum tag_types); static tree lookup_and_check_tag (enum tag_types, tree, tag_scope, bool); static int walk_namespaces_r (tree, walk_namespaces_fn, void *); @@ -3892,53 +3891,6 @@ record_builtin_type (enum rid rid_index, debug_hooks->type_decl (tdecl, 0); } -/* Record one of the standard Java types. - * Declare it as having the given NAME. - * If SIZE > 0, it is the size of one of the integral types; - * otherwise it is the negative of the size of one of the other types. */ - -static tree -record_builtin_java_type (const char* name, int size) -{ - tree type, decl; - if (size > 0) - { - type = build_nonstandard_integer_type (size, 0); - type = build_distinct_type_copy (type); - } - else if (size > -32) - { - tree stype; - /* "__java_char" or ""__java_boolean". */ - type = build_nonstandard_integer_type (-size, 1); - type = build_distinct_type_copy (type); - /* Get the signed type cached and attached to the unsigned type, - so it doesn't get garbage-collected at "random" times, - causing potential codegen differences out of different UIDs - and different alias set numbers. */ - stype = build_nonstandard_integer_type (-size, 0); - stype = build_distinct_type_copy (stype); - TREE_CHAIN (type) = stype; - /*if (size == -1) TREE_SET_CODE (type, BOOLEAN_TYPE);*/ - } - else - { /* "__java_float" or ""__java_double". */ - type = make_node (REAL_TYPE); - TYPE_PRECISION (type) = - size; - layout_type (type); - } - record_builtin_type (RID_MAX, name, type); - decl = TYPE_NAME (type); - - /* Suppress generate debug symbol entries for these types, - since for normal C++ they are just clutter. - However, push_lang_context undoes this if extern "Java" is seen. */ - DECL_IGNORED_P (decl) = 1; - - TYPE_FOR_JAVA (type) = 1; - return type; -} - /* Push a type into the namespace so that the back ends ignore it. */ static void @@ -3979,7 +3931,6 @@ initialize_predefined_identifiers (void) static const predefined_identifier predefined_identifiers[] = { { "C++", &lang_name_cplusplus, 0 }, { "C", &lang_name_c, 0 }, - { "Java", &lang_name_java, 0 }, /* Some of these names have a trailing space so that it is impossible for them to conflict with names written by users. */ { "__ct ", &ctor_identifier, 1 }, @@ -4051,15 +4002,6 @@ cxx_init_decl_processing (void) c_common_nodes_and_builtins (); - java_byte_type_node = record_builtin_java_type ("__java_byte", 8); - java_short_type_node = record_builtin_java_type ("__java_short", 16); - java_int_type_node = record_builtin_java_type ("__java_int", 32); - java_long_type_node = record_builtin_java_type ("__java_long", 64); - java_float_type_node = record_builtin_java_type ("__java_float", -32); - java_double_type_node = record_builtin_java_type ("__java_double", -64); - java_char_type_node = record_builtin_java_type ("__java_char", -16); - java_boolean_type_node = record_builtin_java_type ("__java_boolean", -1); - integer_two_node = build_int_cst (NULL_TREE, 2); record_builtin_type (RID_BOOL, "bool", boolean_type_node); @@ -6962,20 +6904,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, is *not* defined. */ && (!DECL_EXTERNAL (decl) || init)) { - if (TYPE_FOR_JAVA (type) && MAYBE_CLASS_TYPE_P (type)) - { - tree jclass - = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass")); - /* Allow libjava/prims.cc define primitive classes. */ - if (init != NULL_TREE - || jclass == NULL_TREE - || TREE_CODE (jclass) != TYPE_DECL - || !POINTER_TYPE_P (TREE_TYPE (jclass)) - || !same_type_ignoring_top_level_qualifiers_p - (type, TREE_TYPE (TREE_TYPE (jclass)))) - error ("Java object %qD not allocated with %", decl); - init = NULL_TREE; - } cleanups = make_tree_vector (); init = check_initializer (decl, init, flags, &cleanups); @@ -7019,9 +6947,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, so that we can decide later to emit debug info for them. */ record_types_used_by_current_var_decl (decl); } - else if (TREE_CODE (decl) == FIELD_DECL - && TYPE_FOR_JAVA (type) && MAYBE_CLASS_TYPE_P (type)) - error ("non-static data member %qD has Java class type", decl); /* Add this declaration to the statement-tree. This needs to happen after the call to check_initializer so that the DECL_EXPR for a @@ -8384,9 +8309,7 @@ grokfndecl (tree ctype, check_main_parameter_types (decl); } - if (ctype != NULL_TREE - && (! TYPE_FOR_JAVA (ctype) || check_java_method (decl)) - && check) + if (ctype != NULL_TREE && check) { tree old_decl = check_classfn (ctype, decl, (processing_template_decl @@ -9236,7 +9159,7 @@ check_special_function_return_type (special_function_kind sfk, error_at (smallest_type_quals_location (type_quals, locations), "qualifiers are not allowed on constructor declaration"); - if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA (optype)) + if (targetm.cxx.cdtor_returns_this ()) type = build_pointer_type (optype); else type = void_type_node; @@ -9250,10 +9173,8 @@ check_special_function_return_type (special_function_kind sfk, "qualifiers are not allowed on destructor declaration"); /* We can't use the proper return type here because we run into - problems with ambiguous bases and covariant returns. - Java classes are left unchanged because (void *) isn't a valid - Java type, and we don't want to change the Java ABI. */ - if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA (optype)) + problems with ambiguous bases and covariant returns. */ + if (targetm.cxx.cdtor_returns_this ()) type = build_pointer_type (void_type_node); else type = void_type_node; @@ -10826,11 +10747,6 @@ grokdeclarator (const cp_declarator *declarator, { tree decl; - /* Note that the grammar rejects storage classes - in typenames, fields or parameters. */ - if (current_lang_name == lang_name_java) - TYPE_FOR_JAVA (type) = 1; - /* This declaration: typedef void f(int) const; @@ -11898,16 +11814,6 @@ grokparms (tree parmlist, tree *parms) TREE_TYPE (decl) = error_mark_node; } - if (type != error_mark_node - && TYPE_FOR_JAVA (type) - && MAYBE_CLASS_TYPE_P (type)) - { - error ("parameter %qD has Java class type", decl); - type = error_mark_node; - TREE_TYPE (decl) = error_mark_node; - init = NULL_TREE; - } - if (type != error_mark_node) { if (deprecated_state != DEPRECATED_SUPPRESS) @@ -13108,21 +13014,14 @@ xref_basetypes (tree ref, tree base_list) } if (max_bases > 1) - { - if (TYPE_FOR_JAVA (ref)) - error ("Java class %qT cannot have multiple bases", ref); - else - warning (OPT_Wmultiple_inheritance, - "%qT defined with multiple direct bases", ref); - } + warning (OPT_Wmultiple_inheritance, + "%qT defined with multiple direct bases", ref); if (max_vbases) { vec_alloc (CLASSTYPE_VBASECLASSES (ref), max_vbases); - if (TYPE_FOR_JAVA (ref)) - error ("Java class %qT cannot have virtual bases", ref); - else if (max_dvbases) + if (max_dvbases) warning (OPT_Wvirtual_inheritance, "%qT defined with direct virtual base", ref); } @@ -13147,9 +13046,6 @@ xref_basetypes (tree ref, tree base_list) goto dropped_base; } - if (TYPE_FOR_JAVA (basetype) && (current_lang_depth () == 0)) - TYPE_FOR_JAVA (ref) = 1; - base_binfo = NULL_TREE; if (CLASS_TYPE_P (basetype) && !dependent_scope_p (basetype)) { @@ -13924,15 +13820,11 @@ check_function_type (tree decl, tree current_function_parms) if (dependent_type_p (return_type) || type_uses_auto (return_type)) return; - if (!COMPLETE_OR_VOID_TYPE_P (return_type) - || (TYPE_FOR_JAVA (return_type) && MAYBE_CLASS_TYPE_P (return_type))) + if (!COMPLETE_OR_VOID_TYPE_P (return_type)) { tree args = TYPE_ARG_TYPES (fntype); - if (!COMPLETE_OR_VOID_TYPE_P (return_type)) - error ("return type %q#T is incomplete", return_type); - else - error ("return type has Java class type %q#T", return_type); + error ("return type %q#T is incomplete", return_type); /* Make it return void instead. */ if (TREE_CODE (fntype) == METHOD_TYPE) @@ -14587,8 +14479,7 @@ finish_constructor_body (void) tree val; tree exprstmt; - if (targetm.cxx.cdtor_returns_this () - && (! TYPE_FOR_JAVA (current_class_type))) + if (targetm.cxx.cdtor_returns_this ()) { /* Any return from a constructor will end up here. */ add_stmt (build_stmt (input_location, LABEL_EXPR, cdtor_label)); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4bdac94a8e0..5a04bc7e31e 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -63,7 +63,6 @@ typedef struct priority_info_s { static void mark_vtable_entries (tree); static bool maybe_emit_vtables (tree); -static bool acceptable_java_type (tree); static tree start_objects (int, int); static void finish_objects (int, int, tree); static tree start_static_storage_duration_function (unsigned); @@ -541,80 +540,6 @@ check_member_template (tree tmpl) error ("template declaration of %q#D", decl); } -/* Return true iff TYPE is a valid Java parameter or return type. */ - -static bool -acceptable_java_type (tree type) -{ - if (type == error_mark_node) - return false; - - if (VOID_TYPE_P (type) || TYPE_FOR_JAVA (type)) - return true; - if (TYPE_PTR_P (type) || TREE_CODE (type) == REFERENCE_TYPE) - { - type = TREE_TYPE (type); - if (TREE_CODE (type) == RECORD_TYPE) - { - tree args; int i; - if (! TYPE_FOR_JAVA (type)) - return false; - if (! CLASSTYPE_TEMPLATE_INFO (type)) - return true; - args = CLASSTYPE_TI_ARGS (type); - i = TREE_VEC_LENGTH (args); - while (--i >= 0) - { - type = TREE_VEC_ELT (args, i); - if (TYPE_PTR_P (type)) - type = TREE_TYPE (type); - if (! TYPE_FOR_JAVA (type)) - return false; - } - return true; - } - } - return false; -} - -/* For a METHOD in a Java class CTYPE, return true if - the parameter and return types are valid Java types. - Otherwise, print appropriate error messages, and return false. */ - -bool -check_java_method (tree method) -{ - bool jerr = false; - tree arg_types = TYPE_ARG_TYPES (TREE_TYPE (method)); - tree ret_type = TREE_TYPE (TREE_TYPE (method)); - - if (!acceptable_java_type (ret_type)) - { - error ("Java method %qD has non-Java return type %qT", - method, ret_type); - jerr = true; - } - - arg_types = TREE_CHAIN (arg_types); - if (DECL_HAS_IN_CHARGE_PARM_P (method)) - arg_types = TREE_CHAIN (arg_types); - if (DECL_HAS_VTT_PARM_P (method)) - arg_types = TREE_CHAIN (arg_types); - - for (; arg_types != NULL_TREE; arg_types = TREE_CHAIN (arg_types)) - { - tree type = TREE_VALUE (arg_types); - if (!acceptable_java_type (type)) - { - if (type != error_mark_node) - error ("Java method %qD has non-Java parameter type %qT", - method, type); - jerr = true; - } - } - return !jerr; -} - /* Sanity check: report error if this function FUNCTION is not really a member of the class (CTYPE) it is supposed to belong to. TEMPLATE_PARMS is used to specify the template parameters of a member @@ -2873,10 +2798,8 @@ import_export_decl (tree decl) { class_type = DECL_CONTEXT (decl); import_export_class (class_type); - if (TYPE_FOR_JAVA (class_type)) - import_p = true; - else if (CLASSTYPE_INTERFACE_KNOWN (class_type) - && CLASSTYPE_INTERFACE_ONLY (class_type)) + if (CLASSTYPE_INTERFACE_KNOWN (class_type) + && CLASSTYPE_INTERFACE_ONLY (class_type)) import_p = true; else if ((!flag_weak || TARGET_WEAK_NOT_IN_ARCHIVE_TOC) && !CLASSTYPE_USE_TEMPLATE (class_type) @@ -4080,42 +4003,6 @@ generate_ctor_and_dtor_functions_for_priority (splay_tree_node n, void * data) return 0; } -/* Java requires that we be able to reference a local address for a - method, and not be confused by PLT entries. If supported, create a - hidden alias for all such methods. */ - -static void -build_java_method_aliases (void) -{ -#ifndef HAVE_GAS_HIDDEN - return; -#endif - - struct cgraph_node *node; - FOR_EACH_FUNCTION (node) - { - tree fndecl = node->decl; - - if (DECL_CLASS_SCOPE_P (fndecl) - && TYPE_FOR_JAVA (DECL_CONTEXT (fndecl)) - && TARGET_USE_LOCAL_THUNK_ALIAS_P (fndecl)) - { - /* Mangle the name in a predictable way; we need to reference - this from a java compiled object file. */ - tree oid = DECL_ASSEMBLER_NAME (fndecl); - const char *oname = IDENTIFIER_POINTER (oid); - gcc_assert (oname[0] == '_' && oname[1] == 'Z'); - char *nname = ACONCAT (("_ZGA", oname + 2, NULL)); - - tree alias = make_alias_for (fndecl, get_identifier (nname)); - TREE_PUBLIC (alias) = 1; - DECL_VISIBILITY (alias) = VISIBILITY_HIDDEN; - - cgraph_node::create_same_body_alias (alias, fndecl); - } - } -} - /* Return C++ property of T, based on given operation OP. */ static int @@ -4908,9 +4795,6 @@ c_parse_final_cleanups (void) linkage now. */ pop_lang_context (); - /* Generate Java hidden aliases. */ - build_java_method_aliases (); - if (flag_vtable_verify) { vtv_recover_class_info (); @@ -5066,7 +4950,7 @@ possibly_inlined_p (tree decl) gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); if (DECL_UNINLINABLE (decl)) return false; - if (!optimize || pragma_java_exceptions) + if (!optimize) return DECL_DECLARED_INLINE_P (decl); /* When optimizing, we might inline everything when flatten attribute or heuristics inlining for size or autoinlining diff --git a/gcc/cp/error.c b/gcc/cp/error.c index ca7360fa602..745d7ba8672 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -3019,9 +3019,6 @@ language_to_string (enum languages c) case lang_cplusplus: return "C++"; - case lang_java: - return "Java"; - default: gcc_unreachable (); } diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 6555d6b5576..1c60b08bb10 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -35,7 +35,6 @@ static tree prepare_eh_type (tree); static tree do_begin_catch (void); static int dtor_nothrow (tree); static tree do_end_catch (tree); -static bool decl_is_java_type (tree decl, int err); static void initialize_handler_parm (tree, tree); static tree do_allocate_exception (tree); static tree wrap_cleanups_r (tree *, int *, void *); @@ -103,17 +102,10 @@ prepare_eh_type (tree type) tree eh_type_info (tree type) { - tree exp; - if (type == NULL_TREE || type == error_mark_node) return type; - if (decl_is_java_type (type, 0)) - exp = build_java_class_ref (TREE_TYPE (type)); - else - exp = get_tinfo_decl (type); - - return exp; + return get_tinfo_decl (type); } /* Build the address of a typeinfo decl for use in the runtime @@ -262,107 +254,6 @@ push_eh_cleanup (tree type) finish_decl_cleanup (NULL_TREE, do_end_catch (type)); } -/* Return nonzero value if DECL is a Java type suitable for catch or - throw. */ - -static bool -decl_is_java_type (tree decl, int err) -{ - bool r = (TYPE_PTR_P (decl) - && TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE - && TYPE_FOR_JAVA (TREE_TYPE (decl))); - - if (err) - { - if (TREE_CODE (decl) == REFERENCE_TYPE - && TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE - && TYPE_FOR_JAVA (TREE_TYPE (decl))) - { - /* Can't throw a reference. */ - error ("type %qT is disallowed in Java % or %", - decl); - } - - if (r) - { - tree jthrow_node - = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jthrowable")); - - if (jthrow_node == NULL_TREE) - fatal_error - (input_location, - "call to Java % or % with % undefined"); - - jthrow_node = TREE_TYPE (TREE_TYPE (jthrow_node)); - - if (! DERIVED_FROM_P (jthrow_node, TREE_TYPE (decl))) - { - /* Thrown object must be a Throwable. */ - error ("type %qT is not derived from %", - TREE_TYPE (decl)); - } - } - } - - return r; -} - -/* Select the personality routine to be used for exception handling, - or issue an error if we need two different ones in the same - translation unit. - ??? At present DECL_FUNCTION_PERSONALITY is set via - LANG_HOOKS_EH_PERSONALITY. Should it be done here instead? */ -void -choose_personality_routine (enum languages lang) -{ - static enum { - chose_none, - chose_cpp, - chose_java, - gave_error - } state; - - switch (state) - { - case gave_error: - return; - - case chose_cpp: - if (lang != lang_cplusplus) - goto give_error; - return; - - case chose_java: - if (lang != lang_java) - goto give_error; - return; - - case chose_none: - ; /* Proceed to language selection. */ - } - - switch (lang) - { - case lang_cplusplus: - state = chose_cpp; - break; - - case lang_java: - state = chose_java; - terminate_node = builtin_decl_explicit (BUILT_IN_ABORT); - pragma_java_exceptions = true; - break; - - default: - gcc_unreachable (); - } - return; - - give_error: - error ("mixing C++ and Java catches in a single translation unit"); - state = gave_error; -} - /* Wrap EXPR in a MUST_NOT_THROW_EXPR expressing that EXPR must not throw any exceptions if COND is true. A condition of NULL_TREE is treated as 'true'. */ @@ -408,9 +299,6 @@ initialize_handler_parm (tree decl, tree exp) if (!POINTER_TYPE_P (init_type)) init_type = build_reference_type (init_type); - choose_personality_routine (decl_is_java_type (init_type, 0) - ? lang_java : lang_cplusplus); - /* Since pointers are passed by value, initialize a reference to pointer catch parm with the address of the temporary. */ if (TREE_CODE (init_type) == REFERENCE_TYPE @@ -490,22 +378,6 @@ expand_start_catch_block (tree decl) else type = NULL_TREE; - if (decl && decl_is_java_type (type, 1)) - { - /* Java only passes object via pointer and doesn't require - adjusting. The java object is immediately before the - generic exception header. */ - exp = build_exc_ptr (); - exp = build1 (NOP_EXPR, build_pointer_type (type), exp); - exp = fold_build_pointer_plus (exp, - fold_build1_loc (input_location, - NEGATE_EXPR, sizetype, - TYPE_SIZE_UNIT (TREE_TYPE (exp)))); - exp = cp_build_indirect_ref (exp, RO_NULL, tf_warning_or_error); - initialize_handler_parm (decl, exp); - return type; - } - /* Call __cxa_end_catch at the end of processing the exception. */ push_eh_cleanup (type); @@ -738,27 +610,7 @@ build_throw (tree exp) if (! doing_eh ()) return error_mark_node; - if (exp && decl_is_java_type (TREE_TYPE (exp), 1)) - { - tree fn = get_identifier ("_Jv_Throw"); - if (!get_global_value_if_present (fn, &fn)) - { - /* Declare void _Jv_Throw (void *). */ - tree tmp; - tmp = build_function_type_list (ptr_type_node, - ptr_type_node, NULL_TREE); - fn = push_throw_library_fn (fn, tmp); - } - else if (really_overloaded_fn (fn)) - { - error ("%qD should never be overloaded", fn); - return error_mark_node; - } - fn = OVL_CURRENT (fn); - exp = cp_build_function_call_nary (fn, tf_warning_or_error, - exp, NULL_TREE); - } - else if (exp) + if (exp) { tree throw_type; tree temp_type; diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 798de087160..0d17370e468 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2622,7 +2622,6 @@ build_new_1 (vec **placement, tree type, tree nelts, tree alloc_fn; tree cookie_expr, init_expr; int nothrow, check_new; - int use_java_new = 0; /* If non-NULL, the number of extra bytes to allocate at the beginning of the storage allocated for an array-new expression in order to store the number of elements. */ @@ -2866,149 +2865,97 @@ build_new_1 (vec **placement, tree type, tree nelts, bool member_new_p = false; /* Allocate the object. */ - if (vec_safe_is_empty (*placement) && TYPE_FOR_JAVA (elt_type)) - { - tree class_addr; - tree class_decl; - static const char alloc_name[] = "_Jv_AllocObject"; + tree fnname; + tree fns; - if (!MAYBE_CLASS_TYPE_P (elt_type)) - { - error ("%qT isn%'t a valid Java class type", elt_type); - return error_mark_node; - } + fnname = ansi_opname (array_p ? VEC_NEW_EXPR : NEW_EXPR); - class_decl = build_java_class_ref (elt_type); - if (class_decl == error_mark_node) - return error_mark_node; + member_new_p = !globally_qualified_p + && CLASS_TYPE_P (elt_type) + && (array_p + ? TYPE_HAS_ARRAY_NEW_OPERATOR (elt_type) + : TYPE_HAS_NEW_OPERATOR (elt_type)); - use_java_new = 1; - if (!get_global_value_if_present (get_identifier (alloc_name), - &alloc_fn)) + if (member_new_p) + { + /* Use a class-specific operator new. */ + /* If a cookie is required, add some extra space. */ + if (array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type)) + size = size_binop (PLUS_EXPR, size, cookie_size); + else { - if (complain & tf_error) - error ("call to Java constructor with %qs undefined", alloc_name); - return error_mark_node; + cookie_size = NULL_TREE; + /* No size arithmetic necessary, so the size check is + not needed. */ + if (outer_nelts_check != NULL && inner_size == 1) + outer_nelts_check = NULL_TREE; } - else if (really_overloaded_fn (alloc_fn)) + /* Perform the overflow check. */ + tree errval = TYPE_MAX_VALUE (sizetype); + if (cxx_dialect >= cxx11 && flag_exceptions) + errval = throw_bad_array_new_length (); + if (outer_nelts_check != NULL_TREE) + size = fold_build3 (COND_EXPR, sizetype, outer_nelts_check, + size, errval); + /* Create the argument list. */ + vec_safe_insert (*placement, 0, size); + /* Do name-lookup to find the appropriate operator. */ + fns = lookup_fnfields (elt_type, fnname, /*protect=*/2); + if (fns == NULL_TREE) { - if (complain & tf_error) - error ("%qD should never be overloaded", alloc_fn); + if (complain & tf_error) + error ("no suitable %qD found in class %qT", fnname, elt_type); return error_mark_node; } - alloc_fn = OVL_CURRENT (alloc_fn); - if (TREE_CODE (alloc_fn) != FUNCTION_DECL - || TREE_CODE (TREE_TYPE (alloc_fn)) != FUNCTION_TYPE - || !POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (alloc_fn)))) + if (TREE_CODE (fns) == TREE_LIST) { if (complain & tf_error) - error ("%qD is not a function returning a pointer", alloc_fn); + { + error ("request for member %qD is ambiguous", fnname); + print_candidates (fns); + } return error_mark_node; } - class_addr = build1 (ADDR_EXPR, jclass_node, class_decl); - alloc_call = cp_build_function_call_nary (alloc_fn, complain, - class_addr, NULL_TREE); - } - else if (TYPE_FOR_JAVA (elt_type) && MAYBE_CLASS_TYPE_P (elt_type)) - { - error ("Java class %q#T object allocated using placement new", elt_type); - return error_mark_node; + tree dummy = build_dummy_object (elt_type); + alloc_call = NULL_TREE; + if (align_arg) + { + vec *align_args + = vec_copy_and_insert (*placement, align_arg, 1); + alloc_call + = build_new_method_call (dummy, fns, &align_args, + /*conversion_path=*/NULL_TREE, + LOOKUP_NORMAL, &alloc_fn, tf_none); + /* If no matching function is found and the allocated object type + has new-extended alignment, the alignment argument is removed + from the argument list, and overload resolution is performed + again. */ + if (alloc_call == error_mark_node) + alloc_call = NULL_TREE; + } + if (!alloc_call) + alloc_call = build_new_method_call (dummy, fns, placement, + /*conversion_path=*/NULL_TREE, + LOOKUP_NORMAL, + &alloc_fn, complain); } else { - tree fnname; - tree fns; - - fnname = ansi_opname (array_p ? VEC_NEW_EXPR : NEW_EXPR); - - member_new_p = !globally_qualified_p - && CLASS_TYPE_P (elt_type) - && (array_p - ? TYPE_HAS_ARRAY_NEW_OPERATOR (elt_type) - : TYPE_HAS_NEW_OPERATOR (elt_type)); - - if (member_new_p) + /* Use a global operator new. */ + /* See if a cookie might be required. */ + if (!(array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type))) { - /* Use a class-specific operator new. */ - /* If a cookie is required, add some extra space. */ - if (array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type)) - size = size_binop (PLUS_EXPR, size, cookie_size); - else - { - cookie_size = NULL_TREE; - /* No size arithmetic necessary, so the size check is - not needed. */ - if (outer_nelts_check != NULL && inner_size == 1) - outer_nelts_check = NULL_TREE; - } - /* Perform the overflow check. */ - tree errval = TYPE_MAX_VALUE (sizetype); - if (cxx_dialect >= cxx11 && flag_exceptions) - errval = throw_bad_array_new_length (); - if (outer_nelts_check != NULL_TREE) - size = fold_build3 (COND_EXPR, sizetype, outer_nelts_check, - size, errval); - /* Create the argument list. */ - vec_safe_insert (*placement, 0, size); - /* Do name-lookup to find the appropriate operator. */ - fns = lookup_fnfields (elt_type, fnname, /*protect=*/2); - if (fns == NULL_TREE) - { - if (complain & tf_error) - error ("no suitable %qD found in class %qT", fnname, elt_type); - return error_mark_node; - } - if (TREE_CODE (fns) == TREE_LIST) - { - if (complain & tf_error) - { - error ("request for member %qD is ambiguous", fnname); - print_candidates (fns); - } - return error_mark_node; - } - tree dummy = build_dummy_object (elt_type); - alloc_call = NULL_TREE; - if (align_arg) - { - vec *align_args - = vec_copy_and_insert (*placement, align_arg, 1); - alloc_call - = build_new_method_call (dummy, fns, &align_args, - /*conversion_path=*/NULL_TREE, - LOOKUP_NORMAL, &alloc_fn, tf_none); - /* If no matching function is found and the allocated object type - has new-extended alignment, the alignment argument is removed - from the argument list, and overload resolution is performed - again. */ - if (alloc_call == error_mark_node) - alloc_call = NULL_TREE; - } - if (!alloc_call) - alloc_call = build_new_method_call (dummy, fns, placement, - /*conversion_path=*/NULL_TREE, - LOOKUP_NORMAL, - &alloc_fn, complain); + cookie_size = NULL_TREE; + /* No size arithmetic necessary, so the size check is + not needed. */ + if (outer_nelts_check != NULL && inner_size == 1) + outer_nelts_check = NULL_TREE; } - else - { - /* Use a global operator new. */ - /* See if a cookie might be required. */ - if (!(array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type))) - { - cookie_size = NULL_TREE; - /* No size arithmetic necessary, so the size check is - not needed. */ - if (outer_nelts_check != NULL && inner_size == 1) - outer_nelts_check = NULL_TREE; - } - alloc_call = build_operator_new_call (fnname, placement, - &size, &cookie_size, - align_arg, - outer_nelts_check, - &alloc_fn, complain); - } + alloc_call = build_operator_new_call (fnname, placement, + &size, &cookie_size, + align_arg, outer_nelts_check, + &alloc_fn, complain); } if (alloc_call == error_mark_node) @@ -3111,7 +3058,7 @@ build_new_1 (vec **placement, tree type, tree nelts, So check for a null exception spec on the op new we just called. */ nothrow = TYPE_NOTHROW_P (TREE_TYPE (alloc_fn)); - check_new = (flag_check_new || nothrow) && ! use_java_new; + check_new = (flag_check_new || nothrow); if (cookie_size) { @@ -3290,7 +3237,7 @@ build_new_1 (vec **placement, tree type, tree nelts, unambiguous matching deallocation function can be found, propagating the exception does not cause the object's memory to be freed. */ - if (flag_exceptions && ! use_java_new) + if (flag_exceptions) { enum tree_code dcode = array_p ? VEC_DELETE_EXPR : DELETE_EXPR; tree cleanup; @@ -3531,59 +3478,6 @@ build_new (vec **placement, tree type, tree nelts, return rval; } - -/* Given a Java class, return a decl for the corresponding java.lang.Class. */ - -tree -build_java_class_ref (tree type) -{ - tree name = NULL_TREE, class_decl; - static tree CL_suffix = NULL_TREE; - if (CL_suffix == NULL_TREE) - CL_suffix = get_identifier("class$"); - if (jclass_node == NULL_TREE) - { - jclass_node = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass")); - if (jclass_node == NULL_TREE) - { - error ("call to Java constructor, while % undefined"); - return error_mark_node; - } - jclass_node = TREE_TYPE (jclass_node); - } - - /* Mangle the class$ field. */ - { - tree field; - for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) - if (DECL_NAME (field) == CL_suffix) - { - mangle_decl (field); - name = DECL_ASSEMBLER_NAME (field); - break; - } - if (!field) - { - error ("can%'t find % in %qT", type); - return error_mark_node; - } - } - - class_decl = IDENTIFIER_GLOBAL_VALUE (name); - if (class_decl == NULL_TREE) - { - class_decl = build_decl (input_location, - VAR_DECL, name, TREE_TYPE (jclass_node)); - TREE_STATIC (class_decl) = 1; - DECL_EXTERNAL (class_decl) = 1; - TREE_PUBLIC (class_decl) = 1; - DECL_ARTIFICIAL (class_decl) = 1; - DECL_IGNORED_P (class_decl) = 1; - pushdecl_top_level (class_decl); - make_decl_rtl (class_decl); - } - return class_decl; -} static tree build_vec_delete_1 (tree base, tree maxindex, tree type, diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 43827e57179..eec8b5dca23 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -37,7 +37,6 @@ static void handle_pragma_vtable (cpp_reader *); static void handle_pragma_unit (cpp_reader *); static void handle_pragma_interface (cpp_reader *); static void handle_pragma_implementation (cpp_reader *); -static void handle_pragma_java_exceptions (cpp_reader *); static void init_operators (void); static void copy_lang_type (tree); @@ -71,9 +70,6 @@ struct impl_files }; static struct impl_files *impl_file_chain; - -/* True if we saw "#pragma GCC java_exceptions". */ -bool pragma_java_exceptions; void cxx_finish (void) @@ -210,7 +206,6 @@ init_cp_pragma (void) c_register_pragma (0, "implementation", handle_pragma_implementation); c_register_pragma ("GCC", "interface", handle_pragma_interface); c_register_pragma ("GCC", "implementation", handle_pragma_implementation); - c_register_pragma ("GCC", "java_exceptions", handle_pragma_java_exceptions); } /* TRUE if a code represents a statement. */ @@ -427,18 +422,6 @@ handle_pragma_implementation (cpp_reader* /*dfile*/) } } -/* Indicate that this file uses Java-personality exception handling. */ -static void -handle_pragma_java_exceptions (cpp_reader* /*dfile*/) -{ - tree x; - if (pragma_lex (&x) != CPP_EOF) - warning (0, "junk at end of #pragma GCC java_exceptions"); - - choose_personality_routine (lang_java); - pragma_java_exceptions = true; -} - /* Issue an error message indicating that the lookup of NAME (an IDENTIFIER_NODE) failed. Returns the ERROR_MARK_NODE. */ @@ -580,8 +563,6 @@ retrofit_lang_decl (tree t) SET_DECL_LANGUAGE (t, lang_cplusplus); else if (current_lang_name == lang_name_c) SET_DECL_LANGUAGE (t, lang_c); - else if (current_lang_name == lang_name_java) - SET_DECL_LANGUAGE (t, lang_java); else gcc_unreachable (); diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index bd23260c088..9f86e914afe 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -239,10 +239,6 @@ static bool equal_abi_tags (tree, tree); static inline void start_mangling (const tree); static tree mangle_special_for_type (const tree, const char *); -/* Foreign language functions. */ - -static void write_java_integer_type_codes (const tree); - /* Append a single character to the end of the mangled representation. */ #define write_char(CHAR) \ @@ -2436,8 +2432,6 @@ write_builtin_type (tree type) write_string ("Ds"); else if (type == char32_type_node) write_string ("Di"); - else if (TYPE_FOR_JAVA (type)) - write_java_integer_type_codes (type); else { size_t itk; @@ -2492,11 +2486,9 @@ write_builtin_type (tree type) break; case REAL_TYPE: - if (type == float_type_node - || type == java_float_type_node) + if (type == float_type_node) write_char ('f'); - else if (type == double_type_node - || type == java_double_type_node) + else if (type == double_type_node) write_char ('d'); else if (type == long_double_type_node) write_char ('e'); @@ -2621,40 +2613,16 @@ write_function_type (const tree type) /* Non-terminal . TYPE is a FUNCTION_TYPE or METHOD_TYPE. If INCLUDE_RETURN_TYPE is nonzero, the return value is mangled before the parameter types. If non-NULL, DECL is - FUNCTION_DECL for the function whose type is being emitted. - - If DECL is a member of a Java type, then a literal 'J' - is output and the return type is mangled as if INCLUDE_RETURN_TYPE - were nonzero. - - ::= [J]+ */ + FUNCTION_DECL for the function whose type is being emitted. */ static void write_bare_function_type (const tree type, const int include_return_type_p, const tree decl) { - int java_method_p; - MANGLE_TRACE_TREE ("bare-function-type", type); - /* Detect Java methods and emit special encoding. */ - if (decl != NULL - && DECL_FUNCTION_MEMBER_P (decl) - && TYPE_FOR_JAVA (DECL_CONTEXT (decl)) - && !DECL_CONSTRUCTOR_P (decl) - && !DECL_DESTRUCTOR_P (decl) - && !DECL_CONV_FN_P (decl)) - { - java_method_p = 1; - write_char ('J'); - } - else - { - java_method_p = 0; - } - /* Mangle the return type, if requested. */ - if (include_return_type_p || java_method_p) + if (include_return_type_p) write_type (TREE_TYPE (type)); /* Now mangle the types of the arguments. */ @@ -4264,30 +4232,6 @@ mangle_ref_init_variable (const tree variable) return finish_mangling_get_identifier (); } - -/* Foreign language type mangling section. */ - -/* How to write the type codes for the integer Java type. */ - -static void -write_java_integer_type_codes (const tree type) -{ - if (type == java_int_type_node) - write_char ('i'); - else if (type == java_short_type_node) - write_char ('s'); - else if (type == java_byte_type_node) - write_char ('c'); - else if (type == java_char_type_node) - write_char ('w'); - else if (type == java_long_type_node) - write_char ('x'); - else if (type == java_boolean_type_node) - write_char ('b'); - else - gcc_unreachable (); -} - /* Given a CLASS_TYPE, such as a record for std::bad_exception this function generates a mangled name for the vtable map variable of the class type. For example, if the class type is diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 5de20d40655..bbbf59be6be 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1765,7 +1765,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, type = TYPE_MAIN_VARIANT (type); - if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA (type)) + if (targetm.cxx.cdtor_returns_this ()) { if (kind == sfk_destructor) /* See comment in check_special_function_return_type. */ diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index ce16d57b5d7..1bce63bb2dd 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -6054,9 +6054,6 @@ pushtag_1 (tree name, tree type, tag_scope scope) && b->level_chain->kind == sk_class)) in_class = 1; - if (current_lang_name == lang_name_java) - TYPE_FOR_JAVA (type) = 1; - tdef = create_implicit_typedef (name, type); DECL_CONTEXT (tdef) = FROB_CONTEXT (context); if (scope == ts_within_enclosing_non_class) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a0cbb2e8c0e..2fd1aac5d5d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -893,7 +893,6 @@ maybe_new_partial_specialization (tree type) // for the newly declared specialization. tree t = make_class_type (TREE_CODE (type)); CLASSTYPE_DECLARED_CLASS (t) = CLASSTYPE_DECLARED_CLASS (type); - TYPE_FOR_JAVA (t) = TYPE_FOR_JAVA (type); SET_TYPE_TEMPLATE_INFO (t, build_template_info (tmpl, args)); /* We only need a separate type node for storing the definition of this @@ -8453,7 +8452,6 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, CLASSTYPE_DECLARED_CLASS (t) = CLASSTYPE_DECLARED_CLASS (template_type); SET_CLASSTYPE_IMPLICIT_INSTANTIATION (t); - TYPE_FOR_JAVA (t) = TYPE_FOR_JAVA (template_type); /* A local class. Make sure the decl gets registered properly. */ if (context == current_function_decl) @@ -9918,7 +9916,6 @@ instantiate_class_template_1 (tree type) TYPE_PACKED (type) = TYPE_PACKED (pattern); SET_TYPE_ALIGN (type, TYPE_ALIGN (pattern)); TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (pattern); - TYPE_FOR_JAVA (type) = TYPE_FOR_JAVA (pattern); /* For libjava's JArray */ if (ANON_AGGR_TYPE_P (pattern)) SET_ANON_AGGR_TYPE_P (type); if (CLASSTYPE_VISIBILITY_SPECIFIED (pattern)) diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index bd2e8f66739..c3853e370d1 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -42,7 +42,6 @@ static tree count_trees_r (tree *, int *, void *); static tree verify_stmt_tree_r (tree *, int *, void *); static tree build_local_temp (tree); -static tree handle_java_interface_attribute (tree *, tree, tree, int, bool *); static tree handle_init_priority_attribute (tree *, tree, tree, int, bool *); static tree handle_abi_tag_attribute (tree *, tree, tree, int, bool *); @@ -3638,8 +3637,6 @@ const struct attribute_spec cxx_attribute_table[] = { /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler, affects_type_identity } */ - { "java_interface", 0, 0, false, false, false, - handle_java_interface_attribute, false }, { "init_priority", 1, 1, true, false, false, handle_init_priority_attribute, false }, { "abi_tag", 1, -1, false, false, false, @@ -3659,31 +3656,6 @@ const struct attribute_spec std_attribute_table[] = { NULL, 0, 0, false, false, false, NULL, false } }; -/* Handle a "java_interface" attribute; arguments as in - struct attribute_spec.handler. */ -static tree -handle_java_interface_attribute (tree* node, - tree name, - tree /*args*/, - int flags, - bool* no_add_attrs) -{ - if (DECL_P (*node) - || !CLASS_TYPE_P (*node) - || !TYPE_FOR_JAVA (*node)) - { - error ("%qE attribute can only be applied to Java class definitions", - name); - *no_add_attrs = true; - return NULL_TREE; - } - if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) - *node = build_variant_type_copy (*node); - TYPE_JAVA_INTERFACE (*node) = 1; - - return NULL_TREE; -} - /* Handle an "init_priority" attribute; arguments as in struct attribute_spec.handler. */ static tree diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 8b780beae72..c70cfc80ff7 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1226,8 +1226,6 @@ structural_comptypes (tree t1, tree t2, int strict) || TREE_CODE (t1) == METHOD_TYPE) && type_memfn_rqual (t1) != type_memfn_rqual (t2)) return false; - if (TYPE_FOR_JAVA (t1) != TYPE_FOR_JAVA (t2)) - return false; /* Allow for two different type nodes which have essentially the same definition. Note that we already checked for equality of the type diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 49e68d7f947..49367f540f0 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -21392,7 +21392,6 @@ Predefined Macros,cpp,The GNU C Preprocessor}). * Namespace Association:: Strong using-directives for namespace association. * Type Traits:: Compiler support for type traits. * C++ Concepts:: Improved support for generic programming. -* Java Exceptions:: Tweaking exception handling to work with Java. * Deprecated Features:: Things will disappear from G++. * Backwards Compatibility:: Compatibilities with earlier definitions of C++. @end menu @@ -21937,14 +21936,6 @@ Some_Class B __attribute__ ((init_priority (543))); Note that the particular values of @var{priority} do not matter; only their relative ordering. -@item java_interface -@cindex @code{java_interface} type attribute - -This type attribute informs C++ that the class is a Java interface. It may -only be applied to classes declared within an @code{extern "Java"} block. -Calls to methods declared in this interface are dispatched using GCJ's -interface table mechanism, instead of regular virtual table dispatch. - @item warn_unused @cindex @code{warn_unused} type attribute @@ -22252,41 +22243,6 @@ A binary type trait: true whenever the type arguments are the same. @end table -@node Java Exceptions -@section Java Exceptions - -The Java language uses a slightly different exception handling model -from C++. Normally, GNU C++ automatically detects when you are -writing C++ code that uses Java exceptions, and handle them -appropriately. However, if C++ code only needs to execute destructors -when Java exceptions are thrown through it, GCC guesses incorrectly. -Sample problematic code is: - -@smallexample - struct S @{ ~S(); @}; - extern void bar(); // @r{is written in Java, and may throw exceptions} - void foo() - @{ - S s; - bar(); - @} -@end smallexample - -@noindent -The usual effect of an incorrect guess is a link failure, complaining of -a missing routine called @samp{__gxx_personality_v0}. - -You can inform the compiler that Java exceptions are to be used in a -translation unit, irrespective of what it might think, by writing -@samp{@w{#pragma GCC java_exceptions}} at the head of the file. This -@samp{#pragma} must appear before any functions that throw or catch -exceptions, or run destructors when exceptions are thrown through them. - -You cannot mix Java and C++ exceptions in the same translation unit. It -is believed to be safe to throw a C++ exception from one file through -another file compiled for the Java exception model, or vice versa, but -there may be bugs in this area. - @node Deprecated Features @section Deprecated Features diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 41c2f381c86..ef45ca1ca3b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2016-10-04 Jakub Jelinek + + * g++.dg/other/java3.C: Remove. + * g++.dg/other/java1.C: Remove. + * g++.dg/other/error12.C: Remove. + * g++.dg/other/java2.C: Remove. + * g++.dg/warn/Wnvdtor.C: Remove. + * g++.dg/lookup/java1.C: Remove. + * g++.dg/lookup/java2.C: Remove. + * g++.dg/ext/pr34829.C: Remove. + * g++.dg/ext/java-3.C: Remove. + * g++.dg/ext/java-1.C: Remove. + * g++.dg/ext/java-2.C: Remove. + * g++.old-deja/g++.oliva/dwarf2.C: Remove. + 2016-10-04 Doug Gilmore PR tree-optimization/77808 diff --git a/gcc/testsuite/g++.dg/ext/java-1.C b/gcc/testsuite/g++.dg/ext/java-1.C deleted file mode 100644 index f88e1fcab5d..00000000000 --- a/gcc/testsuite/g++.dg/ext/java-1.C +++ /dev/null @@ -1,26 +0,0 @@ -// { dg-do compile { target { ! { powerpc-ibm-aix* } } } } -// { dg-options "" } -// Test extern "java" and some throwing of the objects. - -extern "Java" - namespace java - { - namespace lang - { - class Throwable; - class Class; - } -} -typedef class java::lang::Throwable* jthrowable; -typedef class java::lang::Class* jclass; -class java::lang::Throwable { -public: - static jclass class$; -}; -int -_Jv_FindClassFromSignature ( ) - try - { - } - catch (java::lang::Throwable *ncdfe) {} - diff --git a/gcc/testsuite/g++.dg/ext/java-2.C b/gcc/testsuite/g++.dg/ext/java-2.C deleted file mode 100644 index 8114517b942..00000000000 --- a/gcc/testsuite/g++.dg/ext/java-2.C +++ /dev/null @@ -1,79 +0,0 @@ -// PR c++/30293 -// PR c++/30294 -// { dg-do compile { target { ! { powerpc-ibm-aix* } } } } -// { dg-options "" } - -extern "Java" { -typedef __java_byte jbyte; -namespace java { -namespace lang { - class Object {}; - class Class {}; -} -} -typedef struct java::lang::Object* jobject; -typedef java::lang::Class *jclass; -} -extern "C" jobject _Jv_AllocObject (jclass); - -extern "Java" { - struct A { static java::lang::Class class$; }; -} - -struct B { - A a; // { dg-error "has Java class type" } -}; - -void* operator new (__SIZE_TYPE__, void*) throw(); -char buf[1024]; - -A a; // { dg-error "not allocated with" } -A b = A (); // { dg-error "not allocated with" } -A *c = new ((void *) buf) A (); // { dg-error "using placement new" } -A *d = new A (); -jbyte e = 6; - -const A fn1 () // { dg-error "return type has Java class type" } -{ - A a; // { dg-error "not allocated with" } - return a; -} - -A fn2 () // { dg-error "return type has Java class type" } -{ - A a; // { dg-error "not allocated with" } - return a; -} - -A *fn3 () -{ - return new A (); -} - -A &fn4 () -{ - return *c; -} - -jbyte fn5 () -{ - return 7; -} - -void fn6 (A x) // { dg-error "has Java class type" } -{ -} - -void fn7 (const A x) // { dg-error "has Java class type" } -{ -} - -void fn8 (A *x) -{ - (void) x; -} - -void fn9 (jbyte x) -{ - (void) x; -} diff --git a/gcc/testsuite/g++.dg/ext/java-3.C b/gcc/testsuite/g++.dg/ext/java-3.C deleted file mode 100644 index 128db653116..00000000000 --- a/gcc/testsuite/g++.dg/ext/java-3.C +++ /dev/null @@ -1,39 +0,0 @@ -// PR c++/70267 -// { dg-do compile { target { ! { powerpc-ibm-aix* } } } } -// { dg-options "-O2" } - -extern "Java" -{ - typedef __java_int jint; - namespace java - { - namespace lang - { - class Class; - class Object; - class Throwable {}; - class Foo; - } - } -} - -typedef struct java::lang::Object * jobject; -typedef struct java::lang::Throwable * jthrowable; -typedef class java::lang::Class * jclass; - -using java::lang::Foo; - -class Foo: public java::lang::Throwable -{ - public:static::java::lang::Class class$; -}; - -extern "C" Foo _Jv_AllocObject (jclass); -extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__)); - -void -Bar4 (void) -{ - Foo * f = new java::lang::Foo; // { dg-error "is not a function returning a pointer" } - throw (f); -} diff --git a/gcc/testsuite/g++.dg/ext/pr34829.C b/gcc/testsuite/g++.dg/ext/pr34829.C deleted file mode 100644 index d588b5b2bbd..00000000000 --- a/gcc/testsuite/g++.dg/ext/pr34829.C +++ /dev/null @@ -1,22 +0,0 @@ -// Test for PR c++/34829 -// Placement new should be ok for non-aggregate Java types. - -// { dg-do compile } -// { dg-options "" } - -extern "Java" -{ - typedef __java_byte jbyte; -} - -typedef __SIZE_TYPE__ size_t; - -void *operator new (size_t, void *m) -{ - return m; -} - -jbyte *f(void *memory) -{ - return new (memory) jbyte; -} diff --git a/gcc/testsuite/g++.dg/lookup/java1.C b/gcc/testsuite/g++.dg/lookup/java1.C deleted file mode 100644 index 0d9b22ee1d5..00000000000 --- a/gcc/testsuite/g++.dg/lookup/java1.C +++ /dev/null @@ -1,68 +0,0 @@ -// { dg-do compile } -// { dg-options "-fdollars-in-identifiers" } -// Origin: Giovanni Bajo -// Make sure that Java special functions can be called correctly. - -extern "Java" -{ - typedef __java_int jint; - namespace java - { - namespace lang - { - class Class; - class Object; - class Throwable {}; - class Foo; - } - } -} - -typedef struct java::lang::Object* jobject; -typedef struct java::lang::Throwable* jthrowable; -typedef class java::lang::Class* jclass; -using java::lang::Foo; - -class Foo : public java::lang::Throwable -{ -public: - static ::java::lang::Class class$; -}; - - -/* - * Step 1: no declarations. A declaration for _Jv_Throw is created. - */ - -void Bar1(void) -{ - Foo* f = new java::lang::Foo; // { dg-error "call to Java constructor" } - throw (f); -} - - -/* - * Step 2: constructor declaration - */ - -extern "C" jobject _Jv_AllocObject (jclass) __attribute__((__malloc__)); - -void Bar2(void) -{ - Foo* f = new java::lang::Foo; - throw (f); -} - - -/* - * Step 3: overloads - */ - -jobject _Jv_AllocObject (jclass, jint, float) __attribute__((__malloc__)); -void _Jv_Throw (int, float) __attribute__ ((__noreturn__)); - -void Bar3(void) -{ - Foo* f = new java::lang::Foo; // { dg-error "should never be overloaded" } - throw (f); // { dg-error "should never be overloaded" } -} diff --git a/gcc/testsuite/g++.dg/lookup/java2.C b/gcc/testsuite/g++.dg/lookup/java2.C deleted file mode 100644 index 26fd36922b6..00000000000 --- a/gcc/testsuite/g++.dg/lookup/java2.C +++ /dev/null @@ -1,47 +0,0 @@ -// { dg-do compile } -// { dg-options "-fdollars-in-identifiers" } -// Origin: Giovanni Bajo -// Make sure that Java special functions can be called correctly. -// (continue from java1.C) - -extern "Java" -{ - typedef __java_int jint; - namespace java - { - namespace lang - { - class Class; - class Object; - class Throwable {}; - class Foo; - } - } -} - -typedef struct java::lang::Object* jobject; -typedef struct java::lang::Throwable* jthrowable; -typedef class java::lang::Class* jclass; -using java::lang::Foo; - -class Foo : public java::lang::Throwable -{ -public: - static ::java::lang::Class class$; -}; - -/* - * Step 4: Manual declaration of _Jv_Throw - * This is the last case we need to test. In the other file we're testing - * the compiler is able to generate an artifical declaration for this - * function, so we need to test here if it works with a normal declaration. - */ - -extern "C" jobject _Jv_AllocObject (jclass) __attribute__((__malloc__)); -extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__)); - -void Bar4(void) -{ - Foo* f = new java::lang::Foo; - throw (f); -} diff --git a/gcc/testsuite/g++.dg/other/error12.C b/gcc/testsuite/g++.dg/other/error12.C deleted file mode 100644 index 253561e8feb..00000000000 --- a/gcc/testsuite/g++.dg/other/error12.C +++ /dev/null @@ -1,9 +0,0 @@ -//PR c++/28292 - -extern "Java" -{ - struct A - { - void foo(void; // { dg-error "before|incomplete type|invalid use" } - }; -} diff --git a/gcc/testsuite/g++.dg/other/java1.C b/gcc/testsuite/g++.dg/other/java1.C deleted file mode 100644 index 38b5e0c3070..00000000000 --- a/gcc/testsuite/g++.dg/other/java1.C +++ /dev/null @@ -1,22 +0,0 @@ -// { dg-options "-w -ansi -pedantic" } - -// Copyright (C) 2003 Free Software Foundation, Inc. -// Contributed by Nathan Sidwell 23 Oct 2003 - -extern "Java" { - class One - { - ~One (); // { dg-error "cannot have a destructor" "" } - One (); - }; - - class Two {}; - - class Three : One {}; // { dg-error "cannot have an implicit" "" } - - class Four : Two {}; - - class Five : Two, Four {}; // { dg-error "cannot have multiple bases" "" } - - class Six : virtual Two {}; // { dg-error "cannot have virtual base" "" } -} diff --git a/gcc/testsuite/g++.dg/other/java2.C b/gcc/testsuite/g++.dg/other/java2.C deleted file mode 100644 index 8ba4d5a72c8..00000000000 --- a/gcc/testsuite/g++.dg/other/java2.C +++ /dev/null @@ -1,11 +0,0 @@ -// PR c++/??? -// { dg-do compile } - -extern "Java" -{ - struct A {}; -} - -typedef void* jclass; - -A* p = new A; // { dg-error "class\\$" } diff --git a/gcc/testsuite/g++.dg/other/java3.C b/gcc/testsuite/g++.dg/other/java3.C deleted file mode 100644 index 1bc0a8874fe..00000000000 --- a/gcc/testsuite/g++.dg/other/java3.C +++ /dev/null @@ -1,7 +0,0 @@ -// PR c++/11006 - -typedef int* jclass; - -void foo () { - new __java_boolean; // { dg-error "valid" } -} diff --git a/gcc/testsuite/g++.dg/warn/Wnvdtor.C b/gcc/testsuite/g++.dg/warn/Wnvdtor.C deleted file mode 100644 index f03cff5b31c..00000000000 --- a/gcc/testsuite/g++.dg/warn/Wnvdtor.C +++ /dev/null @@ -1,11 +0,0 @@ -// { dg-options "-Wnon-virtual-dtor" } - -extern "Java" -{ - class Foo - { - public: - virtual void bar( void); - }; -} - diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C deleted file mode 100644 index c50b1b7d6be..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C +++ /dev/null @@ -1,10 +0,0 @@ -// { dg-do assemble } - -// Copyright (C) 1999 Free Software Foundation - -// by Alexandre Oliva - -// Fails with dwarf debugging. - -typedef __java_boolean jboolean; -void foo() {} -- 2.30.2