* except.h (protect_cleanup_actions): Remove it.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 May 2001 18:12:27 +0000 (18:12 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 May 2001 18:12:27 +0000 (18:12 +0000)
(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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42218 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/except.c
gcc/doc/install.texi
gcc/except.c
gcc/except.h
gcc/varasm.c

index a50be8d..d7a028f 100644 (file)
@@ -1,3 +1,17 @@
+2001-05-17  Mark Mitchell  <mark@codesourcery.com>
+
+       * 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
index 06e64a5..66540ef 100644 (file)
@@ -1,3 +1,9 @@
+2001-05-17  Mark Mitchell  <mark@codesourcery.com>
+
+       * 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  <nathan@codesourcery.com>
 
        * spew.c (read_token): Call yyerror on all unexpected tokens.
index e4f04e8..6c7ede1 100644 (file)
@@ -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;
index 0c27b7c..877ab0f 100644 (file)
@@ -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
 <p>
 <hr>
index 35d76cb..48efbf9 100644 (file)
@@ -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 ();
 
index e0c8c2e..2720241 100644 (file)
@@ -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));
index 9b2744a..3e7b295 100644 (file)
@@ -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))
     {