From e6855a2d2906226cbaaa5f8653e44e42596771c9 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Thu, 17 May 2001 18:12:27 +0000 Subject: [PATCH] except.h (protect_cleanup_actions): Remove it. * except.h (protect_cleanup_actions): Remove it. (lang_protect_cleanup_actions): Declare it. * except.c (protect_cleanup_actions): Remove it. (lang_protect_cleanup_actions): New variable. (init_eh): Don't make protect_cleanup_actions a GC root. (expand_eh_region_and_cleanup): Call lang_protect_cleanup_actions. (output_function_exception_table): Remove unused `align' variable. * varasm.c (assemble_external): Abort if we have not yet opened the assembly output file. * except.c (cp_protect_cleanup_actions): New function. (init_exception_processing): Don't set protect_cleanup_actions here. Do set lang_protect_cleanup_actions. From-SVN: r42218 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/cp/ChangeLog | 6 ++++++ gcc/cp/except.c | 17 +++++++++++++++-- gcc/doc/install.texi | 27 +++++++-------------------- gcc/except.c | 11 +++++++++-- gcc/except.h | 9 +++++++-- gcc/varasm.c | 7 +++++++ 7 files changed, 65 insertions(+), 26 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a50be8d99eb..d7a028f207c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2001-05-17 Mark Mitchell + + * except.h (protect_cleanup_actions): Remove it. + (lang_protect_cleanup_actions): Declare it. + * except.c (protect_cleanup_actions): Remove it. + (lang_protect_cleanup_actions): New variable. + (init_eh): Don't make protect_cleanup_actions a GC root. + (expand_eh_region_and_cleanup): Call + lang_protect_cleanup_actions. + (output_function_exception_table): Remove unused `align' + variable. + * varasm.c (assemble_external): Abort if we have not yet + opened the assembly output file. + Thu May 17 11:54:50 2001 Jeffrey A Law (law@cygnus.com) * except.c (sjlj_emit_function_enter): Call assemble_external_libcall diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 06e64a5c315..66540efc902 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-05-17 Mark Mitchell + + * except.c (cp_protect_cleanup_actions): New function. + (init_exception_processing): Don't set protect_cleanup_actions + here. Do set lang_protect_cleanup_actions. + 2001-05-16 Nathan Sidwell * spew.c (read_token): Call yyerror on all unexpected tokens. diff --git a/gcc/cp/except.c b/gcc/cp/except.c index e4f04e8dde8..6c7ede1cc50 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -49,6 +49,7 @@ static int complete_ptr_ref_or_void_ptr_p PARAMS ((tree, tree)); static bool is_admissible_throw_operand PARAMS ((tree)); static int can_convert_eh PARAMS ((tree, tree)); static void check_handlers_1 PARAMS ((tree, tree)); +static tree cp_protect_cleanup_actions PARAMS ((void)); #include "decl.h" #include "obstack.h" @@ -72,8 +73,6 @@ init_exception_processing () if (flag_honor_std) pop_namespace (); - protect_cleanup_actions = build_call (terminate_node, NULL_TREE); - /* void __cxa_call_unexpected(void *); */ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); tmp = build_function_type (void_type_node, tmp); @@ -85,8 +84,22 @@ init_exception_processing () : "__gxx_personality_v0"); lang_eh_runtime_type = build_eh_type_type; + lang_protect_cleanup_actions = &cp_protect_cleanup_actions; } +/* Returns an expression to be executed if an unhandled exception is + propogated out of a cleanup region. */ + +static tree +cp_protect_cleanup_actions () +{ + /* [except.terminate] + + When the destruction of an object during stack unwinding exits + using an exception ... void terminate(); is called. */ + return build_call (terminate_node, NULL_TREE); +} + static tree prepare_eh_type (type) tree type; diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 0c27b7c21bd..877ab0ffddc 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -33,7 +33,7 @@ @settitle Installing GCC: Binaries @end ifset -@comment $Id: install.texi,v 1.1 2001/05/11 22:10:54 gerald Exp $ +@comment $Id: install.texi,v 1.2 2001/05/16 14:57:06 dje Exp $ @c Copyright (C) 2001 Free Software Foundation, Inc. @c *** Converted to texinfo by Dean Wakerley, dean@wakerley.com @@ -1550,31 +1550,18 @@ bootstrap and install GCC you first have to install a pre-built compiler, see our @uref{binaries.html,,binaries page} for details. +You must use GNU Make to build GCC on Solaris 2. If you don't have GNU +Make installed, you can use the prebuilt compiler mentioned above to +build it. + Sun as 4.X is broken in that it cannot cope with long symbol names. A typical error message might look similar to the following: @samp{/usr/ccs/bin/as: "/var/tmp/ccMsw135.s", line 11041: error: can't compute value of an expression involving an external symbol.} -This is Sun bug 4237974. See the @uref{../faq.html#squangle,,How to work around too long C++ -symbol names?} FAQ entry for further information and a workaround. This is fixed with patch -108908-02 and has been fixed in later (5.x) versions of the assembler. - -Sun make in all known Solaris 1 (SunOS 4) and Solaris 2 releases has a -broken @emph{VPATH} mechanism, which means you must either: -@itemize @bullet -@item -Use GNU make (recommended), @emph{or:} -@item -Always build in the source directory, @emph{or:} -@item -@emph{(For GCC 2.95.1 only)} -apply the patches mentioned at -@uref{http://www.gnu.org/software/gcc/extensions.html#sun-make,, -http://www.gnu.org/software/gcc/extensions.html#sun-make}. -@end itemize - - +This is Sun bug 4237974. This is fixed with patch 108908-02 and has +been fixed in later (5.x) versions of the assembler. @html


diff --git a/gcc/except.c b/gcc/except.c index 35d76cb8a82..48efbf9b8fc 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -88,7 +88,7 @@ int flag_non_call_exceptions; /* Protect cleanup actions with must-not-throw regions, with a call to the given failure handler. */ -tree protect_cleanup_actions; +tree (*lang_protect_cleanup_actions) PARAMS ((void)); /* Return true if type A catches type B. */ int (*lang_eh_type_covers) PARAMS ((tree a, tree b)); @@ -367,7 +367,6 @@ void init_eh () { ggc_add_rtx_root (&exception_handler_labels, 1); - ggc_add_tree_root (&protect_cleanup_actions, 1); if (! flag_exceptions) return; @@ -691,6 +690,7 @@ expand_eh_region_end_cleanup (handler) tree handler; { struct eh_region *region; + tree protect_cleanup_actions; rtx around_label; rtx data_save[2]; @@ -707,6 +707,13 @@ expand_eh_region_end_cleanup (handler) emit_label (region->label); + /* Give the language a chance to specify an action to be taken if an + exception is thrown that would propogate out of the HANDLER. */ + protect_cleanup_actions + = (lang_protect_cleanup_actions + ? (*lang_protect_cleanup_actions) () + : NULL_TREE); + if (protect_cleanup_actions) expand_eh_region_start (); diff --git a/gcc/except.h b/gcc/except.h index e0c8c2e6959..2720241d9a6 100644 --- a/gcc/except.h +++ b/gcc/except.h @@ -147,8 +147,13 @@ extern int duplicate_eh_regions PARAMS ((struct function *, extern void sjlj_emit_function_exit_after PARAMS ((rtx)); -/* Nonzero to protect cleanup actions with must-not-throw regions. */ -extern tree protect_cleanup_actions; +/* If non-NULL, this is a function that returns an expression to be + executed if an unhandled exception is propogated out of a cleanup + region. For example, in C++, an exception thrown by a destructor + during stack unwinding is required to result in a call to + `std::terminate', so the C++ version of this function returns a + CALL_EXPR for `std::terminate'. */ +extern tree (*lang_protect_cleanup_actions) PARAMS ((void)); /* Return true if type A catches type B. */ extern int (*lang_eh_type_covers) PARAMS ((tree a, tree b)); diff --git a/gcc/varasm.c b/gcc/varasm.c index 9b2744a3fa5..3e7b295305a 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1625,6 +1625,13 @@ void assemble_external (decl) tree decl ATTRIBUTE_UNUSED; { + /* Because most platforms do not define ASM_OUTPUT_EXTERNAL, the + main body of this code is only rarely exercised. To provide some + testing, on all platforms, we make sure that the ASM_OUT_FILE is + open. If it's not, we should not be calling this function. */ + if (!asm_out_file) + abort (); + #ifdef ASM_OUTPUT_EXTERNAL if (DECL_P (decl) && DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) { -- 2.30.2