[cfe-dev] __func__ should be of type char[], not char*

fjahanian fjahanian at apple.com
Mon Jan 14 08:58:13 PST 2008


On Jan 12, 2008, at 11:33 AM, Chris Lattner wrote:

>>> Steve/Fariborz, is __func__ valid in an objc method?
>>
>> __func__ refers to synthesized method name. For example in:
>>
>> @interface I
>> - (int) Meth;
>> @end
>>
>> __func__ will refer to:
>>
>> "-[I Meth]"
>
> Ok, is __FUNCTION__ and __PRETTY_FUNCTION__ also allowed?
Yes. In gcc they are replaced with the synthesize method name string  
as well.


> If so, this is close to  the right patch I think:

Yes. As you pointed out, 'length' of array type is the problem. This  
is not a feature that I have seen used in objective-c. But  
nevertheless....
Either length of array should be ASTized or the entire macro should  
be represented by an 'AST'. This of course has consequences in type  
matching, sizeof, etc. down the road. I will look at this later on.

- Fariborz


> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of- 
> Mon-20080107/003747.html
>
> The problem is that it only reserves space for "foo:bar:".  If you  
> know how to get the right length, please fix :)
>
> -Chris




More information about the cfe-dev mailing list