Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6f9fb91d518b0f68ab13c57687c250ed2e8dc154
      
https://github.com/WebKit/WebKit/commit/6f9fb91d518b0f68ab13c57687c250ed2e8dc154
  Author: Chris Dumez <[email protected]>
  Date:   2026-09-01 (Tue, 01 Sep 2026)

  Changed paths:
    M Source/JavaScriptCore/jsc.cpp
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/BlockObjCExceptions.mm
    M Source/WTF/wtf/MemoryPressureHandler.h
    M Source/WTF/wtf/ObjCRuntimeExtras.mm
    M Source/WTF/wtf/PlatformCocoa.cmake
    M Source/WTF/wtf/cocoa/AuditToken.mm
    M Source/WTF/wtf/cocoa/Entitlements.mm
    M Source/WTF/wtf/cocoa/FileSystemCocoa.mm
    M Source/WTF/wtf/cocoa/LanguageCocoa.mm
    M Source/WTF/wtf/cocoa/LoggingCocoa.mm
    M Source/WTF/wtf/cocoa/MainThreadCocoa.mm
    M Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm
    M Source/WTF/wtf/cocoa/NSURLExtras.mm
    M Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.mm
    M Source/WTF/wtf/cocoa/SchedulePairCocoa.mm
    M Source/WTF/wtf/cocoa/SpanCocoa.mm
    M Source/WTF/wtf/cocoa/URLCocoa.mm
    M Source/WTF/wtf/cocoa/UUIDCocoa.mm
    R Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp
    A Source/WTF/wtf/cocoa/WorkQueueCocoa.mm
    M Source/WTF/wtf/darwin/LibraryPathDiagnostics.mm
    M Source/WTF/wtf/darwin/OSLogPrintStream.mm
    M Source/WTF/wtf/mac/FileSystemMac.mm
    M Source/WTF/wtf/text/cocoa/ASCIILiteralCocoa.mm
    M Source/WTF/wtf/text/cocoa/ContextualizedCFString.mm
    M Source/WTF/wtf/text/cocoa/ContextualizedNSString.mm
    M Source/WTF/wtf/text/cocoa/StringCocoa.mm
    M Source/WTF/wtf/text/cocoa/StringImplCocoa.mm
    M Source/WTF/wtf/text/cocoa/StringViewCocoa.mm
    M Source/WTF/wtf/text/cocoa/TextStreamCocoa.mm
    M Source/WebCore/PlatformCocoa.cmake
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    R Source/WebCore/platform/mac/PowerObserverMac.cpp
    A Source/WebCore/platform/mac/PowerObserverMac.mm

  Log Message:
  -----------
  Remove SUPPRESS_RETAINPTR_CTOR_ADOPT for dispatch_*_create() false positives
https://bugs.webkit.org/show_bug.cgi?id=323095

Reviewed by David Kilzer.

alpha.webkit.RetainPtrCtorAdoptChecker flagged every 
adoptOSObject(dispatch_*_create())
call site, and each one was papered over with SUPPRESS_RETAINPTR_CTOR_ADOPT and 
a FIXME
pointing at rdar://160931336. The warnings turn out to be gated on ARC rather 
than on the
file extension:

  - Plain C++ (.cpp): warns. DISPATCH_RETURNS_RETAINED is gated on 
OS_OBJECT_USE_OBJC,
    which requires __OBJC__, so ns_returns_retained is not visible and the 
argument looks
    like +0.
  - Objective-C++ without ARC: clean. adoptOSObject() is correct and the 
checker agrees.
  - Objective-C++ with ARC: adopting warns. Under ARC adopt and the plain 
constructor are
    equivalent -- RetainTraits::retain/release are no-ops and the __strong 
store on m_ptr
    holds the +1 -- so the constructor is both correct and what the checker 
expects.

Each site is therefore fixed by compiling it as Objective-C++ and then matching 
the
target's ARC state, with no suppression left behind. This also covers
dispatch_block_create_with_qos_class(), which is annotated ns_returns_retained 
in every
mode but which the checker only accepts when the result is not adopted.

WebCore compiles all of its Objective-C++ without ARC and WTF compiles all of 
its with
ARC, so the two frameworks are handled differently here.

While adding the ARC guard that Source/WebKit already uses to the rest of WTF's
Objective-C++, it caught SpanCocoa.mm, which was declared as sourcecode.cpp.cpp 
and so was
built with -x c++ despite its extension, while CMake built it as Objective-C++.

