Skip to content

Commit a40f3a3

Browse files
committed
Address safer C++ static analysis warnings in WKObject.h
https://bugs.webkit.org/show_bug.cgi?id=288056 Reviewed by Timothy Hatcher and Darin Adler. - Replace API::ObjectStorage with a new WTF::AlignedStorage type - WTF::AlignedStorage offers several benefits since it is strongly typed and it doesn't rely on std::aligned_storage which is deprecated in C++23. Instead, it uses `alignas(Alignment) std::byte m_storage[sizeof(T)];` which is the suggested replacement in the standard. WTF::AlignedStorage also has the benefit of hiding away the reinterpret_cast which is still required and requirements suppression to silence static analysis - The PR adopts WTF::AlignedStorage instead of std::aligned_storage in several places too. * Source/JavaScriptCore/dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::ensureCanInitializeWithZeros): * Source/WTF/WTF.xcodeproj/project.pbxproj: * Source/WTF/wtf/AlignedStorage.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementInfoInternal.h. (WTF::sizeof): * Source/WTF/wtf/HashTable.h: (WTF::shouldValidateKey>::checkKey): * Source/WTF/wtf/NeverDestroyed.h: (WTF::NeverDestroyed::storagePointer const): (WTF::LazyNeverDestroyed::storagePointerWithoutAccessCheck const): * Source/WTF/wtf/RobinHoodHashTable.h: (WTF::SizePolicy>::checkKey): * Source/WTF/wtf/threads/Signals.h: * Source/WebKit/SaferCPPExpectations/MemoryUnsafeCastCheckerExpectations: * Source/WebKit/Shared/API/Cocoa/_WKFrameHandleInternal.h: * Source/WebKit/Shared/API/Cocoa/_WKHitTestResultInternal.h: * Source/WebKit/Shared/Cocoa/WKNSArray.mm: * Source/WebKit/Shared/Cocoa/WKNSData.mm: * Source/WebKit/Shared/Cocoa/WKNSDictionary.mm: * Source/WebKit/Shared/Cocoa/WKNSNumber.mm: * Source/WebKit/Shared/Cocoa/WKObject.h: (API::ObjectStorage::get): Deleted. (API::ObjectStorage::operator*): Deleted. (API::ObjectStorage::operator->): Deleted. * Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.mm: * Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItem.mm: * Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKContentWorldInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKContextMenuElementInfoInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKDownloadInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKFrameInfoInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStoreInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKNavigation.mm: * Source/WebKit/UIProcess/API/Cocoa/WKNavigationActionInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKNavigationData.mm: * Source/WebKit/UIProcess/API/Cocoa/WKNavigationResponseInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKPreferencesInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKSecurityOriginInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKUserContentControllerInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKUserScriptInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionActionInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionCommandInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionContextInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionControllerConfigurationInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionControllerInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionDataRecordInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionMatchPatternInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionMessagePortInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h: * Source/WebKit/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKAttachmentInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKContentRuleListActionInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKContextMenuElementInfoInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKCustomHeaderFieldsInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKDataTaskInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKFeatureInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKFrameTreeNodeInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKInspectorConfigurationInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKInspectorDebuggableInfoInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKInspectorInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfigurationInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKResourceLoadInfoInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstPartyInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdPartyInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementInfoInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKTargetedElementRequestInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKTextRunInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKUserInitiatedActionInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKVisitedLinkStoreInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponseInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionSidebarInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKWebPushDaemonConnectionInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKWebPushMessageInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKWebPushSubscriptionDataInternal.h: * Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfigurationInternal.h: * Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInCSSStyleDeclarationHandle.mm: * Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm: * Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm: * Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm: * Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: * Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm: * Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm: * Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: Canonical link: https://commits.webkit.org/290792@main
1 parent 12c34ef commit a40f3a3

90 files changed

Lines changed: 243 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/dfg/DFGAbstractValue.cpp‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "DFGGraph.h"
3232
#include "JSCJSValueInlines.h"
3333
#include "TrackedReferences.h"
34+
#include <wtf/AlignedStorage.h>
35+
#include <wtf/StdLibExtras.h>
3436

