[webkit-changes] [WebKit/WebKit] acfb61: Replace std::isnan/isinf/isfinite UB overloads for...

Gerald Squelart noreply at github.com
Tue Nov 7 20:02:11 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: acfb618b4d5ad0bc49791190588cfa125d198c6c
      https://github.com/WebKit/WebKit/commit/acfb618b4d5ad0bc49791190588cfa125d198c6c
  Author: Gerald Squelart <g_squelart at apple.com>
  Date:   2023-11-07 (Tue, 07 Nov 2023)

  Changed paths:
    M Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp
    M Source/WTF/wtf/ApproximateTime.cpp
    M Source/WTF/wtf/ApproximateTime.h
    M Source/WTF/wtf/GenericTimeMixin.h
    M Source/WTF/wtf/MonotonicTime.cpp
    M Source/WTF/wtf/MonotonicTime.h
    M Source/WTF/wtf/Seconds.h
    M Source/WTF/wtf/Stopwatch.h
    M Source/WTF/wtf/TimeWithDynamicClockType.cpp
    M Source/WTF/wtf/TimeWithDynamicClockType.h
    M Source/WTF/wtf/WallTime.cpp
    M Source/WTF/wtf/WallTime.h
    M Source/WTF/wtf/WorkerPool.cpp
    M Source/WTF/wtf/posix/ThreadingPOSIX.cpp
    M Source/WTF/wtf/win/ThreadingWin.cpp
    M Source/WebCore/Modules/applepay/ApplePaySession.cpp
    M Source/WebCore/Modules/applepay/cocoa/PaymentSummaryItemsCocoa.mm
    M Source/WebCore/bindings/IDLTypes.h
    M Source/WebCore/bindings/js/IDBBindingUtilities.cpp
    M Source/WebCore/fileapi/FileReader.cpp
    M Source/WebCore/inspector/InspectorCanvas.cpp
    M Source/WebCore/page/LocalDOMWindow.cpp
    M Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm
    M Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp
    M Source/WebCore/platform/Timer.cpp
    M Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
    M Source/WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.cpp
    M Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp
    M Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp
    M Source/WebKit/Platform/IPC/Timeout.h
    M Source/WebKit/Platform/cocoa/CocoaHelpers.mm
    M Source/WebKit/Shared/ApplePay/cocoa/DeferredPaymentRequestCocoa.mm
    M Tools/TestWebKitAPI/Tests/WTF/Time.cpp

  Log Message:
  -----------
  Replace std::isnan/isinf/isfinite UB overloads for time classes with member functions
https://bugs.webkit.org/show_bug.cgi?id=264241
rdar://problem/117986797

Reviewed by Dan Glastonbury.

Time types under WTF (MonotonicTime, etc.) add overloads of std::isnan, isinf, and isfinite,
but it is generally UB to add declarations&definitions to `namespace std`:
https://en.cppreference.com/w/cpp/language/extending_std

Instead, these functions should be class member functions, or free functions outside of `std`.
I don't believe these functions are used in generic code, so I think member functions are more
appropriate here.

* Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp:
(Inspector::InspectorHeapAgent::didGarbageCollect):
* Source/WTF/wtf/ApproximateTime.cpp:
(WTF::ApproximateTime::approximateWallTime const):
(WTF::ApproximateTime::approximateMonotonicTime const):
* Source/WTF/wtf/ApproximateTime.h:
(WTF::ApproximateTime::MarkableTraits::isEmptyValue):
(std::isnan): Deleted.
(std::isinf): Deleted.
(std::isfinite): Deleted.
* Source/WTF/wtf/GenericTimeMixin.h:
(WTF::GenericTimeMixin::isNaN const):
(WTF::GenericTimeMixin::isInfinity const):
(WTF::GenericTimeMixin::isFinite const):
(WTF::GenericTimeMixin::timePointFromNow):
* Source/WTF/wtf/MonotonicTime.cpp:
(WTF::MonotonicTime::approximateWallTime const):
* Source/WTF/wtf/MonotonicTime.h:
(std::isnan): Deleted.
(std::isinf): Deleted.
(std::isfinite): Deleted.
* Source/WTF/wtf/Seconds.h:
(WTF::Seconds::MarkableTraits::isEmptyValue):
(std::isnan): Deleted.
(std::isinf): Deleted.
(std::isfinite): Deleted.
* Source/WTF/wtf/Stopwatch.h:
(WTF::Stopwatch::start):
(WTF::Stopwatch::stop):
(WTF::Stopwatch::fromMonotonicTime const):
* Source/WTF/wtf/TimeWithDynamicClockType.cpp:
(WTF::hasElapsed):
* Source/WTF/wtf/TimeWithDynamicClockType.h:
(std::isnan): Deleted.
(std::isinf): Deleted.
(std::isfinite): Deleted.
* Source/WTF/wtf/WallTime.cpp:
(WTF::WallTime::approximateMonotonicTime const):
* Source/WTF/wtf/WallTime.h:
(WTF::WallTime::MarkableTraits::isEmptyValue):
(std::isnan): Deleted.
(std::isinf): Deleted.
(std::isfinite): Deleted.
* Source/WTF/wtf/WorkerPool.cpp:
(WTF::WorkerPool::shouldSleep):
* Source/WTF/wtf/posix/ThreadingPOSIX.cpp:
(WTF::ThreadCondition::timedWait):
* Source/WTF/wtf/win/ThreadingWin.cpp:
(WTF::absoluteTimeToWaitTimeoutInterval):
* Source/WebCore/Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePayDeferredPaymentRequest::validate const):
* Source/WebCore/Modules/applepay/cocoa/PaymentSummaryItemsCocoa.mm:
(WebCore::platformRecurringSummaryItem):
(WebCore::platformDeferredSummaryItem):
* Source/WebCore/bindings/IDLTypes.h:
(WebCore::IDLDate::isNullValue):
* Source/WebCore/bindings/js/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromValue):
* Source/WebCore/fileapi/FileReader.cpp:
(WebCore::FileReader::didReceiveData):
* Source/WebCore/inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::finalizeFrame):
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::consumeLastActivationIfNecessary):
* Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::gcTimerString):
* Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp:
(WebCore::gcTimerString):
* Source/WebCore/platform/Timer.cpp:
(WebCore::TimerBase::setNextFireTime):
(WebCore::TimerBase::nextUnalignedFireInterval const):
* Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(CachedResourceStreamingClient::dataReceived):
* Source/WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.cpp:
(WebCore::DisplayCaptureSourceCocoa::elapsedTime):
* Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::tick):
* Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::elapsedTime):
* Source/WebKit/Platform/IPC/Timeout.h:
(IPC::Timeout::Timeout):
(IPC::Timeout::isInfinity const):
* Source/WebKit/Platform/cocoa/CocoaHelpers.mm:
(WebKit::toAPI):
* Source/WebKit/Shared/ApplePay/cocoa/DeferredPaymentRequestCocoa.mm:
(WebKit::platformDeferredPaymentRequest):
* Tools/TestWebKitAPI/Tests/WTF/Time.cpp:
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list