void init_exception_processing (void) { tree tmp; /* void std::terminate (); */ push_namespace (std_identifier); tmp = build_function_type (void_type_node, void_list_node); terminate_node = build_cp_library_fn_ptr ("terminate", tmp); TREE_THIS_VOLATILE (terminate_node) = 1; TREE_NOTHROW (terminate_node) = 1; pop_namespace (); /* void __cxa_call_unexpected(void *); */ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); tmp = build_function_type (void_type_node, tmp); call_unexpected_node = push_throw_library_fn (get_identifier ("__cxa_call_unexpected"), tmp); eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS ? "__gxx_personality_sj0" : "__gxx_personality_v0"); /* APPLE LOCAL begin LLVM */ if (targetm.arm_eabi_unwinder) unwind_resume_libfunc = init_one_libfunc ("__cxa_end_cleanup"); else default_init_unwind_resume_libfunc (); /* APPLE LOCAL end LLVM */ lang_eh_runtime_type = build_eh_type_type; lang_protect_cleanup_actions = &cp_protect_cleanup_actions; }
/* 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 eh_personality_libfunc is set to __gxx_personality_(sj|v)0 in init_exception_processing - 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; eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS ? "__gcj_personality_sj0" : "__gcj_personality_v0"); break; default: gcc_unreachable (); } return; give_error: error ("mixing C++ and Java catches in a single translation unit"); state = gave_error; }