summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-18 23:56:18 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-18 23:56:18 +0000
commit73b8a26bf3cb3730d6888cb56b798a0ce6b8ba6b (patch)
treec6fd4b16dbf1978e9723b877dab3cfb61c21f280 /gcc/cp
parent756b5f985f88533860c986e93def89dd88a554fd (diff)
downloadgcc-73b8a26bf3cb3730d6888cb56b798a0ce6b8ba6b.tar.gz
* decl.c (layout_var_decl): Change prototype. Call layout_decl
even when the declaration is external. (cp_finish_decl): Adjust call to layout_var_decl. * pt.c (tsubst_expr): Make sure to initialize stmt before using it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29504 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c34
-rw-r--r--gcc/cp/pt.c2
3 files changed, 24 insertions, 19 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 00038b54ae8..599c7ff254c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+1999-09-18 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (layout_var_decl): Change prototype. Call layout_decl
+ even when the declaration is external.
+ (cp_finish_decl): Adjust call to layout_var_decl.
+ * pt.c (tsubst_expr): Make sure to initialize stmt before using it.
+
1999-09-18 Martin von Loewis <loewis@informatik.hu-berlin.de>
* typeck.c (get_member_function_from_ptrfunc): Always consider
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index b1563cf2f94..ed3e11e921d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -166,7 +166,7 @@ static tree make_label_decl PROTO((tree, int));
static void pop_label PROTO((tree));
static void pop_labels PROTO((tree));
static void maybe_deduce_size_from_array_init PROTO((tree, tree));
-static tree layout_var_decl PROTO((tree, tree));
+static void layout_var_decl PROTO((tree));
static void maybe_commonize_var PROTO((tree));
static tree check_initializer PROTO((tree, tree));
static void make_rtl_for_nonlocal_decl PROTO((tree, tree, const char *));
@@ -7088,23 +7088,23 @@ maybe_deduce_size_from_array_init (decl, init)
}
/* Set DECL_SIZE, DECL_ALIGN, etc. for DECL (a VAR_DECL), and issue
- any appropriate error messages regarding the layout. INIT is a
- the initializer for DECL; returns a modified version. */
+ any appropriate error messages regarding the layout. */
-static tree
-layout_var_decl (decl, init)
+static void
+layout_var_decl (decl)
tree decl;
- tree init;
{
- tree ttype = target_type (TREE_TYPE (decl));
-
- /* If we haven't already layed out this declaration, and we know its
- type, do so now. Note that we must not call complete type for an
- external object because it's type might involve templates that we
- are not supposed to isntantiate yet. */
- if (!DECL_EXTERNAL (decl)
- && DECL_SIZE (decl) == NULL_TREE
- && TYPE_SIZE (complete_type (TREE_TYPE (decl))) != NULL_TREE)
+ tree type = TREE_TYPE (decl);
+ tree ttype = target_type (type);
+
+ /* If we haven't already layed out this declaration, do so now.
+ Note that we must not call complete type for an external object
+ because it's type might involve templates that we are not
+ supposed to isntantiate yet. (And it's perfectly legal to say
+ `extern X x' for some incomplete type `X'.) */
+ if (!DECL_EXTERNAL (decl))
+ complete_type (type);
+ if (!DECL_SIZE (decl)&& TYPE_SIZE (type))
layout_decl (decl, 0);
if (!DECL_EXTERNAL (decl) && DECL_SIZE (decl) == NULL_TREE)
@@ -7131,8 +7131,6 @@ layout_var_decl (decl, init)
else
cp_error ("storage size of `%D' isn't constant", decl);
}
-
- return init;
}
/* If a local static variable is declared in an inline function, or if
@@ -7746,7 +7744,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
end_temporary_allocation ();
if (TREE_CODE (decl) == VAR_DECL)
- init = layout_var_decl (decl, init);
+ layout_var_decl (decl);
/* Output the assembler code and/or RTL code for variables and functions,
unless the type is an undefined structure or union.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 35bf27f9da0..22efc7e1df3 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7446,7 +7446,7 @@ tsubst_expr (t, args, complain, in_decl)
prep_stmt (t);
if (CLEANUP_P (t))
{
- begin_try_block ();
+ stmt = begin_try_block ();
tsubst_expr (TRY_STMTS (t), args, complain, in_decl);
finish_cleanup_try_block (stmt);
finish_cleanup (tsubst_expr (TRY_HANDLERS (t), args,