Repository navigation
Commit 0af6a2c
committed
Address Safer C++ static analysis warnings in WTF headers
https://bugs.webkit.org/show_bug.cgi?id=327810
Reviewed by Ryosuke Niwa.
Fix Safer C++ warnings reported in WTF headers when other projects include them.
generate-dirty-files doesn't attribute warnings in these header copies to any project,
so they don't appear in expectations files, but they make up a large share of the bot logs.
Where the code was unsafe or could be written in a way the analyzer understands, fix it.
Suppress CRTP casts and the weak pointer primitives the analyzer doesn't model, with a
comment explaining why each is safe. Suppress analyzer false positives with a FIXME pointing
to their radar: rdar://190192936, rdar://190195858 and rdar://190195764.
* Source/WTF/wtf/ButterflyArray.h:
Route CRTP casts through suppressed derived() helpers.
* Source/WTF/wtf/CompactPointerTuple.h:
(WTF::CompactPointerTuple::setType): Update the type bits without decoding the pointer.
* Source/WTF/wtf/CompactRefPtrTuple.h:
* Source/WTF/wtf/CompactUniquePtrTuple.h:
* Source/WTF/wtf/CompletionHandler.h:
* Source/WTF/wtf/DeferrableRefCounted.h:
* Source/WTF/wtf/DoublyLinkedList.h:
* Source/WTF/wtf/Function.h:
* Source/WTF/wtf/GenericTimeMixin.h:
* Source/WTF/wtf/InlineWeakPtr.h:
* Source/WTF/wtf/InlineWeakRef.h:
* Source/WTF/wtf/JSONValues.h:
(WTF::JSONImpl::ArrayOf::castedArray): Removed. Call the ArrayBase methods directly instead
of casting to Array.
* Source/WTF/wtf/ListHashSet.h:
(WTF::ListHashSet::remove): Look up the node by value, like removeFirst() and removeLast().
* Source/WTF/wtf/NativePromise.h:
* Source/WTF/wtf/OSObjectPtr.h:
* Source/WTF/wtf/RefCountedWithInlineWeakPtr.h:
* Source/WTF/wtf/RefPtr.h:
* Source/WTF/wtf/Seconds.h:
* Source/WTF/wtf/SentinelLinkedList.h:
* Source/WTF/wtf/StdLibExtras.h:
(WTF::move): Return std::move(value); T is always an lvalue reference.
(WTF::addressOfArgument): Added. Like std::addressof(), but the analyzer traces the result
back to the argument (rdar://190195680).
(WTF::equalSpans): Mark as LEGACY_NODELETE.
* Source/WTF/wtf/ThreadSafeRefCountedWithSuppressingSaferCPPChecking.h:
* Source/WTF/wtf/TrailingArray.h:
* Source/WTF/wtf/UnionFind.h:
* Source/WTF/wtf/UniqueRef.h:
* Source/WTF/wtf/UniquelyOwnedPtr.h:
* Source/WTF/wtf/Variant.h:
Use std::forward and std::invoke_result_t, which the analyzer understands, instead of
mpark's equivalents.
* Source/WTF/wtf/Vector.h:
(WTF::Vector::appendSlowCase):
(WTF::Vector::insert): Use addressOfArgument().
* Source/WTF/wtf/WeakPtrImpl.h:
* Source/WTF/wtf/cf/TypeCastsCF.h:
(WTF::bridgeCFCast): Mark as CLANG_POINTER_CONVERSION.
* Source/WTF/wtf/unicode/UTF8Conversion.h:
Mark both equal() overloads as LEGACY_NODELETE.
* Source/WebCore/platform/graphics/mac/controls/ControlFactoryMac.mm:
Include the *Part.h headers for the parts passed to makeUnique<>().
Canonical link: https://commits.webkit.org/323956@main1 parent ad96ea9 commit 0af6a2c
32 files changed
Lines changed: 137 additions & 94 deletions
File tree
- Source
- WTF/wtf
- cf
- unicode
- WebCore/platform/graphics/mac/controls
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
| 104 | + | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
139 | 144 | | |
140 | 145 | | |
141 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
110 | | - | |
| 111 | + | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | | - | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
63 | | - | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
68 | | - | |
| 71 | + | |
| 72 | + | |
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
0 commit comments