3537
namespace JSC { namespace DFG {
3638

@@ -524,12 +526,8 @@ void AbstractValue::validateReferences(const TrackedReferences& trackedReference
524526
#if USE(JSVALUE64) && !defined(NDEBUG)
525527
void AbstractValue::ensureCanInitializeWithZeros()
526528
{
527-
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
528-
std::aligned_storage<sizeof(AbstractValue), alignof(AbstractValue)>::type zeroFilledStorage;
529-
ALLOW_DEPRECATED_DECLARATIONS_END
530-
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
531-
memset(static_cast<void*>(&zeroFilledStorage), 0, sizeof(AbstractValue));
532-
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
529+
AlignedStorage<AbstractValue> zeroFilledStorage;
530+
zeroBytes(*zeroFilledStorage);
533531
ASSERT(*this == *static_cast<AbstractValue*>(static_cast<void*>(&zeroFilledStorage)));
534532
}
535533
#endif

‎Source/WTF/SaferCPPExpectations/MemoryUnsafeCastCheckerExpectations‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
wtf/NeverDestroyed.h
21
wtf/Ref.h
32
wtf/RefPtr.h
43
wtf/ThreadSpecific.h

‎Source/WTF/WTF.xcodeproj/project.pbxproj‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
4655743627F5FC4A002D5522 /* ASCIILiteralCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4655743527F5FC4A002D5522 /* ASCIILiteralCocoa.mm */; };
9494
465F34932CD824AF000963B1 /* ObjCRuntimeExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 465F34922CD824AF000963B1 /* ObjCRuntimeExtras.mm */; };
9595
466D69112BA4E433005D43F4 /* SpanCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 466D69102BA4E433005D43F4 /* SpanCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
96+
466E7A7A2D66E57E0096FDA4 /* AlignedStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 466E7A792D66E57E0096FDA4 /* AlignedStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
9697
467DCD532CD4689A0040C644 /* UnicodeExtras.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 467DCD522CD4689A0040C644 /* UnicodeExtras.cpp */; };
9798
468EAFD42D5B1E37005069CF /* SocketPOSIX.h in Headers */ = {isa = PBXBuildFile; fileRef = 468EAFD32D5B1E37005069CF /* SocketPOSIX.h */; settings = {ATTRIBUTES = (Private, ); }; };
9899
46B0FB5D2D24BFBA0012184C /* ParsingUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B0FB5C2D24BFBA0012184C /* ParsingUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1247,6 +1248,7 @@
12471248
4655743527F5FC4A002D5522 /* ASCIILiteralCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASCIILiteralCocoa.mm; sourceTree = "<group>"; };
12481249
465F34922CD824AF000963B1 /* ObjCRuntimeExtras.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjCRuntimeExtras.mm; sourceTree = "<group>"; };
12491250
466D69102BA4E433005D43F4 /* SpanCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpanCocoa.h; sourceTree = "<group>"; };
1251+
466E7A792D66E57E0096FDA4 /* AlignedStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AlignedStorage.h; sourceTree = "<group>"; };
12501252
467DCD522CD4689A0040C644 /* UnicodeExtras.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnicodeExtras.cpp; sourceTree = "<group>"; };
12511253
468EAFD32D5B1E37005069CF /* SocketPOSIX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SocketPOSIX.h; sourceTree = "<group>"; };
12521254
46B0FB5C2D24BFBA0012184C /* ParsingUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParsingUtilities.h; sourceTree = "<group>"; };
@@ -2161,6 +2163,7 @@
21612163
E3B8E6012961EA7600A8AEE3 /* AccessibleAddress.h */,
21622164
CDCC9BC422382FCE00FFB51C /* AggregateLogger.h */,
21632165
CD6D9FCD1EEF3AD4008B0671 /* Algorithms.h */,
2166+
466E7A792D66E57E0096FDA4 /* AlignedStorage.h */,
21642167
CE1132832370634900A8C83B /* AnsiColors.h */,
21652168
E37E96522702AD0700E1C36A /* ApproximateTime.cpp */,
21662169
E37E96532702AD0700E1C36A /* ApproximateTime.h */,
@@ -3245,6 +3248,7 @@
32453248
E383AAC92B6C730B00058E60 /* AdaptiveStringSearcher.h in Headers */,
32463249
DD3DC8FA27A4BF8E007E5B61 /* AggregateLogger.h in Headers */,
32473250
DD3DC96027A4BF8E007E5B61 /* Algorithms.h in Headers */,
3251+
466E7A7A2D66E57E0096FDA4 /* AlignedStorage.h in Headers */,
32483252
DD3DC99627A4BF8E007E5B61 /* AnsiColors.h in Headers */,
32493253
DD3DC92527A4BF8E007E5B61 /* ApproximateTime.h in Headers */,
32503254
5CB8CB6D28C16CB700539906 /* ArgumentCoder.h in Headers */,

