[Webkit-unassigned] [Bug 213204] New: Consistently use WTF_ATTRIBUTE_PRINTF in Assertions.[cpp, h]

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 15 12:02:25 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=213204

            Bug ID: 213204
           Summary: Consistently use WTF_ATTRIBUTE_PRINTF in
                    Assertions.[cpp,h]
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at gnome.org

r262831 removed the GCC pragma that was suppressing these warnings:

[70/1715] Building CXX object Source/WTF/wtf/CMakeFiles/WTF.dir/Assertions.cpp.o
/home/mcatanzaro/Projects/WebKit/Source/WTF/wtf/Assertions.cpp: In function ‘void vprintf_stderr_with_prefix(const char*, const char*, __va_list_tag*)’:
/home/mcatanzaro/Projects/WebKit/Source/WTF/wtf/Assertions.cpp:186:56: warning: function ‘void vprintf_stderr_with_prefix(const char*, const char*, __va_list_tag*)’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
  186 |     vprintf_stderr_common(formatWithPrefix.data(), args);
      |                                                        ^
/home/mcatanzaro/Projects/WebKit/Source/WTF/wtf/Assertions.cpp: In function ‘void vprintf_stderr_with_trailing_newline(const char*, __va_list_tag*)’:
/home/mcatanzaro/Projects/WebKit/Source/WTF/wtf/Assertions.cpp:193:43: warning: function ‘void vprintf_stderr_with_trailing_newline(const char*, __va_list_tag*)’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
  193 |         vprintf_stderr_common(format, args);
      |                                           ^
/home/mcatanzaro/Projects/WebKit/Source/WTF/wtf/Assertions.cpp:202:57: warning: function ‘void vprintf_stderr_with_trailing_newline(const char*, __va_list_tag*)’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
  202 |     vprintf_stderr_common(formatWithNewline.data(), args);
      |                                                         ^
/home/mcatanzaro/Projects/WebKit/Source/WTF/wtf/Assertions.cpp: In function ‘void WTFLogVaList(WTFLogChannel*, const char*, __va_list_tag*)’:
/home/mcatanzaro/Projects/WebKit/Source/WTF/wtf/Assertions.cpp:435:74: warning: function ‘void WTFLogVaList(WTFLogChannel*, const char*, __va_list_tag*)’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
  435 |     String loggingString = WTF::createWithFormatAndArguments(format, args);
      | 

Solution is to use WTF_ATTRIBUTE_PRINTF where recommended. According to https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes, the first argument to WTF_ATTRIBUTE_PRINTF should be the position of the format string itself (starting from 1), and the second argument should be the position of the ... parameter pack (or 0  for functions that take va_list).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200615/e4ed880e/attachment.htm>


More information about the webkit-unassigned mailing list