Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 1c37850168d747622bc2bab5909a5d5b5bdd8b73 https://github.com/WebKit/WebKit/commit/1c37850168d747622bc2bab5909a5d5b5bdd8b73 Author: David Kilzer <ddkil...@apple.com> Date: 2025-08-27 (Wed, 27 Aug 2025)
Changed paths: M Source/WTF/wtf/Assertions.cpp M Source/WTF/wtf/Assertions.h M Source/WTF/wtf/darwin/LibraryPathDiagnostics.mm M Source/WebCore/platform/gamepad/mac/MultiGamepadProvider.mm M Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm M Source/WebCore/platform/ios/wak/WebCoreThread.mm M Source/WebCore/platform/mac/PlatformEventFactoryMac.mm M Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm M Source/WebGPU/WebGPU/Device.mm M Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm M Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm M Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm M Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm M Source/WebKit/UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.mm M Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.mm M Source/WebKit/UIProcess/DigitalCredentials/WKDigitalCredentialsPicker.mm M Source/WebKit/UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm M Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm M Source/WebKit/UIProcess/ios/WKMouseInteraction.mm M Source/WebKit/UIProcess/mac/WKPrintingView.mm M Source/WebKit/UIProcess/mac/WebViewImpl.mm M Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm M Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm M Source/WebKitLegacy/mac/WebView/WebHTMLView.mm M Source/WebKitLegacy/mac/WebView/WebPDFView.mm M Source/WebKitLegacy/mac/WebView/WebView.mm M Tools/TestWebKitAPI/Tests/WebKitCocoa/SOAuthorizationTests.mm Log Message: ----------- Enable format string attributes in Objective-C++ sources rdar://159245047 https://bugs.webkit.org/show_bug.cgi?id=297946 Reviewed by Mike Wyrzykowski, Per Arne Vollan, and Ben Nham. Clang introduced `__attribute__((__format__(__NSString__, format, va_args)))` a few years ago, which is a superset of the `printf` format attribute and supports the `%@` placeholder. Since the assertion and logging code in WTF all support the `%@` placeholder, switch them to use the `__NSString__` format attribute on Apple OSes, then fix all the resulting format warnings. If no comment below, the change is to fix placeholders and/or parameters. * Source/WTF/wtf/Assertions.cpp: - Switch logging methods from WTF_ATTRIBUTE_PRINTF to WTF_ATTRIBUTE_NSSTRING. (WTF::createWithFormatAndArguments): - Extract `formatSpan` into a variable since it's used with USE(CF), we will want to switch to using that in the future anyway, and because it makes clang forget that `format` has an `__NSString__` format attribute when passing to functions with a `printf` format attribute. (WTF::vprintf_stderr_common): - Ditto of comments for WTF::createWithFormatAndArguments(). - Also disable the -Wformat-nonliteral warnings for the whole function like WTF::createWithFormatAndArguments(). * Source/WTF/wtf/Assertions.h: (WTF_ATTRIBUTE_NSSTRING): Add. - Declare compiler attribute for __NSString__ format strings with a fallback to use WTF_ATTRIBUTE_PRINTF() on non-Apple platforms. (WTF_ATTRIBUTE_PRINTF): - Remove hack that disables format string attributes in Objective-C++. - Switch logging functions to use WTF_ATTRIBUTE_NSSTRING() attribute. * Source/WTF/wtf/darwin/LibraryPathDiagnostics.mm: (WTF::LibraryPathDiagnosticsLogger::logError): - Add missing format string attribute. * Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm: (WebCore::keyIdentifierForKeyEvent): * Source/WebCore/platform/ios/wak/WebCoreThread.mm: (WebCoreObjCDeallocOnWebThread): (WebCoreObjCDeallocWithWebThreadLock): * Source/WebCore/platform/gamepad/mac/MultiGamepadProvider.mm: (WebCore::MultiGamepadProvider::platformGamepadConnected): (WebCore::MultiGamepadProvider::platformGamepadDisconnected): * Source/WebCore/platform/mac/PlatformEventFactoryMac.mm: (WebCore::keyIdentifierForKeyEvent): * Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]): * Source/WebGPU/WebGPU/Device.mm: (WebGPU::Device::Device): - Use -localizedDescription instead of logging whole `error` object. * Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): (WebKit::NetworkSessionCocoa::removeNetworkWebsiteData): - Switch LOG() (which doesn't support the {public} modifier) to RELEASE_LOG_DEBUG() (which does support it, and is not enabled by default). * Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::hasProhibitedUsageStrings): * Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm: (WebKit::ensureSandboxCacheDirectory): * Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::checkSandboxRequirementForType): * Source/WebKit/UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.mm: (-[WKSOAuthorizationDelegate authorization:didCompleteWithError:]): * Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.mm: (-[WKWebInspectorPreferenceObserver init]): - Move bridge_cast() to create RetainPtr<NSString>. - Fix placeholder for `NSString *` argument. * Source/WebKit/UIProcess/DigitalCredentials/WKDigitalCredentialsPicker.mm: (-[WKDigitalCredentialsPicker handleNSError:]): * Source/WebKit/UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm: (WebKit::MediaUsageManagerCocoa::updateMediaUsage): * Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::clearAllCredentials): (WebKit::LocalAuthenticator::receiveException const): * Source/WebKit/UIProcess/ios/WKMouseInteraction.mm: (-[WKMouseInteraction beginPointerLockMouseTracking]): - Switch to use PRIVATE_LOG_STRING. - Switch LOG() (which doesn't support the {private} modifier) to RELEASE_LOG_DEBUG() (which does support it, and is not enabled by default). * Source/WebKit/UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]): * Source/WebKit/UIProcess/mac/WebViewImpl.mm: (WebKit::WebViewImpl::insertText): (WebKit::WebViewImpl::selectedRangeWithCompletionHandler): (WebKit::WebViewImpl::markedRangeWithCompletionHandler): (WebKit::WebViewImpl::attributedSubstringForProposedRange): (WebKit::WebViewImpl::firstRectForCharacterRange): (WebKit::WebViewImpl::characterIndexForPoint): (WebKit::WebViewImpl::setMarkedText): * Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: (WebKit::InjectedBundle::extendClassesForParameterCoder): * Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm: (WebKit::ARKitInlinePreviewModelPlayerMac::createPreviewsForModelWithURL): (WebKit::ARKitInlinePreviewModelPlayerMac::didCreateRemotePreviewForModelWithURL): * Source/WebKitLegacy/mac/WebView/WebHTMLView.mm: (-[WebHTMLView firstRectForCharacterRange:]): (-[WebHTMLView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (-[WebHTMLView attributedSubstringFromRange:]): (-[WebHTMLView setMarkedText:selectedRange:]): * Source/WebKitLegacy/mac/WebView/WebPDFView.mm: (-[WebPDFView _menuItemsFromPDFKitForEvent:]): * Source/WebKitLegacy/mac/WebView/WebView.mm: (-[WebView addObserver:forKeyPath:options:context:]): * Tools/TestWebKitAPI/Tests/WebKitCocoa/SOAuthorizationTests.mm: (generateHtml): - Add ALLOW_NONLITERAL_FORMAT_BEGIN/ALLOW_NONLITERAL_FORMAT_END macros to silence nonliteral format warnings. All of the values passed into this function come from `static const char*` globals. Canonical link: https://commits.webkit.org/299238@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes