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

Nuno Lopes nunoplopes at sapo.pt
Tue Mar 25 11:44:58 PDT 2008


> 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.

Thanks for reviewing the patch! (the hurry was more because this patch fixes 
hundreds of bogus warnings in the PHP source).
I've checked gcc 4.1 and it completely ignores the format attribute in K&R 
declarations. Well and who uses old stuff together with new __attribute__? 


More information about the cfe-dev mailing list