Re: [cfe-dev] [PATCH] Let __attribute__((format(…))) accept OFStrings
arthur.j.odwyer at gmail.com
Wed Nov 27 11:56:07 PST 2013
On Wed, Nov 27, 2013 at 7:34 AM, Jonathan Schleifer <js at webkeks.org> wrote:
> Am 27.11.2013 um 10:49 schrieb David Chisnall <David.Chisnall at cl.cam.ac.uk>:
>> I would love to see the printf attribute code generalised so that we could have a pragma
>> to declare a formatting character and the type it expected. ...
> I have to agree, a #pragma would be even better.
> #pragma clang format type(__OFString__, OFString)
> #pragma clang format add(__OFString__, "C", of_unichar_t)
> #pragma clang format add(__OFString__, "S", const of_unichar_t)
> #pragma clang format add(printf, "llc", char32_t)
Sounds like a great idea to me!
(And formats for standard functions like strfmon() and strftime()
could be implemented in the same way, with header-only patches instead
of special cases in the compiler. In practice I'm sure the compiler
would want to act as if a bunch of these pragmas were hard-coded at
the beginning of each translation unit... but just to unify all those
codepaths will still be a HUGE step forward from the status quo.)
More information about the cfe-commits