‎Source/WTF/wtf/AlignedStorage.h‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (C) 2025 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#pragma once
27+
28+
#include <cstddef>
29+
#include <wtf/StdLibExtras.h>
30+
31+
namespace WTF {
32+
33+
template<typename T>
34+
class AlignedStorage {
35+
public:
36+
AlignedStorage() = default;
37+
AlignedStorage(AlignedStorage&&) = delete;
38+
AlignedStorage(const AlignedStorage&) = delete;
39+
AlignedStorage& operator=(AlignedStorage&&) = delete;
40+
AlignedStorage& operator=(const AlignedStorage&) = delete;
41+
42+
T* get() { SUPPRESS_MEMORY_UNSAFE_CAST return reinterpret_cast_ptr<T*>(&m_storage); }
43+
const T* get() const { SUPPRESS_MEMORY_UNSAFE_CAST return reinterpret_cast_ptr<const T*>(&m_storage); }
44+
45+
T& operator*() { return *get(); }
46+
T* operator->() { return get(); }
47+
const T& operator*() const { return *get(); }
48+
const T* operator->() const { return get(); }
49+
50+
private:
51+
struct alignas(T) Storage {
52+
std::byte data[sizeof(T)];
53+
} m_storage;
54+
};
55+
56+
} // namespace WTF
57+
58+
using WTF::AlignedStorage;

‎Source/WTF/wtf/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(WTF_PUBLIC_HEADERS
66
AccessibleAddress.h
77
AggregateLogger.h
88
Algorithms.h
9+
AlignedStorage.h
910
AnsiColors.h
1011
ApproximateTime.h
1112
ArgumentCoder.h

‎Source/WTF/wtf/HashTable.h‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <string.h>
2828
#include <type_traits>
2929
#include <utility>
30+
#include <wtf/AlignedStorage.h>
3031
#include <wtf/Assertions.h>
3132
#include <wtf/DebugHeap.h>
3233
#include <wtf/FastMalloc.h>
@@ -650,11 +651,8 @@ DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HashTable);
650651
} else if constexpr (HashFunctions::safeToCompareToEmptyOrDeleted) {
651652
RELEASE_ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key));
652653

653-
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
654-
typename std::aligned_storage<sizeof(ValueType), std::alignment_of<ValueType>::value>::type deletedValueBuffer;
655-
ALLOW_DEPRECATED_DECLARATIONS_END
656-
ValueType* deletedValuePtr = reinterpret_cast_ptr<ValueType*>(&deletedValueBuffer);
657-
ValueType& deletedValue = *deletedValuePtr;
654+
AlignedStorage<ValueType> deletedValueBuffer;
655+
auto& deletedValue = *deletedValueBuffer;
658656
Traits::constructDeletedValue(deletedValue);
659657
RELEASE_ASSERT(!HashTranslator::equal(Extractor::extract(deletedValue), key));
660658
}

