[cfe-commits] r148324 - in /cfe/trunk: include/clang/Sema/Sema.h lib/Sema/SemaChecking.cpp lib/Sema/SemaExprObjC.cpp test/SemaObjC/format-strings-objc.m

Sebastian Redl sebastian.redl at getdesigned.at
Mon Jan 30 09:46:48 PST 2012


On 30.01.2012, at 18:37, Nico Weber wrote:

> 
> The current %S warning implementation is wrong for just printf() as
> well: It compares the argument to wchar_t, but if you build your
> program with -fshort-wchar, clang won't warn (since your program uses
> wchar_t) yet printf won't work (because libc was built without
> -fshort-wchar). If you store your characters in an uint32* and pass
> that to printf() and build your program with -fshort-wchar, clang will
> warn (because uint32* doesn't match wchar_t* with -fshort-whar) yet
> the program will work correctly.

And just to make things more fun, Microsoft's printf takes "%S" to mean "UCS-2 string" and wprintf interprets L"%S" as "narrow string".

Sebastian



More information about the cfe-commits mailing list