diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/cp/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 29 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 1 | ||||
-rw-r--r-- | gcc/cp/except.c | 13 |
5 files changed, 48 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d6befec6499..a50e9fcaf25 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,17 @@ +2009-09-13 Richard Guenther <rguenther@suse.de> + Rafael Avila de Espindola <espindola@google.com> + + * except.c (init_exception_processing): Do not set + lang_eh_runtime_type. + (choose_personality_routine): Do not set eh_personality_decl, + set pragma_java_exceptions. + * cp-lang.c (LANG_HOOKS_EH_RUNTIME_TYPE): Define. + (LANG_HOOKS_EH_PERSONALITY): Likewise. + (cp_eh_personality_decl): New. + (cp_eh_personality): Likewise. + * Make-lang.in (cp-lang.o): Add $(EXPR_H) and $(EXCEPT_H) + dependencies. + 2009-09-13 Wei Guozhi <carrot@google.com> PR c++/3187 diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index da5d8ac2b18..861c93df066 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -250,7 +250,7 @@ cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \ $(C_PRAGMA_H) toplev.h output.h input.h cp/operators.def $(TM_P_H) cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h debug.h langhooks.h \ $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-cp.h \ - $(DIAGNOSTIC_H) cp/cp-objcp-common.h + $(DIAGNOSTIC_H) cp/cp-objcp-common.h $(EXPR_H) $(EXCEPT_H) cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \ output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \ cp/operators.def $(TM_P_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(C_PRAGMA_H) \ diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index f818e5bb060..9521eab28cd 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -32,11 +32,14 @@ along with GCC; see the file COPYING3. If not see #include "debug.h" #include "cp-objcp-common.h" #include "hashtab.h" +#include "except.h" +#include "expr.h" enum c_language_kind c_language = clk_cxx; static void cp_init_ts (void); static const char * cxx_dwarf_name (tree t, int verbosity); static enum classify_record cp_classify_record (tree type); +static tree cp_eh_personality (void); /* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h; consequently, there should be very few hooks below. */ @@ -71,6 +74,10 @@ static enum classify_record cp_classify_record (tree type); #define LANG_HOOKS_FOLD_OBJ_TYPE_REF cp_fold_obj_type_ref #undef LANG_HOOKS_INIT_TS #define LANG_HOOKS_INIT_TS cp_init_ts +#undef LANG_HOOKS_EH_PERSONALITY +#define LANG_HOOKS_EH_PERSONALITY cp_eh_personality +#undef LANG_HOOKS_EH_RUNTIME_TYPE +#define LANG_HOOKS_EH_RUNTIME_TYPE build_eh_type_type /* Each front end provides its own lang hook initializer. */ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; @@ -145,4 +152,26 @@ finish_file (void) { } +static GTY(()) tree cp_eh_personality_decl; + +static tree +cp_eh_personality (void) +{ + if (!cp_eh_personality_decl) + { + if (!pragma_java_exceptions) + cp_eh_personality_decl + = build_personality_function (USING_SJLJ_EXCEPTIONS + ? "__gxx_personality_sj0" + : "__gxx_personality_v0"); + else + cp_eh_personality_decl + = build_personality_function (USING_SJLJ_EXCEPTIONS + ? "__gcj_personality_sj0" + : "__gcj_personality_v0"); + } + + return cp_eh_personality_decl; +} + #include "gtype-cp.h" diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ea3b4bf3d14..c720a565e7c 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4521,6 +4521,7 @@ extern void choose_personality_routine (enum languages); extern tree eh_type_info (tree); extern tree begin_eh_spec_block (void); extern void finish_eh_spec_block (tree, tree); +extern tree build_eh_type_type (tree); /* in expr.c */ extern tree cplus_expand_constant (tree); diff --git a/gcc/cp/except.c b/gcc/cp/except.c index fdef154f5d1..588c2ee68d8 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -43,7 +43,6 @@ along with GCC; see the file COPYING3. If not see static void push_eh_cleanup (tree); static tree prepare_eh_type (tree); -static tree build_eh_type_type (tree); static tree do_begin_catch (void); static int dtor_nothrow (tree); static tree do_end_catch (tree); @@ -78,15 +77,11 @@ init_exception_processing (void) 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"); if (targetm.arm_eabi_unwinder) unwind_resume_libfunc = init_one_libfunc ("__cxa_end_cleanup"); else default_init_unwind_resume_libfunc (); - lang_eh_runtime_type = build_eh_type_type; lang_protect_cleanup_actions = &cp_protect_cleanup_actions; } @@ -143,7 +138,7 @@ eh_type_info (tree type) /* Build the address of a typeinfo decl for use in the runtime matching field of the exception model. */ -static tree +tree build_eh_type_type (tree type) { tree exp = eh_type_info (type); @@ -313,7 +308,7 @@ decl_is_java_type (tree decl, int err) /* 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 + ??? At present eh_personality_decl is set to __gxx_personality_(sj|v)0 in init_exception_processing - should it be done here instead? */ void @@ -354,9 +349,7 @@ choose_personality_routine (enum languages lang) case lang_java: state = chose_java; terminate_node = built_in_decls [BUILT_IN_ABORT]; - eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS - ? "__gcj_personality_sj0" - : "__gcj_personality_v0"); + pragma_java_exceptions = true; break; default: |