Auto merge of #13723 - Manishearth:resync, r=bholley

Regen bindings, warning fix

The warning only happens on the latest stable (which we use in the incubator), so there's an `#[allow()]` there for now as well.

Don't signal r+ to bors, I'll do that myself when the incubator side lands.

r? @bholley

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13723)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-10-12 22:01:20 -05:00 committed by GitHub
commit d9bb663421
4 changed files with 626 additions and 730 deletions

View file

@ -731,112 +731,3 @@ extern "C" {
fn Gecko_AppendUTF16toCString(this: *mut nsACString, other: *const nsAString); fn Gecko_AppendUTF16toCString(this: *mut nsACString, other: *const nsAString);
fn Gecko_AppendUTF8toString(this: *mut nsAString, other: *const nsACString); fn Gecko_AppendUTF8toString(this: *mut nsAString, other: *const nsACString);
} }
//////////////////////////////////////
// Repr Validation Helper Functions //
//////////////////////////////////////
pub mod test_helpers {
//! This module only exists to help with ensuring that the layout of the
//! structs inside of rust and C++ are identical.
//!
//! It is public to ensure that these testing functions are avaliable to
//! gtest code.
use super::{
nsFixedCStringRepr,
nsFixedStringRepr,
nsCStringRepr,
nsStringRepr,
F_NONE,
F_TERMINATED,
F_VOIDED,
F_SHARED,
F_OWNED,
F_FIXED,
F_LITERAL,
F_CLASS_FIXED,
};
use std::mem;
/// Generates an #[no_mangle] extern "C" function which returns the size and
/// alignment of the given type with the given name.
macro_rules! size_align_check {
($T:ty, $fname:ident) => {
#[no_mangle]
#[allow(non_snake_case)]
pub extern fn $fname(size: *mut usize, align: *mut usize) {
unsafe {
*size = mem::size_of::<$T>();
*align = mem::align_of::<$T>();
}
}
}
}
size_align_check!(nsStringRepr, Rust_Test_ReprSizeAlign_nsString);
size_align_check!(nsCStringRepr, Rust_Test_ReprSizeAlign_nsCString);
size_align_check!(nsFixedStringRepr, Rust_Test_ReprSizeAlign_nsFixedString);
size_align_check!(nsFixedCStringRepr, Rust_Test_ReprSizeAlign_nsFixedCString);
/// Generates a $[no_mangle] extern "C" function which returns the size,
/// alignment and offset in the parent struct of a given member, with the
/// given name.
///
/// This method can trigger Undefined Behavior if the accessing the member
/// $member on a given type would use that type's `Deref` implementation.
macro_rules! member_check {
($T:ty, $member:ident, $method:ident) => {
#[no_mangle]
#[allow(non_snake_case)]
pub extern fn $method(size: *mut usize,
align: *mut usize,
offset: *mut usize) {
unsafe {
// Create a temporary value of type T to get offsets, sizes
// and aligns off of
let tmp: $T = mem::zeroed();
*size = mem::size_of_val(&tmp.$member);
*align = mem::align_of_val(&tmp.$member);
*offset =
(&tmp.$member as *const _ as usize) -
(&tmp as *const _ as usize);
mem::forget(tmp);
}
}
}
}
member_check!(nsStringRepr, data, Rust_Test_Member_nsString_mData);
member_check!(nsStringRepr, length, Rust_Test_Member_nsString_mLength);
member_check!(nsStringRepr, flags, Rust_Test_Member_nsString_mFlags);
member_check!(nsCStringRepr, data, Rust_Test_Member_nsCString_mData);
member_check!(nsCStringRepr, length, Rust_Test_Member_nsCString_mLength);
member_check!(nsCStringRepr, flags, Rust_Test_Member_nsCString_mFlags);
member_check!(nsFixedStringRepr, capacity, Rust_Test_Member_nsFixedString_mFixedCapacity);
member_check!(nsFixedStringRepr, buffer, Rust_Test_Member_nsFixedString_mFixedBuf);
member_check!(nsFixedCStringRepr, capacity, Rust_Test_Member_nsFixedCString_mFixedCapacity);
member_check!(nsFixedCStringRepr, buffer, Rust_Test_Member_nsFixedCString_mFixedBuf);
#[no_mangle]
#[allow(non_snake_case)]
pub extern fn Rust_Test_NsStringFlags(f_none: *mut u32,
f_terminated: *mut u32,
f_voided: *mut u32,
f_shared: *mut u32,
f_owned: *mut u32,
f_fixed: *mut u32,
f_literal: *mut u32,
f_class_fixed: *mut u32) {
unsafe {
*f_none = F_NONE;
*f_terminated = F_TERMINATED;
*f_voided = F_VOIDED;
*f_shared = F_SHARED;
*f_owned = F_OWNED;
*f_fixed = F_FIXED;
*f_literal = F_LITERAL;
*f_class_fixed = F_CLASS_FIXED;
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1984,11 +1984,14 @@ clip-path
${impl_coord_copy('column_width', 'mColumnWidth')} ${impl_coord_copy('column_width', 'mColumnWidth')}
#[allow(unused_unsafe)]
pub fn set_column_count(&mut self, v: longhands::column_count::computed_value::T) { pub fn set_column_count(&mut self, v: longhands::column_count::computed_value::T) {
use gecko_bindings::structs::{NS_STYLE_COLUMN_COUNT_AUTO, nsStyleColumn_kMaxColumnCount}; use gecko_bindings::structs::{NS_STYLE_COLUMN_COUNT_AUTO, nsStyleColumn_kMaxColumnCount};
self.gecko.mColumnCount = match v.0 { self.gecko.mColumnCount = match v.0 {
Some(number) => cmp::min(number, nsStyleColumn_kMaxColumnCount), Some(number) => unsafe {
cmp::min(number, nsStyleColumn_kMaxColumnCount)
},
None => NS_STYLE_COLUMN_COUNT_AUTO None => NS_STYLE_COLUMN_COUNT_AUTO
}; };
} }