‎Source/WTF/wtf/NeverDestroyed.h‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include <type_traits>
2929
#include <utility>
30+
#include <wtf/AlignedStorage.h>
3031
#include <wtf/ForbidHeapAllocation.h>
3132
#include <wtf/MainThread.h>
3233
#include <wtf/RefCounted.h>
@@ -89,7 +90,7 @@ template<typename T, typename AccessTraits> class NeverDestroyed {
8990
PointerType storagePointer() const
9091
{
9192
AccessTraits::assertAccess();
92-
return const_cast<PointerType>(reinterpret_cast<const T*>(&m_storage));
93+
return const_cast<PointerType>(m_storage.get());
9394
}
9495

9596
template<typename PtrType, bool ShouldRelax = std::is_base_of<RefCountedBase, PtrType>::value> struct MaybeRelax {
@@ -101,9 +102,7 @@ template<typename T, typename AccessTraits> class NeverDestroyed {
101102

102103
// FIXME: Investigate whether we should allocate a hunk of virtual memory
103104
// and hand out chunks of it to NeverDestroyed instead, to reduce fragmentation.
104-
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
105-
typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_storage;
106-
ALLOW_DEPRECATED_DECLARATIONS_END
105+
AlignedStorage<T> m_storage;
107106
};
108107

109108
// FIXME: It's messy to have to repeat the whole class just to make this "lazy" version.
@@ -152,7 +151,7 @@ template<typename T, typename AccessTraits> class LazyNeverDestroyed {
152151
PointerType storagePointerWithoutAccessCheck() const
153152
{
154153
ASSERT(m_isConstructed);
155-
return const_cast<PointerType>(reinterpret_cast<const T*>(&m_storage));
154+
return const_cast<PointerType>(m_storage.get());
156155
}
157156

158157
PointerType storagePointer() const
@@ -176,9 +175,7 @@ template<typename T, typename AccessTraits> class LazyNeverDestroyed {
176175

177176
// FIXME: Investigate whether we should allocate a hunk of virtual memory
178177
// and hand out chunks of it to NeverDestroyed instead, to reduce fragmentation.
179-
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
180-
typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_storage;
181-
ALLOW_DEPRECATED_DECLARATIONS_END
178+
AlignedStorage<T> m_storage;
182179
};
183180

184181
template<typename T> NeverDestroyed(T) -> NeverDestroyed<T>;

‎Source/WTF/wtf/RobinHoodHashTable.h‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252
#pragma once
5353

54+
#include <wtf/AlignedStorage.h>
5455
#include <wtf/HashTable.h>
5556
#include <wtf/text/StringHash.h>
5657

@@ -325,11 +326,8 @@ void RobinHoodHashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits,
325326
if (!HashFunctions::safeToCompareToEmptyOrDeleted)
326327
return;
327328
ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key));
328-
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
329-
typename std::aligned_storage<sizeof(ValueType), std::alignment_of<ValueType>::value>::type deletedValueBuffer;
330-
ALLOW_DEPRECATED_DECLARATIONS_END
331-
ValueType* deletedValuePtr = reinterpret_cast_ptr<ValueType*>(&deletedValueBuffer);
332-
ValueType& deletedValue = *deletedValuePtr;
329+
AlignedStorage<ValueType> deletedValueBuffer;
330+
auto& deletedValue = *deletedValueBuffer;
333331
Traits::constructDeletedValue(deletedValue);
334332
ASSERT(!HashTranslator::equal(Extractor::extract(deletedValue), key));
335333
}

‎Source/WTF/wtf/threads/Signals.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#pragma once
2727

28+
#include <wtf/AlignedStorage.h>
2829
#include <wtf/CodePtr.h>
2930
#include <wtf/Function.h>
3031
#include <wtf/Lock.h>
@@ -80,9 +81,7 @@ struct SigInfo {
8081
};
8182

8283
using SignalHandler = Function<SignalAction(Signal, SigInfo&, PlatformRegisters&)>;
83-
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
84-
using SignalHandlerMemory = std::aligned_storage<sizeof(SignalHandler), std::alignment_of<SignalHandler>::value>::type;
85-
ALLOW_DEPRECATED_DECLARATIONS_END
84+
using SignalHandlerMemory = AlignedStorage<SignalHandler>;
8685

8786
struct SignalHandlers {
8887
static void initialize();

‎Source/WebKit/SaferCPPExpectations/MemoryUnsafeCastCheckerExpectations‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Shared/API/c/cf/WKStringCF.mm
88
Shared/API/c/cf/WKURLCF.mm
99
Shared/APIWebArchive.mm
1010
Shared/Cocoa/WKNSURL.mm
11-
Shared/Cocoa/WKObject.h
1211
Shared/UserData.cpp
1312
UIProcess/API/C/WKPage.cpp
1413
UIProcess/API/Cocoa/WKDownload.mm

0 commit comments

Comments
 (0)