[cfe-dev] [PATCH] __format__ attribute with function pointers

Ted Kremenek kremenek at apple.com
Mon Mar 24 16:16:25 PDT 2008


On Mar 24, 2008, at 2:48 PM, Nuno Lopes wrote:

> May I shamelessly ping this? :)
> (the patch is at
> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-March/001226.html)
>
> Regards,
> Nuno

Hi Nuno,

Thanks for the ping, and sorry for the delay!

The patch looks pretty good to me, but I do have one concern/ 
question.  I noticed that you are relying on the function having a  
type of FunctionTypeProto.  This seems to rule out attaching a format  
attribute to a K&R style function prototype (where the parameters are  
omitted).  I'm not certain what GCC allows.  Certainly when the type  
of the function is FunctionTypeProto you should perform extra checking  
to see if the number of arguments line up, etc., but if GCC supports  
K&R style function prototypes to have the format attribute then you  
should also support when the type is FunctionTypeNoProto (and just do  
less checking).  If GCC does indeed disallow K&R style prototypes to  
have the format attribute, it would be great if you could document  
this assumption with a comment.  Otherwise, we should probably handle  
the case where the type is FunctionTypeNoProto.

Ted



More information about the cfe-dev mailing list