Bug 162553 - Fix -Wformat warnings in WebLoaderStrategy
Summary: Fix -Wformat warnings in WebLoaderStrategy
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Minor
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-26 02:04 PDT by Michael Catanzaro
Modified: 2016-09-26 08:27 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.45 KB, patch)
2016-09-26 04:52 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff
Patch (27.28 KB, patch)
2016-09-26 05:49 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2016-09-26 02:04:49 PDT
Fix -Wformat warnings in WebLoaderStrategy:

[5257/6045] Building CXX object Source...rocess/Network/WebLoaderStrategy.cpp.o
In file included from ../../Source/WTF/wtf/StdLibExtras.h:33:0,
                 from ../../Source/WTF/wtf/FastMalloc.h:26,
                 from ../../Source/WebKit2/config.h:44,
                 from ../../Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:26:
../../Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp: In member function ‘void WebKit::WebLoaderStrategy::scheduleLoad(WebCore::ResourceLoader&, WebCore::CachedResource*, bool)’:
../../Source/WTF/wtf/Assertions.h:386:91: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 8 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
 #define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__)
                                                                                           ^
../../Source/WTF/wtf/Assertions.h:409:49: note: in expansion of macro ‘LOG_ERROR’
 #define RELEASE_LOG_ERROR(channel, format, ...) LOG_ERROR(format, ##__VA_ARGS__)
                                                 ^~~~~~~~~
../../Source/WTF/wtf/Assertions.h:412:83: note: in expansion of macro ‘RELEASE_LOG_ERROR’
 #define RELEASE_LOG_ERROR_IF(isAllowed, channel, format, ...) do { if (isAllowed) RELEASE_LOG_ERROR(channel, format, ##__VA_ARGS__); } while (0)
                                                                                   ^~~~~~~~~~~~~~~~~
../../Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:61:67: note: in expansion of macro ‘RELEASE_LOG_ERROR_IF’
 #define RELEASE_LOG_ERROR_IF_ALLOWED(permissionChecker, fmt, ...) RELEASE_LOG_ERROR_IF(permissionChecker.isAlwaysOnLoggingAllowed(), Network, "%p - WebLoaderStrategy::" fmt, this, ##__VA_ARGS__)
                                                                   ^~~~~~~~~~~~~~~~~~~~
../../Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:217:9: note: in expansion of macro ‘RELEASE_LOG_ERROR_IF_ALLOWED’
         RELEASE_LOG_ERROR_IF_ALLOWED(resourceLoader, "scheduleLoad: Unable to schedule resource with the NetworkProcess (frame = %p, priority = %d, pageID = %llu, frameID = %llu, resourceID = %llu)", resourceLoader.frame(), static_cast<int>(resourceLoader.request().priority()), loadParameters.webPageID, loadParameters.identifier, loadParameters.webFrameID);
         ^
../../Source/WTF/wtf/Assertions.h:386:91: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 9 has type ‘WebKit::ResourceLoadIdentifier {aka long unsigned int}’ [-Wformat=]
 #define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__)
                                                                                          ^
../../Source/WTF/wtf/Assertions.h:409:49: note: in expansion of macro ‘LOG_ERROR’
 #define RELEASE_LOG_ERROR(channel, format, ...) LOG_ERROR(format, ##__VA_ARGS__)
                                                 ^~~~~~~~~
../../Source/WTF/wtf/Assertions.h:412:83: note: in expansion of macro ‘RELEASE_LOG_ERROR’
 #define RELEASE_LOG_ERROR_IF(isAllowed, channel, format, ...) do { if (isAllowed) RELEASE_LOG_ERROR(channel, format, ##__VA_ARGS__); } while (0)
                                                                                   ^~~~~~~~~~~~~~~~~
../../Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:61:67: note: in expansion of macro ‘RELEASE_LOG_ERROR_IF’
 #define RELEASE_LOG_ERROR_IF_ALLOWED(permissionChecker, fmt, ...) RELEASE_LOG_ERROR_IF(permissionChecker.isAlwaysOnLoggingAllowed(), Network, "%p - WebLoaderStrategy::" fmt, this, ##__VA_ARGS__)
                                                                   ^~~~~~~~~~~~~~~~~~~~
