class.c (java_hash_tree_node): Fixed indentation in leading comment.
2001-06-20 Alexandre Petit-Bianco <apbianco@redhat.com> * class.c (java_hash_tree_node): Fixed indentation in leading comment. * parse.y (do_resolve_class): Moved comments out to leading comment section. Removed local `start', New local `_ht' and `circularity_hash.' Record `enclosing' in hash table and search it to detect circularity. Use `enclosing' as an argument to `lookup_cl.' Free the hash table when done. (http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01318.html ) From-SVN: r43480
This commit is contained in:
parent
6c0a4eab24
commit
8e41c4f38e
@ -1,3 +1,12 @@
|
|||||||
|
2001-06-20 Alexandre Petit-Bianco <apbianco@redhat.com>
|
||||||
|
|
||||||
|
* class.c (java_hash_tree_node): Fixed indentation in leading comment.
|
||||||
|
* parse.y (do_resolve_class): Moved comments out to leading comment
|
||||||
|
section. Removed local `start', New local `_ht' and
|
||||||
|
`circularity_hash.' Record `enclosing' in hash table and search
|
||||||
|
it to detect circularity. Use `enclosing' as an argument to
|
||||||
|
`lookup_cl.' Free the hash table when done.
|
||||||
|
|
||||||
2001-06-19 Tom Tromey <tromey@redhat.com>
|
2001-06-19 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* lex.c (java_read_char): Disallow invalid and overlong
|
* lex.c (java_read_char): Disallow invalid and overlong
|
||||||
|
@ -618,9 +618,9 @@ init_test_hash_newfunc (entry, table, string)
|
|||||||
return (struct hash_entry *) ret;
|
return (struct hash_entry *) ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hash table helpers. Also reused in find_applicable_accessible_methods_list
|
/* Hash table helpers. Also reused in find_applicable_accessible_methods_list
|
||||||
(parse.y). The hash of a tree node is it's pointer value,
|
(parse.y). The hash of a tree node is its pointer value, comparison
|
||||||
comparison is direct. */
|
is direct. */
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
java_hash_hash_tree_node (k)
|
java_hash_hash_tree_node (k)
|
||||||
|
@ -5519,30 +5519,41 @@ resolve_class (enclosing, class_type, decl, cl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
|
/* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
|
||||||
are used to report error messages. */
|
are used to report error messages. Do not try to replace TYPE_NAME
|
||||||
|
(class_type) by a variable, since it is changed by
|
||||||
|
find_in_imports{_on_demand} and (but it doesn't really matter)
|
||||||
|
qualify_and_find. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
do_resolve_class (enclosing, class_type, decl, cl)
|
do_resolve_class (enclosing, class_type, decl, cl)
|
||||||
tree enclosing, class_type, decl, cl;
|
tree enclosing, class_type, decl, cl;
|
||||||
{
|
{
|
||||||
tree new_class_decl, super, start;
|
tree new_class_decl, super;
|
||||||
|
struct hash_table _ht, *circularity_hash = &_ht;
|
||||||
|
|
||||||
/* Do not try to replace TYPE_NAME (class_type) by a variable, since
|
/* This hash table is used to register the classes we're going
|
||||||
it is changed by find_in_imports{_on_demand} and (but it doesn't
|
through when searching the current class as an inner class, in
|
||||||
really matter) qualify_and_find */
|
order to detect circular references. Remember to free it before
|
||||||
|
returning the section 0- of this function. */
|
||||||
|
hash_table_init (circularity_hash, hash_newfunc,
|
||||||
|
java_hash_hash_tree_node, java_hash_compare_tree_node);
|
||||||
|
|
||||||
/* 0- Search in the current class as an inner class */
|
/* 0- Search in the current class as an inner class.
|
||||||
start = enclosing;
|
Maybe some code here should be added to load the class or
|
||||||
|
|
||||||
/* Maybe some code here should be added to load the class or
|
|
||||||
something, at least if the class isn't an inner class and ended
|
something, at least if the class isn't an inner class and ended
|
||||||
being loaded from class file. FIXME. */
|
being loaded from class file. FIXME. */
|
||||||
while (enclosing)
|
while (enclosing)
|
||||||
{
|
{
|
||||||
tree intermediate;
|
tree intermediate;
|
||||||
|
|
||||||
|
hash_lookup (circularity_hash,
|
||||||
|
(const hash_table_key) enclosing, TRUE, NULL);
|
||||||
|
|
||||||
if ((new_class_decl = find_as_inner_class (enclosing, class_type, cl)))
|
if ((new_class_decl = find_as_inner_class (enclosing, class_type, cl)))
|
||||||
return new_class_decl;
|
{
|
||||||
|
hash_table_free (circularity_hash);
|
||||||
|
return new_class_decl;
|
||||||
|
}
|
||||||
|
|
||||||
intermediate = enclosing;
|
intermediate = enclosing;
|
||||||
/* Explore enclosing contexts. */
|
/* Explore enclosing contexts. */
|
||||||
@ -5551,7 +5562,10 @@ do_resolve_class (enclosing, class_type, decl, cl)
|
|||||||
intermediate = DECL_CONTEXT (intermediate);
|
intermediate = DECL_CONTEXT (intermediate);
|
||||||
if ((new_class_decl = find_as_inner_class (intermediate,
|
if ((new_class_decl = find_as_inner_class (intermediate,
|
||||||
class_type, cl)))
|
class_type, cl)))
|
||||||
return new_class_decl;
|
{
|
||||||
|
hash_table_free (circularity_hash);
|
||||||
|
return new_class_decl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now go to the upper classes, bail out if necessary. */
|
/* Now go to the upper classes, bail out if necessary. */
|
||||||
@ -5563,13 +5577,14 @@ do_resolve_class (enclosing, class_type, decl, cl)
|
|||||||
super = do_resolve_class (NULL, super, NULL, NULL);
|
super = do_resolve_class (NULL, super, NULL, NULL);
|
||||||
else
|
else
|
||||||
super = TYPE_NAME (super);
|
super = TYPE_NAME (super);
|
||||||
|
|
||||||
/* We may not have checked for circular inheritance yet, so do so
|
/* We may not have checked for circular inheritance yet, so do so
|
||||||
here to prevent an infinite loop. */
|
here to prevent an infinite loop. */
|
||||||
if (super == start)
|
if (hash_lookup (circularity_hash,
|
||||||
|
(const hash_table_key) super, FALSE, NULL))
|
||||||
{
|
{
|
||||||
if (!cl)
|
if (!cl)
|
||||||
cl = lookup_cl (decl);
|
cl = lookup_cl (enclosing);
|
||||||
|
|
||||||
parse_error_context
|
parse_error_context
|
||||||
(cl, "Cyclic inheritance involving %s",
|
(cl, "Cyclic inheritance involving %s",
|
||||||
@ -5579,6 +5594,8 @@ do_resolve_class (enclosing, class_type, decl, cl)
|
|||||||
enclosing = super;
|
enclosing = super;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hash_table_free (circularity_hash);
|
||||||
|
|
||||||
/* 1- Check for the type in single imports. This will change
|
/* 1- Check for the type in single imports. This will change
|
||||||
TYPE_NAME() if something relevant is found */
|
TYPE_NAME() if something relevant is found */
|
||||||
find_in_imports (class_type);
|
find_in_imports (class_type);
|
||||||
|
Loading…
Reference in New Issue
Block a user