[cfe-dev] [RFC] new format string attributes

Marcus Johnson via cfe-dev cfe-dev at lists.llvm.org
Sun Mar 22 17:27:06 PDT 2020


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.

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?


More information about the cfe-dev mailing list