[cfe-dev] [PATCH] Let __attribute__((format(…))) accept OFStrings
David Chisnall
David.Chisnall at cl.cam.ac.uk
Wed Nov 27 08:47:44 PST 2013
On 27 Nov 2013, at 16:03, Jonathan Schleifer <js at webkeks.org> wrote:
> You are right. You would need to tell it that it should have e.g. printf syntax, but accept a constant objc string whose type you give (Clang can always interpret it if it generates that constant string anyway). So maybe more like this:
>
> #pragma clang format type(__OFString__, printf, OFString)
>
> Then Clang would accept an OFString* and subclasses (like OFConstantString*) and Clang is able to interpret it (it can generate it after all and with my patch before, it could also handle it - the only difference is that it wouldn't be hardcoded). After that, new format specifiers / length modifiers could be added to that new format string type without modifying what printf accepts.
This seems the wrong way around. You'd want to define a per-method thing, not a per-receiver thing, so we'd just want to define a new printf flavour and add things to it.
David
More information about the cfe-dev
mailing list