Enable -Wformat=2 warnings on projects in the Tools folder. In practice, only TestWebKitAPI required any changes after adding this warning flag.
<rdar://problem/84728058>
Created attachment 442638 [details] Patch v1
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.
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!
Created attachment 442652 [details] Patch for landing
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].