diff options
author | kan <kan@FreeBSD.org> | 2007-08-14 02:45:23 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2007-08-14 02:45:23 +0000 |
commit | f3fdf8c00692bbca20a05f0353d84a0ddfba51f7 (patch) | |
tree | 8f096418faf236b82579082ebcdd54f9d3fc1bf6 /contrib/gcc/cp/class.c | |
parent | 04d2779b5cbe7185f3e841545ae4cb51bffc5acb (diff) | |
parent | d2ff90cc580c62afb8528917c1c80ac49d9aaa01 (diff) | |
download | FreeBSD-src-f3fdf8c00692bbca20a05f0353d84a0ddfba51f7.zip FreeBSD-src-f3fdf8c00692bbca20a05f0353d84a0ddfba51f7.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r171825,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/gcc/cp/class.c')
-rw-r--r-- | contrib/gcc/cp/class.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/contrib/gcc/cp/class.c b/contrib/gcc/cp/class.c index ff1d84b..1f30524 100644 --- a/contrib/gcc/cp/class.c +++ b/contrib/gcc/cp/class.c @@ -5350,22 +5350,34 @@ fixed_type_or_null (tree instance, int* nonnull, int* cdtorp) } else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE) { + /* We only need one hash table because it is always left empty. */ + static htab_t ht; + if (!ht) + ht = htab_create (37, + htab_hash_pointer, + htab_eq_pointer, + /*htab_del=*/NULL); + /* Reference variables should be references to objects. */ if (nonnull) *nonnull = 1; - /* DECL_VAR_MARKED_P is used to prevent recursion; a + /* Enter the INSTANCE in a table to prevent recursion; a variable's initializer may refer to the variable itself. */ if (TREE_CODE (instance) == VAR_DECL && DECL_INITIAL (instance) - && !DECL_VAR_MARKED_P (instance)) + && !htab_find (ht, instance)) { tree type; - DECL_VAR_MARKED_P (instance) = 1; + void **slot; + + slot = htab_find_slot (ht, instance, INSERT); + *slot = instance; type = fixed_type_or_null (DECL_INITIAL (instance), nonnull, cdtorp); - DECL_VAR_MARKED_P (instance) = 0; + htab_remove_elt (ht, instance); + return type; } } |