Added
Link Here
|
1 |
From cd10f3ba0d83f34ca978cc4c7a552b72fdd068aa Mon Sep 17 00:00:00 2001 |
2 |
From: David Tolnay <dtolnay@gmail.com> |
3 |
Date: Tue, 28 Nov 2023 11:18:39 -0800 |
4 |
Subject: [PATCH 1/2] Flatten cursor.kind() matching in Item::parse down to one |
5 |
match |
6 |
|
7 |
--- |
8 |
bindgen/ir/item.rs | 84 ++++++++++++++++++++++------------------------ |
9 |
1 file changed, 41 insertions(+), 43 deletions(-) |
10 |
|
11 |
diff --git bindgen/ir/item.rs bindgen/ir/item.rs |
12 |
index 0556452bfa..4f2d361e51 100644 |
13 |
--- third_party/rust/bindgen/ir/item.rs |
14 |
+++ third_party/rust/bindgen/ir/item.rs |
15 |
@@ -1427,53 +1427,52 @@ |
16 |
} |
17 |
} |
18 |
|
19 |
- // Guess how does clang treat extern "C" blocks? |
20 |
- if cursor.kind() == CXCursor_UnexposedDecl { |
21 |
- Err(ParseError::Recurse) |
22 |
- } else { |
23 |
+ match cursor.kind() { |
24 |
+ // Guess how does clang treat extern "C" blocks? |
25 |
+ CXCursor_UnexposedDecl => Err(ParseError::Recurse), |
26 |
+ |
27 |
// We allowlist cursors here known to be unhandled, to prevent being |
28 |
// too noisy about this. |
29 |
- match cursor.kind() { |
30 |
- CXCursor_MacroDefinition | |
31 |
- CXCursor_MacroExpansion | |
32 |
- CXCursor_UsingDeclaration | |
33 |
- CXCursor_UsingDirective | |
34 |
- CXCursor_StaticAssert | |
35 |
- CXCursor_FunctionTemplate => { |
36 |
- debug!( |
37 |
- "Unhandled cursor kind {:?}: {:?}", |
38 |
- cursor.kind(), |
39 |
- cursor |
40 |
- ); |
41 |
- } |
42 |
- CXCursor_InclusionDirective => { |
43 |
- let file = cursor.get_included_file_name(); |
44 |
- match file { |
45 |
- None => { |
46 |
- warn!( |
47 |
- "Inclusion of a nameless file in {:?}", |
48 |
- cursor |
49 |
- ); |
50 |
- } |
51 |
- Some(filename) => { |
52 |
- ctx.include_file(filename); |
53 |
- } |
54 |
- } |
55 |
- } |
56 |
- _ => { |
57 |
- // ignore toplevel operator overloads |
58 |
- let spelling = cursor.spelling(); |
59 |
- if !spelling.starts_with("operator") { |
60 |
+ CXCursor_MacroDefinition | |
61 |
+ CXCursor_MacroExpansion | |
62 |
+ CXCursor_UsingDeclaration | |
63 |
+ CXCursor_UsingDirective | |
64 |
+ CXCursor_StaticAssert | |
65 |
+ CXCursor_FunctionTemplate => { |
66 |
+ debug!( |
67 |
+ "Unhandled cursor kind {:?}: {:?}", |
68 |
+ cursor.kind(), |
69 |
+ cursor |
70 |
+ ); |
71 |
+ Err(ParseError::Continue) |
72 |
+ } |
73 |
+ CXCursor_InclusionDirective => { |
74 |
+ let file = cursor.get_included_file_name(); |
75 |
+ match file { |
76 |
+ None => { |
77 |
warn!( |
78 |
- "Unhandled cursor kind {:?}: {:?}", |
79 |
- cursor.kind(), |
80 |
+ "Inclusion of a nameless file in {:?}", |
81 |
cursor |
82 |
); |
83 |
} |
84 |
+ Some(filename) => { |
85 |
+ ctx.include_file(filename); |
86 |
+ } |
87 |
} |
88 |
+ Err(ParseError::Continue) |
89 |
+ } |
90 |
+ _ => { |
91 |
+ // ignore toplevel operator overloads |
92 |
+ let spelling = cursor.spelling(); |
93 |
+ if !spelling.starts_with("operator") { |
94 |
+ warn!( |
95 |
+ "Unhandled cursor kind {:?}: {:?}", |
96 |
+ cursor.kind(), |
97 |
+ cursor |
98 |
+ ); |
99 |
+ } |
100 |
+ Err(ParseError::Continue) |
101 |
} |
102 |
- |
103 |
- Err(ParseError::Continue) |
104 |
} |
105 |
} |
106 |
|
107 |
|
108 |
From 2997017b5a3065b83e9d76f0080d6cb99c94c0c1 Mon Sep 17 00:00:00 2001 |
109 |
From: David Tolnay <dtolnay@gmail.com> |
110 |
Date: Tue, 28 Nov 2023 11:21:18 -0800 |
111 |
Subject: [PATCH 2/2] Handle CXCursor_LinkageSpec in Clang 18+ |
112 |
|
113 |
--- |
114 |
bindgen/ir/item.rs | 7 +++++-- |
115 |
1 file changed, 5 insertions(+), 2 deletions(-) |
116 |
|
117 |
diff --git bindgen/ir/item.rs bindgen/ir/item.rs |
118 |
index 4f2d361e51..dd587b088b 100644 |
119 |
--- third_party/rust/bindgen/ir/item.rs |
120 |
+++ third_party/rust/bindgen/ir/item.rs |
121 |
@@ -1433,8 +1433,11 @@ impl Item { |
122 |
} |
123 |
|
124 |
match cursor.kind() { |
125 |
- // Guess how does clang treat extern "C" blocks? |
126 |
- CXCursor_UnexposedDecl => Err(ParseError::Recurse), |
127 |
+ // On Clang 18+, extern "C" is reported accurately as a LinkageSpec. |
128 |
+ // Older LLVM treat it as UnexposedDecl. |
129 |
+ CXCursor_LinkageSpec | CXCursor_UnexposedDecl => { |
130 |
+ Err(ParseError::Recurse) |
131 |
+ } |
132 |
|
133 |
// We allowlist cursors here known to be unhandled, to prevent being |
134 |
// too noisy about this. |
135 |
diff --git dom/media/gmp-plugin-openh264/gmp-fake-openh264.cpp dom/media/gmp-plugin-openh264/gmp-fake-openh264.cpp |
136 |
--- dom/media/gmp-plugin-openh264/gmp-fake-openh264.cpp |
137 |
+++ dom/media/gmp-plugin-openh264/gmp-fake-openh264.cpp |
138 |
@@ -97,11 +97,11 @@ |
139 |
uint32_t width_; |
140 |
uint32_t height_; |
141 |
uint8_t y_; |
142 |
uint8_t u_; |
143 |
uint8_t v_; |
144 |
- uint32_t timestamp_; |
145 |
+ uint64_t timestamp_; |
146 |
} idr_nalu; |
147 |
}; |
148 |
#pragma pack(pop) |
149 |
|
150 |
#define ENCODED_FRAME_MAGIC 0x004000b8 |
151 |
diff --git dom/media/gtest/TestGMPRemoveAndDelete.cpp dom/media/gtest/TestGMPRemoveAndDelete.cpp |
152 |
--- dom/media/gtest/TestGMPRemoveAndDelete.cpp |
153 |
+++ dom/media/gtest/TestGMPRemoveAndDelete.cpp |
154 |
@@ -359,11 +359,11 @@ |
155 |
uint32_t width_; |
156 |
uint32_t height_; |
157 |
uint8_t y_; |
158 |
uint8_t u_; |
159 |
uint8_t v_; |
160 |
- uint32_t timestamp_; |
161 |
+ uint64_t timestamp_; |
162 |
} idr_nalu; |
163 |
}; |
164 |
#pragma pack(pop) |
165 |
|
166 |
GMPVideoFrame* absFrame; |
167 |
diff --git dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.h dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.h |
168 |
--- dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.h |
169 |
+++ dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.h |
170 |
@@ -300,11 +300,11 @@ |
171 |
|
172 |
struct InputImageData { |
173 |
int64_t timestamp_us; |
174 |
}; |
175 |
// Map rtp time -> input image data |
176 |
- DataMutex<std::map<uint32_t, InputImageData>> mInputImageMap; |
177 |
+ DataMutex<std::map<uint64_t, InputImageData>> mInputImageMap; |
178 |
|
179 |
MediaEventProducer<uint64_t> mInitPluginEvent; |
180 |
MediaEventProducer<uint64_t> mReleasePluginEvent; |
181 |
}; |
182 |
|
183 |
diff --git dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.cpp dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.cpp |
184 |
--- dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.cpp |
185 |
+++ dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.cpp |
186 |
@@ -538,11 +538,11 @@ |
187 |
return; |
188 |
} |
189 |
|
190 |
webrtc::VideoFrameType ft; |
191 |
GmpFrameTypeToWebrtcFrameType(aEncodedFrame->FrameType(), &ft); |
192 |
- uint32_t timestamp = (aEncodedFrame->TimeStamp() * 90ll + 999) / 1000; |
193 |
+ uint64_t timestamp = (aEncodedFrame->TimeStamp() * 90ll + 999) / 1000; |
194 |
|
195 |
GMP_LOG_DEBUG("GMP Encoded: %" PRIu64 ", type %d, len %d", |
196 |
aEncodedFrame->TimeStamp(), aEncodedFrame->BufferType(), |
197 |
aEncodedFrame->Size()); |
198 |
|
199 |
|