WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
232404
[Tools] Enable -Wformat=2 warnings
https://bugs.webkit.org/show_bug.cgi?id=232404
Summary
[Tools] Enable -Wformat=2 warnings
David Kilzer (:ddkilzer)
Reported
2021-10-27 14:33:27 PDT
Enable -Wformat=2 warnings on projects in the Tools folder. In practice, only TestWebKitAPI required any changes after adding this warning flag.
Attachments
Patch v1
(14.41 KB, patch)
2021-10-27 15:26 PDT
,
David Kilzer (:ddkilzer)
darin
: review+
Details
Formatted Diff
Diff
Patch for landing
(14.44 KB, patch)
2021-10-27 16:59 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-10-27 14:33:48 PDT
<
rdar://problem/84728058
>
David Kilzer (:ddkilzer)
Comment 2
2021-10-27 15:26:25 PDT
Created
attachment 442638
[details]
Patch v1
Darin Adler
Comment 3
2021-10-27 15:34:59 PDT
Comment on
attachment 442638
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=442638&action=review
> Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm:174 > + NSString *const html = @"<script>var xhr = new XMLHttpRequest(); xhr.open('GET', '
http://127.0.0.1:%d/
', true); xhr.send();</script>";
I suggest you use constexpr instead. One nice thing about that is that then it can be at the beginning of the line.
> Tools/TestWebKitAPI/Tests/WebKitCocoa/OpenAndCloseWindow.mm:239 > + NSString *const windowOpenFormatString = @"window.open(\"about:blank\", \"_blank\", \"%@\")";
Ditto.
> Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h:83 > + NSString *const format = @"HTTP/1.1 200 OK\r\n"
Ditto.
> Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h:95 > + NSURLRequest *requestWithURLString(NSString *url) { return [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; }
I would name this argument "string", not "url".
> Tools/TestWebKitAPI/cocoa/HTTPServer.mm:368 > + return [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%s://127.0.0.1:%d%s", scheme, port(), path.utf8().data()]]];
No good reason to convert to a UTF8 string just to format. Can use %@ and use path.createCFString().get() instead.
David Kilzer (:ddkilzer)
Comment 4
2021-10-27 16:58:21 PDT
Comment on
attachment 442638
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=442638&action=review
>> Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h:95 >> + NSURLRequest *requestWithURLString(NSString *url) { return [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; } > > I would name this argument "string", not "url".
Changed `url` to `urlString`, and will make the other changes as suggested. Thanks!
David Kilzer (:ddkilzer)
Comment 5
2021-10-27 16:59:35 PDT
Created
attachment 442652
[details]
Patch for landing
EWS
Comment 6
2021-10-28 08:12:15 PDT
Committed
r284977
(
243625@main
): <
https://commits.webkit.org/243625@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 442652
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug