summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2010-06-30 01:26:14 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2010-06-30 01:26:14 +0000
commit0622223a32a82cdda72bd562f493219b19da5764 (patch)
treee3d8aa1bd1e4c4e797fe095849c7f8871ebb5fd2
parentc4ec988762c7a1d1b25efba6be0fbd3b45dfd926 (diff)
downloadgcc-0622223a32a82cdda72bd562f493219b19da5764.tar.gz
decl.c (incomplete_var): Declare.
* decl.c (incomplete_var): Declare. Declare VECs containing them. (incomplete_vars): Adjust comment. Change type to a VEC. (maybe_register_incomplete_var): Adjust for new type. (complete_vars): Adjust iteration over incomplete_vars. From-SVN: r161584
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c36
2 files changed, 31 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 27ab92fe267..44c843b4b74 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,12 @@
2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
+ * decl.c (incomplete_var): Declare. Declare VECs containing them.
+ (incomplete_vars): Adjust comment. Change type to a VEC.
+ (maybe_register_incomplete_var): Adjust for new type.
+ (complete_vars): Adjust iteration over incomplete_vars.
+
+2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
* decl.c (struct named_label_entry): Change type of bad_decls field
to a VEC.
(poplevel_named_label_1): Adjust for new type of bad_decls.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 47d64ca3a53..cf92e4d061e 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -245,11 +245,18 @@ VEC(tree, gc) *deferred_mark_used_calls;
enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
-/* A TREE_LIST of VAR_DECLs. The TREE_PURPOSE is a RECORD_TYPE or
- UNION_TYPE; the TREE_VALUE is a VAR_DECL with that type. At the
- time the VAR_DECL was declared, the type was incomplete. */
+/* A list of VAR_DECLs whose type was incomplete at the time the
+ variable was declared. */
-static GTY(()) tree incomplete_vars;
+typedef struct GTY(()) incomplete_var_d {
+ tree decl;
+ tree incomplete_type;
+} incomplete_var;
+
+DEF_VEC_O(incomplete_var);
+DEF_VEC_ALLOC_O(incomplete_var,gc);
+
+static GTY(()) VEC(incomplete_var,gc) *incomplete_vars;
/* Returns the kind of template specialization we are currently
processing, given that it's declaration contained N_CLASS_SCOPES
@@ -12934,7 +12941,12 @@ maybe_register_incomplete_var (tree var)
/* RTTI TD entries are created while defining the type_info. */
|| (TYPE_LANG_SPECIFIC (inner_type)
&& TYPE_BEING_DEFINED (inner_type)))
- incomplete_vars = tree_cons (inner_type, var, incomplete_vars);
+ {
+ incomplete_var *iv
+ = VEC_safe_push (incomplete_var, gc, incomplete_vars, NULL);
+ iv->decl = var;
+ iv->incomplete_type = inner_type;
+ }
}
}
@@ -12945,24 +12957,24 @@ maybe_register_incomplete_var (tree var)
void
complete_vars (tree type)
{
- tree *list = &incomplete_vars;
+ unsigned ix;
+ incomplete_var *iv;
- gcc_assert (CLASS_TYPE_P (type));
- while (*list)
+ for (ix = 0; VEC_iterate (incomplete_var, incomplete_vars, ix, iv); )
{
- if (same_type_p (type, TREE_PURPOSE (*list)))
+ if (same_type_p (type, iv->incomplete_type))
{
- tree var = TREE_VALUE (*list);
+ tree var = iv->decl;
tree type = TREE_TYPE (var);
/* Complete the type of the variable. The VAR_DECL itself
will be laid out in expand_expr. */
complete_type (type);
cp_apply_type_quals_to_decl (cp_type_quals (type), var);
/* Remove this entry from the list. */
- *list = TREE_CHAIN (*list);
+ VEC_unordered_remove (incomplete_var, incomplete_vars, ix);
}
else
- list = &TREE_CHAIN (*list);
+ ix++;
}
/* Check for pending declarations which may have abstract type. */