This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Canonical types (1/3)
Doug Gregor wrote:
>> Does it ever make sense to have both TYPE_CANONICAL and
>> TYPE_STRUCTURAL_EQUALITY set?
> No, it does not make sense for both to be set.
>> If we have to do the structural equality
>> test, then it seems to me that the canonical type isn't useful, and we
>> might as well not construct it.
> Yes, we consider types with different alignments the same (from the
> language point of view). It's a little surprising what we do now in
> comptypes. We basically check qualifiers and whether the type is a
> Java type. If those match, and the TYPE_MAIN_VARIANT is the same for
> the two types, we conclude that the types are the same... which means
> that we ignore attributes, alignment, sizes, and a host of other
> things. Now, this makes some sense, because type attributes and
> alignment don't really exist in the C++ type system, so two types (in
> the C++ sense) can't differ by their attributes.
Right. (I did post proposed semantics for attributes a few months ago,
and in that model, these certainly would be different types. But, that
just means making the canonicalization test different when we get there.)
>> Why do we ever want the explicit COMPARE_STRUCTURAL?
> It comes in useful when you've created a new type node but you need to
> search through a list somewhere to find its canonical type.
Good, that was my guess. I should have said that, and saved you the
trouble of explaining it to me. Thanks!
>> Have you tested with flag_check_canonical_types on, and verified that
>> you get no warnings?
> Yes. I bootstrapped with C, C++, Objective-C, Objective-C++, and Java,
> then ran "make check" for the first four languages, along with "make
> check" for libstdc++. No warnings anywhere.
OK, that's great. Unfortunately, I think you should to do that again
with the final patch, which I know takes a while. Feel free to post a
more casually tested patch for me to provisionally review, if you like.
You're almost there. :-)
(650) 331-3385 x713