../../Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:217:9: note: in expansion of macro ‘RELEASE_LOG_ERROR_IF_ALLOWED’
         RELEASE_LOG_ERROR_IF_ALLOWED(resourceLoader, "scheduleLoad: Unable to schedule resource with the NetworkProcess (frame = %p, priority = %d, pageID = %llu, frameID = %llu, resourceID = %llu)", resourceLoader.frame(), static_cast<int>(resourceLoader.request().priority()), loadParameters.webPageID, loadParameters.identifier, loadParameters.webFrameID);
         ^
../../Source/WTF/wtf/Assertions.h:386:91: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 10 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
 #define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__)
                                                                                           ^
../../Source/WTF/wtf/Assertions.h:409:49: note: in expansion of macro ‘LOG_ERROR’
 #define RELEASE_LOG_ERROR(channel, format, ...) LOG_ERROR(format, ##__VA_ARGS__)
                                                 ^~~~~~~~~
../../Source/WTF/wtf/Assertions.h:412:83: note: in expansion of macro ‘RELEASE_LOG_ERROR’
 #define RELEASE_LOG_ERROR_IF(isAllowed, channel, format, ...) do { if (isAllowed) RELEASE_LOG_ERROR(channel, format, ##__VA_ARGS__); } while (0)
                                                                                   ^~~~~~~~~~~~~~~~~
../../Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:61:67: note: in expansion of macro ‘RELEASE_LOG_ERROR_IF’
 #define RELEASE_LOG_ERROR_IF_ALLOWED(permissionChecker, fmt, ...) RELEASE_LOG_ERROR_IF(permissionChecker.isAlwaysOnLoggingAllowed(), Network, "%p - WebLoaderStrategy::" fmt, this, ##__VA_ARGS__)
                                                                   ^~~~~~~~~~~~~~~~~~~~
../../Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp:217:9: note: in expansion of macro ‘RELEASE_LOG_ERROR_IF_ALLOWED’
         RELEASE_LOG_ERROR_IF_ALLOWED(resourceLoader, "scheduleLoad: Unable to schedule resource with the NetworkProcess (frame = %p, priority = %d, pageID = %llu, frameID = %llu, resourceID = %llu)", resourceLoader.frame(), static_cast<int>(resourceLoader.request().priority()), loadParameters.webPageID, loadParameters.identifier, loadParameters.webFrameID);
         ^
Comment 1 Michael Catanzaro 2016-09-26 02:30:59 PDT
Two problems here:

 * Need to use the PRIu64 macro rather to print a uint64_t, not %lld
 * The loadParameters.webFrameID argument is in the wrong place, swapped with loadParameters.identifier
Comment 2 Michael Catanzaro 2016-09-26 02:31:38 PDT
(In reply to comment #1)
> Two problems here:
> 
>  * Need to use the PRIu64 macro rather to print a uint64_t, not %lld

(I meant: not %llu)
Comment 3 Michael Catanzaro 2016-09-26 04:45:37 PDT
I'm going to split this into two commits. First, an unreviewed commit to fix the order of the parameters. Next, a patch here to fix use of %llu. I'll audit each use of RELEASE_LOG_IF_ALLOWED in WebKit2.
Comment 4 Michael Catanzaro 2016-09-26 04:52:23 PDT
Created attachment 289819 [details]
Patch
Comment 5 Michael Catanzaro 2016-09-26 04:56:47 PDT
Committed r206371: <http://trac.webkit.org/changeset/206371>
Comment 6 Michael Catanzaro 2016-09-26 04:57:36 PDT
Reopening for part two
Comment 7 Michael Catanzaro 2016-09-26 05:49:27 PDT
Created attachment 289822 [details]
Patch
Comment 8 WebKit Commit Bot 2016-09-26 08:27:20 PDT
Comment on attachment 289822 [details]
Patch

Clearing flags on attachment: 289822

Committed r206376: <http://trac.webkit.org/changeset/206376>
Comment 9 WebKit Commit Bot 2016-09-26 08:27:25 PDT
All reviewed patches have been landed.  Closing bug.