diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-10-04 17:32:31 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-10-04 17:32:31 +0200 |
commit | bfecd57cd46ac368213f55fc4a3ff67c8c59c5ea (patch) | |
tree | 67b42e486b9999f08c29028115ba5ebbee98254b /gcc/cp/except.c | |
parent | fe8b1e839ca91a61440288049a868944346eef4b (diff) | |
download | gcc-bfecd57cd46ac368213f55fc4a3ff67c8c59c5ea.zip gcc-bfecd57cd46ac368213f55fc4a3ff67c8c59c5ea.tar.gz gcc-bfecd57cd46ac368213f55fc4a3ff67c8c59c5ea.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r-- | gcc/cp/except.c | 152 |
1 files changed, 2 insertions, 150 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 6555d6b..1c60b08 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 %<throw%> or %<catch%>", - decl); - } - - if (r) - { - tree jthrow_node - = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jthrowable")); - - if (jthrow_node == NULL_TREE) - fatal_error - (input_location, - "call to Java %<catch%> or %<throw%> with %<jthrowable%> 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 %<java::lang::Throwable%>", - 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; |