Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build for LLVM/Clang 18+ #3457

Merged
merged 4 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,8 @@ uniffi_bindgen = "=0.23.0"
uniffi_build = "=0.23.0"
uniffi_macros = "=0.23.0"
weedle2 = "=4.0.0"

[patch.crates-io.bindgen_0_64_0]
package = "bindgen"
version = "0.64.0"
path = "third_party/rust/bindgen"
2 changes: 1 addition & 1 deletion dom/media/gmp-plugin-openh264/gmp-fake-openh264.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct EncodedFrame {
uint8_t y_;
uint8_t u_;
uint8_t v_;
uint32_t timestamp_;
uint64_t timestamp_;
} idr_nalu;
};
#pragma pack(pop)
Expand Down
2 changes: 1 addition & 1 deletion dom/media/gtest/TestGMPRemoveAndDelete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ void GMPRemoveTest::gmp_Decode() {
uint8_t y_;
uint8_t u_;
uint8_t v_;
uint32_t timestamp_;
uint64_t timestamp_;
} idr_nalu;
};
#pragma pack(pop)
Expand Down
2 changes: 1 addition & 1 deletion dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ void WebrtcGmpVideoEncoder::Encoded(

webrtc::VideoFrameType ft;
GmpFrameTypeToWebrtcFrameType(aEncodedFrame->FrameType(), &ft);
uint32_t timestamp = (aEncodedFrame->TimeStamp() * 90ll + 999) / 1000;
uint64_t timestamp = (aEncodedFrame->TimeStamp() * 90ll + 999) / 1000;

GMP_LOG_DEBUG("GMP Encoded: %" PRIu64 ", type %d, len %d",
aEncodedFrame->TimeStamp(), aEncodedFrame->BufferType(),
Expand Down
2 changes: 1 addition & 1 deletion dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class WebrtcGmpVideoEncoder : public GMPVideoEncoderCallbackProxy,
int64_t timestamp_us;
};
// Map rtp time -> input image data
DataMutex<std::map<uint32_t, InputImageData>> mInputImageMap;
DataMutex<std::map<uint64_t, InputImageData>> mInputImageMap;

MediaEventProducer<uint64_t> mInitPluginEvent;
MediaEventProducer<uint64_t> mReleasePluginEvent;
Expand Down
80 changes: 41 additions & 39 deletions third_party/rust/bindgen/ir/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,53 +1427,55 @@ impl Item {
}
}

// Guess how does clang treat extern "C" blocks?
if cursor.kind() == CXCursor_UnexposedDecl {
Err(ParseError::Recurse)
} else {
match cursor.kind() {
// On Clang 18+, extern "C" is reported accurately as a LinkageSpec.
// Older LLVM treat it as UnexposedDecl.
CXCursor_LinkageSpec | CXCursor_UnexposedDecl => {
Err(ParseError::Recurse)
}

// We allowlist cursors here known to be unhandled, to prevent being
// too noisy about this.
match cursor.kind() {
CXCursor_MacroDefinition |
CXCursor_MacroExpansion |
CXCursor_UsingDeclaration |
CXCursor_UsingDirective |
CXCursor_StaticAssert |
CXCursor_FunctionTemplate => {
debug!(
"Unhandled cursor kind {:?}: {:?}",
cursor.kind(),
cursor
);
}
CXCursor_InclusionDirective => {
let file = cursor.get_included_file_name();
match file {
None => {
warn!(
"Inclusion of a nameless file in {:?}",
cursor
);
}
Some(filename) => {
ctx.include_file(filename);
}
}
}
_ => {
// ignore toplevel operator overloads
let spelling = cursor.spelling();
if !spelling.starts_with("operator") {
CXCursor_MacroDefinition |
CXCursor_MacroExpansion |
CXCursor_UsingDeclaration |
CXCursor_UsingDirective |
CXCursor_StaticAssert |
CXCursor_FunctionTemplate => {
debug!(
"Unhandled cursor kind {:?}: {:?}",
cursor.kind(),
cursor
);
Err(ParseError::Continue)
}
CXCursor_InclusionDirective => {
let file = cursor.get_included_file_name();
match file {
None => {
warn!(
"Unhandled cursor kind {:?}: {:?}",
cursor.kind(),
"Inclusion of a nameless file in {:?}",
cursor
);
}
Some(filename) => {
ctx.include_file(filename);
}
}
Err(ParseError::Continue)
}
_ => {
// ignore toplevel operator overloads
let spelling = cursor.spelling();
if !spelling.starts_with("operator") {
warn!(
"Unhandled cursor kind {:?}: {:?}",
cursor.kind(),
cursor
);
}
Err(ParseError::Continue)
}

Err(ParseError::Continue)
}
}

Expand Down
Loading