[cfe-commits] [PATCH] Tagging NSLog/NSLogv with the __NSString__ format instead of __printf__ format

Jean-Daniel Dupas devlists at shadowlab.org
Fri Jan 20 14:09:22 PST 2012


Hi,

Actually, clang automatically add a "format(printf)" attribute to the declarations of NSLog/NSLogv functions.
This is actually wrong, as NSLog expect an NSString format attribute. It is not really an issue as the code that checks the format string is the same for printf and NSString,
but actually I'm working on adding support for CFString format, and having the wrong tag on NSLog functions prevent some code factoring between CFString and NSString format checking.

Now that NSString format is properly checked, this trick is no longer needed, so I'd like to stop forcing the type to printf, and use NSString instead.

This patch also reduce the scope of this hack to objc code only (so if by any change someone write a C library with an NSLog function, clang will not try to tag it with an NSString format attribute).

Please, can someone review this patch.
Thanks

-- Jean-Daniel


-------------- next part --------------
A non-text attachment was scrubbed...
Name: NSLog.patch
Type: application/octet-stream
Size: 1080 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120120/f77e48ee/attachment.obj>


More information about the cfe-commits mailing list