This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Variants of __typeof


On Thu, Feb 04, 2016 at 10:52:28AM +0000, Pedro Alves wrote:
> On 02/04/2016 06:01 AM, Richard Henderson wrote:
> > While attempting to write some code that uses the new x86 named address space 
> > support in gcc 6, I found that __typeof is very unhelpful.  In particular, given
> > 
> > 	int __seg_fs *ptr;
> > 	__typeof(*ptr) obj;
> > 
> > OBJ will not be type "int", but "int __seg_fs".  Which means that you can't use 
> > it to create temporaries within statement expressions.
> > 
> > In the process of writing this, I found a hack in __typeof added just to 
> > support _Atomic.  Which suggests that one of these variants would be more 
> > generally helpful than the hack.
> > 
> > I add __typeof_noas and __typeof_noqual.  The first strips only the address 
> > space, leaving 'const' and 'volatile' (and, I suppose 'restrict').  The second 
> > strips all qualifiers, essentially yielding the TYPE_MAIN_VARIANT.
> > 
> > Thoughts?
> 
> Do we need matching __auto_type variants?

I think at present __auto_type removes the qualifiers from atomic types only,
but I'd hope we can just adjust __auto_type to always strip the qualifiers,
not introduce __auto_type_noqual...

	Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]