Loading... (original) (raw)

Fix for

[JDK-8036122](/browse/JDK-8036122 "Fix warning "format not a string literal"")

removed -Wno-format-nonliteral, which cause build with Xcode5 or clang to fail because clang has more strict rule with format than GCC,

Quoted from http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html,

"-Wformat-nonliteral
If -Wformat is specified, also warn if the format string is not a string literal and so cannot be checked, unless the format function takes its format arguments as a va_list."

As for clang, quoted from http://clang.llvm.org/docs/AttributeReference.html?highlight=wformat#format-gnu-format,

"Clang checks that the format string argument is a literal string. This is the -Wformat-nonliteral warning, it is off by default.

Clang implements this mostly the same way as GCC, but there is a difference for functions that accept a va_list argument (for example, vprintf). GCC does not emit -Wformat-nonliteral warning for calls to such fuctions. Clang does not warn if the format string comes from a function parameter, where the function is annotated with a compatible attribute, otherwise it warns."