On Wed, Nov 27, 2013 at 7:34 AM, Jonathan Schleifer <[email protected]> wrote:
> Am 27.11.2013 um 10:49 schrieb David Chisnall <[email protected]>:
>>
>> 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.)

–Arthur

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to