* Source/JavaScriptCore/jsc.cpp:
(jscmain):
jsc.cpp cannot become Objective-C++, so it now uses setDispatchQueueWithLabel() 
instead of
creating the queue itself.
* Source/WTF/WTF.xcodeproj/project.pbxproj:
Corrected SpanCocoa.mm to sourcecode.cpp.objcpp. The file contains no 
Objective-C
constructs, so this only changes which language the two builds agree it is.
* Source/WTF/wtf/BlockObjCExceptions.mm:
* Source/WTF/wtf/MemoryPressureHandler.h:
Declared setDispatchQueueWithLabel() so that callers in plain C++ translation 
units can
get a dedicated serial queue without naming dispatch_queue_create() themselves.
* Source/WTF/wtf/ObjCRuntimeExtras.mm:
* Source/WTF/wtf/PlatformCocoa.cmake:
WTF's Objective-C++ was built with ARC by Xcode (CLANG_ENABLE_OBJC_ARC in 
Base.xcconfig)
but without it by CMake, which never passed -fobjc-arc for this framework. Set 
the flag
target-wide so the two builds agree. It has to be set before 
WEBKIT_ADD_PREFIX_HEADER()
below, because the OBJCXX precompiled header must be built with the same flag 
as the
sources that include it.
* Source/WTF/wtf/cocoa/AuditToken.mm:
* Source/WTF/wtf/cocoa/Entitlements.mm:
* Source/WTF/wtf/cocoa/FileSystemCocoa.mm:
* Source/WTF/wtf/cocoa/LanguageCocoa.mm:
* Source/WTF/wtf/cocoa/LoggingCocoa.mm:
* Source/WTF/wtf/cocoa/MainThreadCocoa.mm:
* Source/WTF/wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::setDispatchQueueWithLabel):
(WTF::MemoryPressureHandler::install):
(WTF::MemoryPressureHandler::holdOff):
Dropped the adoptOSObject() calls and added setDispatchQueueWithLabel().
* Source/WTF/wtf/cocoa/NSURLExtras.mm:
* Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.mm:
* Source/WTF/wtf/cocoa/SchedulePairCocoa.mm:
* Source/WTF/wtf/cocoa/SpanCocoa.mm:
* Source/WTF/wtf/cocoa/URLCocoa.mm:
* Source/WTF/wtf/cocoa/UUIDCocoa.mm:
* Source/WTF/wtf/cocoa/WorkQueueCocoa.mm: Renamed from 
Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp.
(WTF::dispatchWorkItem):
(WTF::WorkQueueBase::dispatch):
(WTF::WorkQueueBase::dispatchWithQOS):
(WTF::WorkQueueBase::dispatchAfter):
(WTF::WorkQueueBase::dispatchSync):
(WTF::WorkQueueBase::WorkQueueBase):
(WTF::WorkQueueBase::platformInitialize):
(WTF::WorkQueueBase::platformInvalidate):
(WTF::WorkQueue::WorkQueue):
(WTF::ConcurrentWorkQueue::apply):
Renamed to Objective-C++ and dropped the adoptOSObject() calls. blockWithQOS no 
longer
needs an OSObjectPtr at all, since ARC owns the block.
* Source/WTF/wtf/darwin/LibraryPathDiagnostics.mm:
* Source/WTF/wtf/darwin/OSLogPrintStream.mm:
* Source/WTF/wtf/mac/FileSystemMac.mm:
* Source/WTF/wtf/text/cocoa/ASCIILiteralCocoa.mm:
* Source/WTF/wtf/text/cocoa/ContextualizedCFString.mm:
* Source/WTF/wtf/text/cocoa/ContextualizedNSString.mm:
* Source/WTF/wtf/text/cocoa/StringCocoa.mm:
* Source/WTF/wtf/text/cocoa/StringImplCocoa.mm:
* Source/WTF/wtf/text/cocoa/StringViewCocoa.mm:
* Source/WTF/wtf/text/cocoa/TextStreamCocoa.mm:
* Source/WebCore/PlatformCocoa.cmake:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
Marked PowerObserverMac.mm @nonARC, matching every other Objective-C++ file in 
WebCore.
* Source/WebCore/platform/mac/PowerObserverMac.mm: Renamed from 
Source/WebCore/platform/mac/PowerObserverMac.cpp.
(WebCore::PowerObserver::PowerObserver):
(WebCore::PowerObserver::~PowerObserver):
(WebCore::PowerObserver::didReceiveSystemPowerNotification):
The file was already PLATFORM(MAC)-only and already using #import, so renaming 
it is
enough. It keeps adoptOSObject(), which is correct in a non-ARC Objective-C++ 
file.

Canonical link: https://commits.webkit.org/320307@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to