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 | d2ff90cc580c62afb8528917c1c80ac49d9aaa01 (patch) | |
tree | 7b2fa7d3de8706d9ca72fdb284ce2a57f67d460a /contrib/gcc/cp/class.c | |
parent | 8a2681fa7ee14c49235e12318f7de5a9a7f492ea (diff) | |
download | FreeBSD-src-d2ff90cc580c62afb8528917c1c80ac49d9aaa01.zip FreeBSD-src-d2ff90cc580c62afb8528917c1c80ac49d9aaa01.tar.gz |
GCC 4.2.1 release.
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; } } |