[cfe-dev] [PATCH] __format__ attribute with function pointers
kremenek at apple.com
Tue Mar 25 15:09:15 PDT 2008
On Mar 25, 2008, at 11:44 AM, Nuno Lopes wrote:
>> 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.
Great! If you could regenerate the patch that is synced with the
latest revision and send it my way that would be great; I'll then go
and apply it. If you could also add a comment about the K&R stuff
(one line comment: GCC ignores attributes on ...) that would also be
> Well and who uses old stuff together with new __attribute__? :)
The world of C and C++ is full of mongrels. I've seen stranger
More information about the cfe-dev