Bug 1670633 - Update bindgen to 0.69.1 and coreaudio-sys to 0.2.14. r=supply-chain-reviewers,glandium

This sets the stage for an update to cubeb-coreaudio-rs.

Differential Revision: https://phabricator.services.mozilla.com/D193899
This commit is contained in:
Andreas Pehrson 2023-11-24 08:22:32 +00:00
parent e8be57c066
commit e94273f845
24 changed files with 181 additions and 60 deletions

22
Cargo.lock generated
View File

@ -432,14 +432,14 @@ dependencies = [
name = "bindgen"
version = "0.66.999"
dependencies = [
"bindgen 0.68.1",
"bindgen 0.69.1",
]
[[package]]
name = "bindgen"
version = "0.68.1"
version = "0.69.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078"
checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2"
dependencies = [
"bitflags 2.4.0",
"cexpr",
@ -584,7 +584,7 @@ dependencies = [
name = "builtins-static"
version = "0.1.0"
dependencies = [
"bindgen 0.68.1",
"bindgen 0.69.1",
"mozilla-central-workspace-hack",
"nom",
"pkcs11-bindings",
@ -885,11 +885,11 @@ dependencies = [
[[package]]
name = "coreaudio-sys"
version = "0.2.13"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8478e5bdad14dce236b9898ea002eabfa87cbe14f0aa538dbe3b6a4bec4332d"
checksum = "f3120ebb80a9de008e638ad833d4127d50ea3d3a960ea23ea69bc66d9358a028"
dependencies = [
"bindgen 0.68.1",
"bindgen 0.69.1",
]
[[package]]
@ -2020,7 +2020,7 @@ name = "gecko-profiler"
version = "0.1.0"
dependencies = [
"bincode",
"bindgen 0.68.1",
"bindgen 0.69.1",
"lazy_static",
"mozbuild",
"profiler-macros",
@ -2562,7 +2562,7 @@ name = "http3server"
version = "0.1.1"
dependencies = [
"base64 0.21.3",
"bindgen 0.68.1",
"bindgen 0.69.1",
"cfg-if 1.0.0",
"http",
"hyper",
@ -3632,7 +3632,7 @@ name = "mozilla-central-workspace-hack"
version = "0.1.0"
dependencies = [
"arrayvec",
"bindgen 0.68.1",
"bindgen 0.69.1",
"bitflags 2.4.0",
"bytes",
"chrono",
@ -5234,7 +5234,7 @@ dependencies = [
"app_units",
"arrayvec",
"atomic_refcell",
"bindgen 0.68.1",
"bindgen 0.69.1",
"bitflags 2.4.0",
"byteorder",
"cssparser",

View File

@ -137,7 +137,7 @@ wasi = { path = "build/rust/wasi" }
# else we do use requires backtrace, so dummy it out for now.
backtrace = { path = "build/rust/backtrace" }
# Patch bindgen 0.63, 0.64 and 0.66 to 0.68
# Patch bindgen 0.63, 0.64 and 0.66 to 0.69
bindgen_0_63 = { package = "bindgen", path = "build/rust/bindgen-0.63" }
bindgen_0_64 = { package = "bindgen", path = "build/rust/bindgen-0.64" }
bindgen = { path = "build/rust/bindgen" }

View File

@ -8,7 +8,7 @@ license = "BSD-3-Clause"
path = "lib.rs"
[dependencies.bindgen]
version = "0.68.0"
version = "0.69.0"
default-features = false
[features]

View File

@ -52,7 +52,7 @@ uuid = { version = "1", features = ["serde", "v4"], optional = true }
scopeguard = { version = "1", optional = true }
[build-dependencies]
bindgen = { version = "0.68", default-features = false, features = ["runtime"], optional = true }
bindgen = { version = "0.69", default-features = false, features = ["runtime"], optional = true }
libc = "0.2"
memchr = { version = "2", optional = true }
nom = { version = "7", optional = true }

View File

@ -28,7 +28,7 @@ features = ["gecko"]
# Make sure to use bindgen's runtime-loading of libclang, as it allows for a wider range of clang versions to be used
[build-dependencies]
bindgen = {version = "0.68", default-features = false, features = ["runtime"] }
bindgen = {version = "0.69", default-features = false, features = ["runtime"] }
[[bin]]
name = "http3server"

View File

@ -11,7 +11,7 @@ smallvec = { version = "1.9.0", features = ["const_new"] }
mozilla-central-workspace-hack = { version = "0.1", features = ["builtins-static"], optional = true }
[build-dependencies]
bindgen = { default-features = false, features = ["runtime"], version = "0.68" }
bindgen = { default-features = false, features = ["runtime"], version = "0.69" }
nom = "7.1.1"
[lib]

View File

@ -84,7 +84,7 @@ gecko-profiler = { path = "../../../tools/profiler/rust-api" }
[build-dependencies]
lazy_static = "1"
log = { version = "0.4", features = ["std"] }
bindgen = {version = "0.68", optional = true, default-features = false}
bindgen = {version = "0.69", optional = true, default-features = false}
regex = {version = "1.0", optional = true, default-features = false, features = ["perf", "std"]}
walkdir = "2.1.4"
toml = {version = "0.5", optional = true, default-features = false}

View File

@ -681,6 +681,11 @@ who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"
delta = "0.66.1 -> 0.68.1"
[[audits.bindgen]]
who = "Andreas Pehrson <apehrson@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.68.1 -> 0.69.1"
[[audits.bit-set]]
who = "Aria Beingessner <a.beingessner@gmail.com>"
criteria = "safe-to-deploy"
@ -881,6 +886,11 @@ who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"
delta = "0.2.12 -> 0.2.13"
[[audits.coreaudio-sys]]
who = "Andreas Pehrson <apehrson@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.2.13 -> 0.2.14"
[[audits.cose]]
who = "Mathew Hodson <mathew.hodson@gmail.com>"
criteria = "safe-to-deploy"

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
edition = "2018"
rust-version = "1.60.0"
name = "bindgen"
version = "0.68.1"
version = "0.69.1"
authors = [
"Jyun-Yan You <jyyou.tw@gmail.com>",
"Emilio Cobos Álvarez <emilio@crisal.io>",
@ -41,8 +41,25 @@ repository = "https://github.com/rust-lang/rust-bindgen"
features = ["experimental"]
[package.metadata.release]
pre-release-hook = [
"../node_modules/doctoc/doctoc.js",
"../CHANGELOG.md",
]
release = true
[[package.metadata.release.pre-release-replacements]]
file = "../CHANGELOG.md"
replace = """
# Unreleased
## Added
## Changed
## Removed
## Fixed
## Security
# {{version}} ({{date}})"""
search = "# Unreleased"
[lib]
name = "bindgen"
path = "lib.rs"

View File

@ -99,6 +99,9 @@ pub trait ParseCallbacks: fmt::Debug {
None
}
/// This will be called on every header filename passed to (`Builder::header`)[`crate::Builder::header`].
fn header_file(&self, _filename: &str) {}
/// This will be called on every file inclusion, with the full path of the included file.
fn include_file(&self, _filename: &str) {}

View File

@ -1820,7 +1820,7 @@ impl TranslationUnit {
let fname = CString::new(file).unwrap();
let _c_args: Vec<CString> = cmd_args
.iter()
.map(|s| CString::new(s.clone().into_boxed_bytes()).unwrap())
.map(|s| CString::new(s.as_bytes()).unwrap())
.collect();
let c_args: Vec<*const c_char> =
_c_args.iter().map(|s| s.as_ptr()).collect();

View File

@ -14,25 +14,36 @@ pub(crate) enum Error {
/// Function ABI is not supported.
UnsupportedAbi(&'static str),
/// The pointer type size does not match the target's pointer size.
InvalidPointerSize {
ty_name: String,
ty_size: usize,
ptr_size: usize,
},
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(match *self {
match self {
Error::NoLayoutForOpaqueBlob => {
"Tried to generate an opaque blob, but had no layout."
"Tried to generate an opaque blob, but had no layout.".fmt(f)
}
Error::InstantiationOfOpaqueType => {
"Instantiation of opaque template type or partial template specialization."
.fmt(f)
}
Error::UnsupportedAbi(abi) => {
return write!(
write!(
f,
"{} ABI is not supported by the configured Rust target.",
abi
)
}
})
Error::InvalidPointerSize { ty_name, ty_size, ptr_size } => {
write!(f, "The {} pointer type has size {} but the current target's pointer size is {}.", ty_name, ty_size, ptr_size)
}
}
}
}

View File

@ -21,6 +21,7 @@ use self::struct_layout::StructLayoutTracker;
use super::BindgenOptions;
use crate::callbacks::{DeriveInfo, FieldInfo, TypeKind as DeriveTypeKind};
use crate::codegen::error::Error;
use crate::ir::analysis::{HasVtable, Sizedness};
use crate::ir::annotations::{
Annotations, FieldAccessorKind, FieldVisibilityKind,
@ -3923,6 +3924,16 @@ impl TryToRustTy for Type {
}
TypeKind::Opaque => self.try_to_opaque(ctx, item),
TypeKind::Pointer(inner) | TypeKind::Reference(inner) => {
// Check that this type has the same size as the target's pointer type.
let size = self.get_layout(ctx, item).size;
if size != ctx.target_pointer_size() {
return Err(Error::InvalidPointerSize {
ty_name: self.name().unwrap_or("unknown").into(),
ty_size: size,
ptr_size: ctx.target_pointer_size(),
});
}
let is_const = ctx.resolve_type(inner).is_const();
let inner =

View File

@ -322,21 +322,26 @@ impl<'a> CSerialize<'a> for Type {
}
write!(writer, ")")?;
write!(writer, " (")?;
serialize_sep(
", ",
signature.argument_types().iter(),
ctx,
writer,
|(name, type_id), ctx, buf| {
let mut stack = vec![];
if let Some(name) = name {
stack.push(name.clone());
}
type_id.serialize(ctx, (), &mut stack, buf)
},
)?;
write!(writer, ")")?
let args = signature.argument_types();
if args.is_empty() {
write!(writer, " (void)")?;
} else {
write!(writer, " (")?;
serialize_sep(
", ",
args.iter(),
ctx,
writer,
|(name, type_id), ctx, buf| {
let mut stack = vec![];
if let Some(name) = name {
stack.push(name.clone());
}
type_id.serialize(ctx, (), &mut stack, buf)
},
)?;
write!(writer, ")")?
}
}
TypeKind::ResolvedTypeRef(type_id) => {
if self.is_const() {

View File

@ -334,20 +334,13 @@ mod tests {
// Yes, what follows is a **terribly** inefficient set union
// implementation. Don't copy this code outside of this test!
let original_size = self
.reachable
.entry(node)
.or_insert_with(HashSet::default)
.len();
let original_size = self.reachable.entry(node).or_default().len();
for sub_node in self.graph.0[&node].iter() {
self.reachable.get_mut(&node).unwrap().insert(*sub_node);
let sub_reachable = self
.reachable
.entry(*sub_node)
.or_insert_with(HashSet::default)
.clone();
let sub_reachable =
self.reachable.entry(*sub_node).or_default().clone();
for transitive in sub_reachable {
self.reachable.get_mut(&node).unwrap().insert(transitive);

View File

@ -98,13 +98,13 @@ pub(crate) trait ItemAncestors {
fn ancestors<'a>(&self, ctx: &'a BindgenContext) -> ItemAncestorsIter<'a>;
}
#[cfg(__testing_only_extra_assertions)]
#[cfg(feature = "__testing_only_extra_assertions")]
type DebugOnlyItemSet = ItemSet;
#[cfg(not(__testing_only_extra_assertions))]
#[cfg(not(feature = "__testing_only_extra_assertions"))]
struct DebugOnlyItemSet;
#[cfg(not(__testing_only_extra_assertions))]
#[cfg(not(feature = "__testing_only_extra_assertions"))]
impl DebugOnlyItemSet {
fn new() -> Self {
DebugOnlyItemSet

View File

@ -253,11 +253,24 @@ impl ObjCMethod {
let split_name: Vec<Option<Ident>> = self
.name
.split(':')
.map(|name| {
.enumerate()
.map(|(idx, name)| {
if name.is_empty() {
None
} else if idx == 0 {
// Try to parse the method name as an identifier. Having a keyword is ok
// unless it is `crate`, `self`, `super` or `Self`, so we try to add the `_`
// suffix to it and parse it.
if ["crate", "self", "super", "Self"].contains(&name) {
Some(Ident::new(
&format!("{}_", name),
Span::call_site(),
))
} else {
Some(Ident::new(name, Span::call_site()))
}
} else {
// Try to parse the current name as an identifier. This might fail if the name
// Try to parse the current joining name as an identifier. This might fail if the name
// is a keyword, so we try to "r#" to it and parse again, this could also fail
// if the name is `crate`, `self`, `super` or `Self`, so we try to add the `_`
// suffix to it and parse again. If this also fails, we panic with the first

View File

@ -325,6 +325,11 @@ impl Builder {
.map(String::into_boxed_str),
);
for header in &self.options.input_headers {
self.options
.for_each_callback(|cb| cb.header_file(header.as_ref()));
}
// Transform input headers to arguments on the clang command line.
self.options.clang_args.extend(
self.options.input_headers
@ -566,6 +571,10 @@ impl BindgenOptions {
.collect()
}
fn for_each_callback(&self, f: impl Fn(&dyn callbacks::ParseCallbacks)) {
self.parse_callbacks.iter().for_each(|cb| f(cb.as_ref()));
}
fn process_comment(&self, comment: &str) -> String {
let comment = comment::preprocess(comment);
self.parse_callbacks
@ -1232,9 +1241,50 @@ fn get_target_dependent_env_var(
/// .generate();
/// ```
#[derive(Debug)]
pub struct CargoCallbacks;
pub struct CargoCallbacks {
rerun_on_header_files: bool,
}
/// Create a new `CargoCallbacks` value with [`CargoCallbacks::rerun_on_header_files`] disabled.
///
/// This constructor has been deprecated in favor of [`CargoCallbacks::new`] where
/// [`CargoCallbacks::rerun_on_header_files`] is enabled by default.
#[deprecated = "Use `CargoCallbacks::new()` instead. Please, check the documentation for further information."]
pub const CargoCallbacks: CargoCallbacks = CargoCallbacks {
rerun_on_header_files: false,
};
impl CargoCallbacks {
/// Create a new `CargoCallbacks` value.
pub fn new() -> Self {
Self {
rerun_on_header_files: true,
}
}
/// Whether Cargo should re-run the build script if any of the input header files has changed.
///
/// This option is enabled by default unless the deprecated [`const@CargoCallbacks`]
/// constructor is used.
pub fn rerun_on_header_files(mut self, doit: bool) -> Self {
self.rerun_on_header_files = doit;
self
}
}
impl Default for CargoCallbacks {
fn default() -> Self {
Self::new()
}
}
impl callbacks::ParseCallbacks for CargoCallbacks {
fn header_file(&self, filename: &str) {
if self.rerun_on_header_files {
println!("cargo:rerun-if-changed={}", filename);
}
}
fn include_file(&self, filename: &str) {
println!("cargo:rerun-if-changed={}", filename);
}

View File

@ -1374,7 +1374,7 @@ options! {
/// or `-fno-inline-functions` if you are responsible of compiling the library to make
/// them callable.
#[cfg_attr(
features = "experimental",
feature = "experimental",
doc = "\nCheck the [`Builder::wrap_static_fns`] method for an alternative."
)]
pub fn generate_inline_functions(mut self, doit: bool) -> Self {

View File

@ -1 +1 @@
{"files":{"Cargo.toml":"17c9796d79b692e07056a6f6b45fcb8160c98385d9dd46c3a3d67a02865b3d33","LICENSE":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README.md":"a8adeaf1947035175b890109b36604ac3676f887911b5b8debd216689c0b65bd","build.rs":"e3d45b1a17b655996a09b1d8f5f4dabb8c574e5b803814a13494f56dfce32f4e","src/lib.rs":"22c9dbbb1dc38d6f77b9362e806a7ee59a8ca1aa9b2c9344d1a487a91287ed59"},"package":"d8478e5bdad14dce236b9898ea002eabfa87cbe14f0aa538dbe3b6a4bec4332d"}
{"files":{"Cargo.toml":"21b0b00002a9b66a31357ddc5ac4c0f2a1702c85f6303cc7309e9dc7ffcaefd8","LICENSE":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README.md":"a8adeaf1947035175b890109b36604ac3676f887911b5b8debd216689c0b65bd","build.rs":"d109f0a043b4f62bee52674888a52595f9b0dc37345815905a12ad0723ab8de5","src/lib.rs":"22c9dbbb1dc38d6f77b9362e806a7ee59a8ca1aa9b2c9344d1a487a91287ed59"},"package":"f3120ebb80a9de008e638ad833d4127d50ea3d3a960ea23ea69bc66d9358a028"}

View File

@ -11,7 +11,7 @@
[package]
name = "coreaudio-sys"
version = "0.2.13"
version = "0.2.14"
authors = ["Mitchell Nordine <mitchell.nordine@gmail.com>"]
build = "build.rs"
description = "Bindings for Apple's CoreAudio frameworks generated via rust-bindgen"
@ -36,7 +36,7 @@ targets = [
]
[build-dependencies.bindgen]
version = "0.68"
version = "0.69"
features = ["runtime"]
default-features = false
@ -52,4 +52,5 @@ default = [
"open_al",
"core_midi",
]
io_kit_audio = []
open_al = []

View File

@ -86,6 +86,13 @@ fn build(sdk_path: Option<&str>, target: &str) {
}
}
#[cfg(feature = "io_kit_audio")]
{
assert!(target.contains("apple-darwin"));
println!("cargo:rustc-link-lib=framework=IOKit");
headers.push("IOKit/audio/IOAudioTypes.h");
}
#[cfg(feature = "open_al")]
{
println!("cargo:rustc-link-lib=framework=OpenAL");

View File

@ -14,7 +14,7 @@ mozbuild = "0.1"
[build-dependencies]
lazy_static = "1"
bindgen = {version = "0.68", default-features = false}
bindgen = {version = "0.69", default-features = false}
mozbuild = "0.1"
[features]