[cfe-dev] [RFC] new format string attributes
Aaron Ballman via cfe-dev
cfe-dev at lists.llvm.org
Wed Mar 25 06:06:09 PDT 2020
Thank you, this sounds like interesting work. I have a few questions below.
On Tue, Mar 24, 2020 at 4:22 PM Marcus Johnson via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> Hey guys,
>
> I'd like to add an extension to Clang's format string checking, as well as extend the format string attributes to add UTF-16 (u) and UTF-32 (U) length modifiers to the c, C, s, and S type specifiers.
>
> I've chosen lower case and upper case u to match the C and C++ standards for string literal specifiers, u"" and U"" telling the compiler to create a UTF-16 and UTF-32 string literals respectively.
Are you proposing you want to add these length modifiers to llvm-libc?
Or do you have an existing libc implementation that already supports
them and you would like Clang's format string checking functionality
to honor them?
You should not use 'u' as a length modifier as that's reserved for
future standardization because it's lowercase (see C17 7.31.11p1).
Perhaps U16 and U32 would be reasonable length modifiers though? Also,
what about U8 for UTF-8 strings, or are you planning to not handle
those for some reason?
Also, are there any active proposals within the C committee for this
functionality? Are you planning to introduce any? (This relates to
https://clang.llvm.org/get_involved.html "Contributing Extensions to
Clang" bullet 4.)
> as for the function attributes, my plan is to create uprintf and Uprintf arguments to the gcc style attributes e.g. __attribute__(__format__(uprintf)) and __attribute__(__format__(Uprintf))
>
> I've chosen uprintf and Uprintf to match C and C++'s string type indicators as well, though it might be a better idea to go with u16printf and u32printf to match C++'s u16string and u32string types?
Why do you need a new format archtype?
~Aaron
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list