[C/C++/ObjC/ObjC++ PATCH] Battle of the comptypes (PR c++/35049)

H.J. Lu hjl.tools@gmail.com
Thu Feb 7 13:52:00 GMT 2008


On Thu, Feb 07, 2008 at 02:09:45PM +0100, Paolo Bonzini wrote:
> Here it is.  The problem is that C and C++ call two different things 
> "comptypes".  What C calls comptypes, C++ calls same_type_p.  In turn, C++ 
> does have a comptypes but it has an additional third argument; same_type_p 
> (a, b) == comptypes (a, b, 0) == <C front-end comptypes> (a, b).
>
> The solution is to give the same signature to the C and C++ front-end's 
> comptypes functions.  Furthermore, I moved the same_type_p macro from C++ 
> to c-common.h so that the whole family of languages can use the same name 
> for the same thing.  Therefore, a large part of the patch renames comptypes 
> calls to same_type_p or same_type_ignoring_top_level_qualifiers_p.
>
> The patch may seem a little more complicated than Doug's because it touches 
> multiple languages, but actually it kills more code than it adds!  In 
> particular, it removes an ugly hack in the ObjC++ front-end to mediate 
> between objc/objc-act.c (which uses a two-argument comptypes) and 
> cp/typeck.c (which implements a three-argument comptypes).
>
> Bootstrapped/regtested i686-pc-linux-gnu, C/C++/ObjC/ObjC++/Fortran/Java.  
> Ok for mainline together with reverting Doug's changes?
>

Will your patch work with g++.dg/ext/vector13.C for PR c++/35096,
which is the part for Doug's changes?

BTW, could you please mention PR c++/35049 and PR c++/35096 in your
ChangeLog?

Thanks.

H.J.



More information about the Gcc-patches mailing list