[pacman-dev] [PATCH] fix clang -Wformat-nonliteral warnings

Allan McRae allan at archlinux.org
Sun Feb 10 00:51:48 EST 2013


On 10/02/13 13:11, Andrew Gregory wrote:
> GCC is smart enough not to issue a warning when calling a printf
> function using a va_list; clang is not.  Selectively disable the warning
> using pragmas to allow building with warnings using clang.
> 
> Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> ---
> 
> Adding a bunch of pragmas doesn't strike me as an ideal solution, but clang's
> warning flag documentation is non-existent and I can't find another solution
> other than removing -Wformat-nonliteral altogether.
> 

Ugh...   definitely not!

Solution is to add a format attribute:
http://clang.llvm.org/docs/LanguageExtensions.html#format-string-checking

Allan


More information about the pacman-dev mailing list