Summary: | [W32] Many warnings about printf format all over the code when building with MinGW | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | LRN <lrn1986> | ||||
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | NEW --- | ||||||
Severity: | Normal | CC: | cgarcia, lrn1986 | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=30342 | ||||||
Bug Depends on: | |||||||
Bug Blocks: | 133028 | ||||||
Attachments: |
|
Description
LRN
2015-04-15 06:34:44 PDT
Created attachment 250820 [details]
Change printf format attribute to gnu_printf, MinGW compatibility
"printf" means "gnu_printf" when compiling for non-Windows and means
"ms_printf" when compiling for Windows. The code, however, does seems to be
assuming gnu_printf (judging by the use of %z and %l).
Fix this by explicitly specifying gnu_printf format style.
To ensure that gnu-compatible printf implementation is used, compile
with -D__USE_MINGW_ANSI_STDIO=1, it will automagically turn all *printf()
invocations into __mingw_*printf(), which are gnu-compatible.
Only one function that won't be turned is _vsnprintf(). Ifdef its use and
call vsnprintf() instead when __USE_MINGW_ANSI_STDIO != 0.
Comment on attachment 250820 [details] Change printf format attribute to gnu_printf, MinGW compatibility View in context: https://bugs.webkit.org/attachment.cgi?id=250820&action=review > Source/WTF/ChangeLog:7 > + "printf" means "gnu_printf" when compiling for non-Windows and means > + "ms_printf" when compiling for Windows. The code, however, does seems to be > + assuming gnu_printf (judging by the use of %z and %l). We don’t need to use %z and %l; where do you see those? This patch might makes things better for MinGW, but they don’t resolve the problem for Windows so I’d prefer to actually tackle that problem. (In reply to comment #2) > Comment on attachment 250820 [details] > Change printf format attribute to gnu_printf, MinGW compatibility > > View in context: > https://bugs.webkit.org/attachment.cgi?id=250820&action=review > > > Source/WTF/ChangeLog:7 > > + "printf" means "gnu_printf" when compiling for non-Windows and means > > + "ms_printf" when compiling for Windows. The code, however, does seems to be > > + assuming gnu_printf (judging by the use of %z and %l). > > We don’t need to use %z and %l; where do you see those? This patch might > makes things better for MinGW, but they don’t resolve the problem for > Windows so I’d prefer to actually tackle that problem. ../webkitgtk-2.4.8/Source/WTF/wtf/FilePrintStream.cpp: In member function 'virtual void WTF::FilePrintStream::vprintf(const char*, va_list)': ../webkitgtk-2.4.8/Source/WTF/wtf/FilePrintStream.cpp:55:37: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] vfprintf(m_file, format, argList); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/PrintStream.cpp: In function 'void WTF::printInternal(WTF::PrintStream&, long long int)': ../webkitgtk-2.4.8/Source/WTF/wtf/PrintStream.cpp:124:29: warning: unknown conversion type character 'l' in format [-Wformat=] out.printf("%lld", value); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/PrintStream.cpp:124:29: warning: too many arguments for format [-Wformat-extra-args] ../webkitgtk-2.4.8/Source/WTF/wtf/PrintStream.cpp: In function 'void WTF::printInternal(WTF::PrintStream&, long long unsigned int)': ../webkitgtk-2.4.8/Source/WTF/wtf/PrintStream.cpp:129:29: warning: unknown conversion type character 'l' in format [-Wformat=] out.printf("%llu", value); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/PrintStream.cpp:129:29: warning: too many arguments for format [-Wformat-extra-args] ../webkitgtk-2.4.8/Source/WTF/wtf/StringPrintStream.cpp: In member function 'virtual void WTF::StringPrintStream::vprintf(const char*, va_list)': ../webkitgtk-2.4.8/Source/WTF/wtf/StringPrintStream.cpp:60:79: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] vsnprintf(m_buffer + m_next, m_size - m_next, format, firstPassArgList); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/StringPrintStream.cpp:73:70: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] vsnprintf(m_buffer + m_next, m_size - m_next, format, argList); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/text/WTFString.cpp: In static member function 'static WTF::String WTF::String::format(const char*, ...)': ../webkitgtk-2.4.8/Source/WTF/wtf/text/WTFString.cpp:463:48: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] int result = vsnprintf(&ch, 1, format, args); ^ ../webkitgtk-2.4.8/Source/WTF/wtf/text/WTFString.cpp:482:57: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] vsnprintf(buffer.data(), buffer.size(), format, args); ^ ../webkitgtk-2.4.8/Source/WebCore/platform/sql/SQLiteFileSystem.cpp: In static member function 'static WTF::String WebCore::SQLiteFileSystem::getFileNameForNewDatabase(const WTF::String&, const WTF::String&, const WTF::String&, WebCore::SQLiteDatabase*)': ../webkitgtk-2.4.8/Source/WebCore/platform/sql/SQLiteFileSystem.cpp:76:91: warning: unknown conversion type character 'l' in format [-Wformat=] fileName = pathByAppendingComponent(dbDir, String::format("%016" PRIx64 ".db", seq)); ^ ../webkitgtk-2.4.8/Source/WebCore/platform/sql/SQLiteFileSystem.cpp:76:91: warning: too many arguments for format [-Wformat-extra-args] ../webkitgtk-2.4.8/Source/WebCore/platform/sql/SQLiteFileSystem.cpp:79:51: warning: unknown conversion type character 'l' in format [-Wformat=] return String::format("%016" PRIx64 ".db", seq); ^ ../webkitgtk-2.4.8/Source/WebCore/platform/sql/SQLiteFileSystem.cpp:79:51: warning: too many arguments for format [-Wformat-extra-args] ../webkitgtk-2.4.8/Source/JavaScriptCore/jsc.cpp: In member function 'JSC::StackVisitor::Status FunctionJSCStackFunctor::operator()(JSC::StackVisitor&)': ../webkitgtk-2.4.8/Source/JavaScriptCore/jsc.cpp:339:108: warning: unknown conversion type character 'z' in format [-Wformat=] m_trace.append(String::format(" %zu %s\n", visitor->index(), visitor->toString().utf8().data())); ^ ../webkitgtk-2.4.8/Source/JavaScriptCore/jsc.cpp:339:108: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'size_t {aka unsigned int}' [-Wformat=] ../webkitgtk-2.4.8/Source/JavaScriptCore/jsc.cpp:339:108: warning: too many arguments for format [-Wformat-extra-args] ../webkitgtk-2.4.8/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp: In member function 'void WebCore::XMLDocumentParser::error(WebCore::XMLErrors::ErrorType, const char*, va_list)': ../webkitgtk-2.4.8/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:964:46: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] vsnprintf(m, sizeof(m) - 1, message, args); ^ In file included from ../webkitgtk-2.4.8/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.cpp:27:0: ../webkitgtk-2.4.8/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.h: In member function 'void JSC::ARM64Disassembler::A64DOpcode::appendUnsignedImmediate64(uint64_t)': ../webkitgtk-2.4.8/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.h:175:42: warning: unknown conversion type character 'l' in format [-Wformat=] bufferPrintf("#0x%llx", immediate); ^ ../webkitgtk-2.4.8/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.h:175:42: warning: too many arguments for format [-Wformat-extra-args] ../webkitgtk-2.4.8/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.h: In member function 'void JSC::ARM64Disassembler::A64DOpcode::appendPCRelativeOffset(uint32_t*, int32_t)': ../webkitgtk-2.4.8/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.h:180:74: warning: unknown conversion type character 'l' in format [-Wformat=] bufferPrintf("0x%llx", reinterpret_cast<uint64_t>(pc + immediate)); ^ ../webkitgtk-2.4.8/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.h:180:74: warning: too many arguments for format [-Wformat-extra-args] ../webkitgtk-2.4.8/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.cpp: In member function 'void JSC::ARM64Disassembler::A64DOpcode::bufferPrintf(const char*, ...)': ../webkitgtk-2.4.8/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.cpp:162:110: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] m_bufferOffset += vsnprintf(m_formatBuffer + m_bufferOffset, bufferSize - m_bufferOffset, format, argList); ^ In file included from ../webkitgtk-2.4.8/Source/JavaScriptCore/tools/CodeProfile.cpp:32:0: ../webkitgtk-2.4.8/Source/JavaScriptCore/tools/ProfileTreeNode.h: In member function 'void JSC::ProfileTreeNode::dumpInternal(unsigned int)': ../webkitgtk-2.4.8/Source/JavaScriptCore/tools/ProfileTreeNode.h:102:89: warning: unknown conversion type character 'l' in format [-Wformat=] static_cast<long long>(entry->value.count() - entry->value.childCount())); ^ ../webkitgtk-2.4.8/Source/JavaScriptCore/tools/ProfileTreeNode.h:102:89: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'long long int' [-Wformat=] ../webkitgtk-2.4.8/Source/JavaScriptCore/tools/ProfileTreeNode.h:102:89: warning: unknown conversion type character 'l' in format [-Wformat=] ../webkitgtk-2.4.8/Source/JavaScriptCore/tools/ProfileTreeNode.h:102:89: warning: too many arguments for format [-Wformat-extra-args] ../webkitgtk-2.4.8/Source/JavaScriptCore/tools/CodeProfile.cpp: In member function 'void JSC::CodeProfile::report()': ../webkitgtk-2.4.8/Source/JavaScriptCore/tools/CodeProfile.cpp:183:83: warning: unknown conversion type character 'l' in format [-Wformat=] dataLogF("Total samples: %lld\n", static_cast<long long>(profile.childCount())); ^ ../webkitgtk-2.4.8/Source/JavaScriptCore/tools/CodeProfile.cpp:183:83: warning: too many arguments for format [-Wformat-extra-args] |